fix otio, remove double clips
parent
17f3e0c71b
commit
84a5b93387
|
@ -217,6 +217,7 @@ class VSETB_OT_export_edl(Operator):
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
opentimelineio = install_module('opentimelineio')
|
opentimelineio = install_module('opentimelineio')
|
||||||
|
opentimelineio = install_module('opentimelineio-plugins')
|
||||||
|
|
||||||
from opentimelineio.schema import (Clip, Timeline, Track, ExternalReference)
|
from opentimelineio.schema import (Clip, Timeline, Track, ExternalReference)
|
||||||
from opentimelineio.opentime import (RationalTime, TimeRange)
|
from opentimelineio.opentime import (RationalTime, TimeRange)
|
||||||
|
|
|
@ -356,7 +356,7 @@ def import_edit(filepath, adapter="cmx_3600", channel='Shots', match_by='name'):
|
||||||
# Get all video clips only
|
# Get all video clips only
|
||||||
clips = []
|
clips = []
|
||||||
for track in timeline.tracks:
|
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...
|
# FIXME Exclude Gaps for now. Gaps are Transitions, Blank Spaces...
|
||||||
if not isinstance(child, Clip):
|
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):
|
if any(child.name.lower().endswith(ext) for ext in SOUND_SUFFIXES):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if [c for c in clips if child.range_in_parent() == c.range_in_parent()]:
|
||||||
|
continue
|
||||||
|
|
||||||
clips.append(child)
|
clips.append(child)
|
||||||
|
|
||||||
clips.sort(key=lambda x: x.range_in_parent().start_time)
|
clips.sort(key=lambda x: x.range_in_parent().start_time)
|
||||||
|
|
||||||
|
|
||||||
for i, clip in enumerate(clips):
|
for i, clip in enumerate(clips):
|
||||||
|
#print(clip)
|
||||||
|
|
||||||
frame_start = opentimelineio.opentime.to_frames(
|
frame_start = opentimelineio.opentime.to_frames(
|
||||||
clip.range_in_parent().start_time)
|
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}')
|
print(f'No strip found for {clip.name}')
|
||||||
|
|
||||||
if strip:
|
if strip:
|
||||||
|
#print('Strip already existing', clip)
|
||||||
if frame_start != strip.frame_final_start or frame_end !=strip.frame_final_end:
|
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')
|
print(f'The strip {strip.name} is updated with new range')
|
||||||
#self.report({'INFO'}, 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
|
strip.frame_final_end = frame_end
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print('Create a new strip')
|
print('Create a new strip', clip)
|
||||||
strip = sequencer.new_effect(
|
strip = sequencer.new_effect(
|
||||||
name=clip.name,
|
name=clip.name,
|
||||||
type='COLOR',
|
type='COLOR',
|
||||||
|
|
Loading…
Reference in New Issue