Slate support, duration fix, fps fix

This commit is contained in:
jrsndlr 2024-01-12 11:20:19 +01:00
parent 046154037b
commit e0e2cb06dd
2 changed files with 15 additions and 5 deletions

View file

@ -279,6 +279,10 @@ def create_timeline_item(
# timing variables
if all([timeline_in, source_start, source_end]):
fps = timeline.GetSetting("timelineFrameRate")
# Strangely, Resolve seem to output '23' instead of 23.976
if fps == '23':
fps = 23.976
duration = source_end - source_start
timecode_in = frames_to_timecode(timeline_in, fps)
timecode_out = frames_to_timecode(timeline_in + duration, fps)

View file

@ -408,7 +408,14 @@ class ClipLoader:
_clip_property = media_pool_item.GetClipProperty
source_in = int(_clip_property("Start"))
source_out = int(_clip_property("End"))
source_duration = int(_clip_property("Frames"))
# Trim clip start if slate is present
if "slate" in self.data["versionData"]["families"]:
print("LOAD: slate found ")
source_in += 1
print("LOAD media pool item source in slate : {}".format(source_in))
# Calculate source duration excluding slate
source_duration = source_out - source_in + 1
if not self.with_handles:
# Load file without the handles of the source media
@ -435,13 +442,12 @@ class ClipLoader:
handle_start = version_data.get("handleStart", 0)
handle_end = version_data.get("handleEnd", 0)
frame_start_handle = frame_start - handle_start
frame_end_handle = frame_start + handle_end
frame_end_handle = frame_end + handle_end
database_frame_duration = int(
frame_end_handle - frame_start_handle + 1
)
if source_duration >= database_frame_duration:
source_in += handle_start
source_out -= handle_end
source_in += handle_start
source_out -= handle_end
# get timeline in
timeline_start = self.active_timeline.GetStartFrame()