mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-26 13:52:15 +01:00
REN-52: Ensure no default camera is renderable
This commit is contained in:
parent
6d6898030d
commit
390ccb4a09
1 changed files with 40 additions and 0 deletions
|
|
@ -0,0 +1,40 @@
|
|||
from maya import cmds
|
||||
|
||||
import pyblish.api
|
||||
import colorbleed.api
|
||||
import colorbleed.maya.lib as lib
|
||||
|
||||
|
||||
class ValidateRenderNoDefaultCameras(pyblish.api.InstancePlugin):
|
||||
"""Ensure no default (startup) cameras are to be rendered."""
|
||||
|
||||
order = colorbleed.api.ValidateContentsOrder
|
||||
hosts = ['maya']
|
||||
families = ['colorbleed.renderlayer']
|
||||
label = "No Default Cameras Renderable"
|
||||
actions = [colorbleed.api.SelectInvalidAction]
|
||||
|
||||
@staticmethod
|
||||
def get_invalid(instance):
|
||||
|
||||
layer = instance.data["setMembers"]
|
||||
|
||||
# Collect default cameras
|
||||
cameras = cmds.ls(type='camera', long=True)
|
||||
defaults = [cam for cam in cameras if
|
||||
cmds.camera(cam, query=True, startupCamera=True)]
|
||||
|
||||
invalid = []
|
||||
with lib.renderlayer(layer):
|
||||
for cam in defaults:
|
||||
if cmds.getAttr(cam + ".renderable"):
|
||||
invalid.append(cam)
|
||||
|
||||
return invalid
|
||||
|
||||
def process(self, instance):
|
||||
"""Process all the cameras in the instance"""
|
||||
invalid = self.get_invalid(instance)
|
||||
if invalid:
|
||||
raise RuntimeError("Renderable default cameras "
|
||||
"found: {0}".format(invalid))
|
||||
Loading…
Add table
Add a link
Reference in a new issue