Merge pull request #6108 from ynput/enhancement/OP-7661_houdini-split-render-job-redshift

Houdini: add split job export support for Redshift ROP
This commit is contained in:
Ondřej Samohel 2024-01-09 10:41:50 +01:00 committed by GitHub
commit 4fa4b78b32
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 72 additions and 15 deletions

View file

@ -15,6 +15,9 @@ class CreateRedshiftROP(plugin.HoudiniCreator):
icon = "magic" icon = "magic"
ext = "exr" ext = "exr"
# Default to split export and render jobs
split_render = True
def create(self, subset_name, instance_data, pre_create_data): def create(self, subset_name, instance_data, pre_create_data):
instance_data.pop("active", None) instance_data.pop("active", None)
@ -36,12 +39,15 @@ class CreateRedshiftROP(plugin.HoudiniCreator):
# Also create the linked Redshift IPR Rop # Also create the linked Redshift IPR Rop
try: try:
ipr_rop = instance_node.parent().createNode( ipr_rop = instance_node.parent().createNode(
"Redshift_IPR", node_name=basename + "_IPR" "Redshift_IPR", node_name=f"{basename}_IPR"
) )
except hou.OperationFailed: except hou.OperationFailed as e:
raise plugin.OpenPypeCreatorError( raise plugin.OpenPypeCreatorError(
("Cannot create Redshift node. Is Redshift " (
"installed and enabled?")) "Cannot create Redshift node. Is Redshift "
"installed and enabled?"
)
) from e
# Move it to directly under the Redshift ROP # Move it to directly under the Redshift ROP
ipr_rop.setPosition(instance_node.position() + hou.Vector2(0, -1)) ipr_rop.setPosition(instance_node.position() + hou.Vector2(0, -1))
@ -74,8 +80,15 @@ class CreateRedshiftROP(plugin.HoudiniCreator):
for node in self.selected_nodes: for node in self.selected_nodes:
if node.type().name() == "cam": if node.type().name() == "cam":
camera = node.path() camera = node.path()
parms.update({ parms["RS_renderCamera"] = camera or ""
"RS_renderCamera": camera or ""})
export_dir = hou.text.expandString("$HIP/pyblish/rs/")
rs_filepath = f"{export_dir}{subset_name}/{subset_name}.$F4.rs"
parms["RS_archive_file"] = rs_filepath
if pre_create_data.get("split_render", self.split_render):
parms["RS_archive_enable"] = 1
instance_node.setParms(parms) instance_node.setParms(parms)
# Lock some Avalon attributes # Lock some Avalon attributes
@ -102,6 +115,9 @@ class CreateRedshiftROP(plugin.HoudiniCreator):
BoolDef("farm", BoolDef("farm",
label="Submitting to Farm", label="Submitting to Farm",
default=True), default=True),
BoolDef("split_render",
label="Split export and render jobs",
default=self.split_render),
EnumDef("image_format", EnumDef("image_format",
image_format_enum, image_format_enum,
default=self.ext, default=self.ext,

View file

@ -31,7 +31,6 @@ class CollectRedshiftROPRenderProducts(pyblish.api.InstancePlugin):
families = ["redshift_rop"] families = ["redshift_rop"]
def process(self, instance): def process(self, instance):
rop = hou.node(instance.data.get("instance_node")) rop = hou.node(instance.data.get("instance_node"))
# Collect chunkSize # Collect chunkSize
@ -43,13 +42,29 @@ class CollectRedshiftROPRenderProducts(pyblish.api.InstancePlugin):
default_prefix = evalParmNoFrame(rop, "RS_outputFileNamePrefix") default_prefix = evalParmNoFrame(rop, "RS_outputFileNamePrefix")
beauty_suffix = rop.evalParm("RS_outputBeautyAOVSuffix") beauty_suffix = rop.evalParm("RS_outputBeautyAOVSuffix")
render_products = [] # Store whether we are splitting the render job (export + render)
split_render = bool(rop.parm("RS_archive_enable").eval())
instance.data["splitRender"] = split_render
export_products = []
if split_render:
export_prefix = evalParmNoFrame(
rop, "RS_archive_file", pad_character="0"
)
beauty_export_product = self.get_render_product_name(
prefix=export_prefix,
suffix=None)
export_products.append(beauty_export_product)
self.log.debug(
"Found export product: {}".format(beauty_export_product)
)
instance.data["ifdFile"] = beauty_export_product
instance.data["exportFiles"] = list(export_products)
# Default beauty AOV # Default beauty AOV
beauty_product = self.get_render_product_name( beauty_product = self.get_render_product_name(
prefix=default_prefix, suffix=beauty_suffix prefix=default_prefix, suffix=beauty_suffix
) )
render_products.append(beauty_product) render_products = [beauty_product]
files_by_aov = { files_by_aov = {
"_": self.generate_expected_files(instance, "_": self.generate_expected_files(instance,
beauty_product)} beauty_product)}
@ -59,11 +74,11 @@ class CollectRedshiftROPRenderProducts(pyblish.api.InstancePlugin):
i = index + 1 i = index + 1
# Skip disabled AOVs # Skip disabled AOVs
if not rop.evalParm("RS_aovEnable_%s" % i): if not rop.evalParm(f"RS_aovEnable_{i}"):
continue continue
aov_suffix = rop.evalParm("RS_aovSuffix_%s" % i) aov_suffix = rop.evalParm(f"RS_aovSuffix_{i}")
aov_prefix = evalParmNoFrame(rop, "RS_aovCustomPrefix_%s" % i) aov_prefix = evalParmNoFrame(rop, f"RS_aovCustomPrefix_{i}")
if not aov_prefix: if not aov_prefix:
aov_prefix = default_prefix aov_prefix = default_prefix
@ -85,7 +100,7 @@ class CollectRedshiftROPRenderProducts(pyblish.api.InstancePlugin):
instance.data["attachTo"] = [] # stub required data instance.data["attachTo"] = [] # stub required data
if "expectedFiles" not in instance.data: if "expectedFiles" not in instance.data:
instance.data["expectedFiles"] = list() instance.data["expectedFiles"] = []
instance.data["expectedFiles"].append(files_by_aov) instance.data["expectedFiles"].append(files_by_aov)
# update the colorspace data # update the colorspace data

View file

@ -15,6 +15,7 @@ from openpype.lib import (
NumberDef NumberDef
) )
@attr.s @attr.s
class DeadlinePluginInfo(): class DeadlinePluginInfo():
SceneFile = attr.ib(default=None) SceneFile = attr.ib(default=None)
@ -41,6 +42,12 @@ class VrayRenderPluginInfo():
SeparateFilesPerFrame = attr.ib(default=True) SeparateFilesPerFrame = attr.ib(default=True)
@attr.s
class RedshiftRenderPluginInfo():
SceneFile = attr.ib(default=None)
Version = attr.ib(default=None)
class HoudiniSubmitDeadline( class HoudiniSubmitDeadline(
abstract_submit_deadline.AbstractSubmitDeadline, abstract_submit_deadline.AbstractSubmitDeadline,
OpenPypePyblishPluginMixin OpenPypePyblishPluginMixin
@ -262,6 +269,25 @@ class HoudiniSubmitDeadline(
plugin_info = VrayRenderPluginInfo( plugin_info = VrayRenderPluginInfo(
InputFilename=instance.data["ifdFile"], InputFilename=instance.data["ifdFile"],
) )
elif family == "redshift_rop":
plugin_info = RedshiftRenderPluginInfo(
SceneFile=instance.data["ifdFile"]
)
# Note: To use different versions of Redshift on Deadline
# set the `REDSHIFT_VERSION` env variable in the Tools
# settings in the AYON Application plugin. You will also
# need to set that version in `Redshift.param` file
# of the Redshift Deadline plugin:
# [Redshift_Executable_*]
# where * is the version number.
if os.getenv("REDSHIFT_VERSION"):
plugin_info.Version = os.getenv("REDSHIFT_VERSION")
else:
self.log.warning((
"REDSHIFT_VERSION env variable is not set"
" - using version configured in Deadline"
))
else: else:
self.log.error( self.log.error(
"Family '%s' not supported yet to split render job", "Family '%s' not supported yet to split render job",

View file

@ -1 +1 @@
__version__ = "0.1.5" __version__ = "0.1.6"

View file

@ -1 +1 @@
__version__ = "0.2.10" __version__ = "0.2.11"