From e3342ecd9b4b7e2da9ca2ec6394e41b9031f59bd Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Wed, 6 Nov 2024 16:08:32 +0100 Subject: [PATCH 01/13] Improving reviewable UX on instances --- client/ayon_hiero/api/plugin.py | 4 +- .../plugins/create/create_shot_clip.py | 134 +++++++++++++----- 2 files changed, 103 insertions(+), 35 deletions(-) diff --git a/client/ayon_hiero/api/plugin.py b/client/ayon_hiero/api/plugin.py index 6ecef54..12bb2f2 100644 --- a/client/ayon_hiero/api/plugin.py +++ b/client/ayon_hiero/api/plugin.py @@ -689,7 +689,9 @@ class PublishClip: # publish settings "audio", "sourceResolution", # shot attributes - "workfileFrameStart", "handleStart", "handleEnd" + "workfileFrameStart", "handleStart", "handleEnd", + # instance attributes data + "reviewableTrack", } def __init__( diff --git a/client/ayon_hiero/plugins/create/create_shot_clip.py b/client/ayon_hiero/plugins/create/create_shot_clip.py index 38d772e..99cf88d 100644 --- a/client/ayon_hiero/plugins/create/create_shot_clip.py +++ b/client/ayon_hiero/plugins/create/create_shot_clip.py @@ -176,7 +176,52 @@ class _HieroInstanceClipCreatorBase(_HieroInstanceCreator): """ Base clip product creator. """ - def get_instance_attr_defs(self): + def register_callbacks(self): + self.create_context.add_value_changed_callback(self._on_value_change) + + def _on_value_change(self, event): + for item in event["changes"]: + instance = item["instance"] + if ( + instance is None + or instance.creator_identifier != self.identifier + ): + continue + + changes = item["changes"].get("creator_attributes", {}) + print(changes) + + attr_defs = instance.creator_attributes.attr_defs + + if "review" in changes: + review_value = changes["review"] + review_track = next( + attr_def + for attr_def in attr_defs + if attr_def.key == "reviewableTrack" + ) + + if review_value: + instance.creator_attributes["reviewableTrack"] = "< none >" + review_track.visible = False + else: + review_track.visible = True + + elif "reviewableTrack" in changes: + # if set value to "< none >" then switch review to False + review_switch = next( + attr_def for attr_def in attr_defs if attr_def.key == "review" + ) + + if changes["reviewableTrack"] == "< none >": + review_switch.visible = True + else: + instance.creator_attributes["review"] = False + review_switch.visible = False + + instance.set_create_attr_defs(attr_defs) + + def get_attr_defs_for_instance(self, instance): current_sequence = lib.get_current_sequence() if current_sequence is not None: @@ -192,23 +237,34 @@ def get_instance_attr_defs(self): ) ] if self.product_type == "plate": - instance_attributes.extend([ - BoolDef( - "vSyncOn", - label="Enable Vertical Sync", - tooltip="Switch on if you want clips above " - "each other to share its attributes", - default=True, - ), - EnumDef( - "vSyncTrack", - label="Hero Track", - tooltip="Select driving track name which should " - "be mastering all others", - items=gui_tracks or [""], + review_switch = BoolDef( + "review", + label="Review", + tooltip="Switch to reviewable instance", + default=False, + ) + reviewable_track = EnumDef( + "reviewableTrack", + label="Use Review Track", + tooltip=( + "Generate preview videos on fly, if '< none >' " + "is defined nothing will be generated." ), + items=["< none >"] + gui_tracks, + ) + instance_attributes.extend([ + review_switch, + reviewable_track, ]) + if instance.creator_attributes["reviewableTrack"] == "< none >": + review_switch.visible = True + else: + review_switch.visible = False + if instance.creator_attributes["review"] is True: + reviewable_track.visible = False + else: + reviewable_track.visible = True return instance_attributes @@ -564,16 +620,21 @@ def create(self, subset_name, instance_data, pre_create_data): # metadata recollection as publish time. else: parenting_data = clip_instances[shot_creator_id] - sub_instance_data.update({ - "parent_instance_id": parenting_data["instance_id"], - "label": ( - f"{shot_folder_path} " - f"{creator.product_type}" - ), - "creator_attributes": { - "parentInstance": parenting_data["label"], + sub_instance_data.update( + { + "parent_instance_id": parenting_data["instance_id"], + "label": ( + f"{shot_folder_path} " + f"{creator.product_type}" + ), + "creator_attributes": { + "parentInstance": parenting_data["label"], + "reviewableTrack": sub_instance_data[ + "reviewableTrack"], + "review": False, + }, } - }) + ) instance = creator.create(sub_instance_data, None) instance.transient_data["track_item"] = track_item @@ -738,17 +799,22 @@ def _collect_legacy_instance(self, track_item): for sub_creator_id in sub_creators: sub_instance_data = instance_data.copy() creator = self.create_context.creators[sub_creator_id] - sub_instance_data.update({ - "clip_variant": sub_instance_data["variant"], - "parent_instance_id": parenting_data["instance_id"], - "label": ( - f"{sub_instance_data['folderPath']} " - f"{creator.product_type}" - ), - "creator_attributes": { - "parentInstance": parenting_data["label"], + sub_instance_data.update( + { + "clip_variant": sub_instance_data["variant"], + "parent_instance_id": parenting_data["instance_id"], + "label": ( + f"{sub_instance_data['folderPath']} " + f"{creator.product_type}" + ), + "creator_attributes": { + "parentInstance": parenting_data["label"], + "reviewableTrack": sub_instance_data[ + "reviewableTrack"], + "review": False, + }, } - }) + ) instance = creator.create(sub_instance_data, None) instance.transient_data["track_item"] = track_item From 0237f097f64fd7be3971db3bb9ee80eb807a06ae Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Wed, 6 Nov 2024 16:34:39 +0100 Subject: [PATCH 02/13] collect reviewable flags correctly. --- .../plugins/publish/collect_plates.py | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/client/ayon_hiero/plugins/publish/collect_plates.py b/client/ayon_hiero/plugins/publish/collect_plates.py index 12c3c13..57ba9f3 100644 --- a/client/ayon_hiero/plugins/publish/collect_plates.py +++ b/client/ayon_hiero/plugins/publish/collect_plates.py @@ -16,6 +16,30 @@ def process(self, instance): """ instance.data["families"].append("clip") + # solve reviewable options + review_switch = instance.data["creator_attributes"].get("review") + review_track_name = instance.data["creator_attributes"].get( + "reviewableTrack") + + if review_switch is True: + instance.data["families"].append("review") + instance.data.pop("reviewTrack") + + if ( + review_track_name != "< none >" + and review_switch is not True + ): + instance.data["reviewTrack"] = review_track_name + + elif ( + review_track_name == "< none >" + # the reviewTrack key is set to None if '< none >' is selected + # in creator plugin + and instance.data.get("reviewTrack", False) is None + ): + # lets just remove it if it is not relevant + instance.data.pop("reviewTrack") + # Retrieve instance data from parent instance shot instance. parent_instance_id = instance.data["parent_instance_id"] edit_shared_data = instance.context.data["editorialSharedData"] From 9461c2d563b919d9300451b61dae5a2ce5207ab5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Je=C5=BEek?= Date: Thu, 7 Nov 2024 16:05:50 +0100 Subject: [PATCH 03/13] Update client/ayon_hiero/plugins/create/create_shot_clip.py Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> --- .../plugins/create/create_shot_clip.py | 53 ++++++++++--------- 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/client/ayon_hiero/plugins/create/create_shot_clip.py b/client/ayon_hiero/plugins/create/create_shot_clip.py index 99cf88d..df8f0e4 100644 --- a/client/ayon_hiero/plugins/create/create_shot_clip.py +++ b/client/ayon_hiero/plugins/create/create_shot_clip.py @@ -237,34 +237,39 @@ def get_attr_defs_for_instance(self, instance): ) ] if self.product_type == "plate": - review_switch = BoolDef( - "review", - label="Review", - tooltip="Switch to reviewable instance", - default=False, + # Review checkbox visibility + current_review_track = instance.creator_attributes.get( + "reviewableTrack" ) - reviewable_track = EnumDef( - "reviewableTrack", - label="Use Review Track", - tooltip=( - "Generate preview videos on fly, if '< none >' " - "is defined nothing will be generated." - ), - items=["< none >"] + gui_tracks, + review_visible = ( + current_review_track is None + or current_review_track == "< none >" ) + # Review track visibility + current_review = instance.creator_attributes.get("review") + if current_review is None: + current_review = False + reviewable_track_visible = not current_review + instance_attributes.extend([ - review_switch, - reviewable_track, + BoolDef( + "review", + label="Review", + tooltip="Switch to reviewable instance", + default=False, + visible=review_visible, + ), + EnumDef( + "reviewableTrack", + label="Use Review Track", + tooltip=( + "Generate preview videos on fly, if '< none >' " + "is defined nothing will be generated." + ), + items=["< none >"] + gui_tracks, + visible=reviewable_track_visible, + ), ]) - if instance.creator_attributes["reviewableTrack"] == "< none >": - review_switch.visible = True - else: - review_switch.visible = False - - if instance.creator_attributes["review"] is True: - reviewable_track.visible = False - else: - reviewable_track.visible = True return instance_attributes From 62f65d31ddebcb9de618e9ea5a53961b0f41ecd3 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Thu, 7 Nov 2024 16:33:02 +0100 Subject: [PATCH 04/13] WIP on (no branch) Update EnumDef label from "reviewTrack" to "reviewableTrack". WIP on (no branch): Update EnumDef label for reviewableTrack. --- client/ayon_hiero/plugins/create/create_shot_clip.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_hiero/plugins/create/create_shot_clip.py b/client/ayon_hiero/plugins/create/create_shot_clip.py index df8f0e4..bbd2896 100644 --- a/client/ayon_hiero/plugins/create/create_shot_clip.py +++ b/client/ayon_hiero/plugins/create/create_shot_clip.py @@ -462,7 +462,7 @@ def header_label(text): items=['plate', 'take'], ), EnumDef( - "reviewTrack", + "reviewableTrack", label="Use Review Track", tooltip="Generate preview videos on fly, if " "'< none >' is defined nothing will be generated.", From 0200cda05be29406a47e0d9c70d45463c12b6867 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Thu, 7 Nov 2024 17:29:34 +0100 Subject: [PATCH 05/13] Update review-related attributes and visibility in plugin code. Fix attribute names, default values, and logic for reviewable sources. --- client/ayon_hiero/api/plugin.py | 34 ++--- .../plugins/create/create_shot_clip.py | 124 +++++++++--------- 2 files changed, 81 insertions(+), 77 deletions(-) diff --git a/client/ayon_hiero/api/plugin.py b/client/ayon_hiero/api/plugin.py index 12bb2f2..1507578 100644 --- a/client/ayon_hiero/api/plugin.py +++ b/client/ayon_hiero/api/plugin.py @@ -673,7 +673,7 @@ class PublishClip: hierarchy_default = "{_folder_}/{_sequence_}/{_track_}" clip_name_default = "shot_{_trackIndex_:0>3}_{_clipIndex_:0>4}" product_name_default = "" - review_track_default = "< none >" + review_source_default = None product_type_default = "plate" count_from_default = 10 count_steps_default = 10 @@ -691,7 +691,7 @@ class PublishClip: # shot attributes "workfileFrameStart", "handleStart", "handleEnd", # instance attributes data - "reviewableTrack", + "reviewableSource", } def __init__( @@ -745,8 +745,9 @@ def convert(self): # if track name is in review track name and also if driving track name # is not in review track name: skip tag creation - if (self.track_name in self.review_layer) and ( - self.driving_layer not in self.review_layer): + if (self.track_name in self.reviewable_source) and ( + self.driving_layer not in self.reviewable_source + ): return # deal with clip name @@ -767,10 +768,8 @@ def convert(self): ) self.tag_data["folderPath"] = folder_path - if self.tag_data["heroTrack"] and self.review_layer: - self.tag_data.update({"reviewTrack": self.review_layer}) - else: - self.tag_data.update({"reviewTrack": None}) + if self.tag_data["heroTrack"] and self.reviewable_source: + self.tag_data.update({"reviewableSource": self.reviewable_source}) return self.track_item @@ -797,7 +796,7 @@ def _populate_attributes(self): log.debug( "____ self.shot_num: {}".format(self.shot_num)) - # publisher ui attribute inputs or default values if gui was not used + # publisher ui attribute inputs or default values if gui was not used def get(key): """Shorthand access for code readability""" return self.pre_create_data.get(key) @@ -812,7 +811,7 @@ def get(key): self.product_type = get("productType") or self.product_type_default self.vertical_sync = get("vSyncOn") or self.vertical_sync_default self.driving_layer = get("vSyncTrack") or self.driving_layer_default - self.review_track = get("reviewTrack") or self.review_track_default + self.review_source = get("reviewableSource") or self.review_source_default self.audio = get("audio") or False self.hierarchy_data = { @@ -843,7 +842,7 @@ def _convert_to_tag_data(self): """ # define vertical sync attributes hero_track = True - self.review_layer = "" + self.reviewable_source = "" if self.vertical_sync: # check if track name is not in driving layer if self.track_name not in self.driving_layer: @@ -860,15 +859,18 @@ def _convert_to_tag_data(self): # adding tag metadata from ui for _key, _value in self.pre_create_data.items(): if _key in self.tag_keys: + # backward compatibility for reviewTrack (2024.11.07) + if "reviewTrack" in _key: + self.tag_data["reviewableSource"] = _value self.tag_data[_key] = _value # driving layer is set as positive match if hero_track or self.vertical_sync: # mark review layer - if self.review_track and ( - self.review_track not in self.review_track_default): + if self.review_source and ( + self.review_source is not self.review_source_default): # if review layer is defined and not the same as default - self.review_layer = self.review_track + self.reviewable_source = self.review_source # shot num calculate if self.rename_index == 0: self.shot_num = self.count_from @@ -926,8 +928,8 @@ def _convert_to_tag_data(self): self.tag_data["uuid"] = str(uuid.uuid4()) # add review track only to hero track - if hero_track and self.review_layer: - self.tag_data["reviewTrack"] = self.review_layer + if hero_track and self.reviewable_source: + self.tag_data["reviewTrack"] = self.reviewable_source else: self.tag_data.update({"reviewTrack": None}) diff --git a/client/ayon_hiero/plugins/create/create_shot_clip.py b/client/ayon_hiero/plugins/create/create_shot_clip.py index bbd2896..24e4f5b 100644 --- a/client/ayon_hiero/plugins/create/create_shot_clip.py +++ b/client/ayon_hiero/plugins/create/create_shot_clip.py @@ -198,26 +198,13 @@ def _on_value_change(self, event): review_track = next( attr_def for attr_def in attr_defs - if attr_def.key == "reviewableTrack" + if attr_def.key == "reviewableSource" ) if review_value: - instance.creator_attributes["reviewableTrack"] = "< none >" - review_track.visible = False - else: review_track.visible = True - - elif "reviewableTrack" in changes: - # if set value to "< none >" then switch review to False - review_switch = next( - attr_def for attr_def in attr_defs if attr_def.key == "review" - ) - - if changes["reviewableTrack"] == "< none >": - review_switch.visible = True else: - instance.creator_attributes["review"] = False - review_switch.visible = False + review_track.visible = False instance.set_create_attr_defs(attr_defs) @@ -225,7 +212,10 @@ def get_attr_defs_for_instance(self, instance): current_sequence = lib.get_current_sequence() if current_sequence is not None: - gui_tracks = [tr.name() for tr in current_sequence.videoTracks()] + gui_tracks = [ + {"value": tr.name(), "label": f"Track: {tr.name()}"} + for tr in current_sequence.videoTracks() + ] else: gui_tracks = [] @@ -237,39 +227,44 @@ def get_attr_defs_for_instance(self, instance): ) ] if self.product_type == "plate": - # Review checkbox visibility - current_review_track = instance.creator_attributes.get( - "reviewableTrack" - ) - review_visible = ( - current_review_track is None - or current_review_track == "< none >" - ) # Review track visibility current_review = instance.creator_attributes.get("review") if current_review is None: current_review = False - reviewable_track_visible = not current_review - - instance_attributes.extend([ - BoolDef( - "review", - label="Review", - tooltip="Switch to reviewable instance", - default=False, - visible=review_visible, - ), - EnumDef( - "reviewableTrack", - label="Use Review Track", - tooltip=( - "Generate preview videos on fly, if '< none >' " - "is defined nothing will be generated." + + review_source = instance.creator_attributes.get("reviewableSource") + if review_source: + instance.creator_attributes["review"] = True + current_review = True + + instance_attributes.extend( + [ + BoolDef( + "review", + label="Review", + tooltip="Switch to reviewable instance", + default=False, ), - items=["< none >"] + gui_tracks, - visible=reviewable_track_visible, - ), - ]) + EnumDef( + "reviewableSource", + label="Reviewable Source", + tooltip=( + "Generate preview videos on fly, if '< none >' " + "is defined nothing will be generated." + ), + items=( + [ + { + "value": "clip_media", + "label": "[ Clip's media ]", + }, + ] + + gui_tracks + ), + visible=current_review, + ), + ] + ) return instance_attributes @@ -332,7 +327,10 @@ def header_label(text): current_sequence = lib.get_current_sequence() if current_sequence is not None: - gui_tracks = [tr.name() for tr in current_sequence.videoTracks()] + gui_tracks = [ + {"value": tr.name(), "label": f"Track: {tr.name()}"} + for tr in current_sequence.videoTracks() + ] else: gui_tracks = [] @@ -440,9 +438,12 @@ def header_label(text): label="Hero track", tooltip="Select driving track name which should " "be mastering all others", - items=gui_tracks or [""], + items=( + gui_tracks or [ + {"value": None, "label": "< nothing to select> "} + ] + ), ), - # publishSettings UILabelDef( label=header_label("Publish Settings") @@ -462,11 +463,15 @@ def header_label(text): items=['plate', 'take'], ), EnumDef( - "reviewableTrack", - label="Use Review Track", + "reviewableSource", + label="Reviewable Source", tooltip="Generate preview videos on fly, if " - "'< none >' is defined nothing will be generated.", - items=['< none >'] + gui_tracks, + "'< none >' is defined nothing will be generated.", + items=[ + {"value": None, "label": "< none >"}, + {"value": "clip_media", "label": "[ Clip's media ]"}, + ] + + gui_tracks, ), BoolDef( "export_audio", @@ -477,10 +482,9 @@ def header_label(text): BoolDef( "sourceResolution", label="Source resolution", - tooltip="Is resloution taken from timeline or source?", + tooltip="Is resolution taken from timeline or source?", default=False, ), - # shotAttr UILabelDef( label=header_label("Shot Attributes"), @@ -628,14 +632,12 @@ def create(self, subset_name, instance_data, pre_create_data): sub_instance_data.update( { "parent_instance_id": parenting_data["instance_id"], - "label": ( - f"{shot_folder_path} " - f"{creator.product_type}" - ), + "label": (f"{shot_folder_path} " f"{creator.product_type}"), "creator_attributes": { "parentInstance": parenting_data["label"], - "reviewableTrack": sub_instance_data[ - "reviewableTrack"], + "reviewableSource": sub_instance_data[ + "reviewableSource" + ], "review": False, }, } @@ -814,8 +816,8 @@ def _collect_legacy_instance(self, track_item): ), "creator_attributes": { "parentInstance": parenting_data["label"], - "reviewableTrack": sub_instance_data[ - "reviewableTrack"], + "reviewableSource": sub_instance_data[ + "reviewableSource"], "review": False, }, } From 8cbf30c2b1e81d73c2b5a8bf473e1bd5e39800a5 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Fri, 8 Nov 2024 14:21:56 +0100 Subject: [PATCH 06/13] turning reviewable track into reviewable source Remove redundant reviewable flag distribution logic and update handling of review-related data in plugin files. --- client/ayon_hiero/api/plugin.py | 36 +++++++++++++++---- .../plugins/create/create_shot_clip.py | 26 +++++++------- .../plugins/publish/collect_plates.py | 32 +++++++---------- 3 files changed, 54 insertions(+), 40 deletions(-) diff --git a/client/ayon_hiero/api/plugin.py b/client/ayon_hiero/api/plugin.py index 1507578..8d2c9c1 100644 --- a/client/ayon_hiero/api/plugin.py +++ b/client/ayon_hiero/api/plugin.py @@ -768,9 +768,6 @@ def convert(self): ) self.tag_data["folderPath"] = folder_path - if self.tag_data["heroTrack"] and self.reviewable_source: - self.tag_data.update({"reviewableSource": self.reviewable_source}) - return self.track_item def _populate_track_item_default_data(self): @@ -811,7 +808,8 @@ def get(key): self.product_type = get("productType") or self.product_type_default self.vertical_sync = get("vSyncOn") or self.vertical_sync_default self.driving_layer = get("vSyncTrack") or self.driving_layer_default - self.review_source = get("reviewableSource") or self.review_source_default + self.review_source = ( + get("reviewableSource") or self.review_source_default) self.audio = get("audio") or False self.hierarchy_data = { @@ -858,10 +856,15 @@ def _convert_to_tag_data(self): # adding tag metadata from ui for _key, _value in self.pre_create_data.items(): + if ( + _key == "reviewableSource" + and "reviewTrack" in self.tag_keys + ): + self.tag_data.pop("reviewTrack") + self.tag_data["reviewableSource"] = _value if _key in self.tag_keys: - # backward compatibility for reviewTrack (2024.11.07) - if "reviewTrack" in _key: - self.tag_data["reviewableSource"] = _value + # backward compatibility for reviewableSource (2024.11.08) + self.tag_data[_key] = _value # driving layer is set as positive match @@ -933,6 +936,25 @@ def _convert_to_tag_data(self): else: self.tag_data.update({"reviewTrack": None}) + # add only review related data if reviewable source is set + if self.reviewable_source: + review_switch = True + reviewable_source = self.reviewable_source + # + if self.vertical_sync and not hero_track: + review_switch = False + reviewable_source = False + + if review_switch: + self.tag_data["review"] = True + else: + self.tag_data.pop("review", None) + + if reviewable_source: + self.tag_data["reviewableSource"] = reviewable_source + else: + self.tag_data.pop("reviewableSource", None) + def _solve_tag_hierarchy_data(self, hierarchy_formatting_data): """ Solve tag data from hierarchy data and templates. """ # fill up clip name and hierarchy keys diff --git a/client/ayon_hiero/plugins/create/create_shot_clip.py b/client/ayon_hiero/plugins/create/create_shot_clip.py index 24e4f5b..7434754 100644 --- a/client/ayon_hiero/plugins/create/create_shot_clip.py +++ b/client/ayon_hiero/plugins/create/create_shot_clip.py @@ -195,16 +195,16 @@ def _on_value_change(self, event): if "review" in changes: review_value = changes["review"] - review_track = next( + reviewable_source = next( attr_def for attr_def in attr_defs if attr_def.key == "reviewableSource" ) if review_value: - review_track.visible = True + reviewable_source.visible = True else: - review_track.visible = False + reviewable_source.visible = False instance.set_create_attr_defs(attr_defs) @@ -229,13 +229,6 @@ def get_attr_defs_for_instance(self, instance): if self.product_type == "plate": # Review track visibility current_review = instance.creator_attributes.get("review") - if current_review is None: - current_review = False - - review_source = instance.creator_attributes.get("reviewableSource") - if review_source: - instance.creator_attributes["review"] = True - current_review = True instance_attributes.extend( [ @@ -643,6 +636,14 @@ def create(self, subset_name, instance_data, pre_create_data): } ) + # add reviewable source to plate if shot has it + if sub_instance_data.get("reviewableSource"): + sub_instance_data["creator_attributes"].update({ + "reviewableSource": sub_instance_data[ + "reviewableSource"], + "review": True, + }) + instance = creator.create(sub_instance_data, None) instance.transient_data["track_item"] = track_item self._add_instance_to_context(instance) @@ -710,7 +711,7 @@ def _collect_legacy_instance(self, track_item): "tag.handleStart": ("handleStart", int), "tag.handleEnd": ("handleEnd", int), "tag.folderPath": ("folderPath", str), - "tag.reviewTrack": ("reviewTrack", str), + "tag.reviewTrack": ("reviewableSource", str), "tag.variant": ("variant", str), "tag.workfileFrameStart": ("workfileFrameStart", int), "tag.sourceResolution": ("sourceResolution", bool), @@ -816,8 +817,7 @@ def _collect_legacy_instance(self, track_item): ), "creator_attributes": { "parentInstance": parenting_data["label"], - "reviewableSource": sub_instance_data[ - "reviewableSource"], + "reviewableSource": sub_instance_data["reviewableSource"], "review": False, }, } diff --git a/client/ayon_hiero/plugins/publish/collect_plates.py b/client/ayon_hiero/plugins/publish/collect_plates.py index 57ba9f3..b1ad7a4 100644 --- a/client/ayon_hiero/plugins/publish/collect_plates.py +++ b/client/ayon_hiero/plugins/publish/collect_plates.py @@ -17,28 +17,20 @@ def process(self, instance): instance.data["families"].append("clip") # solve reviewable options - review_switch = instance.data["creator_attributes"].get("review") - review_track_name = instance.data["creator_attributes"].get( - "reviewableTrack") + review_switch = instance.data["creator_attributes"].get( + "review") + reviewable_source = instance.data["creator_attributes"].get( + "reviewableSource") if review_switch is True: - instance.data["families"].append("review") - instance.data.pop("reviewTrack") - - if ( - review_track_name != "< none >" - and review_switch is not True - ): - instance.data["reviewTrack"] = review_track_name - - elif ( - review_track_name == "< none >" - # the reviewTrack key is set to None if '< none >' is selected - # in creator plugin - and instance.data.get("reviewTrack", False) is None - ): - # lets just remove it if it is not relevant - instance.data.pop("reviewTrack") + if reviewable_source == "clip_media": + instance.data["families"].append("review") + else: + instance.data["reviewTrack"] = reviewable_source + + # remove review keys from instance data + instance.data.pop("reviewableSource", None) + instance.data.pop("review", None) # Retrieve instance data from parent instance shot instance. parent_instance_id = instance.data["parent_instance_id"] From c567f530dea4a5bbb5839fa29982cf6bc002a236 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Fri, 8 Nov 2024 15:04:54 +0100 Subject: [PATCH 07/13] fixing plate attributes --- client/ayon_hiero/plugins/create/create_shot_clip.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/client/ayon_hiero/plugins/create/create_shot_clip.py b/client/ayon_hiero/plugins/create/create_shot_clip.py index 7434754..c94d6e5 100644 --- a/client/ayon_hiero/plugins/create/create_shot_clip.py +++ b/client/ayon_hiero/plugins/create/create_shot_clip.py @@ -228,7 +228,7 @@ def get_attr_defs_for_instance(self, instance): ] if self.product_type == "plate": # Review track visibility - current_review = instance.creator_attributes.get("review") + current_review = instance.creator_attributes.get("review", False) instance_attributes.extend( [ @@ -627,11 +627,7 @@ def create(self, subset_name, instance_data, pre_create_data): "parent_instance_id": parenting_data["instance_id"], "label": (f"{shot_folder_path} " f"{creator.product_type}"), "creator_attributes": { - "parentInstance": parenting_data["label"], - "reviewableSource": sub_instance_data[ - "reviewableSource" - ], - "review": False, + "parentInstance": parenting_data["label"] }, } ) From e3c4acc3500d12e90b5b3ff09328761949955db0 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Fri, 8 Nov 2024 15:43:47 +0100 Subject: [PATCH 08/13] Refactor review visibility logic in creator attributes - Refactored logic for setting reviewable source visibility based on changes. --- .../plugins/create/create_shot_clip.py | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/client/ayon_hiero/plugins/create/create_shot_clip.py b/client/ayon_hiero/plugins/create/create_shot_clip.py index c94d6e5..62470c7 100644 --- a/client/ayon_hiero/plugins/create/create_shot_clip.py +++ b/client/ayon_hiero/plugins/create/create_shot_clip.py @@ -189,22 +189,23 @@ def _on_value_change(self, event): continue changes = item["changes"].get("creator_attributes", {}) - print(changes) attr_defs = instance.creator_attributes.attr_defs - if "review" in changes: - review_value = changes["review"] - reviewable_source = next( - attr_def - for attr_def in attr_defs - if attr_def.key == "reviewableSource" - ) + if "review" not in changes: + continue - if review_value: - reviewable_source.visible = True - else: - reviewable_source.visible = False + review_value = changes["review"] + reviewable_source = next( + attr_def + for attr_def in attr_defs + if attr_def.key == "reviewableSource" + ) + + if review_value: + reviewable_source.visible = True + else: + reviewable_source.visible = False instance.set_create_attr_defs(attr_defs) From a81eb8f8bfc54b7233617316d954c7ca77420c7b Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Fri, 8 Nov 2024 15:45:11 +0100 Subject: [PATCH 09/13] Refactor code to simplify setting visibility of reviewable source. - Simplified logic for setting visibility of reviewable source based on review value. --- client/ayon_hiero/plugins/create/create_shot_clip.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/client/ayon_hiero/plugins/create/create_shot_clip.py b/client/ayon_hiero/plugins/create/create_shot_clip.py index 62470c7..c63dd5b 100644 --- a/client/ayon_hiero/plugins/create/create_shot_clip.py +++ b/client/ayon_hiero/plugins/create/create_shot_clip.py @@ -201,11 +201,7 @@ def _on_value_change(self, event): for attr_def in attr_defs if attr_def.key == "reviewableSource" ) - - if review_value: - reviewable_source.visible = True - else: - reviewable_source.visible = False + reviewable_source.visible = review_value instance.set_create_attr_defs(attr_defs) From 7c69d92bd912a24b644f83c220c59ad2fde36f65 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Fri, 8 Nov 2024 15:51:37 +0100 Subject: [PATCH 10/13] Fix comparison operator for review source in PublishClip class Changed the comparison operator from "is not" to "!=" for checking if the review source is different from the default. --- client/ayon_hiero/api/plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_hiero/api/plugin.py b/client/ayon_hiero/api/plugin.py index 8d2c9c1..ce906c4 100644 --- a/client/ayon_hiero/api/plugin.py +++ b/client/ayon_hiero/api/plugin.py @@ -871,7 +871,7 @@ def _convert_to_tag_data(self): if hero_track or self.vertical_sync: # mark review layer if self.review_source and ( - self.review_source is not self.review_source_default): + self.review_source != self.review_source_default): # if review layer is defined and not the same as default self.reviewable_source = self.review_source # shot num calculate From 7d4323b49d974f450af101039a27882067b6f2b9 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Fri, 8 Nov 2024 15:56:30 +0100 Subject: [PATCH 11/13] Update source selection tooltip for reviewable files Adjusted tooltip description for selecting source of reviewable files. --- client/ayon_hiero/plugins/create/create_shot_clip.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/client/ayon_hiero/plugins/create/create_shot_clip.py b/client/ayon_hiero/plugins/create/create_shot_clip.py index c63dd5b..0797a4e 100644 --- a/client/ayon_hiero/plugins/create/create_shot_clip.py +++ b/client/ayon_hiero/plugins/create/create_shot_clip.py @@ -239,8 +239,7 @@ def get_attr_defs_for_instance(self, instance): "reviewableSource", label="Reviewable Source", tooltip=( - "Generate preview videos on fly, if '< none >' " - "is defined nothing will be generated." + "Selecting source for reviewable files." ), items=( [ From cc94470bf6b52169bad0c4fac2d063609cbfdc07 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Tue, 12 Nov 2024 16:11:23 +0100 Subject: [PATCH 12/13] Add backward compatibility for reviewableSource (2024.11.08) In the PublishClip class, implemented a check to maintain backward compatibility for the "reviewableSource" tag metadata by handling the "reviewTrack" key appropriately when present in the data. --- client/ayon_hiero/api/plugin.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/client/ayon_hiero/api/plugin.py b/client/ayon_hiero/api/plugin.py index ce906c4..bc98d2f 100644 --- a/client/ayon_hiero/api/plugin.py +++ b/client/ayon_hiero/api/plugin.py @@ -856,6 +856,7 @@ def _convert_to_tag_data(self): # adding tag metadata from ui for _key, _value in self.pre_create_data.items(): + # backward compatibility for reviewableSource (2024.11.08) if ( _key == "reviewableSource" and "reviewTrack" in self.tag_keys @@ -863,8 +864,6 @@ def _convert_to_tag_data(self): self.tag_data.pop("reviewTrack") self.tag_data["reviewableSource"] = _value if _key in self.tag_keys: - # backward compatibility for reviewableSource (2024.11.08) - self.tag_data[_key] = _value # driving layer is set as positive match From 32799aa91615a77f7496fe856c19f1bbdee99282 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Tue, 12 Nov 2024 16:14:48 +0100 Subject: [PATCH 13/13] Update reviewable source visibility and disable state based on review value. Refactor tooltip formatting. --- client/ayon_hiero/plugins/create/create_shot_clip.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/client/ayon_hiero/plugins/create/create_shot_clip.py b/client/ayon_hiero/plugins/create/create_shot_clip.py index 0797a4e..05f6383 100644 --- a/client/ayon_hiero/plugins/create/create_shot_clip.py +++ b/client/ayon_hiero/plugins/create/create_shot_clip.py @@ -201,7 +201,7 @@ def _on_value_change(self, event): for attr_def in attr_defs if attr_def.key == "reviewableSource" ) - reviewable_source.visible = review_value + reviewable_source.disabled = not review_value instance.set_create_attr_defs(attr_defs) @@ -238,9 +238,7 @@ def get_attr_defs_for_instance(self, instance): EnumDef( "reviewableSource", label="Reviewable Source", - tooltip=( - "Selecting source for reviewable files." - ), + tooltip=("Selecting source for reviewable files."), items=( [ { @@ -250,7 +248,7 @@ def get_attr_defs_for_instance(self, instance): ] + gui_tracks ), - visible=current_review, + disabled=not current_review, ), ] )