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

Commit

Permalink
♻️ add mixin to all validators and isort imports
Browse files Browse the repository at this point in the history
  • Loading branch information
antirotor committed Sep 5, 2023
1 parent 4456ac8 commit 6ed87d7
Show file tree
Hide file tree
Showing 104 changed files with 547 additions and 316 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import pyblish.api

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


Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import maya.cmds as cmds

import pyblish.api

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


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 Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import pyblish.api

from openpype.pipeline.publish import (
ValidateContentsOrder, PublishValidationError
OptionalPyblishPluginMixin,
PublishValidationError,
ValidateContentsOrder,
)


class ValidateArnoldSceneSource(pyblish.api.InstancePlugin):
class ValidateArnoldSceneSource(pyblish.api.InstancePlugin,
OptionalPyblishPluginMixin):
"""Validate Arnold Scene Source.
We require at least 1 root node/parent for the meshes. This is to ensure we
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import pyblish.api

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


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 Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@
import types

import maya.cmds as cmds
import pyblish.api
from mtoa.core import createOptions

import pyblish.api
from openpype.pipeline.publish import (
OptionalPyblishPluginMixin,
PublishValidationError,
RepairAction,
ValidateContentsOrder,
PublishValidationError
)


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

order = ValidateContentsOrder
Expand Down
9 changes: 6 additions & 3 deletions openpype/hosts/maya/plugins/publish/validate_assembly_name.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import pyblish.api
import maya.cmds as cmds
import pyblish.api

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


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 Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import pyblish.api

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

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 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 (
OptionalPyblishPluginMixin,
PublishValidationError,
RepairAction,
)


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
7 changes: 5 additions & 2 deletions openpype/hosts/maya/plugins/publish/validate_attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@

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


class ValidateAttributes(pyblish.api.InstancePlugin,
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)
OptionalPyblishPluginMixin,
PublishValidationError,
ValidateContentsOrder,
)


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 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)
OptionalPyblishPluginMixin,
PublishValidationError,
ValidateContentsOrder,
)


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 Down
4 changes: 2 additions & 2 deletions openpype/hosts/maya/plugins/publish/validate_color_sets.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import pyblish.api
from maya import cmds

import pyblish.api
import openpype.hosts.maya.api.action
from openpype.pipeline.publish import (
OptionalPyblishPluginMixin,
RepairAction,
ValidateMeshOrder,
OptionalPyblishPluginMixin
)


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 (
OptionalPyblishPluginMixin,
context_plugin_should_run,
)


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 Down
5 changes: 4 additions & 1 deletion openpype/hosts/maya/plugins/publish/validate_cycle_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
import openpype.hosts.maya.api.action
from openpype.hosts.maya.api.lib import maintained_selection
from openpype.pipeline.publish import (
OptionalPyblishPluginMixin, PublishValidationError, ValidateContentsOrder)
OptionalPyblishPluginMixin,
PublishValidationError,
ValidateContentsOrder,
)


class ValidateCycleError(pyblish.api.InstancePlugin,
Expand Down
16 changes: 8 additions & 8 deletions openpype/hosts/maya/plugins/publish/validate_frame_range.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import pyblish.api

from maya import cmds
from maya.app.renderSetup.model.override import AbsOverride

from openpype.hosts.maya.api.lib_rendersetup import (
get_attr_in_layer,
get_attr_overrides,
)
from openpype.pipeline.publish import (
OptionalPyblishPluginMixin,
PublishValidationError,
RepairAction,
ValidateContentsOrder,
PublishValidationError,
OptionalPyblishPluginMixin
)
from openpype.hosts.maya.api.lib_rendersetup import (
get_attr_overrides,
get_attr_in_layer,
)
from maya.app.renderSetup.model.override import AbsOverride


class ValidateFrameRange(pyblish.api.InstancePlugin,
Expand Down
11 changes: 7 additions & 4 deletions openpype/hosts/maya/plugins/publish/validate_glsl_material.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import os
from maya import cmds

import pyblish.api
from maya import cmds

from openpype.pipeline import PublishValidationError
from openpype.pipeline.publish import (
OptionalPyblishPluginMixin,
RepairAction,
ValidateContentsOrder
ValidateContentsOrder,
)
from openpype.pipeline import PublishValidationError


class ValidateGLSLMaterial(pyblish.api.InstancePlugin):
class ValidateGLSLMaterial(pyblish.api.InstancePlugin,
OptionalPyblishPluginMixin):
"""
Validate if the asset uses GLSL Shader
"""
Expand Down
7 changes: 4 additions & 3 deletions openpype/hosts/maya/plugins/publish/validate_glsl_plugin.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@

import pyblish.api
from maya import cmds

import pyblish.api
from openpype.pipeline.publish import (
PublishValidationError,
RepairAction,
ValidateContentsOrder,
PublishValidationError
)


class ValidateGLSLPlugin(pyblish.api.InstancePlugin):
class ValidateGLSLPlugin(pyblish.api.InstancePlugin,
OptionalPyblishPluginMixin):
"""
Validate if the asset uses GLSL Shader
"""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import pyblish.api

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


class ValidateInstanceHasMembers(pyblish.api.InstancePlugin):
class ValidateInstanceHasMembers(pyblish.api.InstancePlugin,
OptionalPyblishPluginMixin):
"""Validates instance objectSet has *any* members."""

order = ValidateContentsOrder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
from __future__ import absolute_import

import pyblish.api
from maya import cmds

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

from maya import cmds


class ValidateInstanceInContext(pyblish.api.InstancePlugin,
OptionalPyblishPluginMixin):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import six
from openpype.pipeline.publish import (
ValidateContentsOrder,
PublishValidationError
PublishValidationError,
OptionalPyblishPluginMixin,
)

# Allow only characters, numbers and underscore
Expand All @@ -18,7 +19,8 @@ def validate_name(subset):
return all(x in allowed for x in subset)


class ValidateSubsetName(pyblish.api.InstancePlugin):
class ValidateSubsetName(pyblish.api.InstancePlugin,
OptionalPyblishPluginMixin):
"""Validates subset name has only valid characters"""

order = ValidateContentsOrder
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 (
OptionalPyblishPluginMixin,
PublishValidationError,
)


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 Down
Loading

0 comments on commit 6ed87d7

Please sign in to comment.