import movie replace and fix

This commit is contained in:
Christophe SEUX
2023-05-03 09:15:22 +02:00
parent 4a3042030f
commit 0ebde5f713
2 changed files with 25 additions and 12 deletions
+19 -8
View File
@@ -6,9 +6,10 @@ from bpy.types import Operator
from bpy.props import (CollectionProperty, BoolProperty, EnumProperty, StringProperty)
from vse_toolbox.constants import (EDITS, EDIT_SUFFIXES, MOVIES, MOVIE_SUFFIXES,
SOUNDS, SOUND_SUFFIXES)
SOUNDS, SOUND_SUFFIXES)
from vse_toolbox.sequencer_utils import (clean_sequencer, import_edit, import_movie, import_sound)
from vse_toolbox.sequencer_utils import (clean_sequencer, import_edit, import_movie,
import_sound, get_strips)
from vse_toolbox.bl_utils import get_scene_settings
from vse_toolbox.file_utils import install_module
@@ -27,7 +28,7 @@ class VSETB_OT_auto_select_files(Operator):
def get_items(self, items=[]):
if not items:
return [('NONE', 'None', '', 0)]
return [(e, e, '', i) for i, e in enumerate(sorted(items))]
return [(e, e, '', i) for i, e in enumerate(items)]
def execute(self, context):
params = context.space_data.params
@@ -52,6 +53,10 @@ class VSETB_OT_auto_select_files(Operator):
elif file_entry.suffix in SOUND_SUFFIXES:
sounds.append(file_entry.name)
edits.sort(reverse=True)
movies.sort(reverse=True)
sounds.sort(reverse=True)
EDITS.extend(self.get_items(items=edits))
MOVIES.extend(self.get_items(items=movies))
SOUNDS.extend(self.get_items(items=sounds))
@@ -130,7 +135,7 @@ class VSETB_OT_import_files(Operator):
return {'RUNNING_MODAL'}
def execute(self, context):
otio = install_module('opentimelineio')
sequencer = context.scene.sequence_editor.sequences
edit_filepath = Path(self.directory, self.edit)
if not edit_filepath.exists():
@@ -153,18 +158,24 @@ class VSETB_OT_import_files(Operator):
if self.import_edit:
print(f'[>.] Loading Edit from: {str(edit_filepath)}')
import_edit(edit_filepath, adapter="cmx_3600")
if self.import_movie:
print(f'[>.] Loading Movie from: {str(movie_filepath)}')
for strip in get_strips(channel='Movie'):
sequencer.remove(strip)
import_movie(movie_filepath)
if self.import_sound:
if self.import_sound or (not self.import_sound and self.import_movie):
print(f'[>.] Loading Audio from: {str(sound_filepath)}')
for strip in get_strips(channel='Audio'):
sequencer.remove(strip)
import_sound(sound_filepath)
elif not self.import_sound and self.import_movie:
print(f'[>.] Loading Audio from Movie: {str(movie_filepath)}')
import_sound(movie_filepath)
context.scene.sequence_editor.sequences.update()