From b7732dbddc5b07bf207b3708d9f77fe74c31d894 Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Fri, 23 Feb 2024 11:42:12 +0100 Subject: [PATCH] resolve is using product name and type --- client/ayon_core/hosts/resolve/api/lib.py | 4 +- .../ayon_core/hosts/resolve/api/pipeline.py | 4 +- client/ayon_core/hosts/resolve/api/plugin.py | 60 ++++++++++--------- .../plugins/create/create_shot_clip.py | 18 +++--- .../hosts/resolve/plugins/load/load_clip.py | 2 +- .../plugins/publish/precollect_instances.py | 20 +++---- .../plugins/publish/precollect_workfile.py | 10 ++-- 7 files changed, 61 insertions(+), 57 deletions(-) diff --git a/client/ayon_core/hosts/resolve/api/lib.py b/client/ayon_core/hosts/resolve/api/lib.py index 5eb88afdcb..6e4e17811f 100644 --- a/client/ayon_core/hosts/resolve/api/lib.py +++ b/client/ayon_core/hosts/resolve/api/lib.py @@ -520,8 +520,8 @@ def imprint(timeline_item, data=None): Examples: data = { 'folderPath': 'sq020sh0280', - 'family': 'render', - 'subset': 'subsetMain' + 'productType': 'render', + 'productName': 'productMain' } """ data = data or {} diff --git a/client/ayon_core/hosts/resolve/api/pipeline.py b/client/ayon_core/hosts/resolve/api/pipeline.py index 2c5e0daf4b..19d33971dc 100644 --- a/client/ayon_core/hosts/resolve/api/pipeline.py +++ b/client/ayon_core/hosts/resolve/api/pipeline.py @@ -296,8 +296,8 @@ def list_instances(): if tag_data: asset = tag_data.get("asset") - subset = tag_data.get("subset") - tag_data["label"] = f"{ti_name} [{asset}-{subset}]" + product_name = tag_data.get("productName") + tag_data["label"] = f"{ti_name} [{asset}-{product_name}]" listed_instances.append(tag_data) return listed_instances diff --git a/client/ayon_core/hosts/resolve/api/plugin.py b/client/ayon_core/hosts/resolve/api/plugin.py index ccb20f712f..607bf58afd 100644 --- a/client/ayon_core/hosts/resolve/api/plugin.py +++ b/client/ayon_core/hosts/resolve/api/plugin.py @@ -350,7 +350,7 @@ class ClipLoader: """ Gets context and convert it to self.data data structure: { - "name": "assetName_subsetName_representationName" + "name": "assetName_productName_representationName" "binPath": "projectBinPath", } """ @@ -358,17 +358,17 @@ class ClipLoader: representation = self.context["representation"] representation_context = representation["context"] asset = str(representation_context["asset"]) - subset = str(representation_context["subset"]) + product_name = str(representation_context["subset"]) representation_name = str(representation_context["representation"]) self.data["clip_name"] = "_".join([ asset, - subset, + product_name, representation_name ]) self.data["versionData"] = self.context["version"]["data"] self.data["timeline_basename"] = "timeline_{}_{}".format( - subset, representation_name) + product_name, representation_name) # solve project bin structure path hierarchy = str("/".join(( @@ -603,9 +603,9 @@ class PublishClip: rename_default = False hierarchy_default = "{_folder_}/{_sequence_}/{_track_}" clip_name_default = "shot_{_trackIndex_:0>3}_{_clipIndex_:0>4}" - subset_name_default = "" + base_product_name_default = "" review_track_default = "< none >" - subset_family_default = "plate" + product_type_default = "plate" count_from_default = 10 count_steps_default = 10 vertical_sync_default = False @@ -728,10 +728,10 @@ class PublishClip: "countFrom", {}).get("value") or self.count_from_default self.count_steps = self.ui_inputs.get( "countSteps", {}).get("value") or self.count_steps_default - self.subset_name = self.ui_inputs.get( - "subsetName", {}).get("value") or self.subset_name_default - self.subset_family = self.ui_inputs.get( - "subsetFamily", {}).get("value") or self.subset_family_default + self.base_product_name = self.ui_inputs.get( + "productName", {}).get("value") or self.base_product_name_default + self.product_type = self.ui_inputs.get( + "productType", {}).get("value") or self.product_type_default self.vertical_sync = self.ui_inputs.get( "vSyncOn", {}).get("value") or self.vertical_sync_default self.driving_layer = self.ui_inputs.get( @@ -739,12 +739,14 @@ class PublishClip: self.review_track = self.ui_inputs.get( "reviewTrack", {}).get("value") or self.review_track_default - # build subset name from layer name - if self.subset_name == "": - self.subset_name = self.track_name + # build product name from layer name + if self.base_product_name == "": + self.base_product_name = self.track_name - # create subset for publishing - self.subset = self.subset_family + self.subset_name.capitalize() + # create product name for publishing + self.product_name = ( + self.product_type + self.base_product_name.capitalize() + ) def _replace_hash_to_expression(self, name, text): """ Replace hash with number in correct padding. """ @@ -824,17 +826,19 @@ class PublishClip: # driving layer is set as negative match for (_in, _out), hero_data in self.vertical_clip_match.items(): hero_data.update({"heroTrack": False}) - if _in == self.clip_in and _out == self.clip_out: - data_subset = hero_data["subset"] - # add track index in case duplicity of names in hero data - if self.subset in data_subset: - hero_data["subset"] = self.subset + str( - self.track_index) - # in case track name and subset name is the same then add - if self.subset_name == self.track_name: - hero_data["subset"] = self.subset - # assign data to return hierarchy data to tag - tag_hierarchy_data = hero_data + if _in != self.clip_in or _out != self.clip_out: + continue + + data_product_name = hero_data["productName"] + # add track index in case duplicity of names in hero data + if self.product_name in data_product_name: + hero_data["productName"] = self.product_name + str( + self.track_index) + # in case track name and product name is the same then add + if self.base_product_name == self.track_name: + hero_data["productName"] = self.product_name + # assign data to return hierarchy data to tag + tag_hierarchy_data = hero_data # add data to return data dict self.tag_data.update(tag_hierarchy_data) @@ -859,8 +863,8 @@ class PublishClip: "hierarchy": hierarchy_filled, "parents": self.parents, "hierarchyData": hierarchy_formatting_data, - "subset": self.subset, - "family": self.subset_family + "productName": self.product_name, + "productType": self.product_type } def _convert_to_entity(self, key): diff --git a/client/ayon_core/hosts/resolve/plugins/create/create_shot_clip.py b/client/ayon_core/hosts/resolve/plugins/create/create_shot_clip.py index 65bc9fed9d..3a2a0345ea 100644 --- a/client/ayon_core/hosts/resolve/plugins/create/create_shot_clip.py +++ b/client/ayon_core/hosts/resolve/plugins/create/create_shot_clip.py @@ -10,12 +10,12 @@ class CreateShotClip(plugin.Creator): """Publishable clip""" label = "Create Publishable Clip" - family = "clip" + product_type = "clip" icon = "film" defaults = ["Main"] gui_tracks = get_video_track_names() - gui_name = "OpenPype publish attributes creator" + gui_name = "AYON publish attributes creator" gui_info = "Define sequential rename and fill hierarchy data." gui_inputs = { "renameHierarchy": { @@ -133,19 +133,19 @@ class CreateShotClip(plugin.Creator): "target": "ui", "order": 3, "value": { - "subsetName": { + "productName": { "value": ["", "main", "bg", "fg", "bg", "animatic"], "type": "QComboBox", - "label": "Subset Name", + "label": "Product Name", "target": "ui", - "toolTip": "chose subset name pattern, if is selected, name of track layer will be used", # noqa + "toolTip": "chose product name pattern, if is selected, name of track layer will be used", # noqa "order": 0}, - "subsetFamily": { + "productType": { "value": ["plate", "take"], "type": "QComboBox", - "label": "Subset Family", - "target": "ui", "toolTip": "What use of this subset is for", # noqa + "label": "Product type", + "target": "ui", "toolTip": "What use of this product is for", # noqa "order": 1}, "reviewTrack": { "value": ["< none >"] + gui_tracks, @@ -159,7 +159,7 @@ class CreateShotClip(plugin.Creator): "type": "QCheckBox", "label": "Include audio", "target": "tag", - "toolTip": "Process subsets with corresponding audio", # noqa + "toolTip": "Process products with corresponding audio", # noqa "order": 3}, "sourceResolution": { "value": False, diff --git a/client/ayon_core/hosts/resolve/plugins/load/load_clip.py b/client/ayon_core/hosts/resolve/plugins/load/load_clip.py index 47aeac213b..4d1f8f1f7c 100644 --- a/client/ayon_core/hosts/resolve/plugins/load/load_clip.py +++ b/client/ayon_core/hosts/resolve/plugins/load/load_clip.py @@ -15,7 +15,7 @@ from ayon_core.lib.transcoding import ( class LoadClip(plugin.TimelineItemLoader): - """Load a subset to timeline as clip + """Load a product to timeline as clip Place clip to timeline on its asset origin timings collected during conforming to project diff --git a/client/ayon_core/hosts/resolve/plugins/publish/precollect_instances.py b/client/ayon_core/hosts/resolve/plugins/publish/precollect_instances.py index 78c5fbbbf7..025b64878e 100644 --- a/client/ayon_core/hosts/resolve/plugins/publish/precollect_instances.py +++ b/client/ayon_core/hosts/resolve/plugins/publish/precollect_instances.py @@ -64,11 +64,11 @@ class PrecollectInstances(pyblish.api.ContextPlugin): }) asset = tag_data["folder_path"] - subset = tag_data["subset"] + product_name = tag_data["productName"] data.update({ - "name": "{}_{}".format(asset, subset), - "label": "{} {}".format(asset, subset), + "name": "{}_{}".format(asset, product_name), + "label": "{} {}".format(asset, product_name), "folderPath": asset, "item": timeline_item, "publish": get_publish_attribute(timeline_item), @@ -128,18 +128,18 @@ class PrecollectInstances(pyblish.api.ContextPlugin): return asset = data["folderPath"] - subset = "shotMain" + product_name = "shotMain" # insert family into families - family = "shot" + product_type = "shot" data.update({ - "name": "{}_{}".format(asset, subset), - "label": "{} {}".format(asset, subset), - "subset": subset, + "name": "{}_{}".format(asset, product_name), + "label": "{} {}".format(asset, product_name), "folderPath": asset, - "family": family, - "families": [], + "productName": product_name, + "productType": product_type, + "families": [product_type], "publish": get_publish_attribute(timeline_item) }) diff --git a/client/ayon_core/hosts/resolve/plugins/publish/precollect_workfile.py b/client/ayon_core/hosts/resolve/plugins/publish/precollect_workfile.py index 814b1e159f..4526b812a0 100644 --- a/client/ayon_core/hosts/resolve/plugins/publish/precollect_workfile.py +++ b/client/ayon_core/hosts/resolve/plugins/publish/precollect_workfile.py @@ -17,7 +17,7 @@ class PrecollectWorkfile(pyblish.api.ContextPlugin): current_asset_name = get_current_asset_name() asset_name = current_asset_name.split("/")[-1] - subset = "workfileMain" + product_name = "workfileMain" project = rapi.get_current_project() fps = project.GetSetting("timelineFrameRate") video_tracks = rapi.get_video_track_names() @@ -26,12 +26,12 @@ class PrecollectWorkfile(pyblish.api.ContextPlugin): otio_timeline = davinci_export.create_otio_timeline(project) instance_data = { - "name": "{}_{}".format(asset_name, subset), - "label": "{} {}".format(current_asset_name, subset), + "name": "{}_{}".format(asset_name, product_name), + "label": "{} {}".format(current_asset_name, product_name), "folderPath": current_asset_name, - "subset": subset, + "productName": product_name, "item": project, - "family": "workfile", + "productType": "workfile", "families": [] }