diff --git a/colorbleed/plugins/maya/publish/validate_render_single_camera.py b/colorbleed/plugins/maya/publish/validate_render_single_camera.py index 9762b562fd..581c1e920d 100644 --- a/colorbleed/plugins/maya/publish/validate_render_single_camera.py +++ b/colorbleed/plugins/maya/publish/validate_render_single_camera.py @@ -1,9 +1,6 @@ -from maya import cmds - import pyblish.api import colorbleed.api import colorbleed.maya.action -import colorbleed.maya.lib as lib class ValidateRenderSingleCamera(pyblish.api.InstancePlugin): @@ -18,33 +15,15 @@ class ValidateRenderSingleCamera(pyblish.api.InstancePlugin): """ order = colorbleed.api.ValidateContentsOrder + label = "Render Single Camera" hosts = ['maya'] families = ['colorbleed.renderlayer', "colorbleed.vrayscene"] - label = "Render Single Camera" + actions = [colorbleed.maya.action.SelectInvalidAction] - @staticmethod - def get_invalid(instance): - - layer = instance.data["setMembers"] - - cameras = cmds.ls(type='camera', long=True) - - with lib.renderlayer(layer): - renderable = [cam for cam in cameras if - cmds.getAttr(cam + ".renderable")] - - if len(renderable) == 0: - raise RuntimeError("No renderable cameras found.") - elif len(renderable) > 1: - return renderable - else: - return [] - def process(self, instance): """Process all the cameras in the instance""" - invalid = self.get_invalid(instance) - if invalid: - raise RuntimeError("Multiple renderable cameras" - "found: {0}".format(invalid)) + cameras = instance.data.get("camera", []) + assert len(cameras) == 1, ("Multiple renderable cameras" "found: %s " % + instance.data["setMembers"])