mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-26 05:42:15 +01:00
Code improvements from suggestions
Co-authored-by: Roy Nieterau <roy_nieterau@hotmail.com>
This commit is contained in:
parent
2517408919
commit
4418d11164
2 changed files with 8 additions and 15 deletions
|
|
@ -60,19 +60,14 @@ class CacheModelLoader(plugin.AssetLoader):
|
|||
|
||||
imported = lib.get_selection()
|
||||
|
||||
empties = [obj for obj in imported if obj.type == 'EMPTY']
|
||||
|
||||
container = None
|
||||
|
||||
for empty in empties:
|
||||
if not empty.parent:
|
||||
container = empty
|
||||
break
|
||||
# Use first EMPTY without parent as container
|
||||
container = next(
|
||||
(obj for obj in imported if obj.type == "EMPTY" and not obj.parent),
|
||||
None
|
||||
)
|
||||
|
||||
objects = []
|
||||
if container:
|
||||
# Children must be linked before parents,
|
||||
# otherwise the hierarchy will break
|
||||
nodes = list(container.children)
|
||||
|
||||
for obj in nodes:
|
||||
|
|
@ -80,11 +75,9 @@ class CacheModelLoader(plugin.AssetLoader):
|
|||
|
||||
bpy.data.objects.remove(container)
|
||||
|
||||
objects.extend(nodes)
|
||||
for obj in nodes:
|
||||
objects.append(obj)
|
||||
objects.extend(list(obj.children_recursive))
|
||||
|
||||
objects.reverse()
|
||||
objects.extend(obj.children_recursive)
|
||||
else:
|
||||
for obj in imported:
|
||||
obj.parent = asset_group
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class CollectInstances(pyblish.api.ContextPlugin):
|
|||
for group in asset_groups:
|
||||
instance = self.create_instance(context, group)
|
||||
members = []
|
||||
if type(group) == bpy.types.Collection:
|
||||
if isinstance(group, bpy.types.Collection):
|
||||
members = list(group.objects)
|
||||
family = instance.data["family"]
|
||||
if family == "animation":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue