Skip to content

Commit

Permalink
Merge pull request #36 from ynput/enhancement/reviewable_source
Browse files Browse the repository at this point in the history
AY-6253_Report review changes from Hiero to Flame
  • Loading branch information
jakubjezek001 authored Dec 5, 2024
2 parents 3ac263e + 7b3c2f9 commit 6e0e676
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 41 deletions.
51 changes: 37 additions & 14 deletions client/ayon_flame/api/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class PublishableClip:
rename_default = False
hierarchy_default = "{_folder_}/{_sequence_}/{_track_}"
clip_name_default = "shot_{_trackIndex_:0>3}_{_clipIndex_:0>4}"
review_track_default = "< none >"
review_source_default = None
base_product_variant_default = "<track_name>"
count_from_default = 10
count_steps_default = 10
Expand Down Expand Up @@ -167,8 +167,8 @@ 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
Expand Down Expand Up @@ -200,11 +200,6 @@ def convert(self):
}
})

if self.marker_data["heroTrack"] and self.review_layer:
self.marker_data["reviewTrack"] = self.review_layer
else:
self.marker_data["reviewTrack"] = "< none >"

return self.current_segment

def _populate_segment_default_data(self):
Expand Down Expand Up @@ -253,8 +248,8 @@ def _populate_attributes(self):
"vSyncOn") or self.vertical_sync_default
self.driving_layer = self.pre_create_data.get(
"vSyncTrack") or self.driving_layer_default
self.review_track = self.pre_create_data.get(
"reviewTrack") or self.review_track_default
self.review_source = self.pre_create_data.get(
"reviewableSource") or self.review_source_default
self.audio = self.pre_create_data.get("audio") or False
self.include_handles = self.pre_create_data.get(
"includeHandles") or self.include_handles_default
Expand Down Expand Up @@ -297,7 +292,7 @@ def _convert_to_marker_data(self):
"""
# define vertical sync attributes
hero_track = True
self.review_layer = ""
self.reviewable_source = ""

if (
self.vertical_sync and
Expand All @@ -317,13 +312,18 @@ def _convert_to_marker_data(self):

if self.pre_create_data:

# backward compatibility for reviewableSource (2024.12.02)
if "reviewTrack" in self.pre_create_data:
_value = self.marker_data.pop("reviewTrack")
self.marker_data["reviewableSource"] = _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 != 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.index_from_segment:
Expand Down Expand Up @@ -435,6 +435,29 @@ def _convert_to_marker_data(self):
# add data to return data dict
self.marker_data.update(tag_hierarchy_data)

# add review track only to hero track
if hero_track and self.reviewable_source:
self.marker_data["reviewTrack"] = self.reviewable_source
else:
self.marker_data["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.marker_data["review"] = True
else:
self.marker_data.pop("review", None)

self.marker_data["reviewableSource"] = reviewable_source


def _solve_tag_hierarchy_data(self, hierarchy_formatting_data):
""" Solve marker data from hierarchy data and templates. """
# fill up clip name and hierarchy keys
Expand Down
57 changes: 37 additions & 20 deletions client/ayon_flame/plugins/create/create_shot_clip.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def _on_value_change(self, event):
reviewable_source = next(
attr_def
for attr_def in attr_defs
if attr_def.key == "reviewTrack"
if attr_def.key == "reviewableSource"
)
reviewable_source.enabled = review_value

Expand All @@ -227,7 +227,10 @@ def get_attr_defs_for_instance(self, instance):

current_sequence = lib.get_current_sequence(lib.CTX.selection)
if current_sequence is not None:
gui_tracks = get_video_track_names(current_sequence)
gui_tracks = [
{"value": tr_name, "label": f"Track: {tr_name}"}
for tr_name in get_video_track_names(current_sequence)
]
else:
gui_tracks = []

Expand All @@ -250,11 +253,19 @@ def get_attr_defs_for_instance(self, instance):
default=False,
),
EnumDef(
"reviewTrack",
label="Review Track",
tooltip=("Selecting source from review tracks."),
items=gui_tracks,
enabled=current_review,
"reviewableSource",
label="Reviewable Source",
tooltip=("Selecting source for reviewable files."),
items=(
[
{
"value": "clip_media",
"label": "[ Clip's media ]",
},
]
+ gui_tracks
),
disabled=not current_review,
),
]
)
Expand Down Expand Up @@ -318,7 +329,10 @@ def header_label(text):

current_sequence = lib.get_current_sequence(lib.CTX.selection)
if current_sequence is not None:
gui_tracks = get_video_track_names(current_sequence)
gui_tracks = [
{"value": tr_name, "label": f"Track: {tr_name}"}
for tr_name in get_video_track_names(current_sequence)
]
else:
gui_tracks = []

Expand Down Expand Up @@ -460,11 +474,14 @@ def header_label(text):
items=['plate', 'take'],
),
EnumDef(
"reviewTrack",
label="Use Review Track",
tooltip="Generate preview videos on fly, if "
"'< none >' is defined nothing will be generated.",
items=['< none >'] + gui_tracks,
"reviewableSource",
label="Reviewable Source",
tooltip="Select source for reviewable files.",
items=[
{"value": None, "label": "< none >"},
{"value": "clip_media", "label": "[ Clip's media ]"},
]
+ gui_tracks,
),
BoolDef(
"export_audio",
Expand Down Expand Up @@ -614,10 +631,10 @@ def create(self, product_name, instance_data, pre_create_data):

# Create new product(s) instances.
clip_instances = {}
# desable shot creator if heroTrack is not enabled
# disable shot creator if heroTrack is not enabled
all_creators[shot_creator_id] = segment_instance_data.get(
"heroTrack", False)
# desable audio creator if audio is not enabled
# disable audio creator if audio is not enabled
all_creators[audio_creator_id] = (
segment_instance_data.get("heroTrack", False) and
pre_create_data.get("export_audio", False)
Expand Down Expand Up @@ -680,10 +697,10 @@ def create(self, product_name, instance_data, pre_create_data):
}
})
# add reviewable source to plate if shot has it
if sub_instance_data.get("reviewTrack"):
if sub_instance_data.get("reviewableSource"):
sub_instance_data["creator_attributes"].update({
"reviewTrack": sub_instance_data[
"reviewTrack"],
"reviewableSource": sub_instance_data[
"reviewableSource"],
"review": True,
})

Expand Down Expand Up @@ -804,9 +821,9 @@ def _collect_legacy_instance(self, segment, marker_data):
})

# add reviewable source to plate if shot has it
if sub_instance_data.get("reviewTrack") != "< none >":
if sub_instance_data.get("reviewableSource") != "< none >":
sub_instance_data["creator_attributes"].update({
"reviewTrack": sub_instance_data[
"reviewableSource": sub_instance_data[
"reviewTrack"],
"review": True,
})
Expand Down
20 changes: 13 additions & 7 deletions client/ayon_flame/plugins/publish/collect_plate.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,22 @@ def process(self, instance):

instance.data["otioClip"] = otio_clip

# solve reviewable options
review_switch = instance.data["creator_attributes"].get(
"review")
review_track = instance.data["creator_attributes"].get(
"reviewTrack")

reviewable_source = instance.data["creator_attributes"].get(
"reviewableSource")

if review_switch is True:
if reviewable_source == "clip_media":
instance.data["families"].append("review")
instance.data.pop("reviewTrack", None)
else:
instance.data["reviewTrack"] = reviewable_source

# remove creator-specific review keys from instance data
instance.data.pop("reviewableSource", None)
instance.data.pop("review", None)
if review_switch:
instance.data["reviewTrack"] = review_track
else:
instance.data.pop("reviewTrack", None)

# Retrieve instance data from parent instance shot instance.
parent_instance_id = instance.data["parent_instance_id"]
Expand Down

0 comments on commit 6e0e676

Please sign in to comment.