mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +01:00
Merge pull request #354 from simonebarbieri/bugfix/blender_local_objects_duplicates
bugfix/Blender local objects duplicated
This commit is contained in:
commit
56c283558d
5 changed files with 57 additions and 44 deletions
|
|
@ -79,21 +79,21 @@ class BlendLayoutLoader(plugin.AssetLoader):
|
|||
# The armature is unparented for all the non-local meshes,
|
||||
# when it is made local.
|
||||
for obj in objects + armatures:
|
||||
obj.make_local()
|
||||
local_obj = obj.make_local()
|
||||
if obj.data:
|
||||
obj.data.make_local()
|
||||
|
||||
if not obj.get(blender.pipeline.AVALON_PROPERTY):
|
||||
obj[blender.pipeline.AVALON_PROPERTY] = dict()
|
||||
if not local_obj.get(blender.pipeline.AVALON_PROPERTY):
|
||||
local_obj[blender.pipeline.AVALON_PROPERTY] = dict()
|
||||
|
||||
avalon_info = obj[blender.pipeline.AVALON_PROPERTY]
|
||||
avalon_info = local_obj[blender.pipeline.AVALON_PROPERTY]
|
||||
avalon_info.update({"container_name": container_name})
|
||||
|
||||
action = actions.get(obj.name, None)
|
||||
action = actions.get(local_obj.name, None)
|
||||
|
||||
if local_obj.type == 'ARMATURE' and action is not None:
|
||||
local_obj.animation_data.action = action
|
||||
|
||||
if obj.type == 'ARMATURE' and action is not None:
|
||||
obj.animation_data.action = action
|
||||
|
||||
layout_container.pop(blender.pipeline.AVALON_PROPERTY)
|
||||
|
||||
bpy.ops.object.select_all(action='DESELECT')
|
||||
|
|
@ -222,7 +222,8 @@ class BlendLayoutLoader(plugin.AssetLoader):
|
|||
|
||||
for obj in objects:
|
||||
if obj.type == 'ARMATURE':
|
||||
actions[obj.name] = obj.animation_data.action
|
||||
if obj.animation_data and obj.animation_data.action:
|
||||
actions[obj.name] = obj.animation_data.action
|
||||
|
||||
self._remove(objects, obj_container)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue