mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-26 22:02:15 +01:00
Merge pull request #193 from aardschok/REN-44b
Patch for breaking validator
This commit is contained in:
commit
6d3b60fa45
7 changed files with 77 additions and 52 deletions
|
|
@ -1,5 +1,3 @@
|
|||
from collections import OrderedDict
|
||||
|
||||
import avalon.maya
|
||||
|
||||
|
||||
|
|
@ -12,27 +10,17 @@ class CreateVRayScene(avalon.maya.Creator):
|
|||
def __init__(self, *args, **kwargs):
|
||||
super(CreateVRayScene, self).__init__(*args, **kwargs)
|
||||
|
||||
# We won't be publishing this one
|
||||
self.data["id"] = "avalon.vrayscene"
|
||||
|
||||
# We don't need subset or asset attributes
|
||||
self.data.pop("subset", None)
|
||||
self.data.pop("asset", None)
|
||||
self.data.pop("active", None)
|
||||
|
||||
data = OrderedDict(**self.data)
|
||||
|
||||
data["camera"] = self._get_cameras()
|
||||
data["suspendRenderJob"] = False
|
||||
data["suspendPublishJob"] = False
|
||||
data["extendFrames"] = False
|
||||
data["pools"] = ""
|
||||
|
||||
self.data = data
|
||||
self.data.update({
|
||||
"id": "avalon.vrayscene", # We won't be publishing this one
|
||||
"suspendRenderJob": False,
|
||||
"suspendPublishJob": False,
|
||||
"extendFrames": False,
|
||||
"pools": ""
|
||||
})
|
||||
|
||||
self.options = {"useSelection": False} # Force no content
|
||||
|
||||
def _get_cameras(self):
|
||||
from maya import cmds
|
||||
|
||||
return [c for c in cmds.ls(type="camera")
|
||||
if cmds.getAttr("%s.renderable" % c)]
|
||||
|
|
|
|||
27
colorbleed/plugins/maya/publish/collect_renderable_camera.py
Normal file
27
colorbleed/plugins/maya/publish/collect_renderable_camera.py
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import pyblish.api
|
||||
|
||||
from maya import cmds
|
||||
|
||||
from colorbleed.maya import lib
|
||||
|
||||
|
||||
class CollectRenderableCamera(pyblish.api.InstancePlugin):
|
||||
"""Collect the renderable camera(s) for the render layer"""
|
||||
|
||||
order = pyblish.api.CollectorOrder + 0.01
|
||||
label = "Collect Renderable Camera(s)"
|
||||
hosts = ["maya"]
|
||||
families = ["colorbleed.vrayscene",
|
||||
"colorbleed.renderlayer"]
|
||||
|
||||
def process(self, instance):
|
||||
layer = instance.data["setMembers"]
|
||||
|
||||
cameras = cmds.ls(type="camera", long=True)
|
||||
with lib.renderlayer(layer):
|
||||
renderable = [c for c in cameras if
|
||||
cmds.getAttr("%s.renderable" % c)]
|
||||
|
||||
self.log.info("Found cameras %s" % len(renderable))
|
||||
|
||||
instance.data.update({"cameras": renderable})
|
||||
|
|
@ -104,5 +104,4 @@ class CollectVRayScene(pyblish.api.ContextPlugin):
|
|||
|
||||
instance = context.create_instance(layer)
|
||||
self.log.info("Created: %s" % instance.name)
|
||||
self.log.debug("VRay Data: %s" % vrscene_data)
|
||||
instance.data.update(data)
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ class VraySubmitDeadline(pyblish.api.InstancePlugin):
|
|||
instance.data["outputDir"] = render_ouput
|
||||
|
||||
# Format output file name
|
||||
sequence_filename = ".".join([instance.name, "%04d", ext])
|
||||
sequence_filename = ".".join([instance.name, ext])
|
||||
output_filename = os.path.join(render_ouput, sequence_filename)
|
||||
|
||||
payload_b = {
|
||||
|
|
@ -183,6 +183,9 @@ class VraySubmitDeadline(pyblish.api.InstancePlugin):
|
|||
def build_command(self, instance):
|
||||
"""Create command for Render.exe to export vray scene
|
||||
|
||||
Args:
|
||||
instance
|
||||
|
||||
Returns:
|
||||
str
|
||||
|
||||
|
|
@ -191,8 +194,11 @@ class VraySubmitDeadline(pyblish.api.InstancePlugin):
|
|||
cmd = ('-r vray -proj {project} -cam {cam} -noRender -s {startFrame} '
|
||||
'-e {endFrame} -rl {layer} -exportFramesSeparate')
|
||||
|
||||
# Get the camera
|
||||
cammera = instance.data["cameras"][0]
|
||||
|
||||
return cmd.format(project=instance.context.data["workspaceDir"],
|
||||
cam=instance.data.get("camera", "persp"),
|
||||
cam=cammera,
|
||||
startFrame=instance.data["startFrame"],
|
||||
endFrame=instance.data["endFrame"],
|
||||
layer=instance.name)
|
||||
|
|
@ -200,6 +206,9 @@ class VraySubmitDeadline(pyblish.api.InstancePlugin):
|
|||
def build_jobinfo_environment(self, env):
|
||||
"""Format environment keys and values to match Deadline rquirements
|
||||
|
||||
Args:
|
||||
env(dict): environment dictionary
|
||||
|
||||
Returns:
|
||||
dict
|
||||
|
||||
|
|
|
|||
|
|
@ -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,19 @@ 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))
|
||||
|
||||
@classmethod
|
||||
def get_invalid(cls, instance):
|
||||
cameras = instance.data.get("cameras", [])
|
||||
if len(cameras) != 1:
|
||||
cls.log.error("Multiple renderable cameras" "found: %s " %
|
||||
instance.data["setMembers"])
|
||||
|
||||
return [instance.data["setMembers"]]
|
||||
|
|
|
|||
|
|
@ -13,6 +13,22 @@ class ValidateVRayTranslatorEnabled(pyblish.api.ContextPlugin):
|
|||
|
||||
def process(self, context):
|
||||
|
||||
# Check if there are any vray scene instances
|
||||
# The reason to not use host.lsattr() as used in collect_vray_scene
|
||||
# is because that information is already available in the context
|
||||
vrayscene_instances = []
|
||||
for inst in context[:]:
|
||||
if inst.data["family"] in self.families:
|
||||
# Skip if instances is inactive
|
||||
if not inst.data["active"]:
|
||||
continue
|
||||
|
||||
vrayscene_instances.append(inst)
|
||||
|
||||
if not vrayscene_instances:
|
||||
self.log.info("No VRay Scene instances found, skipping..")
|
||||
return
|
||||
|
||||
# Get vraySettings node
|
||||
vray_settings = cmds.ls(type="VRaySettingsNode")
|
||||
assert vray_settings, "Please ensure a VRay Settings Node is present"
|
||||
|
|
|
|||
|
|
@ -56,8 +56,11 @@ class ValidateYetiRenderScriptCallbacks(pyblish.api.InstancePlugin):
|
|||
% renderer)
|
||||
return False
|
||||
|
||||
pre_render_callback = cmds.getAttr("defaultRenderGlobals.preMel")
|
||||
post_render_callback = cmds.getAttr("defaultRenderGlobals.postMel")
|
||||
pre_mel_attr = "defaultRenderGlobals.preMel"
|
||||
post_mel_attr = "defaultRenderGlobals.postMel"
|
||||
|
||||
pre_render_callback = cmds.getAttr(pre_mel_attr) or ""
|
||||
post_render_callback = cmds.getAttr(post_mel_attr) or ""
|
||||
|
||||
pre_callbacks = pre_render_callback.split(";")
|
||||
post_callbacks = post_render_callback.split(";")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue