fix: skeleton loading error

This commit is contained in:
Swann
2019-09-17 17:23:57 +02:00
parent 3710b3ca14
commit 85f1db829b
4 changed files with 15 additions and 6 deletions

View File

@ -19,16 +19,23 @@ class BlArmature(BlDatablock):
else: else:
parent_object = bpy.data.objects[data['user']] parent_object = bpy.data.objects[data['user']]
# Link it to the correct context is_object_in_master = (data['user_collection'][0] == "Master Collection")
if data['user_collection'][0] == "Master Collection": #TODO: recursive parent collection loading
# Link parent object to the collection
if is_object_in_master:
parent_collection = bpy.data.scenes[data['user_scene'][0]].collection parent_collection = bpy.data.scenes[data['user_scene'][0]].collection
elif data['user_collection'][0] not in bpy.data.collections.keys(): elif data['user_collection'][0] not in bpy.data.collections.keys():
parent_collection = bpy.data.collections.new(data['user_collection'][0]) parent_collection = bpy.data.collections.new(data['user_collection'][0])
else: else:
parent_collection = bpy.data.collection['user_collection'][0] parent_collection = bpy.data.collections[data['user_collection'][0]]
if parent_object.name not in parent_collection.objects: if parent_object.name not in parent_collection.objects:
parent_collection.objects.link(parent_object) parent_collection.objects.link(parent_object)
# Link parent collection to the scene master collection
if not is_object_in_master and parent_collection.name not in bpy.data.scenes[data['user_scene'][0]].collection.children:
bpy.data.scenes[data['user_scene'][0]].collection. children.link(parent_collection)
# utils.dump_anything.load(target, data) # utils.dump_anything.load(target, data)
# with Overrider(name="bpy_",parent=bpy.context) as bpy_: # with Overrider(name="bpy_",parent=bpy.context) as bpy_:

View File

@ -309,7 +309,9 @@ def redresh_handler(dummy):
if client: if client:
user = client.get(uuid=bpy.context.window_manager.session.user_uuid) user = client.get(uuid=bpy.context.window_manager.session.user_uuid)
user.pointer.is_dirty = True
if hasattr(user,"pointer"):
user.pointer.is_dirty = True
classes = ( classes = (

View File

@ -34,7 +34,7 @@ def get_users(datablock):
root = getattr(bpy.data,datatype.bl_name) root = getattr(bpy.data,datatype.bl_name)
for item in root: for item in root:
if hasattr(item, 'data') and datablock == item.data or \ if hasattr(item, 'data') and datablock == item.data or \
hasattr(item, 'children') and datablock in item.children: datatype.bl_name != 'collections' and hasattr(item, 'children') and datablock in item.children:
users.append(item) users.append(item)
return users return users