feat: undo not authorised operation

This commit is contained in:
Swann Martinez 2019-05-09 15:29:00 +02:00
parent 385d416e6c
commit 34854f43e5
No known key found for this signature in database
GPG Key ID: 414CCAFD8DA720E1
4 changed files with 24 additions and 10 deletions

@ -460,7 +460,7 @@ def rcf_client_worker(ctx,store, pipe, serial_product, serial_feed, stop_event):
if value:
# Stamp with id
value['id'] = agent.id.decode()
# Format massage
rcfmsg = message.RCFMessage(
key=key, id=agent.id, body=value)

@ -326,6 +326,7 @@ def load_collection(target=None, data=None, create=False):
# link objects
for object in data["objects"]:
# if object not in target.objects.keys():
target.objects.link(bpy.data.objects[object])
for object in target.objects.keys():
@ -451,11 +452,11 @@ def load_gpencil_layer(target=None, data=None, create=False):
tpoint = tstroke.points.add(1)
tpoint = tstroke.points[len(tstroke.points)-1]
dump_anything.load(tpoint, p)
tpoint.co[0] = p['co'][0]
tpoint.co[1] = p['co'][1]
tpoint.co[2] = p['co'][2]
print(p['co'])
print(tpoint.co)
# tpoint.co[0] = p['co'][0]
# tpoint.co[1] = p['co'][1]
# tpoint.co[2] = p['co'][2]
# print(p['co'])
# print(tpoint.co)
@ -548,6 +549,7 @@ def dump(key):
elif target_type == 'Scene':
data = dump_datablock_attibute(
target, ['name', 'collection', 'id', 'camera', 'grease_pencil'], 4)
# elif target_type == 'Armature':
# data = dump_datablock(target, 4)

@ -324,7 +324,7 @@ class Loader:
(_load_filter_type(T.PointerProperty), self._load_pointer),
(_load_filter_array, self._load_array),
(_load_filter_type(T.CollectionProperty), self._load_collection),
(_load_filter_default, self._load_default)
# (_load_filter_default, self._load_default)
]

@ -7,6 +7,7 @@ import string
import subprocess
import time
from operator import itemgetter
import queue
import bgl
import blf
@ -30,12 +31,13 @@ client_state = 1
server = None
context = None
update_list = {}
history = queue.Queue()
# UTILITY FUNCTIONS
def client_list_callback(scene, context):
global client_keys
items = []
items = [("Common", "Common", "")]
if client_keys:
for k in client_keys:
if 'Client' in k[0]:
@ -148,7 +150,15 @@ def default_tick():
upload_client_instance_position()
return 1
global history
try:
c = history.get_nowait()
if c:
bpy.ops.ed.undo()
except Exception as e:
pass
return .2
def register_ticks():
@ -537,12 +547,14 @@ def depsgraph_update(scene):
selected_objects = helpers.get_selected_objects(scene)
for update in reversed(updates):
if update.id.id == username or update.id.id == 'None':
if update.id.id == username or update.id.id == 'Common' or update.id.id == 'None':
# TODO: handle errors
data_ref = get_datablock(update,context)
if data_ref:
data_ref.is_dirty= True
elif update.id.id != username:
history.put("undo")
def register():