From f086088a9e710a3f2b377004a96ecaf20fcdaa3e Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Wed, 7 Oct 2020 18:03:09 +0200 Subject: [PATCH 1/4] fix(hiero): plate thumbnail correct frame from source range --- pype/plugins/hiero/publish/collect_plates.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pype/plugins/hiero/publish/collect_plates.py b/pype/plugins/hiero/publish/collect_plates.py index 4d1cc36a920..34ea622414a 100644 --- a/pype/plugins/hiero/publish/collect_plates.py +++ b/pype/plugins/hiero/publish/collect_plates.py @@ -192,11 +192,12 @@ def process(self, instance): instance.data["representations"].append( plates_mov_representation) - thumb_frame = instance.data["clipInH"] + ( - (instance.data["clipOutH"] - instance.data["clipInH"]) / 2) + thumb_frame = instance.data["sourceInH"] + ( + (instance.data["sourceOutH"] - instance.data["sourceInH"]) / 2) thumb_file = "{}_{}{}".format(head, thumb_frame, ".png") thumb_path = os.path.join(staging_dir, thumb_file) - + self.log.debug("__ thumb_path: `{}`, frame: `{}`".format( + thumb_path, thumb_frame)) thumbnail = item.thumbnail(thumb_frame).save( thumb_path, format='png' From 6d30b2e852df3da0e3377dcdb2d8f70c6bc81a8c Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Wed, 7 Oct 2020 18:17:09 +0200 Subject: [PATCH 2/4] fix(hiero): review thumbnail two variation of frame identification --- pype/plugins/hiero/publish/collect_reviews.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pype/plugins/hiero/publish/collect_reviews.py b/pype/plugins/hiero/publish/collect_reviews.py index edb81aed8a3..a444d57d6b3 100644 --- a/pype/plugins/hiero/publish/collect_reviews.py +++ b/pype/plugins/hiero/publish/collect_reviews.py @@ -142,8 +142,15 @@ def create_thumbnail(self, instance): staging_dir = os.path.dirname( source_path) - thumb_frame = instance.data["clipInH"] + ( - (instance.data["clipOutH"] - instance.data["clipInH"]) / 2) + media_duration = instance.data.get("mediaDuration") + clip_duration_h = instance.data.get("clipDurationH") + + if media_duration > clip_duration_h: + thumb_frame = instance.data["clipInH"] + ( + (instance.data["clipOutH"] - instance.data["clipInH"]) / 2) + elif media_duration <= clip_duration_h: + thumb_frame = instance.data["sourceIn"] + ( + (instance.data["sourceOut"] - instance.data["sourceIn"]) / 2) thumb_file = "{}_{}{}".format(head, thumb_frame, ".png") thumb_path = os.path.join(staging_dir, thumb_file) self.log.debug("__ thumb_path: {}".format(thumb_path)) From b4a0b1d2589321bc3389e5d849a3fba1cf3e1776 Mon Sep 17 00:00:00 2001 From: Milan Kolar Date: Wed, 7 Oct 2020 18:53:08 +0200 Subject: [PATCH 3/4] change tasks to dictionary --- pype/plugins/ftrack/publish/integrate_hierarchy_ftrack.py | 7 +++---- pype/plugins/global/publish/extract_hierarchy_avalon.py | 4 ++-- pype/plugins/hiero/publish/collect_shots.py | 2 +- pype/plugins/hiero/publish/collect_tag_tasks.py | 4 ++-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/pype/plugins/ftrack/publish/integrate_hierarchy_ftrack.py b/pype/plugins/ftrack/publish/integrate_hierarchy_ftrack.py index 2ee08987119..e4496138bb3 100644 --- a/pype/plugins/ftrack/publish/integrate_hierarchy_ftrack.py +++ b/pype/plugins/ftrack/publish/integrate_hierarchy_ftrack.py @@ -142,11 +142,10 @@ def import_to_ftrack(self, input_data, parent=None): existing_tasks.append(child['name'].lower()) # existing_tasks.append(child['type']['name']) - for task in tasks: - task_name = next(iter(task)) - task_type = task[task_name]["type"] + for task_name in tasks: + task_type = tasks[task_name]["type"] if task_name.lower() in existing_tasks: - print("Task {} already exists".format(task)) + print("Task {} already exists".format(task_name)) continue tasks_to_create.append((task_name, task_type)) diff --git a/pype/plugins/global/publish/extract_hierarchy_avalon.py b/pype/plugins/global/publish/extract_hierarchy_avalon.py index 64df6727096..72cd935c2d1 100644 --- a/pype/plugins/global/publish/extract_hierarchy_avalon.py +++ b/pype/plugins/global/publish/extract_hierarchy_avalon.py @@ -102,11 +102,11 @@ def import_to_avalon(self, input_data, parent=None): new_tasks = data.pop("tasks", {}) if "tasks" not in cur_entity_data and not new_tasks: continue - for task in new_tasks: + for task_name in new_tasks: task_name = next(iter(task)) if task_name in cur_entity_data["tasks"].keys(): continue - cur_entity_data["tasks"][task_name] = task[task_name] + cur_entity_data["tasks"][task_name] = new_tasks[task_name] cur_entity_data.update(data) data = cur_entity_data else: diff --git a/pype/plugins/hiero/publish/collect_shots.py b/pype/plugins/hiero/publish/collect_shots.py index 6f83e08fbe9..ed658a19a9d 100644 --- a/pype/plugins/hiero/publish/collect_shots.py +++ b/pype/plugins/hiero/publish/collect_shots.py @@ -43,7 +43,7 @@ def process(self, instance): "{} - {} - tasks:{} - assetbuilds:{} - comments:{}".format( data["asset"], data["subset"], - [task.keys()[0] for task in data["tasks"]], + [task for task in data["tasks"]], [x["name"] for x in data.get("assetbuilds", [])], len(data.get("comments", [])) ) diff --git a/pype/plugins/hiero/publish/collect_tag_tasks.py b/pype/plugins/hiero/publish/collect_tag_tasks.py index dbcf5e52607..ae4578bbf70 100644 --- a/pype/plugins/hiero/publish/collect_tag_tasks.py +++ b/pype/plugins/hiero/publish/collect_tag_tasks.py @@ -13,7 +13,7 @@ def process(self, instance): # gets tags tags = instance.data["tags"] - tasks = list() + tasks = dict() for t in tags: t_metadata = dict(t["metadata"]) t_family = t_metadata.get("tag.family", "") @@ -22,7 +22,7 @@ def process(self, instance): if "task" in t_family: t_task_name = t_metadata.get("tag.label", "") t_task_type = t_metadata.get("tag.type", "") - tasks.append({t_task_name: {"type": t_task_type}}) + tasks[t_task_name] = {"type": t_task_type} instance.data["tasks"] = tasks From d67402331a82f4561fa377cebe4f07d0c67ae64f Mon Sep 17 00:00:00 2001 From: Milan Kolar Date: Wed, 7 Oct 2020 19:12:32 +0200 Subject: [PATCH 4/4] remove forgotten line --- pype/plugins/global/publish/extract_hierarchy_avalon.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pype/plugins/global/publish/extract_hierarchy_avalon.py b/pype/plugins/global/publish/extract_hierarchy_avalon.py index 72cd935c2d1..74751c68074 100644 --- a/pype/plugins/global/publish/extract_hierarchy_avalon.py +++ b/pype/plugins/global/publish/extract_hierarchy_avalon.py @@ -103,7 +103,6 @@ def import_to_avalon(self, input_data, parent=None): if "tasks" not in cur_entity_data and not new_tasks: continue for task_name in new_tasks: - task_name = next(iter(task)) if task_name in cur_entity_data["tasks"].keys(): continue cur_entity_data["tasks"][task_name] = new_tasks[task_name]