Add Remove MoveUp-Down for Casting

This commit is contained in:
2023-03-17 20:03:38 +01:00
parent 4dc52b1268
commit 538c0bf60a
7 changed files with 332 additions and 57 deletions
+33 -3
View File
@@ -3,9 +3,11 @@
import bpy
import re
from bpy.app.handlers import persistent
from pathlib import Path
from vse_toolbox.bl_utils import get_settings
def get_strips(channel=0, selected_only=False):
scn = bpy.context.scene
@@ -115,7 +117,6 @@ def import_edit(filepath, adapter="cmx_3600", clean_sequencer=False):
0 if timeline.global_start_time is None else timeline.global_start_time
)
# scn.frame_end = otio.opentime.to_frames(timeline.duration())
for track in timeline.tracks:
for child in track.each_child(shallow_search=True):
@@ -145,6 +146,7 @@ def import_edit(filepath, adapter="cmx_3600", clean_sequencer=False):
frame_end=frame_end,
)
strip.blend_alpha = 0.0
strip.select = False
except Exception as e:
print('e: ', e)
@@ -195,7 +197,6 @@ def import_sound(filepath):
strip.show_waveform = True
return strip
def clean_sequencer(edit=False, movie=False, sound=False):
scn = bpy.context.scene
sequences = []
@@ -208,4 +209,33 @@ def clean_sequencer(edit=False, movie=False, sound=False):
sequences.extend(get_strips('Audio'))
for sequence in sequences:
scn.sequence_editor.sequences.remove(sequence)
scn.sequence_editor.sequences.remove(sequence)
@persistent
def get_active_strip(scene):
scn = bpy.context.scene
settings = get_settings()
if settings.auto_select_strip == False:
return
screen = bpy.context.screen
bpy.ops.sequencer.select_all(action="DESELECT")
strip = None
frame_current = scn.frame_current
strips = bpy.context.sequences
strips = sorted(strips,key=lambda x: (x.channel, x.frame_final_start))
for strip in strips:
#FIXME Pas propre de mettre le channel name en dur
if strip.channel != get_channel('Shots') or 0:
continue
if (not strip.lock
and strip.frame_final_end >= frame_current
and strip.frame_final_start <= frame_current):
strip.select = True
scn.sequence_editor.active_strip = strip