import movie replace and fix
parent
4a3042030f
commit
0ebde5f713
|
@ -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()
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ import bpy
|
|||
from bpy.app.handlers import persistent
|
||||
|
||||
from vse_toolbox.bl_utils import get_scene_settings, get_strip_settings
|
||||
from vse_toolbox.file_utils import install_module
|
||||
from vse_toolbox.constants import SOUND_SUFFIXES
|
||||
#import multiprocessing
|
||||
#from multiprocessing.pool import ThreadPool
|
||||
|
@ -237,9 +238,10 @@ def render_strips(strips, template):
|
|||
scn.frame_end = scene_end
|
||||
scn.render.filepath = render_path
|
||||
|
||||
def import_edit(filepath, adapter="cmx_3600", clear=False):
|
||||
import opentimelineio as otio
|
||||
from opentimelineio.schema import (
|
||||
def import_edit(filepath, adapter="cmx_3600", channel='Shots'):
|
||||
otio = install_module('opentimelineio')
|
||||
|
||||
from otio.schema import (
|
||||
Clip,
|
||||
ExternalReference,
|
||||
Gap,
|
||||
|
@ -297,7 +299,7 @@ def import_edit(filepath, adapter="cmx_3600", clear=False):
|
|||
strip.frame_final_start = frame_start
|
||||
strip.frame_final_end = frame_end
|
||||
else:
|
||||
strip = sequences.new_effect(
|
||||
strip = sequencer.new_effect(
|
||||
name=child.name,
|
||||
type='COLOR',
|
||||
channel=channel,
|
||||
|
|
Loading…
Reference in New Issue