mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Changed validator to work with other families as well
This commit is contained in:
parent
75e891254f
commit
a4dbc19580
2 changed files with 17 additions and 9 deletions
|
|
@ -8,11 +8,20 @@ class ValidateInstanceEmpty(pyblish.api.InstancePlugin):
|
|||
|
||||
order = pyblish.api.ValidatorOrder - 0.01
|
||||
hosts = ["blender"]
|
||||
families = ["blendScene"]
|
||||
families = ["model", "pointcache", "rig", "camera" "layout", "blendScene"]
|
||||
label = "Validate Instance is not Empty"
|
||||
optional = False
|
||||
|
||||
def process(self, instance):
|
||||
collection = bpy.data.collections[instance.name]
|
||||
if not (collection.objects or collection.children):
|
||||
raise RuntimeError(f"Instance {instance.name} is empty.")
|
||||
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):
|
||||
raise RuntimeError(f"Instance {instance.name} is empty.")
|
||||
else:
|
||||
# All other instances are objects
|
||||
asset_group = bpy.data.objects[instance.name]
|
||||
if not asset_group.children:
|
||||
raise RuntimeError(f"Instance {instance.name} is empty.")
|
||||
|
|
|
|||
|
|
@ -67,6 +67,10 @@ class PublishPuginsModel(BaseSettingsModel):
|
|||
default_factory=ValidateFileSavedModel,
|
||||
title="Validate File Saved",
|
||||
)
|
||||
ValidateInstanceEmpty: ValidatePluginModel = Field(
|
||||
default_factory=ValidatePluginModel,
|
||||
title="Validate Instance is not Empty"
|
||||
)
|
||||
ValidateMeshHasUvs: ValidatePluginModel = Field(
|
||||
default_factory=ValidatePluginModel,
|
||||
title="Validate Mesh Has Uvs",
|
||||
|
|
@ -84,11 +88,6 @@ class PublishPuginsModel(BaseSettingsModel):
|
|||
default_factory=ValidatePluginModel,
|
||||
title="Validate No Colons In Name"
|
||||
)
|
||||
ValidateInstanceEmpty: ValidatePluginModel = Field(
|
||||
default_factory=ValidatePluginModel,
|
||||
title="Validate Instance is not Empty",
|
||||
section="BlendScene Validators"
|
||||
)
|
||||
ValidateRenderCameraIsSet: ValidatePluginModel = Field(
|
||||
default_factory=ValidatePluginModel,
|
||||
title="Validate Render Camera Is Set",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue