fix refacto
parent
0ebde5f713
commit
f9384c3d89
|
@ -43,7 +43,7 @@ class VSETB_OT_load_settings(Operator):
|
||||||
project = settings.active_project
|
project = settings.active_project
|
||||||
|
|
||||||
if not prefs.config_path:
|
if not prefs.config_path:
|
||||||
return
|
return {'FINISHED'}
|
||||||
|
|
||||||
addon_config = read_file(os.path.expandvars(prefs.config_path))
|
addon_config = read_file(os.path.expandvars(prefs.config_path))
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ from bpy.types import Operator
|
||||||
from bpy.props import (BoolProperty, StringProperty)
|
from bpy.props import (BoolProperty, StringProperty)
|
||||||
|
|
||||||
from vse_toolbox.sequencer_utils import (get_strips, rename_strips, set_channels,
|
from vse_toolbox.sequencer_utils import (get_strips, rename_strips, set_channels,
|
||||||
get_channel_index, new_text_strip)
|
get_channel_index, new_text_strip)
|
||||||
|
|
||||||
from vse_toolbox.bl_utils import get_scene_settings
|
from vse_toolbox.bl_utils import get_scene_settings
|
||||||
|
|
||||||
|
|
|
@ -166,7 +166,7 @@ class VSETB_OT_export_spreadsheet(Operator):
|
||||||
spreadsheet = project.spreadsheet_export
|
spreadsheet = project.spreadsheet_export
|
||||||
episode = settings.active_episode
|
episode = settings.active_episode
|
||||||
|
|
||||||
cells = [cell for cell in project.spreadsheet if cell.enabled]
|
cells = [cell for cell in spreadsheet.cells if cell.enabled]
|
||||||
rows = []
|
rows = []
|
||||||
|
|
||||||
# Header
|
# Header
|
||||||
|
|
|
@ -101,7 +101,7 @@ def rename_strips(
|
||||||
sequence_name = get_strip_sequence_name(strip)
|
sequence_name = get_strip_sequence_name(strip)
|
||||||
|
|
||||||
if (by_sequence and prev_sequence_name and
|
if (by_sequence and prev_sequence_name and
|
||||||
sequence_name and sequence != prev_sequence_name):
|
sequence_name and sequence_name != prev_sequence_name):
|
||||||
strip_number = 0
|
strip_number = 0
|
||||||
|
|
||||||
name = template.format(
|
name = template.format(
|
||||||
|
@ -239,9 +239,9 @@ def render_strips(strips, template):
|
||||||
scn.render.filepath = render_path
|
scn.render.filepath = render_path
|
||||||
|
|
||||||
def import_edit(filepath, adapter="cmx_3600", channel='Shots'):
|
def import_edit(filepath, adapter="cmx_3600", channel='Shots'):
|
||||||
otio = install_module('opentimelineio')
|
opentimelineio = install_module('opentimelineio')
|
||||||
|
|
||||||
from otio.schema import (
|
from opentimelineio.schema import (
|
||||||
Clip,
|
Clip,
|
||||||
ExternalReference,
|
ExternalReference,
|
||||||
Gap,
|
Gap,
|
||||||
|
@ -254,13 +254,9 @@ def import_edit(filepath, adapter="cmx_3600", channel='Shots'):
|
||||||
scn = bpy.context.scene
|
scn = bpy.context.scene
|
||||||
sequencer = scn.sequence_editor.sequences
|
sequencer = scn.sequence_editor.sequences
|
||||||
|
|
||||||
if clear:
|
|
||||||
for strip in get_strips(channel='Shots'):
|
|
||||||
sequencer.remove(strip)
|
|
||||||
|
|
||||||
edl = Path(filepath)
|
edl = Path(filepath)
|
||||||
try:
|
try:
|
||||||
timeline = otio.adapters.read_from_file(
|
timeline = opentimelineio.adapters.read_from_file(
|
||||||
str(edl), adapter, rate=scn.render.fps, ignore_timecode_mismatch=True)
|
str(edl), adapter, rate=scn.render.fps, ignore_timecode_mismatch=True)
|
||||||
except:
|
except:
|
||||||
print("[>.] read_from_file Failed. Using read_from_string method.")
|
print("[>.] read_from_file Failed. Using read_from_string method.")
|
||||||
|
@ -284,36 +280,37 @@ def import_edit(filepath, adapter="cmx_3600", channel='Shots'):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
channel = get_channel_index('Shots')
|
channel = get_channel_index('Shots')
|
||||||
frame_start = otio.opentime.to_frames(
|
frame_start = opentimelineio.opentime.to_frames(
|
||||||
child.range_in_parent().start_time)
|
child.range_in_parent().start_time)
|
||||||
|
|
||||||
frame_end = frame_start + otio.opentime.to_frames(
|
frame_end = frame_start + opentimelineio.opentime.to_frames(
|
||||||
child.range_in_parent().duration)
|
child.range_in_parent().duration)
|
||||||
|
|
||||||
try:
|
#try:
|
||||||
strip = next((s for s in sequencer.sequences if s.vsetb_strip_settings.source_name == child.name))
|
strip = next((s for s in sequencer if s.vsetb_strip_settings.source_name == child.name), None)
|
||||||
if strip:
|
if strip:
|
||||||
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:
|
||||||
self.report({'INFO'}, 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')
|
||||||
|
|
||||||
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 = sequencer.new_effect(
|
strip = sequencer.new_effect(
|
||||||
name=child.name,
|
name=child.name,
|
||||||
type='COLOR',
|
type='COLOR',
|
||||||
channel=channel,
|
channel=channel,
|
||||||
frame_start=frame_start,
|
frame_start=frame_start,
|
||||||
frame_end=frame_end,
|
frame_end=frame_end,
|
||||||
)
|
)
|
||||||
|
|
||||||
strip.blend_alpha = 0.0
|
strip.blend_alpha = 0.0
|
||||||
strip.select = False
|
strip.select = False
|
||||||
strip.vsetb_strip_settings.source_name = child.name
|
strip.vsetb_strip_settings.source_name = child.name
|
||||||
|
|
||||||
except Exception as e:
|
#except Exception as e:
|
||||||
print('e: ', e)
|
# print('e: ', e)
|
||||||
continue
|
# continue
|
||||||
|
|
||||||
scn.frame_end = frame_end-1
|
scn.frame_end = frame_end-1
|
||||||
return timeline
|
return timeline
|
||||||
|
@ -377,23 +374,28 @@ def clean_sequencer(edit=False, movie=False, sound=False):
|
||||||
|
|
||||||
@persistent
|
@persistent
|
||||||
def set_active_strip(scene):
|
def set_active_strip(scene):
|
||||||
#scn = bpy.context.scene
|
scn = bpy.context.scene
|
||||||
settings = get_scene_settings()
|
if not scn.sequence_editor:
|
||||||
|
|
||||||
if not settings.auto_select_strip:
|
|
||||||
return
|
return
|
||||||
|
|
||||||
bpy.ops.sequencer.select_all(action="DESELECT")
|
if not get_scene_settings().auto_select_strip:
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
#scene.sequence_editor.active_strip = None
|
#scene.sequence_editor.active_strip = None
|
||||||
|
|
||||||
shot_strip = get_strip_at('Shots')
|
shot_strip = get_strip_at('Shots')
|
||||||
if shot_strip:
|
if shot_strip:
|
||||||
|
bpy.ops.sequencer.select_all(action="DESELECT")
|
||||||
shot_strip.select = True
|
shot_strip.select = True
|
||||||
scene.sequence_editor.active_strip = shot_strip
|
scene.sequence_editor.active_strip = shot_strip
|
||||||
|
|
||||||
@persistent
|
@persistent
|
||||||
def update_text_strips(scene):
|
def update_text_strips(scene):
|
||||||
#scn = bpy.context.scene
|
scn = bpy.context.scene
|
||||||
|
if not scn.sequence_editor:
|
||||||
|
return
|
||||||
|
|
||||||
format_data = {
|
format_data = {
|
||||||
'scene': scene,
|
'scene': scene,
|
||||||
'active_shot_name': 'None',
|
'active_shot_name': 'None',
|
||||||
|
|
|
@ -280,6 +280,8 @@ class VSETB_PT_metadata(VSETB_main, Panel):
|
||||||
if metadata_type.entity_type == 'SHOT':
|
if metadata_type.entity_type == 'SHOT':
|
||||||
row = layout.row(align=False)
|
row = layout.row(align=False)
|
||||||
metadata_key = metadata_type.field_name
|
metadata_key = metadata_type.field_name
|
||||||
|
metadata_label = metadata_key.upper()
|
||||||
|
|
||||||
if metadata_type.choices:
|
if metadata_type.choices:
|
||||||
metadata_value = getattr(strip_settings.metadata, metadata_key)
|
metadata_value = getattr(strip_settings.metadata, metadata_key)
|
||||||
icon = 'LAYER_USED'
|
icon = 'LAYER_USED'
|
||||||
|
@ -289,11 +291,11 @@ class VSETB_PT_metadata(VSETB_main, Panel):
|
||||||
else:
|
else:
|
||||||
icon = 'ADD'
|
icon = 'ADD'
|
||||||
|
|
||||||
row.prop_search(strip_settings.metadata, metadata_key, metadata_type, 'choices',
|
row.prop_search(strip_settings.metadata, metadata_label, metadata_type, 'choices',
|
||||||
results_are_suggestions=True, icon=icon)
|
results_are_suggestions=True, icon=icon)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
row.prop(strip_settings.metadata, metadata_key, text=metadata_key.upper())
|
row.prop(strip_settings.metadata, metadata_key, text=metadata_label)
|
||||||
|
|
||||||
#row.operator('vse_toolbox.copy_metadata', icon='PASTEDOWN', text='', emboss=False).metadata = metadata_key
|
#row.operator('vse_toolbox.copy_metadata', icon='PASTEDOWN', text='', emboss=False).metadata = metadata_key
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue