feat: scene annotation

This commit is contained in:
Swann Martinez 2019-05-10 13:01:24 +02:00
parent 8a8dff3aa4
commit 29bfc2db7c
No known key found for this signature in database
GPG Key ID: 414CCAFD8DA720E1
2 changed files with 13 additions and 5 deletions

View File

@ -369,8 +369,11 @@ def load_scene(target=None, data=None, create=False):
target.id = data['id']
# Load annotation
# if data["grease_pencil"]:
# target.grease_pencil = bpy.data.grease_pencils[data["grease_pencil"]["name"]]
if data["grease_pencil"]:
target.grease_pencil = bpy.data.grease_pencils[data["grease_pencil"]["name"]]
else:
target.grease_pencil = None
except:
logger.error("Scene loading error")
@ -526,8 +529,10 @@ def dump(key):
if target_type == 'Material':
data = dump_datablock_attibute(target, ['name','grease_pencil' ,'node_tree', 'id'], 7)
elif target_type == 'Grease Pencil':
data = dump_datablock_attibute(
target, ['name', 'layers', 'materials', 'id'], 9)
data = dump_datablock(target, 2)
dump_datablock_attibute(
target, ['layers'], 9,data)
elif target_type == 'Camera':
data = dump_datablock(target, 1)
elif target_type == 'Light':
@ -556,6 +561,8 @@ def dump(key):
elif target_type == 'Collection':
data = dump_datablock(target, 4)
elif target_type == 'Scene':
if target_type.grease_pencil:
pass
data = dump_datablock_attibute(
target, ['name', 'collection', 'id', 'camera', 'grease_pencil'], 4)

View File

@ -549,7 +549,8 @@ def depsgraph_update(scene):
if client_state == 3:
if bpy.context.mode == 'OBJECT':
print(bpy.context.mode)
if bpy.context.mode in ['OBJECT','PAINT_GPENCIL']:
updates = bpy.context.depsgraph.updates
username = bpy.context.scene.session_settings.username
update_selected_object(bpy.context)