feat: started to handle dependency

This commit is contained in:
Swann Martinez 2019-08-08 18:12:13 +02:00
parent 8b23d2bc09
commit 08ce2d5cee
No known key found for this signature in database
GPG Key ID: 414CCAFD8DA720E1
4 changed files with 21 additions and 4 deletions

View File

@ -211,7 +211,7 @@ def register():
bpy.types.WindowManager.session = bpy.props.PointerProperty( bpy.types.WindowManager.session = bpy.props.PointerProperty(
type=SessionProps) type=SessionProps)
bpy.types.ID.uuid = bpy.props.StringProperty(default="")
bpy.context.window_manager.session.load() bpy.context.window_manager.session.load()
save_session_config(bpy.context.window_manager.session,bpy.context) save_session_config(bpy.context.window_manager.session,bpy.context)
operators.register() operators.register()

@ -1 +1 @@
Subproject commit 69df1e1f4962151079fff5017038d7f9acd1afef Subproject commit 212dca0825568427ef409a7a9236044ad6f7782b

View File

@ -64,6 +64,23 @@ context = None
# client_data[0][1]['active_objects'] = [] # client_data[0][1]['active_objects'] = []
# client.set(client_key, client_data[0][1]) # client.set(client_key, client_data[0][1])
def add_datablock(datablock):
global client
child=None
if hasattr(datablock,"data"):
child = add_datablock(datablock.data)
if datablock.uuid and client.exist(datablock.uuid) :
return datablock.uuid
else:
new_uuid = client.add(datablock,childs=child)
datablock.uuid = new_uuid
return new_uuid
# TODO: cleanup # TODO: cleanup
def init_supported_datablocks(supported_types_id): def init_supported_datablocks(supported_types_id):
global client global client
@ -71,8 +88,7 @@ def init_supported_datablocks(supported_types_id):
for type_id in supported_types_id: for type_id in supported_types_id:
if hasattr(bpy.data,type_id): if hasattr(bpy.data,type_id):
for item in getattr(bpy.data,type_id): for item in getattr(bpy.data,type_id):
print(item) add_datablock(item)
client.add(item)
# def default_tick(): # def default_tick():

1
ui.py
View File

@ -199,6 +199,7 @@ class SESSION_PT_outliner(bpy.types.Panel):
# Property area # Property area
# area_msg = row.box() # area_msg = row.box()
client_keys = operators.client.list() client_keys = operators.client.list()
client_keys = operators.client.list()
if client_keys and len(client_keys) > 0: if client_keys and len(client_keys) > 0:
col = layout.column(align=True) col = layout.column(align=True)
for item in sorted(client_keys, key=get_client_key): for item in sorted(client_keys, key=get_client_key):