From effb71e2804e2646558825a4e9cebd5423dc1a2f Mon Sep 17 00:00:00 2001 From: MustafaJafar Date: Mon, 22 Apr 2024 18:25:51 +0200 Subject: [PATCH] tweak filepaths - make them more consistent --- .../plugins/create/create_alembic_camera.py | 10 ++++- .../plugins/create/create_arnold_ass.py | 9 ++-- .../plugins/create/create_arnold_rop.py | 15 ++++--- .../houdini/plugins/create/create_bgeo.py | 12 +++--- .../plugins/create/create_composite.py | 11 +++-- .../houdini/plugins/create/create_hda.py | 8 +++- .../plugins/create/create_karma_rop.py | 27 ++++++++---- .../plugins/create/create_mantra_ifd.py | 8 ++-- .../plugins/create/create_mantra_rop.py | 18 +++++--- .../plugins/create/create_pointcache.py | 10 ++++- .../plugins/create/create_redshift_proxy.py | 8 +++- .../plugins/create/create_redshift_rop.py | 18 +++++--- .../houdini/plugins/create/create_review.py | 4 +- .../plugins/create/create_staticmesh.py | 8 ++-- .../houdini/plugins/create/create_usd.py | 9 +++- .../plugins/create/create_vbd_cache.py | 11 +++-- .../houdini/plugins/create/create_vray_rop.py | 43 ++++++++++--------- 17 files changed, 147 insertions(+), 82 deletions(-) diff --git a/client/ayon_core/hosts/houdini/plugins/create/create_alembic_camera.py b/client/ayon_core/hosts/houdini/plugins/create/create_alembic_camera.py index 0ab5e2794e..f4c1634fbe 100644 --- a/client/ayon_core/hosts/houdini/plugins/create/create_alembic_camera.py +++ b/client/ayon_core/hosts/houdini/plugins/create/create_alembic_camera.py @@ -26,9 +26,15 @@ class CreateAlembicCamera(plugin.HoudiniCreator): pre_create_data) instance_node = hou.node(instance.get("instance_node")) + + filepath = "{staging_dir}/{product_name}/{product_name}.abc".format( + staging_dir=hou.text.expandString("$HIP/ayon"), + # keep dynamic link to product name + product_name="`chs(\"AYON_productName\")`", + ) + parms = { - "filename": hou.text.expandString( - "$HIP/pyblish/{}.abc".format(product_name)), + "filename": filepath, "use_sop_path": False, } diff --git a/client/ayon_core/hosts/houdini/plugins/create/create_arnold_ass.py b/client/ayon_core/hosts/houdini/plugins/create/create_arnold_ass.py index be5604c01c..abbc1730ec 100644 --- a/client/ayon_core/hosts/houdini/plugins/create/create_arnold_ass.py +++ b/client/ayon_core/hosts/houdini/plugins/create/create_arnold_ass.py @@ -39,10 +39,13 @@ class CreateArnoldAss(plugin.HoudiniCreator): parm_template_group.hideFolder("Properties", True) instance_node.setParmTemplateGroup(parm_template_group) - filepath = "{}{}".format( - hou.text.expandString("$HIP/pyblish/"), - "{}.$F4{}".format(product_name, self.ext) + filepath = "{staging_dir}/{product_name}/{product_name}.$F4.{ext}".format( + staging_dir=hou.text.expandString("$HIP/ayon"), + # keep dynamic link to product name + product_name="`chs(\"AYON_productName\")`", + ext=self.ext.lstrip(".") # ignore the dot in self.ext ) + parms = { # Render frame range "trange": 1, diff --git a/client/ayon_core/hosts/houdini/plugins/create/create_arnold_rop.py b/client/ayon_core/hosts/houdini/plugins/create/create_arnold_rop.py index f65b54a452..02a41464fc 100644 --- a/client/ayon_core/hosts/houdini/plugins/create/create_arnold_rop.py +++ b/client/ayon_core/hosts/houdini/plugins/create/create_arnold_rop.py @@ -37,9 +37,10 @@ class CreateArnoldRop(plugin.HoudiniCreator): ext = pre_create_data.get("image_format") - filepath = "{renders_dir}{product_name}/{product_name}.$F4.{ext}".format( - renders_dir=hou.text.expandString("$HIP/pyblish/renders/"), - product_name=product_name, + filepath = "{render_dir}/{product_name}/{product_name}.$F4.{ext}".format( + render_dir=hou.text.expandString("$HIP/ayon/renders"), + # keep dynamic link to product name + product_name="`chs(\"AYON_productName\")`", ext=ext, ) parms = { @@ -52,10 +53,10 @@ class CreateArnoldRop(plugin.HoudiniCreator): } if pre_create_data.get("export_job"): - ass_filepath = \ - "{export_dir}{product_name}/{product_name}.$F4.ass".format( - export_dir=hou.text.expandString("$HIP/pyblish/ass/"), - product_name=product_name, + ass_filepath = "{render_dir}/{product_name}/ass/{product_name}.$F4.ass".format( + render_dir=hou.text.expandString("$HIP/ayon/renders/"), + # keep dynamic link to product name + product_name="`chs(\"AYON_productName\")`", ) parms["ar_ass_export_enable"] = 1 parms["ar_ass_file"] = ass_filepath diff --git a/client/ayon_core/hosts/houdini/plugins/create/create_bgeo.py b/client/ayon_core/hosts/houdini/plugins/create/create_bgeo.py index 3749598b1d..b6ab391044 100644 --- a/client/ayon_core/hosts/houdini/plugins/create/create_bgeo.py +++ b/client/ayon_core/hosts/houdini/plugins/create/create_bgeo.py @@ -29,14 +29,14 @@ class CreateBGEO(plugin.HoudiniCreator): instance_node = hou.node(instance.get("instance_node")) - file_path = "{}{}".format( - hou.text.expandString("$HIP/pyblish/"), - "{}.$F4.{}".format( - product_name, - pre_create_data.get("bgeo_type") or "bgeo.sc") + filepath = "{staging_dir}/{product_name}/{product_name}.$F4.{ext}".format( + staging_dir=hou.text.expandString("$HIP/ayon"), + # keep dynamic link to product name + product_name="`chs(\"AYON_productName\")`", + ext=pre_create_data.get("bgeo_type") or "bgeo.sc" ) parms = { - "sopoutput": file_path + "sopoutput": filepath } instance_node.parm("trange").set(1) diff --git a/client/ayon_core/hosts/houdini/plugins/create/create_composite.py b/client/ayon_core/hosts/houdini/plugins/create/create_composite.py index a25faf0e8e..6fee077b1c 100644 --- a/client/ayon_core/hosts/houdini/plugins/create/create_composite.py +++ b/client/ayon_core/hosts/houdini/plugins/create/create_composite.py @@ -14,7 +14,7 @@ class CreateCompositeSequence(plugin.HoudiniCreator): product_type = "imagesequence" icon = "gears" - ext = ".exr" + ext = "exr" def create(self, product_name, instance_data, pre_create_data): import hou # noqa @@ -28,10 +28,13 @@ class CreateCompositeSequence(plugin.HoudiniCreator): pre_create_data) instance_node = hou.node(instance.get("instance_node")) - filepath = "{}{}".format( - hou.text.expandString("$HIP/pyblish/"), - "{}.$F4{}".format(product_name, self.ext) + filepath = "{staging_dir}/{product_name}/{product_name}.$F4.{ext}".format( + staging_dir=hou.text.expandString("$HIP/ayon"), + # keep dynamic link to product name + product_name="`chs(\"AYON_productName\")`", + ext=self.ext ) + parms = { "trange": 1, "copoutput": filepath diff --git a/client/ayon_core/hosts/houdini/plugins/create/create_hda.py b/client/ayon_core/hosts/houdini/plugins/create/create_hda.py index d399aa5e15..8cfd06e5ef 100644 --- a/client/ayon_core/hosts/houdini/plugins/create/create_hda.py +++ b/client/ayon_core/hosts/houdini/plugins/create/create_hda.py @@ -56,9 +56,15 @@ class CreateHDA(plugin.HoudiniCreator): raise CreatorError( "cannot create hda from node {}".format(to_hda)) + filepath = "{staging_dir}/HDAs/{product_name}.hda".format( + staging_dir=hou.text.expandString("$HIP/ayon"), + # keep dynamic link to product name + product_name="`chs(\"AYON_productName\")`" + ) + hda_node = to_hda.createDigitalAsset( name=node_name, - hda_file_name="$HIP/{}.hda".format(node_name) + hda_file_name=filepath ) hda_node.layoutChildren() elif self._check_existing(folder_path, node_name): diff --git a/client/ayon_core/hosts/houdini/plugins/create/create_karma_rop.py b/client/ayon_core/hosts/houdini/plugins/create/create_karma_rop.py index e91ddbc0ac..a00527e210 100644 --- a/client/ayon_core/hosts/houdini/plugins/create/create_karma_rop.py +++ b/client/ayon_core/hosts/houdini/plugins/create/create_karma_rop.py @@ -30,19 +30,28 @@ class CreateKarmaROP(plugin.HoudiniCreator): ext = pre_create_data.get("image_format") - filepath = "{renders_dir}{product_name}/{product_name}.$F4.{ext}".format( - renders_dir=hou.text.expandString("$HIP/pyblish/renders/"), - product_name=product_name, + filepath = "{render_dir}/{product_name}/{product_name}.$F4.{ext}".format( + render_dir=hou.text.expandString("$HIP/ayon/renders"), + # keep dynamic link to product name + product_name="`chs(\"AYON_productName\")`", ext=ext, ) - checkpoint = "{cp_dir}{product_name}.$F4.checkpoint".format( - cp_dir=hou.text.expandString("$HIP/pyblish/"), - product_name=product_name + checkpoint = ( + "{render_dir}/{product_name}/checkpoints/{product_name}.$F4.checkpoint" + .format( + render_dir=hou.text.expandString("$HIP/ayon/renders"), + # keep dynamic link to product name + product_name="`chs(\"AYON_productName\")`", + ) ) - usd_directory = "{usd_dir}{product_name}_$RENDERID".format( - usd_dir=hou.text.expandString("$HIP/pyblish/renders/usd_renders/"), # noqa - product_name=product_name + usd_directory = ( + "{render_dir}/{product_name}/usd/{product_name}_$RENDERID" + .format( + render_dir=hou.text.expandString("$HIP/ayon/renders"), + # keep dynamic link to product name + product_name="`chs(\"AYON_productName\")`" + ) ) parms = { diff --git a/client/ayon_core/hosts/houdini/plugins/create/create_mantra_ifd.py b/client/ayon_core/hosts/houdini/plugins/create/create_mantra_ifd.py index e0cf035c35..9fa9e969ea 100644 --- a/client/ayon_core/hosts/houdini/plugins/create/create_mantra_ifd.py +++ b/client/ayon_core/hosts/houdini/plugins/create/create_mantra_ifd.py @@ -25,9 +25,11 @@ class CreateMantraIFD(plugin.HoudiniCreator): instance_node = hou.node(instance.get("instance_node")) - filepath = "{}{}".format( - hou.text.expandString("$HIP/pyblish/"), - "{}.$F4.ifd".format(product_name)) + filepath = "{staging_dir}/{product_name}/{product_name}.$F4.ifd".format( + staging_dir=hou.text.expandString("$HIP/ayon"), + # keep dynamic link to product name + product_name="`chs(\"AYON_productName\")`" + ) parms = { # Render frame range "trange": 1, diff --git a/client/ayon_core/hosts/houdini/plugins/create/create_mantra_rop.py b/client/ayon_core/hosts/houdini/plugins/create/create_mantra_rop.py index 64ecf428e9..445296bd6a 100644 --- a/client/ayon_core/hosts/houdini/plugins/create/create_mantra_rop.py +++ b/client/ayon_core/hosts/houdini/plugins/create/create_mantra_rop.py @@ -33,9 +33,10 @@ class CreateMantraROP(plugin.HoudiniCreator): ext = pre_create_data.get("image_format") - filepath = "{renders_dir}{product_name}/{product_name}.$F4.{ext}".format( - renders_dir=hou.text.expandString("$HIP/pyblish/renders/"), - product_name=product_name, + filepath = "{render_dir}/{product_name}/{product_name}.$F4.{ext}".format( + render_dir=hou.text.expandString("$HIP/ayon/renders"), + # keep dynamic link to product name + product_name="`chs(\"AYON_productName\")`", ext=ext, ) @@ -47,11 +48,14 @@ class CreateMantraROP(plugin.HoudiniCreator): } if pre_create_data.get("export_job"): - ifd_filepath = \ - "{export_dir}{product_name}/{product_name}.$F4.ifd".format( - export_dir=hou.text.expandString("$HIP/pyblish/ifd/"), - product_name=product_name, + ifd_filepath = ( + "{staging_dir}/{product_name}/ifd/{product_name}.$F4.ifd" + .format( + staging_dir=hou.text.expandString("$HIP/ayon"), + # keep dynamic link to product name + product_name="`chs(\"AYON_productName\")`" ) + ) parms["soho_outputmode"] = 1 parms["soho_diskfile"] = ifd_filepath diff --git a/client/ayon_core/hosts/houdini/plugins/create/create_pointcache.py b/client/ayon_core/hosts/houdini/plugins/create/create_pointcache.py index 4c9a0d9b37..9acd1d6841 100644 --- a/client/ayon_core/hosts/houdini/plugins/create/create_pointcache.py +++ b/client/ayon_core/hosts/houdini/plugins/create/create_pointcache.py @@ -27,6 +27,13 @@ class CreatePointCache(plugin.HoudiniCreator): pre_create_data) instance_node = hou.node(instance.get("instance_node")) + + filepath = "{staging_dir}/{product_name}/{product_name}.abc".format( + staging_dir=hou.text.expandString("$HIP/ayon"), + # keep dynamic link to product name + product_name="`chs(\"AYON_productName\")`", + ) + parms = { "use_sop_path": True, "build_from_path": True, @@ -34,8 +41,7 @@ class CreatePointCache(plugin.HoudiniCreator): "prim_to_detail_pattern": "cbId", "format": 2, "facesets": 0, - "filename": hou.text.expandString( - "$HIP/pyblish/{}.abc".format(product_name)) + "filename": filepath } if self.selected_nodes: diff --git a/client/ayon_core/hosts/houdini/plugins/create/create_redshift_proxy.py b/client/ayon_core/hosts/houdini/plugins/create/create_redshift_proxy.py index 6a9321b95a..80d19daecf 100644 --- a/client/ayon_core/hosts/houdini/plugins/create/create_redshift_proxy.py +++ b/client/ayon_core/hosts/houdini/plugins/create/create_redshift_proxy.py @@ -36,8 +36,14 @@ class CreateRedshiftProxy(plugin.HoudiniCreator): instance_node = hou.node(instance.get("instance_node")) + filepath = "{staging_dir}/{product_name}/{product_name}.$F4.rs".format( + staging_dir=hou.text.expandString("$HIP/ayon"), + # keep dynamic link to product name + product_name="`chs(\"AYON_productName\")`" + ) + parms = { - "RS_archive_file": '$HIP/pyblish/{}.$F4.rs'.format(product_name), + "RS_archive_file": filepath, } if self.selected_nodes: diff --git a/client/ayon_core/hosts/houdini/plugins/create/create_redshift_rop.py b/client/ayon_core/hosts/houdini/plugins/create/create_redshift_rop.py index 1cd239e929..dc04999018 100644 --- a/client/ayon_core/hosts/houdini/plugins/create/create_redshift_rop.py +++ b/client/ayon_core/hosts/houdini/plugins/create/create_redshift_rop.py @@ -63,11 +63,12 @@ class CreateRedshiftROP(plugin.HoudiniCreator): multilayer_mode_index = {"No Multi-Layered EXR File": "1", "Full Multi-Layered EXR File": "2" } - filepath = "{renders_dir}{product_name}/{product_name}.{fmt}".format( - renders_dir=hou.text.expandString("$HIP/pyblish/renders/"), - product_name=product_name, - fmt="$AOV.$F4.{ext}".format(ext=ext) - ) + filepath = "{render_dir}/{product_name}/{product_name}.$AOV.$F4.{ext}".format( + render_dir=hou.text.expandString("$HIP/ayon/renders"), + # keep dynamic link to product name + product_name="`chs(\"AYON_productName\")`", + ext=ext, + ) if multilayer_mode_index[multi_layered_mode] == "1": multipart = False @@ -95,8 +96,11 @@ class CreateRedshiftROP(plugin.HoudiniCreator): camera = node.path() parms["RS_renderCamera"] = camera or "" - export_dir = hou.text.expandString("$HIP/pyblish/rs/") - rs_filepath = f"{export_dir}{product_name}/{product_name}.$F4.rs" + rs_filepath = "{staging_dir}/{product_name}/rs/{product_name}.$F4.rs".format( + staging_dir=hou.text.expandString("$HIP/ayon"), + # keep dynamic link to product name + product_name="`chs(\"AYON_productName\")`" + ) parms["RS_archive_file"] = rs_filepath if pre_create_data.get("split_render", self.split_render): diff --git a/client/ayon_core/hosts/houdini/plugins/create/create_review.py b/client/ayon_core/hosts/houdini/plugins/create/create_review.py index 18f7ce498d..fbb74886ee 100644 --- a/client/ayon_core/hosts/houdini/plugins/create/create_review.py +++ b/client/ayon_core/hosts/houdini/plugins/create/create_review.py @@ -31,8 +31,8 @@ class CreateReview(plugin.HoudiniCreator): frame_range = hou.playbar.frameRange() - filepath = "{root}/{product_name}/{product_name}.$F4.{ext}".format( - root=hou.text.expandString("$HIP/pyblish"), + filepath = "{staging_dir}/{product_name}/{product_name}.$F4.{ext}".format( + staging_dir=hou.text.expandString("$HIP/ayon"), # keep dynamic link to product name product_name="`chs(\"AYON_productName\")`", ext=pre_create_data.get("image_format") or "png" diff --git a/client/ayon_core/hosts/houdini/plugins/create/create_staticmesh.py b/client/ayon_core/hosts/houdini/plugins/create/create_staticmesh.py index 3271107c6e..bca62207d5 100644 --- a/client/ayon_core/hosts/houdini/plugins/create/create_staticmesh.py +++ b/client/ayon_core/hosts/houdini/plugins/create/create_staticmesh.py @@ -29,13 +29,15 @@ class CreateStaticMesh(plugin.HoudiniCreator): instance_node = hou.node(instance.get("instance_node")) # prepare parms - output_path = hou.text.expandString( - "$HIP/pyblish/{}.fbx".format(product_name) + filepath = "{staging_dir}/{product_name}.fbx".format( + staging_dir=hou.text.expandString("$HIP/ayon"), + # keep dynamic link to product name + product_name="`chs(\"AYON_productName\")`", ) parms = { "startnode": self.get_selection(), - "sopoutput": output_path, + "sopoutput": filepath, # vertex cache format "vcformat": pre_create_data.get("vcformat"), "convertunits": pre_create_data.get("convertunits"), diff --git a/client/ayon_core/hosts/houdini/plugins/create/create_usd.py b/client/ayon_core/hosts/houdini/plugins/create/create_usd.py index 700f7eefd6..108d7b28b0 100644 --- a/client/ayon_core/hosts/houdini/plugins/create/create_usd.py +++ b/client/ayon_core/hosts/houdini/plugins/create/create_usd.py @@ -25,8 +25,15 @@ class CreateUSD(plugin.HoudiniCreator): instance_node = hou.node(instance.get("instance_node")) + filepath = "{staging_dir}/{product_name}/{product_name}.{ext}".format( + staging_dir=hou.text.expandString("$HIP/ayon"), + # keep dynamic link to product name + product_name="`chs(\"AYON_productName\")`", + ext=self.ext + ) + parms = { - "lopoutput": "$HIP/pyblish/{}.usd".format(product_name), + "lopoutput": filepath, "enableoutputprocessor_simplerelativepaths": False, } diff --git a/client/ayon_core/hosts/houdini/plugins/create/create_vbd_cache.py b/client/ayon_core/hosts/houdini/plugins/create/create_vbd_cache.py index c34cd2b4b5..c60a0e47e4 100644 --- a/client/ayon_core/hosts/houdini/plugins/create/create_vbd_cache.py +++ b/client/ayon_core/hosts/houdini/plugins/create/create_vbd_cache.py @@ -28,11 +28,14 @@ class CreateVDBCache(plugin.HoudiniCreator): pre_create_data) instance_node = hou.node(instance.get("instance_node")) - file_path = "{}{}".format( - hou.text.expandString("$HIP/pyblish/"), - "{}.$F4.vdb".format(product_name)) + filepath = "{staging_dir}/{product_name}/{product_name}.$F4.vdb".format( + staging_dir=hou.text.expandString("$HIP/ayon"), + # keep dynamic link to product name + product_name="`chs(\"AYON_productName\")`" + ) + parms = { - "sopoutput": file_path, + "sopoutput": filepath, "initsim": True, "trange": 1 } diff --git a/client/ayon_core/hosts/houdini/plugins/create/create_vray_rop.py b/client/ayon_core/hosts/houdini/plugins/create/create_vray_rop.py index 5ed9e848a7..f5db4a1e65 100644 --- a/client/ayon_core/hosts/houdini/plugins/create/create_vray_rop.py +++ b/client/ayon_core/hosts/houdini/plugins/create/create_vray_rop.py @@ -56,11 +56,14 @@ class CreateVrayROP(plugin.HoudiniCreator): } if pre_create_data.get("export_job"): - scene_filepath = \ - "{export_dir}{product_name}/{product_name}.$F4.vrscene".format( - export_dir=hou.text.expandString("$HIP/pyblish/vrscene/"), - product_name=product_name, + scene_filepath = ( + "{staging_dir}/{product_name}/vrscene/{product_name}.$F4.vrscene" + .format( + staging_dir=hou.text.expandString("$HIP/pyblish"), + # keep dynamic link to product name + product_name="`chs(\"AYON_productName\")`" ) + ) # Setting render_export_mode to "2" because that's for # "Export only" ("1" is for "Export & Render") parms["render_export_mode"] = "2" @@ -81,18 +84,14 @@ class CreateVrayROP(plugin.HoudiniCreator): instance_data["RenderElement"] = pre_create_data.get("render_element_enabled") # noqa if pre_create_data.get("render_element_enabled", True): # Vray has its own tag for AOV file output - filepath = "{renders_dir}{product_name}/{product_name}.{fmt}".format( - renders_dir=hou.text.expandString("$HIP/pyblish/renders/"), - product_name=product_name, - fmt="${aov}.$F4.{ext}".format(aov="AOV", - ext=ext) - ) - filepath = "{}{}".format( - hou.text.expandString("$HIP/pyblish/renders/"), - "{}/{}.${}.$F4.{}".format(product_name, - product_name, - "AOV", - ext) + filepath = ( + "{render_dir}/{product_name}/{product_name}.$AOV.$F4.{ext}" + .format( + render_dir=hou.text.expandString("$HIP/pyblish/renders"), + # keep dynamic link to product name + product_name="`chs(\"AYON_productName\")`", + ext=ext, + ) ) re_rop = instance_node.parent().createNode( "vray_render_channels", @@ -108,10 +107,14 @@ class CreateVrayROP(plugin.HoudiniCreator): }) else: - filepath = "{renders_dir}{product_name}/{product_name}.{fmt}".format( - renders_dir=hou.text.expandString("$HIP/pyblish/renders/"), - product_name=product_name, - fmt="$F4.{ext}".format(ext=ext) + filepath = ( + "{render_dir}/{product_name}/{product_name}.$F4.{ext}" + .format( + render_dir=hou.text.expandString("$HIP/ayon/renders"), + # keep dynamic link to product name + product_name="`chs(\"AYON_productName\")`", + ext=ext, + ) ) parms.update({ "use_render_channels": 0,