Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Houdini: add split job export support for Redshift ROP #6108

Merged
28 changes: 22 additions & 6 deletions openpype/hosts/houdini/plugins/create/create_redshift_rop.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ class CreateRedshiftROP(plugin.HoudiniCreator):
icon = "magic"
ext = "exr"

# Default to split export and render jobs
split_render = True

def create(self, subset_name, instance_data, pre_create_data):

instance_data.pop("active", None)
Expand All @@ -36,12 +39,15 @@ def create(self, subset_name, instance_data, pre_create_data):
# Also create the linked Redshift IPR Rop
try:
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(
("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
ipr_rop.setPosition(instance_node.position() + hou.Vector2(0, -1))
Expand Down Expand Up @@ -74,8 +80,15 @@ def create(self, subset_name, instance_data, pre_create_data):
for node in self.selected_nodes:
if node.type().name() == "cam":
camera = node.path()
parms.update({
"RS_renderCamera": camera or ""})
parms["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)

# Lock some Avalon attributes
Expand All @@ -102,6 +115,9 @@ def get_pre_create_attr_defs(self):
BoolDef("farm",
label="Submitting to Farm",
default=True),
BoolDef("split_render",
label="Split export and render jobs",
default=self.split_render),
EnumDef("image_format",
image_format_enum,
default=self.ext,
Expand Down
29 changes: 22 additions & 7 deletions openpype/hosts/houdini/plugins/publish/collect_redshift_rop.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class CollectRedshiftROPRenderProducts(pyblish.api.InstancePlugin):
families = ["redshift_rop"]

def process(self, instance):

rop = hou.node(instance.data.get("instance_node"))

# Collect chunkSize
Expand All @@ -43,13 +42,29 @@ def process(self, instance):

default_prefix = evalParmNoFrame(rop, "RS_outputFileNamePrefix")
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
antirotor marked this conversation as resolved.
Show resolved Hide resolved
instance.data["exportFiles"] = list(export_products)

# Default beauty AOV
beauty_product = self.get_render_product_name(
prefix=default_prefix, suffix=beauty_suffix
)
render_products.append(beauty_product)
render_products = [beauty_product]
files_by_aov = {
"_": self.generate_expected_files(instance,
beauty_product)}
Expand All @@ -59,11 +74,11 @@ def process(self, instance):
i = index + 1

# Skip disabled AOVs
if not rop.evalParm("RS_aovEnable_%s" % i):
if not rop.evalParm(f"RS_aovEnable_{i}"):
continue

aov_suffix = rop.evalParm("RS_aovSuffix_%s" % i)
aov_prefix = evalParmNoFrame(rop, "RS_aovCustomPrefix_%s" % i)
aov_suffix = rop.evalParm(f"RS_aovSuffix_{i}")
aov_prefix = evalParmNoFrame(rop, f"RS_aovCustomPrefix_{i}")
if not aov_prefix:
aov_prefix = default_prefix

Expand All @@ -85,7 +100,7 @@ def process(self, instance):
instance.data["attachTo"] = [] # stub required data

if "expectedFiles" not in instance.data:
instance.data["expectedFiles"] = list()
instance.data["expectedFiles"] = []
instance.data["expectedFiles"].append(files_by_aov)

# update the colorspace data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
NumberDef
)


@attr.s
class DeadlinePluginInfo():
SceneFile = attr.ib(default=None)
Expand All @@ -41,6 +42,12 @@ class VrayRenderPluginInfo():
SeparateFilesPerFrame = attr.ib(default=True)


@attr.s
class RedshiftRenderPluginInfo():
SceneFile = attr.ib(default=None)
Version = attr.ib(default=None)

MustafaJafar marked this conversation as resolved.
Show resolved Hide resolved

class HoudiniSubmitDeadline(
abstract_submit_deadline.AbstractSubmitDeadline,
OpenPypePyblishPluginMixin
Expand Down Expand Up @@ -262,6 +269,25 @@ def get_plugin_info(self, job_type=None):
plugin_info = VrayRenderPluginInfo(
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:
self.log.error(
"Family '%s' not supported yet to split render job",
Expand Down
2 changes: 1 addition & 1 deletion server_addon/deadline/server/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.1.5"
__version__ = "0.1.6"
2 changes: 1 addition & 1 deletion server_addon/houdini/server/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.2.10"
__version__ = "0.2.11"