Merge pull request #242 from BigRoy/enhancement/maya_disable_cbid_workflow

Maya: Add setting to disable `cbId` workflow
This commit is contained in:
Ondřej Samohel 2024-03-26 17:14:27 +01:00 committed by GitHub
commit 573e29ac5c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 101 additions and 3 deletions

View file

@ -7,7 +7,9 @@ from ayon_core.pipeline.publish import (
RepairAction,
ValidateContentsOrder,
PublishValidationError,
OptionalPyblishPluginMixin
OptionalPyblishPluginMixin,
get_plugin_settings,
apply_plugin_settings_automatically
)
@ -32,6 +34,20 @@ class ValidateOutRelatedNodeIds(pyblish.api.InstancePlugin,
]
optional = False
@classmethod
def apply_settings(cls, project_settings):
# Preserve automatic settings applying logic
settings = get_plugin_settings(plugin=cls,
project_settings=project_settings,
log=cls.log,
category="maya")
apply_plugin_settings_automatically(cls, settings, logger=cls.log)
# Disable plug-in if cbId workflow is disabled
if not project_settings["maya"].get("use_cbid_workflow", True):
cls.enabled = False
return
def process(self, instance):
"""Process all meshes"""
if not self.is_active(instance.data):

View file

@ -22,6 +22,13 @@ class ValidateArnoldSceneSourceCbid(pyblish.api.InstancePlugin,
actions = [RepairAction]
optional = False
@classmethod
def apply_settings(cls, project_settings):
# Disable plug-in if cbId workflow is disabled
if not project_settings["maya"].get("use_cbid_workflow", True):
cls.enabled = False
return
@staticmethod
def _get_nodes_by_name(nodes):
nodes_by_name = {}

View file

@ -27,6 +27,13 @@ class ValidateLookIdReferenceEdits(pyblish.api.InstancePlugin):
actions = [ayon_core.hosts.maya.api.action.SelectInvalidAction,
RepairAction]
@classmethod
def apply_settings(cls, project_settings):
# Disable plug-in if cbId workflow is disabled
if not project_settings["maya"].get("use_cbid_workflow", True):
cls.enabled = False
return
def process(self, instance):
invalid = self.get_invalid(instance)

View file

@ -31,6 +31,13 @@ class ValidateNodeIDs(pyblish.api.InstancePlugin):
actions = [ayon_core.hosts.maya.api.action.SelectInvalidAction,
ayon_core.hosts.maya.api.action.GenerateUUIDsOnInvalidAction]
@classmethod
def apply_settings(cls, project_settings):
# Disable plug-in if cbId workflow is disabled
if not project_settings["maya"].get("use_cbid_workflow", True):
cls.enabled = False
return
def process(self, instance):
"""Process all meshes"""

View file

@ -26,6 +26,13 @@ class ValidateNodeIdsDeformedShape(pyblish.api.InstancePlugin):
RepairAction
]
@classmethod
def apply_settings(cls, project_settings):
# Disable plug-in if cbId workflow is disabled
if not project_settings["maya"].get("use_cbid_workflow", True):
cls.enabled = False
return
def process(self, instance):
"""Process all the nodes in the instance"""

View file

@ -26,6 +26,13 @@ class ValidateNodeIdsInDatabase(pyblish.api.InstancePlugin):
actions = [ayon_core.hosts.maya.api.action.SelectInvalidAction,
ayon_core.hosts.maya.api.action.GenerateUUIDsOnInvalidAction]
@classmethod
def apply_settings(cls, project_settings):
# Disable plug-in if cbId workflow is disabled
if not project_settings["maya"].get("use_cbid_workflow", True):
cls.enabled = False
return
def process(self, instance):
invalid = self.get_invalid(instance)
if invalid:

View file

@ -24,6 +24,13 @@ class ValidateNodeIDsRelated(pyblish.api.InstancePlugin,
actions = [ayon_core.hosts.maya.api.action.SelectInvalidAction,
ayon_core.hosts.maya.api.action.GenerateUUIDsOnInvalidAction]
@classmethod
def apply_settings(cls, project_settings):
# Disable plug-in if cbId workflow is disabled
if not project_settings["maya"].get("use_cbid_workflow", True):
cls.enabled = False
return
def process(self, instance):
"""Process all nodes in instance (including hierarchy)"""
if not self.is_active(instance.data):

View file

@ -26,6 +26,13 @@ class ValidateNodeIdsUnique(pyblish.api.InstancePlugin):
actions = [ayon_core.hosts.maya.api.action.SelectInvalidAction,
ayon_core.hosts.maya.api.action.GenerateUUIDsOnInvalidAction]
@classmethod
def apply_settings(cls, project_settings):
# Disable plug-in if cbId workflow is disabled
if not project_settings["maya"].get("use_cbid_workflow", True):
cls.enabled = False
return
def process(self, instance):
"""Process all meshes"""

View file

@ -8,7 +8,9 @@ from ayon_core.pipeline.publish import (
RepairAction,
ValidateContentsOrder,
PublishValidationError,
OptionalPyblishPluginMixin
OptionalPyblishPluginMixin,
get_plugin_settings,
apply_plugin_settings_automatically
)
@ -34,6 +36,20 @@ class ValidateRigOutSetNodeIds(pyblish.api.InstancePlugin,
allow_history_only = False
optional = False
@classmethod
def apply_settings(cls, project_settings):
# Preserve automatic settings applying logic
settings = get_plugin_settings(plugin=cls,
project_settings=project_settings,
log=cls.log,
category="maya")
apply_plugin_settings_automatically(cls, settings, logger=cls.log)
# Disable plug-in if cbId workflow is disabled
if not project_settings["maya"].get("use_cbid_workflow", True):
cls.enabled = False
return
def process(self, instance):
"""Process all meshes"""
if not self.is_active(instance.data):

View file

@ -32,6 +32,13 @@ class ValidateRigOutputIds(pyblish.api.InstancePlugin):
actions = [RepairAction,
ayon_core.hosts.maya.api.action.SelectInvalidAction]
@classmethod
def apply_settings(cls, project_settings):
# Disable plug-in if cbId workflow is disabled
if not project_settings["maya"].get("use_cbid_workflow", True):
cls.enabled = False
return
def process(self, instance):
invalid = self.get_invalid(instance, compute=True)
if invalid:

View file

@ -30,6 +30,15 @@ class ExtMappingItemModel(BaseSettingsModel):
class MayaSettings(BaseSettingsModel):
"""Maya Project Settings."""
use_cbid_workflow: bool = SettingsField(
True, title="Use cbId workflow",
description=(
"When enabled, a per node `cbId` identifier will be created and "
"validated for many product types. This is then used for look "
"publishing and many others. By disabling this, the `cbId` "
"attribute will still be created on scene save but it will not "
"be validated."))
open_workfile_post_initialization: bool = SettingsField(
True, title="Open Workfile Post Initialization")
explicit_plugins_loading: ExplicitPluginsLoadingModel = SettingsField(
@ -88,6 +97,7 @@ DEFAULT_MEL_WORKSPACE_SETTINGS = "\n".join((
))
DEFAULT_MAYA_SETTING = {
"use_cbid_workflow": True,
"open_workfile_post_initialization": True,
"explicit_plugins_loading": DEFAULT_EXPLITCIT_PLUGINS_LOADING_SETTINGS,
"imageio": DEFAULT_IMAGEIO_SETTINGS,

View file

@ -1,3 +1,3 @@
# -*- coding: utf-8 -*-
"""Package declaring addon version."""
__version__ = "0.1.10"
__version__ = "0.1.11"