From cf0ac31aa63ea52663a8ad01ba01dd5cac7ab3e3 Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Thu, 22 Feb 2024 17:06:48 +0100 Subject: [PATCH] harmony is using product name and type --- client/ayon_core/hosts/harmony/api/README.md | 4 +-- .../harmony/js/loaders/ImageSequenceLoader.js | 6 ++--- .../harmony/js/loaders/TemplateLoader.js | 6 ++--- .../plugins/create/create_farm_render.py | 2 +- .../harmony/plugins/create/create_render.py | 2 +- .../harmony/plugins/create/create_template.py | 2 +- .../hosts/harmony/plugins/load/load_audio.py | 6 ++--- .../harmony/plugins/load/load_background.py | 6 ++--- .../plugins/load/load_imagesequence.py | 6 ++--- .../harmony/plugins/load/load_palette.py | 6 ++--- .../plugins/load/load_template_workfile.py | 6 ++--- .../plugins/publish/collect_farm_render.py | 26 ++++++++++--------- .../plugins/publish/collect_instances.py | 18 +++++++++---- .../plugins/publish/collect_palettes.py | 7 ++--- .../plugins/publish/collect_workfile.py | 24 ++++++++--------- .../plugins/publish/extract_template.py | 4 ++- .../publish/help/validate_instances.xml | 6 ++--- 17 files changed, 75 insertions(+), 62 deletions(-) diff --git a/client/ayon_core/hosts/harmony/api/README.md b/client/ayon_core/hosts/harmony/api/README.md index 457e22fb2e..5b90d45f98 100644 --- a/client/ayon_core/hosts/harmony/api/README.md +++ b/client/ayon_core/hosts/harmony/api/README.md @@ -204,7 +204,7 @@ class CreateComposite(harmony.Creator): name = "compositeDefault" label = "Composite" - family = "mindbender.template" + product_type = "mindbender.template" def __init__(self, *args, **kwargs): super(CreateComposite, self).__init__(*args, **kwargs) @@ -221,7 +221,7 @@ class CreateRender(harmony.Creator): name = "writeDefault" label = "Write" - family = "mindbender.imagesequence" + product_type = "mindbender.imagesequence" node_type = "WRITE" def __init__(self, *args, **kwargs): diff --git a/client/ayon_core/hosts/harmony/js/loaders/ImageSequenceLoader.js b/client/ayon_core/hosts/harmony/js/loaders/ImageSequenceLoader.js index 25afeff214..ebbd7163f9 100644 --- a/client/ayon_core/hosts/harmony/js/loaders/ImageSequenceLoader.js +++ b/client/ayon_core/hosts/harmony/js/loaders/ImageSequenceLoader.js @@ -88,7 +88,7 @@ ImageSequenceLoader.getUniqueColumnName = function(columnPrefix) { * var args = [ * files, // Files in file sequences. * asset, // Asset name. - * subset, // Subset name. + * productName, // Product name. * startFrame, // Sequence starting frame. * groupId // Unique group ID (uuid4). * ]; @@ -106,7 +106,7 @@ ImageSequenceLoader.prototype.importFiles = function(args) { var doc = $.scn; var files = args[0]; var asset = args[1]; - var subset = args[2]; + var productName = args[2]; var startFrame = args[3]; var groupId = args[4]; var vectorFormat = null; @@ -124,7 +124,7 @@ ImageSequenceLoader.prototype.importFiles = function(args) { var num = 0; var name = ''; do { - name = asset + '_' + (num++) + '_' + subset; + name = asset + '_' + (num++) + '_' + productName; } while (currentGroup.getNodeByName(name) != null); extension = filename.substr(pos+1).toLowerCase(); diff --git a/client/ayon_core/hosts/harmony/js/loaders/TemplateLoader.js b/client/ayon_core/hosts/harmony/js/loaders/TemplateLoader.js index 06ef1671ea..78167fcb39 100644 --- a/client/ayon_core/hosts/harmony/js/loaders/TemplateLoader.js +++ b/client/ayon_core/hosts/harmony/js/loaders/TemplateLoader.js @@ -31,7 +31,7 @@ var TemplateLoader = function() {}; * var args = [ * templatePath, // Path to tpl file. * assetName, // Asset name. - * subsetName, // Subset name. + * productName, // Product name. * groupId // unique ID (uuid4) * ]; */ @@ -39,7 +39,7 @@ TemplateLoader.prototype.loadContainer = function(args) { var doc = $.scn; var templatePath = args[0]; var assetName = args[1]; - var subset = args[2]; + var productName = args[2]; var groupId = args[3]; // Get the current group @@ -62,7 +62,7 @@ TemplateLoader.prototype.loadContainer = function(args) { var num = 0; var containerGroupName = ''; do { - containerGroupName = assetName + '_' + (num++) + '_' + subset; + containerGroupName = assetName + '_' + (num++) + '_' + productName; } while (currentGroup.getNodeByName(containerGroupName) != null); // import the template diff --git a/client/ayon_core/hosts/harmony/plugins/create/create_farm_render.py b/client/ayon_core/hosts/harmony/plugins/create/create_farm_render.py index 6b19764181..16c403de6a 100644 --- a/client/ayon_core/hosts/harmony/plugins/create/create_farm_render.py +++ b/client/ayon_core/hosts/harmony/plugins/create/create_farm_render.py @@ -9,7 +9,7 @@ class CreateFarmRender(plugin.Creator): name = "renderDefault" label = "Render on Farm" - family = "renderFarm" + product_type = "renderFarm" node_type = "WRITE" def __init__(self, *args, **kwargs): diff --git a/client/ayon_core/hosts/harmony/plugins/create/create_render.py b/client/ayon_core/hosts/harmony/plugins/create/create_render.py index 0a2cd33551..23e02bd8a5 100644 --- a/client/ayon_core/hosts/harmony/plugins/create/create_render.py +++ b/client/ayon_core/hosts/harmony/plugins/create/create_render.py @@ -9,7 +9,7 @@ class CreateRender(plugin.Creator): name = "renderDefault" label = "Render" - family = "render" + product_type = "render" node_type = "WRITE" def __init__(self, *args, **kwargs): diff --git a/client/ayon_core/hosts/harmony/plugins/create/create_template.py b/client/ayon_core/hosts/harmony/plugins/create/create_template.py index 4f3fd85f00..c16e429436 100644 --- a/client/ayon_core/hosts/harmony/plugins/create/create_template.py +++ b/client/ayon_core/hosts/harmony/plugins/create/create_template.py @@ -6,7 +6,7 @@ class CreateTemplate(plugin.Creator): name = "templateDefault" label = "Template" - family = "harmony.template" + product_type = "harmony.template" def __init__(self, *args, **kwargs): super(CreateTemplate, self).__init__(*args, **kwargs) diff --git a/client/ayon_core/hosts/harmony/plugins/load/load_audio.py b/client/ayon_core/hosts/harmony/plugins/load/load_audio.py index 14389166d7..1017d6c2a2 100644 --- a/client/ayon_core/hosts/harmony/plugins/load/load_audio.py +++ b/client/ayon_core/hosts/harmony/plugins/load/load_audio.py @@ -45,12 +45,12 @@ class ImportAudioLoader(load.LoaderPlugin): {"function": func, "args": [context["subset"]["name"], wav_file]} ) - subset_name = context["subset"]["name"] + product_name = context["subset"]["name"] return harmony.containerise( - subset_name, + product_name, namespace, - subset_name, + product_name, context, self.__class__.__name__ ) diff --git a/client/ayon_core/hosts/harmony/plugins/load/load_background.py b/client/ayon_core/hosts/harmony/plugins/load/load_background.py index 1c61cfa7a4..cc664bb24f 100644 --- a/client/ayon_core/hosts/harmony/plugins/load/load_background.py +++ b/client/ayon_core/hosts/harmony/plugins/load/load_background.py @@ -254,7 +254,7 @@ class BackgroundLoader(load.LoaderPlugin): bg_folder = os.path.dirname(path) - subset_name = context["subset"]["name"] + product_name = context["subset"]["name"] # read_node_name += "_{}".format(uuid.uuid4()) container_nodes = [] @@ -272,9 +272,9 @@ class BackgroundLoader(load.LoaderPlugin): container_nodes.append(read_node) return harmony.containerise( - subset_name, + product_name, namespace, - subset_name, + product_name, context, self.__class__.__name__, nodes=container_nodes diff --git a/client/ayon_core/hosts/harmony/plugins/load/load_imagesequence.py b/client/ayon_core/hosts/harmony/plugins/load/load_imagesequence.py index 4d87272de8..db67ff1123 100644 --- a/client/ayon_core/hosts/harmony/plugins/load/load_imagesequence.py +++ b/client/ayon_core/hosts/harmony/plugins/load/load_imagesequence.py @@ -47,7 +47,7 @@ class ImageSequenceLoader(load.LoaderPlugin): files.append(fname.parent.joinpath(remainder[0]).as_posix()) asset = context["asset"]["name"] - subset = context["subset"]["name"] + product_name = context["subset"]["name"] group_id = str(uuid.uuid4()) read_node = harmony.send( @@ -56,7 +56,7 @@ class ImageSequenceLoader(load.LoaderPlugin): "args": [ files, asset, - subset, + product_name, 1, group_id ] @@ -64,7 +64,7 @@ class ImageSequenceLoader(load.LoaderPlugin): )["result"] return harmony.containerise( - f"{asset}_{subset}", + f"{asset}_{product_name}", namespace, read_node, context, diff --git a/client/ayon_core/hosts/harmony/plugins/load/load_palette.py b/client/ayon_core/hosts/harmony/plugins/load/load_palette.py index aa5894e026..1794ffda5e 100644 --- a/client/ayon_core/hosts/harmony/plugins/load/load_palette.py +++ b/client/ayon_core/hosts/harmony/plugins/load/load_palette.py @@ -27,8 +27,8 @@ class ImportPaletteLoader(load.LoaderPlugin): ) def load_palette(self, representation): - subset_name = representation["context"]["subset"] - name = subset_name.replace("palette", "") + product_name = representation["context"]["subset"] + name = product_name.replace("palette", "") # Overwrite palette on disk. scene_path = harmony.send( @@ -44,7 +44,7 @@ class ImportPaletteLoader(load.LoaderPlugin): harmony.save_scene() - msg = "Updated {}.".format(subset_name) + msg = "Updated {}.".format(product_name) msg += " You need to reload the scene to see the changes.\n" msg += "Please save workfile when ready and use Workfiles " msg += "to reopen it." diff --git a/client/ayon_core/hosts/harmony/plugins/load/load_template_workfile.py b/client/ayon_core/hosts/harmony/plugins/load/load_template_workfile.py index 0ea46f8f67..65f4fe6d0a 100644 --- a/client/ayon_core/hosts/harmony/plugins/load/load_template_workfile.py +++ b/client/ayon_core/hosts/harmony/plugins/load/load_template_workfile.py @@ -40,12 +40,12 @@ class ImportTemplateLoader(load.LoaderPlugin): shutil.rmtree(temp_dir) - subset_name = context["subset"]["name"] + product_name = context["subset"]["name"] return harmony.containerise( - subset_name, + product_name, namespace, - subset_name, + product_name, context, self.__class__.__name__ ) diff --git a/client/ayon_core/hosts/harmony/plugins/publish/collect_farm_render.py b/client/ayon_core/hosts/harmony/plugins/publish/collect_farm_render.py index 6a9c349185..dea13ffa27 100644 --- a/client/ayon_core/hosts/harmony/plugins/publish/collect_farm_render.py +++ b/client/ayon_core/hosts/harmony/plugins/publish/collect_farm_render.py @@ -80,7 +80,7 @@ class CollectFarmRender(publish.AbstractCollectRender): for frame in range(start, end + 1): expected_files.append( path / "{}-{}.{}".format( - render_instance.subset, + render_instance.productName, str(frame).rjust(int(info[2]) + 1, "0"), ext ) @@ -89,7 +89,7 @@ class CollectFarmRender(publish.AbstractCollectRender): return expected_files def get_instances(self, context): - """Get instances per Write node in `renderFarm` family.""" + """Get instances per Write node in `renderFarm` product type.""" version = None if self.sync_workfile_version: version = context.data["version"] @@ -111,7 +111,10 @@ class CollectFarmRender(publish.AbstractCollectRender): if "container" in data["id"]: continue - if data["family"] != "renderFarm": + product_type = data.get("productType") + if product_type is None: + product_type = data.get("family") + if product_type != "renderFarm": continue # 0 - filename / 1 - type / 2 - zeros / 3 - start / 4 - enabled @@ -124,15 +127,14 @@ class CollectFarmRender(publish.AbstractCollectRender): # TODO: handle pixel aspect and frame step # TODO: set Deadline stuff (pools, priority, etc. by presets) - # because of using 'renderFarm' as a family, replace 'Farm' with - # capitalized task name - issue of avalon-core Creator app - subset_name = node.split("/")[1] - task_name = context.data["anatomyData"]["task"][ - "name"].capitalize() + # because of using 'renderFarm' as a product type, replace 'Farm' + # with capitalized task name - issue of Creator tool + product_name = node.split("/")[1] + task_name = context.data["task"].capitalize() replace_str = "" - if task_name.lower() not in subset_name.lower(): + if task_name.lower() not in product_name.lower(): replace_str = task_name - subset_name = subset_name.replace( + product_name = product_name.replace( 'Farm', replace_str) @@ -141,7 +143,7 @@ class CollectFarmRender(publish.AbstractCollectRender): time=get_formatted_current_time(), source=context.data["currentFile"], label=node.split("/")[1], - subset=subset_name, + productName=product_name, folderPath=folder_path, task=task_name, attachTo=False, @@ -151,7 +153,7 @@ class CollectFarmRender(publish.AbstractCollectRender): priority=50, name=node.split("/")[1], - family="render.farm", + productType="render.farm", families=["render.farm"], farm=True, diff --git a/client/ayon_core/hosts/harmony/plugins/publish/collect_instances.py b/client/ayon_core/hosts/harmony/plugins/publish/collect_instances.py index 9ce99a3c3d..fd394c0b43 100644 --- a/client/ayon_core/hosts/harmony/plugins/publish/collect_instances.py +++ b/client/ayon_core/hosts/harmony/plugins/publish/collect_instances.py @@ -19,7 +19,7 @@ class CollectInstances(pyblish.api.ContextPlugin): label = "Instances" order = pyblish.api.CollectorOrder hosts = ["harmony"] - families_mapping = { + product_type_mapping = { "render": ["review", "ftrack"], "harmony.template": [], "palette": ["palette", "ftrack"] @@ -49,8 +49,13 @@ class CollectInstances(pyblish.api.ContextPlugin): if "container" in data["id"]: continue - # skip render farm family as it is collected separately - if data["family"] == "renderFarm": + product_type = data.get("productType") + if product_type is None: + product_type = data["family"] + data["productType"] = product_type + + # skip render farm product type as it is collected separately + if product_type == "renderFarm": continue instance = context.create_instance(node.split("/")[-1]) @@ -59,11 +64,14 @@ class CollectInstances(pyblish.api.ContextPlugin): instance.data["publish"] = harmony.send( {"function": "node.getEnable", "args": [node]} )["result"] - instance.data["families"] = self.families_mapping[data["family"]] + + families = [product_type] + families.extend(self.product_type_mapping[product_type]) + instance.data["families"] = families # If set in plugin, pair the scene Version in ftrack with # thumbnails and review media. - if (self.pair_media and instance.data["family"] == "scene"): + if (self.pair_media and product_type == "scene"): context.data["scene_instance"] = instance # Produce diagnostic message for any graphical diff --git a/client/ayon_core/hosts/harmony/plugins/publish/collect_palettes.py b/client/ayon_core/hosts/harmony/plugins/publish/collect_palettes.py index 66b1ee6085..6e8583c340 100644 --- a/client/ayon_core/hosts/harmony/plugins/publish/collect_palettes.py +++ b/client/ayon_core/hosts/harmony/plugins/publish/collect_palettes.py @@ -33,14 +33,15 @@ class CollectPalettes(pyblish.api.ContextPlugin): return folder_path = context.data["folderPath"] + product_type = "harmony.palette" for name, id in palettes.items(): instance = context.create_instance(name) instance.data.update({ "id": id, - "family": "harmony.palette", - 'families': [], + "productType": product_type, + "families": [product_type], "folderPath": folder_path, - "subset": "{}{}".format("palette", name) + "productName": "{}{}".format("palette", name) }) self.log.info( "Created instance:\n" + json.dumps( diff --git a/client/ayon_core/hosts/harmony/plugins/publish/collect_workfile.py b/client/ayon_core/hosts/harmony/plugins/publish/collect_workfile.py index 1ea1f15124..54a2fd3b48 100644 --- a/client/ayon_core/hosts/harmony/plugins/publish/collect_workfile.py +++ b/client/ayon_core/hosts/harmony/plugins/publish/collect_workfile.py @@ -3,7 +3,7 @@ import os import pyblish.api -from ayon_core.pipeline.create import get_subset_name +from ayon_core.pipeline.create import get_product_name class CollectWorkfile(pyblish.api.ContextPlugin): @@ -15,26 +15,26 @@ class CollectWorkfile(pyblish.api.ContextPlugin): def process(self, context): """Plugin entry point.""" - family = "workfile" + product_type = "workfile" basename = os.path.basename(context.data["currentFile"]) - subset = get_subset_name( - family, - "", - context.data["anatomyData"]["task"]["name"], + product_name = get_product_name( + context.data["projectName"], context.data["assetEntity"], - context.data["anatomyData"]["project"]["name"], - host_name=context.data["hostName"], + context.data["task"], + context.data["hostName"], + product_type, + "", project_settings=context.data["project_settings"] ) # Create instance - instance = context.create_instance(subset) + instance = context.create_instance(product_name) instance.data.update({ - "subset": subset, + "productName": product_name, "label": basename, "name": basename, - "family": family, - "families": [family], + "productType": product_type, + "families": [product_type], "representations": [], "folderPath": context.data["folderPath"] }) diff --git a/client/ayon_core/hosts/harmony/plugins/publish/extract_template.py b/client/ayon_core/hosts/harmony/plugins/publish/extract_template.py index c481a34454..b2c7fa8174 100644 --- a/client/ayon_core/hosts/harmony/plugins/publish/extract_template.py +++ b/client/ayon_core/hosts/harmony/plugins/publish/extract_template.py @@ -75,7 +75,9 @@ class ExtractTemplate(publish.Extractor): instance.data["representations"] = [representation] instance.data["version_name"] = "{}_{}".format( - instance.data["subset"], instance.context.data["task"]) + instance.data["productName"], + instance.context.data["task"] + ) def get_backdrops(self, node: str) -> list: """Get backdrops for the node. diff --git a/client/ayon_core/hosts/harmony/plugins/publish/help/validate_instances.xml b/client/ayon_core/hosts/harmony/plugins/publish/help/validate_instances.xml index 3b040e8ea8..67ad7e2d21 100644 --- a/client/ayon_core/hosts/harmony/plugins/publish/help/validate_instances.xml +++ b/client/ayon_core/hosts/harmony/plugins/publish/help/validate_instances.xml @@ -3,9 +3,9 @@ Subset context -## Invalid subset context +## Invalid product context -Asset name found '{found}' in subsets, expected '{expected}'. +Asset name found '{found}' in products, expected '{expected}'. ### How to repair? @@ -19,7 +19,7 @@ If this is unwanted, close workfile and open again, that way different asset val ### __Detailed Info__ (optional) This might happen if you are reuse old workfile and open it in different context. -(Eg. you created subset "renderCompositingDefault" from asset "Robot' in "your_project_Robot_compositing.aep", now you opened this workfile in a context "Sloth" but existing subset for "Robot" asset stayed in the workfile.) +(Eg. you created product "renderCompositingDefault" from asset "Robot' in "your_project_Robot_compositing.aep", now you opened this workfile in a context "Sloth" but existing product for "Robot" asset stayed in the workfile.) \ No newline at end of file