import movie replace and fix
parent
4a3042030f
commit
0ebde5f713
|
@ -8,7 +8,8 @@ from bpy.props import (CollectionProperty, BoolProperty, EnumProperty, StringPro
|
||||||
from vse_toolbox.constants import (EDITS, EDIT_SUFFIXES, MOVIES, MOVIE_SUFFIXES,
|
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.bl_utils import get_scene_settings
|
||||||
from vse_toolbox.file_utils import install_module
|
from vse_toolbox.file_utils import install_module
|
||||||
|
@ -27,7 +28,7 @@ class VSETB_OT_auto_select_files(Operator):
|
||||||
def get_items(self, items=[]):
|
def get_items(self, items=[]):
|
||||||
if not items:
|
if not items:
|
||||||
return [('NONE', 'None', '', 0)]
|
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):
|
def execute(self, context):
|
||||||
params = context.space_data.params
|
params = context.space_data.params
|
||||||
|
@ -52,6 +53,10 @@ class VSETB_OT_auto_select_files(Operator):
|
||||||
elif file_entry.suffix in SOUND_SUFFIXES:
|
elif file_entry.suffix in SOUND_SUFFIXES:
|
||||||
sounds.append(file_entry.name)
|
sounds.append(file_entry.name)
|
||||||
|
|
||||||
|
edits.sort(reverse=True)
|
||||||
|
movies.sort(reverse=True)
|
||||||
|
sounds.sort(reverse=True)
|
||||||
|
|
||||||
EDITS.extend(self.get_items(items=edits))
|
EDITS.extend(self.get_items(items=edits))
|
||||||
MOVIES.extend(self.get_items(items=movies))
|
MOVIES.extend(self.get_items(items=movies))
|
||||||
SOUNDS.extend(self.get_items(items=sounds))
|
SOUNDS.extend(self.get_items(items=sounds))
|
||||||
|
@ -130,7 +135,7 @@ class VSETB_OT_import_files(Operator):
|
||||||
return {'RUNNING_MODAL'}
|
return {'RUNNING_MODAL'}
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
otio = install_module('opentimelineio')
|
sequencer = context.scene.sequence_editor.sequences
|
||||||
|
|
||||||
edit_filepath = Path(self.directory, self.edit)
|
edit_filepath = Path(self.directory, self.edit)
|
||||||
if not edit_filepath.exists():
|
if not edit_filepath.exists():
|
||||||
|
@ -153,18 +158,24 @@ class VSETB_OT_import_files(Operator):
|
||||||
|
|
||||||
if self.import_edit:
|
if self.import_edit:
|
||||||
print(f'[>.] Loading Edit from: {str(edit_filepath)}')
|
print(f'[>.] Loading Edit from: {str(edit_filepath)}')
|
||||||
|
|
||||||
import_edit(edit_filepath, adapter="cmx_3600")
|
import_edit(edit_filepath, adapter="cmx_3600")
|
||||||
|
|
||||||
if self.import_movie:
|
if self.import_movie:
|
||||||
print(f'[>.] Loading Movie from: {str(movie_filepath)}')
|
print(f'[>.] Loading Movie from: {str(movie_filepath)}')
|
||||||
|
|
||||||
|
for strip in get_strips(channel='Movie'):
|
||||||
|
sequencer.remove(strip)
|
||||||
|
|
||||||
import_movie(movie_filepath)
|
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)}')
|
print(f'[>.] Loading Audio from: {str(sound_filepath)}')
|
||||||
|
|
||||||
|
for strip in get_strips(channel='Audio'):
|
||||||
|
sequencer.remove(strip)
|
||||||
|
|
||||||
import_sound(sound_filepath)
|
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()
|
context.scene.sequence_editor.sequences.update()
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ import bpy
|
||||||
from bpy.app.handlers import persistent
|
from bpy.app.handlers import persistent
|
||||||
|
|
||||||
from vse_toolbox.bl_utils import get_scene_settings, get_strip_settings
|
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
|
from vse_toolbox.constants import SOUND_SUFFIXES
|
||||||
#import multiprocessing
|
#import multiprocessing
|
||||||
#from multiprocessing.pool import ThreadPool
|
#from multiprocessing.pool import ThreadPool
|
||||||
|
@ -237,9 +238,10 @@ def render_strips(strips, template):
|
||||||
scn.frame_end = scene_end
|
scn.frame_end = scene_end
|
||||||
scn.render.filepath = render_path
|
scn.render.filepath = render_path
|
||||||
|
|
||||||
def import_edit(filepath, adapter="cmx_3600", clear=False):
|
def import_edit(filepath, adapter="cmx_3600", channel='Shots'):
|
||||||
import opentimelineio as otio
|
otio = install_module('opentimelineio')
|
||||||
from opentimelineio.schema import (
|
|
||||||
|
from otio.schema import (
|
||||||
Clip,
|
Clip,
|
||||||
ExternalReference,
|
ExternalReference,
|
||||||
Gap,
|
Gap,
|
||||||
|
@ -297,7 +299,7 @@ def import_edit(filepath, adapter="cmx_3600", clear=False):
|
||||||
strip.frame_final_start = frame_start
|
strip.frame_final_start = frame_start
|
||||||
strip.frame_final_end = frame_end
|
strip.frame_final_end = frame_end
|
||||||
else:
|
else:
|
||||||
strip = sequences.new_effect(
|
strip = sequencer.new_effect(
|
||||||
name=child.name,
|
name=child.name,
|
||||||
type='COLOR',
|
type='COLOR',
|
||||||
channel=channel,
|
channel=channel,
|
||||||
|
|
Loading…
Reference in New Issue