mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-02 00:44:52 +01:00
create_timeline_item with backward comapatibility
This commit is contained in:
parent
3bbc3d0489
commit
435408dc14
2 changed files with 21 additions and 13 deletions
|
|
@ -261,10 +261,10 @@ def create_timeline_item(
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
media_pool_item (resolve.MediaPoolItem): resolve's object
|
media_pool_item (resolve.MediaPoolItem): resolve's object
|
||||||
source_start (int): media source input frame (sequence frame)
|
timeline (Optional[resolve.Timeline]): resolve's object
|
||||||
source_end (int): media source output frame (sequence frame)
|
timeline_in (Optional[int]): timeline input frame (sequence frame)
|
||||||
timeline_in (int): timeline input frame (sequence frame)
|
source_start (Optional[int]): media source input frame (sequence frame)
|
||||||
timeline (resolve.Timeline)[optional]: resolve's object
|
source_end (Optional[int]): media source output frame (sequence frame)
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
object: resolve.TimelineItem
|
object: resolve.TimelineItem
|
||||||
|
|
@ -277,21 +277,29 @@ def create_timeline_item(
|
||||||
timeline = timeline or get_current_timeline()
|
timeline = timeline or get_current_timeline()
|
||||||
|
|
||||||
# timing variables
|
# timing variables
|
||||||
fps = project.GetSetting("timelineFrameRate")
|
if all([timeline_in, source_start, source_end]):
|
||||||
duration = source_end - source_start
|
fps = project.GetSetting("timelineFrameRate")
|
||||||
timecode_in = frames_to_timecode(timeline_in, fps)
|
duration = source_end - source_start
|
||||||
timecode_out = frames_to_timecode(timeline_in + duration, fps)
|
timecode_in = frames_to_timecode(timeline_in, fps)
|
||||||
|
timecode_out = frames_to_timecode(timeline_in + duration, fps)
|
||||||
|
else:
|
||||||
|
timecode_in = None
|
||||||
|
timecode_out = None
|
||||||
|
|
||||||
# if timeline was used then switch it to current timeline
|
# if timeline was used then switch it to current timeline
|
||||||
with maintain_current_timeline(timeline):
|
with maintain_current_timeline(timeline):
|
||||||
# Add input mediaPoolItem to clip data
|
# Add input mediaPoolItem to clip data
|
||||||
clip_data = {
|
clip_data = {
|
||||||
"mediaPoolItem": media_pool_item,
|
"mediaPoolItem": media_pool_item,
|
||||||
"startFrame": source_start,
|
|
||||||
"endFrame": source_end,
|
|
||||||
"recordFrame": timeline_in,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if source_start:
|
||||||
|
clip_data["startFrame"] = source_start
|
||||||
|
if source_end:
|
||||||
|
clip_data["endFrame"] = source_end
|
||||||
|
if timecode_in:
|
||||||
|
clip_data["recordFrame"] = timecode_in
|
||||||
|
|
||||||
# add to timeline
|
# add to timeline
|
||||||
media_pool.AppendToTimeline([clip_data])
|
media_pool.AppendToTimeline([clip_data])
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -434,10 +434,10 @@ class ClipLoader:
|
||||||
# make track item from source in bin as item
|
# make track item from source in bin as item
|
||||||
timeline_item = lib.create_timeline_item(
|
timeline_item = lib.create_timeline_item(
|
||||||
media_pool_item,
|
media_pool_item,
|
||||||
|
self.active_timeline,
|
||||||
|
timeline_in,
|
||||||
source_in,
|
source_in,
|
||||||
source_out,
|
source_out,
|
||||||
timeline_in,
|
|
||||||
self.active_timeline,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
print("Loading clips: `{}`".format(self.data["clip_name"]))
|
print("Loading clips: `{}`".format(self.data["clip_name"]))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue