mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Changed how we get instance group in the validator
This commit is contained in:
parent
cab0a6a3ee
commit
a0da4cd17f
2 changed files with 7 additions and 11 deletions
|
|
@ -1,4 +1,3 @@
|
|||
import json
|
||||
from typing import Generator
|
||||
|
||||
import bpy
|
||||
|
|
@ -50,6 +49,7 @@ class CollectInstances(pyblish.api.ContextPlugin):
|
|||
|
||||
for group in asset_groups:
|
||||
instance = self.create_instance(context, group)
|
||||
instance.data["instance_group"] = group
|
||||
members = []
|
||||
if isinstance(group, bpy.types.Collection):
|
||||
members = list(group.objects)
|
||||
|
|
@ -65,6 +65,6 @@ class CollectInstances(pyblish.api.ContextPlugin):
|
|||
|
||||
members.append(group)
|
||||
instance[:] = members
|
||||
self.log.debug(json.dumps(instance.data, indent=4))
|
||||
self.log.debug(instance.data)
|
||||
for obj in instance:
|
||||
self.log.debug(obj)
|
||||
|
|
|
|||
|
|
@ -13,15 +13,11 @@ class ValidateInstanceEmpty(pyblish.api.InstancePlugin):
|
|||
optional = False
|
||||
|
||||
def process(self, instance):
|
||||
self.log.debug(instance)
|
||||
self.log.debug(instance.data)
|
||||
if instance.data["family"] == "blendScene":
|
||||
# blendScene instances are collections
|
||||
collection = bpy.data.collections[instance.name]
|
||||
if not (collection.objects or collection.children):
|
||||
asset_group = instance.data["instance_group"]
|
||||
|
||||
if isinstance(asset_group, bpy.types.Collection):
|
||||
if not (asset_group.objects or asset_group.children):
|
||||
raise RuntimeError(f"Instance {instance.name} is empty.")
|
||||
else:
|
||||
# All other instances are objects
|
||||
asset_group = bpy.data.objects[instance.name]
|
||||
elif isinstance(asset_group, bpy.types.Object):
|
||||
if not asset_group.children:
|
||||
raise RuntimeError(f"Instance {instance.name} is empty.")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue