From b0b1e3d632744b1c9dfb2c938d1d68207a17969a Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Thu, 6 May 2021 16:09:24 +0200 Subject: [PATCH] Changed template_name_profiles from raw-json to profiles in Settings for IntegrateNew Originally it was in Settings only as json. Standardized to profile approach. Resulted in slight change in integrate_new.py --- openpype/plugins/publish/integrate_new.py | 12 ++++++- .../defaults/project_settings/global.json | 15 ++++---- .../schemas/schema_global_publish.json | 34 +++++++++++++++++-- 3 files changed, 52 insertions(+), 9 deletions(-) diff --git a/openpype/plugins/publish/integrate_new.py b/openpype/plugins/publish/integrate_new.py index 19b12e953d..f9f056cbc3 100644 --- a/openpype/plugins/publish/integrate_new.py +++ b/openpype/plugins/publish/integrate_new.py @@ -297,7 +297,17 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin): else: orig_transfers = list(instance.data['transfers']) - template_name = self.template_name_from_instance(instance) + task_name = io.Session.get("AVALON_TASK") + family = self.main_family_from_instance(instance) + + key_values = {"families": family, "tasks": task_name} + profile = filter_profiles(self.template_name_profiles, key_values, + logger=self.log) + if profile: + template_name = profile["template_name"] + else: + # fallback + template_name = self.template_name_from_instance(instance) published_representations = {} for idx, repre in enumerate(instance.data["representations"]): diff --git a/openpype/settings/defaults/project_settings/global.json b/openpype/settings/defaults/project_settings/global.json index 53a33339c9..84e3bcf52b 100644 --- a/openpype/settings/defaults/project_settings/global.json +++ b/openpype/settings/defaults/project_settings/global.json @@ -116,19 +116,22 @@ ] }, "IntegrateAssetNew": { - "template_name_profiles": { - "publish": { + "template_name_profiles": [ + { "families": [], - "tasks": [] + "tasks": [], + "template_name": "publish" }, - "render": { + { "families": [ "review", "render", "prerender" - ] + ], + "tasks": [], + "template_name": "render" } - }, + ], "subset_grouping_profiles": [ { "families": [], diff --git a/openpype/settings/entities/schemas/projects_schema/schemas/schema_global_publish.json b/openpype/settings/entities/schemas/projects_schema/schemas/schema_global_publish.json index 8b0828be23..534638ecc3 100644 --- a/openpype/settings/entities/schemas/projects_schema/schemas/schema_global_publish.json +++ b/openpype/settings/entities/schemas/projects_schema/schemas/schema_global_publish.json @@ -420,9 +420,39 @@ "is_group": true, "children": [ { - "type": "raw-json", + "type": "list", "key": "template_name_profiles", - "label": "template_name_profiles" + "label": "Template name profiles", + "use_label_wrap": true, + "object_type": { + "type": "dict", + "children": [ + { + "type": "label", + "label": "" + }, + { + "key": "families", + "label": "Families", + "type": "list", + "object_type": "text" + }, + { + "key": "tasks", + "label": "Task names", + "type": "list", + "object_type": "text" + }, + { + "type": "separator" + }, + { + "type": "text", + "key": "template_name", + "label": "Template name" + } + ] + } }, { "type": "list",