From dbeed281cb1ddcea1923965cd51409b3e934bee4 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Wed, 18 Nov 2020 12:13:25 +0100 Subject: [PATCH] feat(SP): dictionary way of adding tasks from preset --- .../publish/collect_hierarchy.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pype/plugins/standalonepublisher/publish/collect_hierarchy.py b/pype/plugins/standalonepublisher/publish/collect_hierarchy.py index 45d2fb4160..b2d71084e4 100644 --- a/pype/plugins/standalonepublisher/publish/collect_hierarchy.py +++ b/pype/plugins/standalonepublisher/publish/collect_hierarchy.py @@ -130,10 +130,17 @@ class CollectHierarchyInstance(pyblish.api.ContextPlugin): if self.shot_add_tasks: tasks_to_add = dict() project_tasks = io.find_one({"type": "project"})["config"]["tasks"] - for task in self.shot_add_tasks: + for task_name, task_data in self.shot_add_tasks.items(): for task_type in project_tasks.keys(): - if task_type.lower() in task.lower(): - tasks_to_add.update({task: {"type": task_type}}) + try: + if task_type in task_data["type"]: + tasks_to_add.update({task_name: task_data}) + except KeyError as error: + self.log.error( + "Wrong presets: `{}` \n" + "example: {\"task_name\": {\"type\":" + " \"FtrackTaskType\"}}".format(error) + ) instance.data["tasks"] = tasks_to_add else: