mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-26 13:52:15 +01:00
Raise PublishValidationError
This commit is contained in:
parent
c131071c7d
commit
149c83e136
1 changed files with 8 additions and 2 deletions
|
|
@ -3,9 +3,11 @@ import pyblish.api
|
|||
from maya import cmds
|
||||
from ayon_core.pipeline.publish import (
|
||||
context_plugin_should_run,
|
||||
PublishValidationError,
|
||||
OptionalPyblishPluginMixin
|
||||
)
|
||||
|
||||
|
||||
class ValidateCurrentRenderLayerIsRenderable(pyblish.api.ContextPlugin,
|
||||
OptionalPyblishPluginMixin):
|
||||
"""Validate if current render layer has a renderable camera
|
||||
|
|
@ -35,5 +37,9 @@ class ValidateCurrentRenderLayerIsRenderable(pyblish.api.ContextPlugin,
|
|||
layer = cmds.editRenderLayerGlobals(query=True, currentRenderLayer=True)
|
||||
cameras = cmds.ls(type="camera", long=True)
|
||||
renderable = any(c for c in cameras if cmds.getAttr(c + ".renderable"))
|
||||
assert renderable, ("Current render layer '%s' has no renderable "
|
||||
"camera" % layer)
|
||||
if not renderable:
|
||||
raise PublishValidationError(
|
||||
"Current render layer '{}' has no renderable camera".format(
|
||||
layer
|
||||
)
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue