From 1fef682dfc5e4ed5361b5028e1a1c80c1e219b1b Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Tue, 13 Apr 2021 16:58:22 +0200 Subject: [PATCH] Hiero: fixing review workflow --- openpype/hosts/hiero/api/plugin.py | 12 +++++++++--- openpype/hosts/hiero/api/tags.py | 7 +++++++ .../hiero/plugins/publish/precollect_instances.py | 4 ++-- openpype/plugins/publish/collect_hierarchy.py | 2 +- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/openpype/hosts/hiero/api/plugin.py b/openpype/hosts/hiero/api/plugin.py index 9b3bc25d80..5620fe3cb8 100644 --- a/openpype/hosts/hiero/api/plugin.py +++ b/openpype/hosts/hiero/api/plugin.py @@ -675,6 +675,9 @@ class PublishClip: if kwargs.get("avalon"): self.tag_data.update(kwargs["avalon"]) + # add publish attribute to tag data + self.tag_data.update({"publish": True}) + # adding ui inputs if any self.ui_inputs = kwargs.get("ui_inputs", {}) @@ -688,6 +691,7 @@ class PublishClip: self._create_parents() def convert(self): + # solve track item data and add them to tag data self._convert_to_tag_data() @@ -707,6 +711,11 @@ class PublishClip: else: self.tag_data["asset"] = self.ti_name + if self.tag_data["heroTrack"] and self.review_layer: + self.tag_data.update({"reviewTrack": self.review_layer}) + else: + self.tag_data.update({"reviewTrack": None}) + # create pype tag on track_item and add data lib.imprint(self.track_item, self.tag_data) @@ -862,9 +871,6 @@ class PublishClip: # add data to return data dict self.tag_data.update(tag_hierarchy_data) - if hero_track and self.review_layer: - self.tag_data.update({"reviewTrack": self.review_layer}) - def _solve_tag_hierarchy_data(self, hierarchy_formating_data): """ Solve tag data from hierarchy data and templates. """ # fill up clip name and hierarchy keys diff --git a/openpype/hosts/hiero/api/tags.py b/openpype/hosts/hiero/api/tags.py index 06fa655a2e..d2502f3c71 100644 --- a/openpype/hosts/hiero/api/tags.py +++ b/openpype/hosts/hiero/api/tags.py @@ -84,6 +84,13 @@ def update_tag(tag, data): mtd = tag.metadata() # get metadata key from data data_mtd = data.get("metadata", {}) + + # due to hiero bug we have to make sure keys which are not existent in + # data are cleared of value by `None` + for _mk in mtd.keys(): + if _mk.replace("tag.", "") not in data_mtd.keys(): + mtd.setValue(_mk, str(None)) + # set all data metadata to tag metadata for k, v in data_mtd.items(): mtd.setValue( diff --git a/openpype/hosts/hiero/plugins/publish/precollect_instances.py b/openpype/hosts/hiero/plugins/publish/precollect_instances.py index 242cfed254..63585b387e 100644 --- a/openpype/hosts/hiero/plugins/publish/precollect_instances.py +++ b/openpype/hosts/hiero/plugins/publish/precollect_instances.py @@ -146,13 +146,13 @@ class PrecollectInstances(pyblish.api.ContextPlugin): dict: otio clip object """ - track_name = track_item.parent().name() + ti_track_name = track_item.parent().name() timeline_range = self.create_otio_time_range_from_timeline_item_data( track_item) for otio_clip in otio_timeline.each_clip(): track_name = otio_clip.parent().name parent_range = otio_clip.range_in_parent() - if track_name not in track_name: + if ti_track_name not in track_name: continue if otio_clip.name not in track_item.name(): continue diff --git a/openpype/plugins/publish/collect_hierarchy.py b/openpype/plugins/publish/collect_hierarchy.py index 390ce443b6..1aa10fcb9b 100644 --- a/openpype/plugins/publish/collect_hierarchy.py +++ b/openpype/plugins/publish/collect_hierarchy.py @@ -15,7 +15,7 @@ class CollectHierarchy(pyblish.api.ContextPlugin): label = "Collect Hierarchy" order = pyblish.api.CollectorOrder - 0.57 families = ["shot"] - hosts = ["resolve"] + hosts = ["resolve", "hiero"] def process(self, context): temp_context = {}