mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
Raise PublishValidationError
This commit is contained in:
parent
434ed6c620
commit
47ef404f04
5 changed files with 85 additions and 12 deletions
|
|
@ -2,7 +2,17 @@ from maya import cmds
|
||||||
|
|
||||||
import pyblish.api
|
import pyblish.api
|
||||||
import openpype.hosts.maya.api.action
|
import openpype.hosts.maya.api.action
|
||||||
from openpype.pipeline.publish import ValidateMeshOrder
|
from openpype.pipeline.publish import (
|
||||||
|
ValidateMeshOrder,
|
||||||
|
PublishValidationError
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _as_report_list(values, prefix="- ", suffix="\n"):
|
||||||
|
"""Return list as bullet point list for a report"""
|
||||||
|
if not values:
|
||||||
|
return ""
|
||||||
|
return prefix + (suffix + prefix).join(values)
|
||||||
|
|
||||||
|
|
||||||
class ValidateMeshNonManifold(pyblish.api.Validator):
|
class ValidateMeshNonManifold(pyblish.api.Validator):
|
||||||
|
|
@ -16,7 +26,7 @@ class ValidateMeshNonManifold(pyblish.api.Validator):
|
||||||
order = ValidateMeshOrder
|
order = ValidateMeshOrder
|
||||||
hosts = ['maya']
|
hosts = ['maya']
|
||||||
families = ['model']
|
families = ['model']
|
||||||
label = 'Mesh Non-Manifold Vertices/Edges'
|
label = 'Mesh Non-Manifold Edges/Vertices'
|
||||||
actions = [openpype.hosts.maya.api.action.SelectInvalidAction]
|
actions = [openpype.hosts.maya.api.action.SelectInvalidAction]
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
@ -38,5 +48,9 @@ class ValidateMeshNonManifold(pyblish.api.Validator):
|
||||||
invalid = self.get_invalid(instance)
|
invalid = self.get_invalid(instance)
|
||||||
|
|
||||||
if invalid:
|
if invalid:
|
||||||
raise ValueError("Meshes found with non-manifold "
|
raise PublishValidationError(
|
||||||
"edges/vertices: {0}".format(invalid))
|
"Meshes found with non-manifold edges/vertices:\n\n{0}".format(
|
||||||
|
_as_report_list(sorted(invalid))
|
||||||
|
),
|
||||||
|
title="Non-Manifold Edges/Vertices"
|
||||||
|
)
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,18 @@ import pyblish.api
|
||||||
import openpype.hosts.maya.api.action
|
import openpype.hosts.maya.api.action
|
||||||
from openpype.pipeline.publish import (
|
from openpype.pipeline.publish import (
|
||||||
ValidateContentsOrder,
|
ValidateContentsOrder,
|
||||||
OptionalPyblishPluginMixin
|
OptionalPyblishPluginMixin,
|
||||||
|
PublishValidationError
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _as_report_list(values, prefix="- ", suffix="\n"):
|
||||||
|
"""Return list as bullet point list for a report"""
|
||||||
|
if not values:
|
||||||
|
return ""
|
||||||
|
return prefix + (suffix + prefix).join(values)
|
||||||
|
|
||||||
|
|
||||||
class ValidateNoAnimation(pyblish.api.Validator,
|
class ValidateNoAnimation(pyblish.api.Validator,
|
||||||
OptionalPyblishPluginMixin):
|
OptionalPyblishPluginMixin):
|
||||||
"""Ensure no keyframes on nodes in the Instance.
|
"""Ensure no keyframes on nodes in the Instance.
|
||||||
|
|
@ -31,7 +39,12 @@ class ValidateNoAnimation(pyblish.api.Validator,
|
||||||
|
|
||||||
invalid = self.get_invalid(instance)
|
invalid = self.get_invalid(instance)
|
||||||
if invalid:
|
if invalid:
|
||||||
raise RuntimeError("Keyframes found: {0}".format(invalid))
|
raise PublishValidationError(
|
||||||
|
"Keyframes found on:\n\n{0}".format(
|
||||||
|
_as_report_list(sorted(invalid))
|
||||||
|
),
|
||||||
|
title="Keyframes on model"
|
||||||
|
)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_invalid(instance):
|
def get_invalid(instance):
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,17 @@ from maya import cmds
|
||||||
|
|
||||||
import pyblish.api
|
import pyblish.api
|
||||||
import openpype.hosts.maya.api.action
|
import openpype.hosts.maya.api.action
|
||||||
from openpype.pipeline.publish import ValidateContentsOrder
|
from openpype.pipeline.publish import (
|
||||||
|
ValidateContentsOrder,
|
||||||
|
PublishValidationError
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _as_report_list(values, prefix="- ", suffix="\n"):
|
||||||
|
"""Return list as bullet point list for a report"""
|
||||||
|
if not values:
|
||||||
|
return ""
|
||||||
|
return prefix + (suffix + prefix).join(values)
|
||||||
|
|
||||||
|
|
||||||
class ValidateNoDefaultCameras(pyblish.api.InstancePlugin):
|
class ValidateNoDefaultCameras(pyblish.api.InstancePlugin):
|
||||||
|
|
@ -28,4 +38,10 @@ class ValidateNoDefaultCameras(pyblish.api.InstancePlugin):
|
||||||
def process(self, instance):
|
def process(self, instance):
|
||||||
"""Process all the cameras in the instance"""
|
"""Process all the cameras in the instance"""
|
||||||
invalid = self.get_invalid(instance)
|
invalid = self.get_invalid(instance)
|
||||||
assert not invalid, "Default cameras found: {0}".format(invalid)
|
if invalid:
|
||||||
|
raise PublishValidationError(
|
||||||
|
"Default cameras found:\n\n{0}".format(
|
||||||
|
_as_report_list(sorted(invalid))
|
||||||
|
),
|
||||||
|
title="Default cameras"
|
||||||
|
)
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,18 @@ import pyblish.api
|
||||||
import openpype.hosts.maya.api.action
|
import openpype.hosts.maya.api.action
|
||||||
from openpype.pipeline.publish import (
|
from openpype.pipeline.publish import (
|
||||||
ValidateContentsOrder,
|
ValidateContentsOrder,
|
||||||
OptionalPyblishPluginMixin
|
OptionalPyblishPluginMixin,
|
||||||
|
PublishValidationError
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _as_report_list(values, prefix="- ", suffix="\n"):
|
||||||
|
"""Return list as bullet point list for a report"""
|
||||||
|
if not values:
|
||||||
|
return ""
|
||||||
|
return prefix + (suffix + prefix).join(values)
|
||||||
|
|
||||||
|
|
||||||
class ValidateNoUnknownNodes(pyblish.api.InstancePlugin,
|
class ValidateNoUnknownNodes(pyblish.api.InstancePlugin,
|
||||||
OptionalPyblishPluginMixin):
|
OptionalPyblishPluginMixin):
|
||||||
"""Checks to see if there are any unknown nodes in the instance.
|
"""Checks to see if there are any unknown nodes in the instance.
|
||||||
|
|
@ -38,4 +46,9 @@ class ValidateNoUnknownNodes(pyblish.api.InstancePlugin,
|
||||||
|
|
||||||
invalid = self.get_invalid(instance)
|
invalid = self.get_invalid(instance)
|
||||||
if invalid:
|
if invalid:
|
||||||
raise ValueError("Unknown nodes found: {0}".format(invalid))
|
raise PublishValidationError(
|
||||||
|
"Unknown nodes found:\n\n{0}".format(
|
||||||
|
_as_report_list(sorted(invalid))
|
||||||
|
),
|
||||||
|
title="Unknown nodes"
|
||||||
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,13 @@
|
||||||
import pyblish.api
|
import pyblish.api
|
||||||
from maya import cmds
|
from maya import cmds
|
||||||
|
from openpype.pipeline.publish import PublishValidationError
|
||||||
|
|
||||||
|
|
||||||
|
def _as_report_list(values, prefix="- ", suffix="\n"):
|
||||||
|
"""Return list as bullet point list for a report"""
|
||||||
|
if not values:
|
||||||
|
return ""
|
||||||
|
return prefix + (suffix + prefix).join(values)
|
||||||
|
|
||||||
|
|
||||||
class ValidateNoVRayMesh(pyblish.api.InstancePlugin):
|
class ValidateNoVRayMesh(pyblish.api.InstancePlugin):
|
||||||
|
|
@ -11,6 +19,9 @@ class ValidateNoVRayMesh(pyblish.api.InstancePlugin):
|
||||||
|
|
||||||
def process(self, instance):
|
def process(self, instance):
|
||||||
|
|
||||||
|
if not cmds.pluginInfo("vrayformaya", query=True, loaded=True):
|
||||||
|
return
|
||||||
|
|
||||||
shapes = cmds.ls(instance,
|
shapes = cmds.ls(instance,
|
||||||
shapes=True,
|
shapes=True,
|
||||||
type="mesh")
|
type="mesh")
|
||||||
|
|
@ -20,5 +31,11 @@ class ValidateNoVRayMesh(pyblish.api.InstancePlugin):
|
||||||
source=True) or []
|
source=True) or []
|
||||||
vray_meshes = cmds.ls(inputs, type='VRayMesh')
|
vray_meshes = cmds.ls(inputs, type='VRayMesh')
|
||||||
if vray_meshes:
|
if vray_meshes:
|
||||||
raise RuntimeError("Meshes that are VRayMeshes shouldn't "
|
raise PublishValidationError(
|
||||||
"be pointcached: {0}".format(vray_meshes))
|
"Meshes that are V-Ray Proxies should not be in an Alembic "
|
||||||
|
"pointcache.\n"
|
||||||
|
"Found V-Ray proxies:\n\n{}".format(
|
||||||
|
_as_report_list(sorted(vray_meshes))
|
||||||
|
),
|
||||||
|
title="V-Ray Proxies in pointcache"
|
||||||
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue