fix otio, remove double clips

master
christophe.seux 2025-01-23 19:49:28 +01:00
parent 17f3e0c71b
commit 84a5b93387
2 changed files with 8 additions and 2 deletions

View File

@ -217,6 +217,7 @@ class VSETB_OT_export_edl(Operator):
def execute(self, context):
opentimelineio = install_module('opentimelineio')
opentimelineio = install_module('opentimelineio-plugins')
from opentimelineio.schema import (Clip, Timeline, Track, ExternalReference)
from opentimelineio.opentime import (RationalTime, TimeRange)

View File

@ -356,7 +356,7 @@ def import_edit(filepath, adapter="cmx_3600", channel='Shots', match_by='name'):
# Get all video clips only
clips = []
for track in timeline.tracks:
for child in track.each_child(shallow_search=True):
for child in track.find_clips(shallow_search=True):
# FIXME Exclude Gaps for now. Gaps are Transitions, Blank Spaces...
if not isinstance(child, Clip):
@ -366,12 +366,16 @@ def import_edit(filepath, adapter="cmx_3600", channel='Shots', match_by='name'):
if any(child.name.lower().endswith(ext) for ext in SOUND_SUFFIXES):
continue
if [c for c in clips if child.range_in_parent() == c.range_in_parent()]:
continue
clips.append(child)
clips.sort(key=lambda x: x.range_in_parent().start_time)
for i, clip in enumerate(clips):
#print(clip)
frame_start = opentimelineio.opentime.to_frames(
clip.range_in_parent().start_time)
@ -390,6 +394,7 @@ def import_edit(filepath, adapter="cmx_3600", channel='Shots', match_by='name'):
print(f'No strip found for {clip.name}')
if strip:
#print('Strip already existing', clip)
if frame_start != strip.frame_final_start or frame_end !=strip.frame_final_end:
print(f'The strip {strip.name} is updated with new range')
#self.report({'INFO'}, f'The strip {strip.name} is updated with new range')
@ -399,7 +404,7 @@ def import_edit(filepath, adapter="cmx_3600", channel='Shots', match_by='name'):
strip.frame_final_end = frame_end
else:
print('Create a new strip')
print('Create a new strip', clip)
strip = sequencer.new_effect(
name=clip.name,
type='COLOR',