Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

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

Maya: Make sure validators being shown in the Publisher UI when they set to be optional in AYON setting
  • Loading branch information
antirotor authored Apr 9, 2024
2 parents 45ee85c + ae18900 commit e23b4f6
Show file tree
Hide file tree
Showing 57 changed files with 448 additions and 149 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
import openpype.hosts.maya.api.action
from openpype.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 = [openpype.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,12 +2,14 @@
import openpype.hosts.maya.api.action
from openpype.pipeline.publish import (
PublishValidationError,
ValidateContentsOrder
ValidateContentsOrder,
OptionalPyblishPluginMixin
)


class ValidateAnimationContent(pyblish.api.InstancePlugin):
"""Adheres to the content of 'animation' family
class ValidateAnimationContent(pyblish.api.InstancePlugin,
OptionalPyblishPluginMixin):
"""Adheres to the content of 'animation' product type
- Must have collected `out_hierarchy` data.
- All nodes in `out_hierarchy` must be in the instance.
Expand All @@ -19,6 +21,7 @@ class ValidateAnimationContent(pyblish.api.InstancePlugin):
families = ["animation"]
label = "Animation Content"
actions = [openpype.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 openpype.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):
openpype.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
Expand Up @@ -8,20 +8,25 @@
from openpype.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
10 changes: 7 additions & 3 deletions openpype/hosts/maya/plugins/publish/validate_assembly_name.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
import maya.cmds as cmds
import openpype.hosts.maya.api.action
from openpype.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 = [openpype.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,13 @@
import pyblish.api
import openpype.hosts.maya.api.action
from openpype.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 +23,11 @@ class ValidateAssemblyNamespaces(pyblish.api.InstancePlugin):
order = pyblish.api.ValidatorOrder
families = ["assembly"]
actions = [openpype.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 openpype.hosts.maya.api.action
from openpype.pipeline.publish import PublishValidationError, RepairAction
from openpype.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 openpype.hosts.maya.api.action
from openpype.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 = [openpype.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
11 changes: 8 additions & 3 deletions openpype/hosts/maya/plugins/publish/validate_camera_contents.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@

import openpype.hosts.maya.api.action
from openpype.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 = [openpype.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,14 @@
import pyblish.api

from maya import cmds
from openpype.pipeline.publish import context_plugin_should_run
from openpype.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 +24,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
10 changes: 8 additions & 2 deletions openpype/hosts/maya/plugins/publish/validate_glsl_material.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@
RepairAction,
ValidateContentsOrder
)
from openpype.pipeline import PublishValidationError
from openpype.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 +27,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
9 changes: 7 additions & 2 deletions openpype/hosts/maya/plugins/publish/validate_glsl_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
from openpype.pipeline.publish import (
RepairAction,
ValidateContentsOrder,
PublishValidationError
PublishValidationError,
OptionalPyblishPluginMixin
)


class ValidateGLSLPlugin(pyblish.api.InstancePlugin):
class ValidateGLSLPlugin(pyblish.api.InstancePlugin,
OptionalPyblishPluginMixin):
"""
Validate if the asset uses GLSL Shader
"""
Expand All @@ -19,8 +21,11 @@ class ValidateGLSLPlugin(pyblish.api.InstancePlugin):
hosts = ['maya']
label = 'maya2glTF plugin'
actions = [RepairAction]
optional = False

def process(self, instance):
if not self.is_active(instance.data):
return
if not cmds.pluginInfo("maya2glTF", query=True, loaded=True):
raise PublishValidationError("maya2glTF is not loaded")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
import pyblish.api

from openpype.hosts.maya.api import lib
from openpype.pipeline.publish import PublishValidationError
from openpype.pipeline.publish import (
PublishValidationError,
OptionalPyblishPluginMixin
)


class ValidateInstancerContent(pyblish.api.InstancePlugin):
class ValidateInstancerContent(pyblish.api.InstancePlugin,
OptionalPyblishPluginMixin):
"""Validates that all meshes in the instance have object IDs.
This skips a check on intermediate objects because we consider them
Expand All @@ -14,9 +18,11 @@ class ValidateInstancerContent(pyblish.api.InstancePlugin):
order = pyblish.api.ValidatorOrder
label = 'Instancer Content'
families = ['instancer']
optional = False

def process(self, instance):

if not self.is_active(instance.data):
return
error = False
members = instance.data['setMembers']
export_members = instance.data['exactExportMembers']
Expand Down
Loading

0 comments on commit e23b4f6

Please sign in to comment.