From 7e9dfd5b47795f53cb2f038e57dcb19b49eeda34 Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Mon, 11 Mar 2024 12:11:22 +0100 Subject: [PATCH] 'get_product_name' now expects 'task_name' and 'task_type' --- .../plugins/publish/collect_timeline_otio.py | 8 +++++++- .../harmony/plugins/publish/collect_workfile.py | 8 +++++++- .../plugins/publish/validate_subset_name.py | 17 ++++++++++++++--- client/ayon_core/hosts/maya/api/plugin.py | 7 ++++++- .../plugins/create/create_flatten_image.py | 10 +++++++++- .../plugins/publish/collect_auto_image.py | 7 ++++++- .../plugins/publish/collect_auto_review.py | 7 ++++++- .../plugins/publish/collect_auto_workfile.py | 7 ++++++- .../publish/collect_textureset_images.py | 12 +++++++++--- .../plugins/create/create_movie_batch.py | 15 ++++++++------- client/ayon_core/hosts/tvpaint/api/plugin.py | 7 ++++++- .../pipeline/create/creator_plugins.py | 9 ++++++++- .../ayon_core/pipeline/create/legacy_create.py | 8 ++++++-- .../ayon_core/pipeline/create/product_name.py | 11 ++++------- .../tools/push_to_project/models/integrate.py | 12 ++++++------ 15 files changed, 108 insertions(+), 37 deletions(-) diff --git a/client/ayon_core/hosts/flame/plugins/publish/collect_timeline_otio.py b/client/ayon_core/hosts/flame/plugins/publish/collect_timeline_otio.py index 9c06a4c76b..7609ea7879 100644 --- a/client/ayon_core/hosts/flame/plugins/publish/collect_timeline_otio.py +++ b/client/ayon_core/hosts/flame/plugins/publish/collect_timeline_otio.py @@ -22,9 +22,15 @@ class CollecTimelineOTIO(pyblish.api.ContextPlugin): sequence = opfapi.get_current_sequence(opfapi.CTX.selection) # create product name + task_entity = context.data["taskEntity"] + task_name = task_type = None + if task_entity: + task_name = task_entity["name"] + task_type = task_entity["taskType"] product_name = get_product_name( context.data["projectName"], - context.data["taskEntity"], + task_name, + task_type, context.data["hostName"], product_type, variant, 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 79356b3a5f..488a7c4c71 100644 --- a/client/ayon_core/hosts/harmony/plugins/publish/collect_workfile.py +++ b/client/ayon_core/hosts/harmony/plugins/publish/collect_workfile.py @@ -17,9 +17,15 @@ class CollectWorkfile(pyblish.api.ContextPlugin): """Plugin entry point.""" product_type = "workfile" basename = os.path.basename(context.data["currentFile"]) + task_entity = context.data["taskEntity"] + task_name = task_type = None + if task_entity: + task_name = task_entity["name"] + task_type = task_entity["taskType"] product_name = get_product_name( context.data["projectName"], - context.data["taskEntity"], + task_name, + task_type, context.data["hostName"], product_type, "", diff --git a/client/ayon_core/hosts/houdini/plugins/publish/validate_subset_name.py b/client/ayon_core/hosts/houdini/plugins/publish/validate_subset_name.py index 8e62b85650..0481929824 100644 --- a/client/ayon_core/hosts/houdini/plugins/publish/validate_subset_name.py +++ b/client/ayon_core/hosts/houdini/plugins/publish/validate_subset_name.py @@ -55,9 +55,15 @@ class ValidateSubsetName(pyblish.api.InstancePlugin, # Check product name folder_entity = instance.data["folderEntity"] + task_entity = instance.data["taskEntity"] + task_name = task_type = None + if task_entity: + task_name = task_entity["name"] + task_type = task_entity["taskType"] product_name = get_product_name( instance.context.data["projectName"], - instance.data["taskEntity"], + task_name, + task_type, instance.context.data["hostName"], instance.data["productType"], variant=instance.data["variant"], @@ -79,10 +85,15 @@ class ValidateSubsetName(pyblish.api.InstancePlugin, # Check product name folder_entity = instance.data["folderEntity"] + task_entity = instance.data["taskEntity"] + task_name = task_type = None + if task_entity: + task_name = task_entity["name"] + task_type = task_entity["taskType"] product_name = get_product_name( instance.context.data["projectName"], - instance.data["taskEntity"], - instance.data["task"], + task_name, + task_type, instance.context.data["hostName"], instance.data["productType"], variant=instance.data["variant"], diff --git a/client/ayon_core/hosts/maya/api/plugin.py b/client/ayon_core/hosts/maya/api/plugin.py index f2268088e6..eaf93725f4 100644 --- a/client/ayon_core/hosts/maya/api/plugin.py +++ b/client/ayon_core/hosts/maya/api/plugin.py @@ -600,10 +600,15 @@ class RenderlayerCreator(NewCreator, MayaCreatorBase): host_name, instance ) + task_name = task_type = None + if task_entity: + task_name = task_entity["name"] + task_type = task_entity["taskType"] # creator.product_type != 'render' as expected return get_product_name( project_name, - task_entity, + task_name, + task_type host_name, self.layer_instance_prefix or self.product_type, variant, diff --git a/client/ayon_core/hosts/photoshop/plugins/create/create_flatten_image.py b/client/ayon_core/hosts/photoshop/plugins/create/create_flatten_image.py index 84c5548e7b..a3bc77c640 100644 --- a/client/ayon_core/hosts/photoshop/plugins/create/create_flatten_image.py +++ b/client/ayon_core/hosts/photoshop/plugins/create/create_flatten_image.py @@ -136,10 +136,18 @@ class AutoImageCreator(PSAutoCreator): ): if host_name is None: host_name = self.create_context.host_name + + task_name = task_type = None + if task_entity: + task_name = task_entity["name"] + task_type = task_entity["taskType"] + dynamic_data = prepare_template_data({"layer": "{layer}"}) + product_name = get_product_name( project_name, - task_entity, + task_name, + task_type, host_name, self.product_type, variant, diff --git a/client/ayon_core/hosts/photoshop/plugins/publish/collect_auto_image.py b/client/ayon_core/hosts/photoshop/plugins/publish/collect_auto_image.py index ab8254d747..b488ab364d 100644 --- a/client/ayon_core/hosts/photoshop/plugins/publish/collect_auto_image.py +++ b/client/ayon_core/hosts/photoshop/plugins/publish/collect_auto_image.py @@ -27,6 +27,10 @@ class CollectAutoImage(pyblish.api.ContextPlugin): host_name = context.data["hostName"] folder_entity = context.data["folderEntity"] task_entity = context.data["taskEntity"] + task_name = task_type = None + if task_entity: + task_name = task_entity["name"] + task_type = task_entity["taskType"] auto_creator = proj_settings.get( "photoshop", {}).get( @@ -79,7 +83,8 @@ class CollectAutoImage(pyblish.api.ContextPlugin): product_name = get_product_name( project_name, - task_entity, + task_name, + task_type, host_name, product_type, variant, diff --git a/client/ayon_core/hosts/photoshop/plugins/publish/collect_auto_review.py b/client/ayon_core/hosts/photoshop/plugins/publish/collect_auto_review.py index 49eac1cbd2..d7267d253a 100644 --- a/client/ayon_core/hosts/photoshop/plugins/publish/collect_auto_review.py +++ b/client/ayon_core/hosts/photoshop/plugins/publish/collect_auto_review.py @@ -65,10 +65,15 @@ class CollectAutoReview(pyblish.api.ContextPlugin): host_name = context.data["hostName"] folder_entity = context.data["folderEntity"] task_entity = context.data["taskEntity"] + task_name = task_type = None + if task_entity: + task_name = task_entity["name"] + task_type = task_entity["taskType"] product_name = get_product_name( project_name, - task_entity, + task_name, + task_type, host_name, product_type, variant, diff --git a/client/ayon_core/hosts/photoshop/plugins/publish/collect_auto_workfile.py b/client/ayon_core/hosts/photoshop/plugins/publish/collect_auto_workfile.py index fd68529437..af74c76a15 100644 --- a/client/ayon_core/hosts/photoshop/plugins/publish/collect_auto_workfile.py +++ b/client/ayon_core/hosts/photoshop/plugins/publish/collect_auto_workfile.py @@ -70,10 +70,15 @@ class CollectAutoWorkfile(pyblish.api.ContextPlugin): host_name = context.data["hostName"] folder_entity = context.data["folderEntity"] task_entity = context.data["taskEntity"] + task_name = task_type = None + if task_entity: + task_name = task_entity["name"] + task_type = task_entity["taskType"] product_name = get_product_name( project_name, - task_entity, + task_name, + task_type, host_name, product_type, variant, diff --git a/client/ayon_core/hosts/substancepainter/plugins/publish/collect_textureset_images.py b/client/ayon_core/hosts/substancepainter/plugins/publish/collect_textureset_images.py index 7f7a0acd75..20aaa56993 100644 --- a/client/ayon_core/hosts/substancepainter/plugins/publish/collect_textureset_images.py +++ b/client/ayon_core/hosts/substancepainter/plugins/publish/collect_textureset_images.py @@ -86,13 +86,19 @@ class CollectTextureSet(pyblish.api.InstancePlugin): map_identifier = strip_template(template) suffix += f".{map_identifier}" + task_name = task_type = None + if task_entity: + task_name = task_entity["name"] + task_type = task_entity["taskType"] + image_product_name = get_product_name( # TODO: The product type actually isn't 'texture' currently but # for now this is only done so the product name starts with # 'texture' - project_name=context.data["projectName"], - task_entity=task_entity, - host_name=context.data["hostName"], + context.data["projectName"], + task_name, + task_type, + context.data["hostName"], product_type="texture", variant=instance.data["variant"] + suffix, project_settings=context.data["project_settings"] diff --git a/client/ayon_core/hosts/traypublisher/plugins/create/create_movie_batch.py b/client/ayon_core/hosts/traypublisher/plugins/create/create_movie_batch.py index 1fa431fcd0..546408b4d6 100644 --- a/client/ayon_core/hosts/traypublisher/plugins/create/create_movie_batch.py +++ b/client/ayon_core/hosts/traypublisher/plugins/create/create_movie_batch.py @@ -105,10 +105,15 @@ class BatchMovieCreator(TrayPublishCreator): def _get_product_name(self, project_name, task_entity, variant): """Create product name according to standard template process""" host_name = self.create_context.host_name + task_name = task_type = None + if task_entity: + task_name = task_entity["name"] + task_type = task_entity["taskType"] try: product_name = get_product_name( project_name, - task_entity, + task_name, + task_type, host_name, self.product_type, variant, @@ -119,14 +124,10 @@ class BatchMovieCreator(TrayPublishCreator): # but user have ability to change it # NOTE: This expect that there is not task 'Undefined' on folder dumb_value = "Undefined" - task_entity = { - "name": dumb_value, - "taskType": dumb_value, - "short": dumb_value, - } product_name = get_product_name( project_name, - task_entity, + dumb_value, + dumb_value, host_name, self.product_type, variant, diff --git a/client/ayon_core/hosts/tvpaint/api/plugin.py b/client/ayon_core/hosts/tvpaint/api/plugin.py index c198f62583..e715b959f4 100644 --- a/client/ayon_core/hosts/tvpaint/api/plugin.py +++ b/client/ayon_core/hosts/tvpaint/api/plugin.py @@ -70,10 +70,15 @@ class TVPaintCreatorCommon: host_name, instance ) + task_name = task_type = None + if task_entity: + task_name = task_entity["name"] + task_type = task_entity["taskType"] return get_product_name( project_name, - task_entity, + task_name, + task_type, host_name, self.product_type, variant, diff --git a/client/ayon_core/pipeline/create/creator_plugins.py b/client/ayon_core/pipeline/create/creator_plugins.py index a984b7affe..5505427d7e 100644 --- a/client/ayon_core/pipeline/create/creator_plugins.py +++ b/client/ayon_core/pipeline/create/creator_plugins.py @@ -514,6 +514,12 @@ class BaseCreator: if host_name is None: host_name = self.create_context.host_name + + task_name = task_type = None + if task_entity: + task_name = task_entity["name"] + task_type = task_entity["taskType"] + dynamic_data = self.get_dynamic_data( project_name, folder_entity, @@ -525,7 +531,8 @@ class BaseCreator: return get_product_name( project_name, - task_entity, + task_name, + task_type, host_name, self.product_type, variant, diff --git a/client/ayon_core/pipeline/create/legacy_create.py b/client/ayon_core/pipeline/create/legacy_create.py index 018e958329..a8a39b41e3 100644 --- a/client/ayon_core/pipeline/create/legacy_create.py +++ b/client/ayon_core/pipeline/create/legacy_create.py @@ -149,10 +149,14 @@ class LegacyCreator(object): dynamic_data = cls.get_dynamic_data( project_name, folder_entity, task_entity, variant, host_name ) - + task_name = task_type = None + if task_entity: + task_name = task_entity["name"] + task_type = task_entity["taskType"] return get_product_name( project_name, - task_entity, + task_name, + task_type, host_name, cls.product_type, variant, diff --git a/client/ayon_core/pipeline/create/product_name.py b/client/ayon_core/pipeline/create/product_name.py index 6da357b5aa..74e268fbb3 100644 --- a/client/ayon_core/pipeline/create/product_name.py +++ b/client/ayon_core/pipeline/create/product_name.py @@ -81,7 +81,8 @@ def get_product_name_template( def get_product_name( project_name, - task_entity, + task_name, + task_type, host_name, product_type, variant, @@ -106,7 +107,8 @@ def get_product_name( Args: project_name (str): Project name. - task_entity (Dict[str, Any]): Task entity. + task_name (Union[str, None]): Task name. + task_type (Union[str, None]): Task type. host_name (str): Host name. product_type (str): Product type. variant (str): In most of the cases it is user input during creation. @@ -129,11 +131,6 @@ def get_product_name( if not product_type: return "" - task_name = task_type = None - if task_entity: - task_name = task_entity["name"] - task_type = task_entity["taskType"] - template = get_product_name_template( project_name, product_type_filter or product_type, diff --git a/client/ayon_core/tools/push_to_project/models/integrate.py b/client/ayon_core/tools/push_to_project/models/integrate.py index 30bccc46a3..8a29da2fe4 100644 --- a/client/ayon_core/tools/push_to_project/models/integrate.py +++ b/client/ayon_core/tools/push_to_project/models/integrate.py @@ -819,15 +819,15 @@ class ProjectPushItemProcess: def _determine_product_name(self): product_type = self._product_type task_info = self._task_info - new_task_info = None + task_name = task_type = None if task_info: - new_task_info = { - "name": task_info["name"], - "taskType": task_info["type"] - } + task_name = task_info["name"] + task_type = task_info["type"] + product_name = get_product_name( self._item.dst_project_name, - new_task_info, + task_name, + task_type, self.host_name, product_type, self._item.variant,