Skip to content

Commit

Permalink
Merge pull request #201 from ynput/bugfix/AY-4004_Maya-optional-valid…
Browse files Browse the repository at this point in the history
…ator-not-shown-in-publish-context

Max & Maya: Make sure validators being shown in the Publisher UI when they set to be optional in AYON setting
  • Loading branch information
m-u-r-p-h-y authored Mar 20, 2024
2 parents 99e2755 + 8a37ca1 commit 1456989
Show file tree
Hide file tree
Showing 60 changed files with 451 additions and 153 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ def get_invalid(cls, instance):
return invalid

def process(self, instance):
if not self.is_active(instance.data):
return
invalid = self.get_invalid(instance)
if invalid:
bullet_point_invalid_statement = "\n".join(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
import ayon_core.hosts.maya.api.action
from ayon_core.pipeline.publish import (
PublishValidationError,
ValidateContentsOrder
ValidateContentsOrder,
OptionalPyblishPluginMixin
)
from maya import cmds


class ValidateAnimatedReferenceRig(pyblish.api.InstancePlugin):
class ValidateAnimatedReferenceRig(pyblish.api.InstancePlugin,
OptionalPyblishPluginMixin):
"""Validate all nodes in skeletonAnim_SET are referenced"""

order = ValidateContentsOrder
Expand All @@ -16,8 +18,11 @@ class ValidateAnimatedReferenceRig(pyblish.api.InstancePlugin):
label = "Animated Reference Rig"
accepted_controllers = ["transform", "locator"]
actions = [ayon_core.hosts.maya.api.action.SelectInvalidAction]
optional = False

def process(self, instance):
if not self.is_active(instance.data):
return
animated_sets = instance.data.get("animated_skeleton", [])
if not animated_sets:
self.log.debug(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
import ayon_core.hosts.maya.api.action
from ayon_core.pipeline.publish import (
PublishValidationError,
ValidateContentsOrder
ValidateContentsOrder,
OptionalPyblishPluginMixin
)


class ValidateAnimationContent(pyblish.api.InstancePlugin):
class ValidateAnimationContent(pyblish.api.InstancePlugin,
OptionalPyblishPluginMixin):
"""Adheres to the content of 'animation' product type
- Must have collected `out_hierarchy` data.
Expand All @@ -19,6 +21,7 @@ class ValidateAnimationContent(pyblish.api.InstancePlugin):
families = ["animation"]
label = "Animation Content"
actions = [ayon_core.hosts.maya.api.action.SelectInvalidAction]
optional = False

@classmethod
def get_invalid(cls, instance):
Expand Down Expand Up @@ -48,6 +51,8 @@ def get_invalid(cls, instance):
return invalid

def process(self, instance):
if not self.is_active(instance.data):
return
invalid = self.get_invalid(instance)
if invalid:
raise PublishValidationError(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
from ayon_core.pipeline.publish import (
RepairAction,
ValidateContentsOrder,
PublishValidationError
PublishValidationError,
OptionalPyblishPluginMixin
)


class ValidateOutRelatedNodeIds(pyblish.api.InstancePlugin):
class ValidateOutRelatedNodeIds(pyblish.api.InstancePlugin,
OptionalPyblishPluginMixin):
"""Validate if deformed shapes have related IDs to the original shapes
When a deformer is applied in the scene on a referenced mesh that already
Expand All @@ -28,10 +30,12 @@ class ValidateOutRelatedNodeIds(pyblish.api.InstancePlugin):
ayon_core.hosts.maya.api.action.SelectInvalidAction,
RepairAction
]
optional = False

def process(self, instance):
"""Process all meshes"""

if not self.is_active(instance.data):
return
# Ensure all nodes have a cbId and a related ID to the original shapes
# if a deformer has been created on the shape
invalid = self.get_invalid(instance)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import pyblish.api
from ayon_core.hosts.maya.api import lib
from ayon_core.pipeline.publish import (
ValidateContentsOrder, PublishValidationError, RepairAction
ValidateContentsOrder,
PublishValidationError,
RepairAction,
OptionalPyblishPluginMixin
)


class ValidateArnoldSceneSourceCbid(pyblish.api.InstancePlugin):
class ValidateArnoldSceneSourceCbid(pyblish.api.InstancePlugin,
OptionalPyblishPluginMixin):
"""Validate Arnold Scene Source Cbid.
It is required for the proxy and content nodes to share the same cbid.
Expand All @@ -16,6 +20,7 @@ class ValidateArnoldSceneSourceCbid(pyblish.api.InstancePlugin):
families = ["ass"]
label = "Validate Arnold Scene Source CBID"
actions = [RepairAction]
optional = False

@staticmethod
def _get_nodes_by_name(nodes):
Expand Down Expand Up @@ -55,6 +60,8 @@ def get_invalid_couples(cls, instance):
return invalid_couples

def process(self, instance):
if not self.is_active(instance.data):
return
# Proxy validation.
if not instance.data.get("proxy", []):
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,25 @@
from ayon_core.pipeline.publish import (
RepairAction,
ValidateContentsOrder,
PublishValidationError
PublishValidationError,
OptionalPyblishPluginMixin
)


class ValidateAssRelativePaths(pyblish.api.InstancePlugin):
class ValidateAssRelativePaths(pyblish.api.InstancePlugin,
OptionalPyblishPluginMixin):
"""Ensure exporting ass file has set relative texture paths"""

order = ValidateContentsOrder
hosts = ['maya']
families = ['ass']
label = "ASS has relative texture paths"
actions = [RepairAction]
optional = False

def process(self, instance):
if not self.is_active(instance.data):
return
# we cannot ask this until user open render settings as
# `defaultArnoldRenderOptions` doesn't exist
errors = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
import maya.cmds as cmds
import ayon_core.hosts.maya.api.action
from ayon_core.pipeline.publish import (
PublishValidationError
PublishValidationError,
OptionalPyblishPluginMixin
)


class ValidateAssemblyName(pyblish.api.InstancePlugin):
class ValidateAssemblyName(pyblish.api.InstancePlugin,
OptionalPyblishPluginMixin):
""" Ensure Assembly name ends with `GRP`
Check if assembly name ends with `_GRP` string.
Expand All @@ -17,6 +19,7 @@ class ValidateAssemblyName(pyblish.api.InstancePlugin):
families = ["assembly"]
actions = [ayon_core.hosts.maya.api.action.SelectInvalidAction]
active = False
optional = True

@classmethod
def get_invalid(cls, instance):
Expand Down Expand Up @@ -47,7 +50,8 @@ def get_invalid(cls, instance):
return invalid

def process(self, instance):

if not self.is_active(instance.data):
return
invalid = self.get_invalid(instance)
if invalid:
raise PublishValidationError("Found {} invalid named assembly "
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import pyblish.api
import ayon_core.hosts.maya.api.action
from ayon_core.pipeline.publish import (
PublishValidationError
PublishValidationError,
OptionalPyblishPluginMixin
)

class ValidateAssemblyNamespaces(pyblish.api.InstancePlugin):
class ValidateAssemblyNamespaces(pyblish.api.InstancePlugin,
OptionalPyblishPluginMixin):
"""Ensure namespaces are not nested
In the outliner an item in a normal namespace looks as following:
Expand All @@ -20,9 +22,11 @@ class ValidateAssemblyNamespaces(pyblish.api.InstancePlugin):
order = pyblish.api.ValidatorOrder
families = ["assembly"]
actions = [ayon_core.hosts.maya.api.action.SelectInvalidAction]
optional = False

def process(self, instance):

if not self.is_active(instance.data):
return
self.log.debug("Checking namespace for %s" % instance.name)
if self.get_invalid(instance):
raise PublishValidationError("Nested namespaces found")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@
from maya import cmds

import ayon_core.hosts.maya.api.action
from ayon_core.pipeline.publish import PublishValidationError, RepairAction
from ayon_core.pipeline.publish import (
PublishValidationError,
RepairAction,
OptionalPyblishPluginMixin
)


class ValidateAssemblyModelTransforms(pyblish.api.InstancePlugin):
class ValidateAssemblyModelTransforms(pyblish.api.InstancePlugin,
OptionalPyblishPluginMixin):
"""Verify only root nodes of the loaded asset have transformations.
Note: This check is temporary and is subject to change.
Expand Down Expand Up @@ -34,7 +39,11 @@ class ValidateAssemblyModelTransforms(pyblish.api.InstancePlugin):
" This can alter the look of your scene. "
"Are you sure you want to continue?")

optional = False

def process(self, instance):
if not self.is_active(instance.data):
return
invalid = self.get_invalid(instance)
if invalid:
raise PublishValidationError(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@

import ayon_core.hosts.maya.api.action
from ayon_core.pipeline.publish import (
PublishValidationError, ValidateContentsOrder)
PublishValidationError,
ValidateContentsOrder,
OptionalPyblishPluginMixin
)


class ValidateCameraAttributes(pyblish.api.InstancePlugin):
class ValidateCameraAttributes(pyblish.api.InstancePlugin,
OptionalPyblishPluginMixin):
"""Validates Camera has no invalid attribute keys or values.
The Alembic file format does not a specific subset of attributes as such
Expand All @@ -20,6 +24,7 @@ class ValidateCameraAttributes(pyblish.api.InstancePlugin):
hosts = ['maya']
label = 'Camera Attributes'
actions = [ayon_core.hosts.maya.api.action.SelectInvalidAction]
optional = True

DEFAULTS = [
("filmFitOffset", 0.0),
Expand Down Expand Up @@ -62,7 +67,8 @@ def get_invalid(cls, instance):

def process(self, instance):
"""Process all the nodes in the instance"""

if not self.is_active(instance.data):
return
invalid = self.get_invalid(instance)

if invalid:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@

import ayon_core.hosts.maya.api.action
from ayon_core.pipeline.publish import (
PublishValidationError, ValidateContentsOrder)
PublishValidationError,
ValidateContentsOrder,
OptionalPyblishPluginMixin)


class ValidateCameraContents(pyblish.api.InstancePlugin):
class ValidateCameraContents(pyblish.api.InstancePlugin,
OptionalPyblishPluginMixin):
"""Validates Camera instance contents.
A Camera instance may only hold a SINGLE camera's transform, nothing else.
Expand All @@ -22,6 +25,7 @@ class ValidateCameraContents(pyblish.api.InstancePlugin):
label = 'Camera Contents'
actions = [ayon_core.hosts.maya.api.action.SelectInvalidAction]
validate_shapes = True
optional = False

@classmethod
def get_invalid(cls, instance):
Expand Down Expand Up @@ -71,7 +75,8 @@ def get_invalid(cls, instance):

def process(self, instance):
"""Process all the nodes in the instance"""

if not self.is_active(instance.data):
return
invalid = self.get_invalid(instance)
if invalid:
raise PublishValidationError("Invalid camera contents: "
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import pyblish.api

from maya import cmds
from ayon_core.pipeline.publish import context_plugin_should_run
from ayon_core.pipeline.publish import (
context_plugin_should_run,
OptionalPyblishPluginMixin
)


class ValidateCurrentRenderLayerIsRenderable(pyblish.api.ContextPlugin):
class ValidateCurrentRenderLayerIsRenderable(pyblish.api.ContextPlugin,
OptionalPyblishPluginMixin):
"""Validate if current render layer has a renderable camera
There is a bug in Redshift which occurs when the current render layer
Expand All @@ -20,9 +23,11 @@ class ValidateCurrentRenderLayerIsRenderable(pyblish.api.ContextPlugin):
order = pyblish.api.ValidatorOrder
hosts = ["maya"]
families = ["renderlayer"]
optional = False

def process(self, context):

if not self.is_active(context.data):
return
# Workaround bug pyblish-base#250
if not context_plugin_should_run(self, context):
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
RepairAction,
ValidateContentsOrder
)
from ayon_core.pipeline import PublishValidationError
from ayon_core.pipeline import PublishValidationError, OptionalPyblishPluginMixin


class ValidateGLSLMaterial(pyblish.api.InstancePlugin):
class ValidateGLSLMaterial(pyblish.api.InstancePlugin,
OptionalPyblishPluginMixin):
"""
Validate if the asset uses GLSL Shader
"""
Expand All @@ -23,6 +24,8 @@ class ValidateGLSLMaterial(pyblish.api.InstancePlugin):
active = True

def process(self, instance):
if not self.is_active(instance.data):
return
shading_grp = self.get_material_from_shapes(instance)
if not shading_grp:
raise PublishValidationError("No shading group found")
Expand Down
Loading

0 comments on commit 1456989

Please sign in to comment.