mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Added validator to verify that the instance is not empty
This commit is contained in:
parent
8f4d490af2
commit
7b9c6c3b99
5 changed files with 62 additions and 14 deletions
|
|
@ -0,0 +1,18 @@
|
|||
import bpy
|
||||
|
||||
import pyblish.api
|
||||
|
||||
|
||||
class ValidateInstanceEmpty(pyblish.api.InstancePlugin):
|
||||
"""Validator to verify that the instance is not empty"""
|
||||
|
||||
order = pyblish.api.ValidatorOrder - 0.01
|
||||
hosts = ["blender"]
|
||||
families = ["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.")
|
||||
|
|
@ -71,6 +71,11 @@
|
|||
"optional": false,
|
||||
"active": true
|
||||
},
|
||||
"ValidateInstanceEmpty": {
|
||||
"enabled": true,
|
||||
"optional": false,
|
||||
"active": true
|
||||
},
|
||||
"ExtractBlend": {
|
||||
"enabled": true,
|
||||
"optional": true,
|
||||
|
|
|
|||
|
|
@ -79,6 +79,22 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "collapsible-wrap",
|
||||
"label": "BlendScene",
|
||||
"children": [
|
||||
{
|
||||
"type": "schema_template",
|
||||
"name": "template_publish_plugin",
|
||||
"template_data": [
|
||||
{
|
||||
"key": "ValidateInstanceEmpty",
|
||||
"label": "Validate Instance is not Empty"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "collapsible-wrap",
|
||||
"label": "Render",
|
||||
|
|
|
|||
|
|
@ -61,26 +61,16 @@ class PublishPuginsModel(BaseSettingsModel):
|
|||
ValidateCameraZeroKeyframe: ValidatePluginModel = Field(
|
||||
default_factory=ValidatePluginModel,
|
||||
title="Validate Camera Zero Keyframe",
|
||||
section="Validators"
|
||||
section="General Validators"
|
||||
)
|
||||
ValidateFileSaved: ValidateFileSavedModel = Field(
|
||||
default_factory=ValidateFileSavedModel,
|
||||
title="Validate File Saved",
|
||||
section="Validators"
|
||||
)
|
||||
ValidateRenderCameraIsSet: ValidatePluginModel = Field(
|
||||
default_factory=ValidatePluginModel,
|
||||
title="Validate Render Camera Is Set",
|
||||
section="Validators"
|
||||
)
|
||||
ValidateDeadlinePublish: ValidatePluginModel = Field(
|
||||
default_factory=ValidatePluginModel,
|
||||
title="Validate Render Output for Deadline",
|
||||
section="Validators"
|
||||
)
|
||||
ValidateMeshHasUvs: ValidatePluginModel = Field(
|
||||
default_factory=ValidatePluginModel,
|
||||
title="Validate Mesh Has Uvs"
|
||||
title="Validate Mesh Has Uvs",
|
||||
section="Model Validators"
|
||||
)
|
||||
ValidateMeshNoNegativeScale: ValidatePluginModel = Field(
|
||||
default_factory=ValidatePluginModel,
|
||||
|
|
@ -94,6 +84,20 @@ 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",
|
||||
section="Render Validators"
|
||||
)
|
||||
ValidateDeadlinePublish: ValidatePluginModel = Field(
|
||||
default_factory=ValidatePluginModel,
|
||||
title="Validate Render Output for Deadline",
|
||||
)
|
||||
ExtractBlend: ExtractBlendModel = Field(
|
||||
default_factory=ExtractBlendModel,
|
||||
title="Extract Blend",
|
||||
|
|
@ -179,6 +183,11 @@ DEFAULT_BLENDER_PUBLISH_SETTINGS = {
|
|||
"optional": False,
|
||||
"active": True
|
||||
},
|
||||
"ValidateInstanceEmpty": {
|
||||
"enabled": True,
|
||||
"optional": False,
|
||||
"active": True
|
||||
},
|
||||
"ExtractBlend": {
|
||||
"enabled": True,
|
||||
"optional": True,
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
__version__ = "0.1.3"
|
||||
__version__ = "0.1.5"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue