mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 13:24:54 +01:00
Validate only when redshift renderer is used
This commit is contained in:
parent
03ee91cf2c
commit
2bf1ca2a2d
1 changed files with 25 additions and 0 deletions
|
|
@ -36,6 +36,12 @@ class ValidateCurrentRenderLayerIsRenderable(pyblish.api.ContextPlugin,
|
|||
if not context_plugin_should_run(self, context):
|
||||
return
|
||||
|
||||
# This validator only makes sense when publishing renderlayer instances
|
||||
# with Redshift. We skip validation if there isn't any.
|
||||
if not any(self.is_active_redshift_render_instance(instance)
|
||||
for instance in context):
|
||||
return
|
||||
|
||||
cameras = cmds.ls(type="camera", long=True)
|
||||
renderable = any(c for c in cameras if cmds.getAttr(c + ".renderable"))
|
||||
if not renderable:
|
||||
|
|
@ -47,3 +53,22 @@ class ValidateCurrentRenderLayerIsRenderable(pyblish.api.ContextPlugin,
|
|||
),
|
||||
description=inspect.getdoc(self)
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def is_active_redshift_render_instance(instance) -> bool:
|
||||
"""Return whether instance is an active renderlayer instance set to
|
||||
render with Redshift renderer."""
|
||||
if not instance.data.get("active", True):
|
||||
return False
|
||||
|
||||
# Check this before families just because it's a faster check
|
||||
if not instance.data.get("renderer") == "redshift":
|
||||
return False
|
||||
|
||||
families = set()
|
||||
families.add(instance.data.get("family"))
|
||||
families.update(instance.data.get("families", []))
|
||||
if "renderlayer" not in families:
|
||||
return False
|
||||
|
||||
return True
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue