mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
configurable model top level validation
This commit is contained in:
parent
2e36b5ba72
commit
5573bb1985
4 changed files with 45 additions and 10 deletions
|
|
@ -386,10 +386,13 @@ class CollectLook(pyblish.api.InstancePlugin):
|
|||
|
||||
self.log.info("Collected resources: {}".format(instance.data["resources"]))
|
||||
|
||||
# Log a warning when no relevant sets were retrieved for the look.
|
||||
if not instance.data["lookData"]["relationships"]:
|
||||
self.log.warning("No sets found for the nodes in the instance: "
|
||||
"%s" % instance[:])
|
||||
# Log warning when no relevant sets were retrieved for the look.
|
||||
if (
|
||||
not instance.data["lookData"]["relationships"]
|
||||
and "model" not in self.families
|
||||
):
|
||||
self.log.warning("No sets found for the nodes in the "
|
||||
"instance: %s" % instance[:])
|
||||
|
||||
# Ensure unique shader sets
|
||||
# Add shader sets to the instance for unify ID validation
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ from openpype.hosts.maya.api import lib
|
|||
class ValidateModelContent(pyblish.api.InstancePlugin):
|
||||
"""Adheres to the content of 'model' family
|
||||
|
||||
- Must have one top group.
|
||||
- Must have one top group. (configurable)
|
||||
- Must only contain: transforms, meshes and groups
|
||||
|
||||
"""
|
||||
|
|
@ -20,6 +20,8 @@ class ValidateModelContent(pyblish.api.InstancePlugin):
|
|||
label = "Model Content"
|
||||
actions = [openpype.hosts.maya.api.action.SelectInvalidAction]
|
||||
|
||||
validate_top_group = True
|
||||
|
||||
@classmethod
|
||||
def get_invalid(cls, instance):
|
||||
|
||||
|
|
@ -59,12 +61,13 @@ class ValidateModelContent(pyblish.api.InstancePlugin):
|
|||
|
||||
# Top group
|
||||
assemblies = cmds.ls(content_instance, assemblies=True, long=True)
|
||||
if len(assemblies) != 1:
|
||||
if len(assemblies) != 1 and cls.validate_top_group:
|
||||
cls.log.error("Must have exactly one top group")
|
||||
if len(assemblies) == 0:
|
||||
cls.log.warning("No top group found. "
|
||||
"(Are there objects in the instance?"
|
||||
" Or is it parented in another group?)")
|
||||
return assemblies
|
||||
if len(assemblies) == 0:
|
||||
cls.log.warning("No top group found. "
|
||||
"(Are there objects in the instance?"
|
||||
" Or is it parented in another group?)")
|
||||
return assemblies or True
|
||||
|
||||
def _is_visible(node):
|
||||
|
|
|
|||
|
|
@ -275,6 +275,11 @@
|
|||
"optional": true,
|
||||
"active": true
|
||||
},
|
||||
"ValidateModelContent": {
|
||||
"enabled": true,
|
||||
"optional": false,
|
||||
"validate_top_group": true
|
||||
},
|
||||
"ValidateNoAnimation": {
|
||||
"enabled": false,
|
||||
"optional": true,
|
||||
|
|
|
|||
|
|
@ -214,6 +214,30 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "dict",
|
||||
"collapsible": true,
|
||||
"key": "ValidateModelContent",
|
||||
"label": "Validate Model Content",
|
||||
"checkbox_key": "enabled",
|
||||
"children": [
|
||||
{
|
||||
"type": "boolean",
|
||||
"key": "enabled",
|
||||
"label": "Enabled"
|
||||
},
|
||||
{
|
||||
"type": "boolean",
|
||||
"key": "optional",
|
||||
"label": "Optional"
|
||||
},
|
||||
{
|
||||
"type": "boolean",
|
||||
"key": "validate_top_group",
|
||||
"label": "Validate one top group"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "dict",
|
||||
"collapsible": true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue