From 6f2191128dc6b8fc14a6ba419c4f5ffa848aa132 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Mon, 11 Dec 2023 10:42:34 +0100 Subject: [PATCH 1/3] Refactor create_editorial.py for better track handling - Refactored the code to filter tracks based on their kind being "Video" - Added a comment to clarify the purpose of media_data variable - Added a comment to explain setting track name - Removed an unnecessary blank line --- .../plugins/create/create_editorial.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/openpype/hosts/traypublisher/plugins/create/create_editorial.py b/openpype/hosts/traypublisher/plugins/create/create_editorial.py index dce4a051fd0..e6f29af40f7 100644 --- a/openpype/hosts/traypublisher/plugins/create/create_editorial.py +++ b/openpype/hosts/traypublisher/plugins/create/create_editorial.py @@ -381,15 +381,19 @@ def _get_clip_instances( """ self.asset_name_check = [] - tracks = otio_timeline.each_child( - descended_from_type=otio.schema.Track - ) + tracks = [ + track for track in otio_timeline.each_child( + descended_from_type=otio.schema.Track) + if track.kind == "Video" + ] - # media data for audio sream and reference solving + # media data for audio stream and reference solving media_data = self._get_media_source_metadata(media_path) for track in tracks: + # set track name track.name = f"{sequence_file_name} - {otio_timeline.name}" + try: track_start_frame = ( abs(track.source_range.start_time.value) @@ -398,7 +402,6 @@ def _get_clip_instances( except AttributeError: track_start_frame = 0 - for clip in track.each_child(): if not self._validate_clip_for_processing(clip): continue From fc179befc24469b39325e0ec12517263cb313410 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Mon, 11 Dec 2023 10:43:11 +0100 Subject: [PATCH 2/3] improving plugin label so it is easier to read --- openpype/plugins/publish/validate_resources.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openpype/plugins/publish/validate_resources.py b/openpype/plugins/publish/validate_resources.py index 7911c70c2d7..ce035154000 100644 --- a/openpype/plugins/publish/validate_resources.py +++ b/openpype/plugins/publish/validate_resources.py @@ -17,7 +17,7 @@ class ValidateResources(pyblish.api.InstancePlugin): """ order = ValidateContentsOrder - label = "Resources" + label = "Validate Resources" def process(self, instance): From 0bbe25fab1b7259c118c03f37748a4bc570eb530 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Mon, 29 Jan 2024 16:57:15 +0100 Subject: [PATCH 3/3] Refactor code for creating and publishing editorial clips - renaming variable to specify correctly value type - Added a condition in `collect_shot_instances.py` to check if the parent kind is "Video" before collecting shot instances. --- .../plugins/create/create_editorial.py | 13 +++++++------ .../plugins/publish/collect_shot_instances.py | 1 + 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/openpype/hosts/traypublisher/plugins/create/create_editorial.py b/openpype/hosts/traypublisher/plugins/create/create_editorial.py index e6f29af40f7..38986352543 100644 --- a/openpype/hosts/traypublisher/plugins/create/create_editorial.py +++ b/openpype/hosts/traypublisher/plugins/create/create_editorial.py @@ -402,18 +402,19 @@ def _get_clip_instances( except AttributeError: track_start_frame = 0 - for clip in track.each_child(): - if not self._validate_clip_for_processing(clip): + for otio_clip in track.each_child(): + if not self._validate_clip_for_processing(otio_clip): continue + # get available frames info to clip data - self._create_otio_reference(clip, media_path, media_data) + self._create_otio_reference(otio_clip, media_path, media_data) # convert timeline range to source range - self._restore_otio_source_range(clip) + self._restore_otio_source_range(otio_clip) base_instance_data = self._get_base_instance_data( - clip, + otio_clip, instance_data, track_start_frame ) @@ -432,7 +433,7 @@ def _get_clip_instances( continue instance = self._make_subset_instance( - clip, + otio_clip, _fpreset, deepcopy(base_instance_data), parenting_data diff --git a/openpype/hosts/traypublisher/plugins/publish/collect_shot_instances.py b/openpype/hosts/traypublisher/plugins/publish/collect_shot_instances.py index b99b634da17..43f65183744 100644 --- a/openpype/hosts/traypublisher/plugins/publish/collect_shot_instances.py +++ b/openpype/hosts/traypublisher/plugins/publish/collect_shot_instances.py @@ -79,6 +79,7 @@ def _get_otio_clip(self, instance): clip for clip in otio_timeline.each_child( descended_from_type=otio.schema.Clip) if clip.name == otio_clip.name + if clip.parent().kind == "Video" ] otio_clip = clips.pop()