From b3a39ddcc38e63787c143cfc01d702e35f4d0562 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Tue, 13 Feb 2024 10:55:17 +0100 Subject: [PATCH] feat: Copy ACES input transform from timeline clip to new media item This commit adds functionality to copy the ACES input transform from a timeline clip to a new media item. It retrieves the IDT (Input Device Transform) property from the timeline clip and sets it on the new media item. Also, it updates the ClipLoader class in plugin.py to read trimming information from the timeline item instead of using "Start" and "End" properties. The start time is calculated as the left offset of the timeline item, and the end time is calculated by adding the duration of the timeline item to its start time. These changes improve compatibility and ensure accurate copying of clips in Ayon Core Resolve API. --- client/ayon_core/hosts/resolve/api/lib.py | 5 +++++ client/ayon_core/hosts/resolve/api/plugin.py | 10 ++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/client/ayon_core/hosts/resolve/api/lib.py b/client/ayon_core/hosts/resolve/api/lib.py index 2c648bb4cc..ab4f30ac64 100644 --- a/client/ayon_core/hosts/resolve/api/lib.py +++ b/client/ayon_core/hosts/resolve/api/lib.py @@ -713,6 +713,11 @@ def swap_clips(from_clip, to_clip, to_in_frame, to_out_frame): bool: True if successfully replaced """ + # copy ACES input transform from timeline clip to new media item + mediapool_item_from_timeline = from_clip.GetMediaPoolItem() + _idt = mediapool_item_from_timeline.GetClipProperty('IDT') + to_clip.SetClipProperty('IDT', _idt) + _clip_prop = to_clip.GetClipProperty to_clip_name = _clip_prop("File Name") # add clip item as take to timeline diff --git a/client/ayon_core/hosts/resolve/api/plugin.py b/client/ayon_core/hosts/resolve/api/plugin.py index ccb20f712f..73a7409f68 100644 --- a/client/ayon_core/hosts/resolve/api/plugin.py +++ b/client/ayon_core/hosts/resolve/api/plugin.py @@ -477,14 +477,16 @@ class ClipLoader: ) _clip_property = media_pool_item.GetClipProperty - source_in = int(_clip_property("Start")) - source_out = int(_clip_property("End")) + # Read trimming from timeline item + timeline_item_in = timeline_item.GetLeftOffset() + timeline_item_len = timeline_item.GetDuration() + timeline_item_out = timeline_item_in + timeline_item_len lib.swap_clips( timeline_item, media_pool_item, - source_in, - source_out + timeline_item_in, + timeline_item_out ) print("Loading clips: `{}`".format(self.data["clip_name"]))