fix refacto
parent
0ebde5f713
commit
f9384c3d89
|
@ -43,7 +43,7 @@ class VSETB_OT_load_settings(Operator):
|
|||
project = settings.active_project
|
||||
|
||||
if not prefs.config_path:
|
||||
return
|
||||
return {'FINISHED'}
|
||||
|
||||
addon_config = read_file(os.path.expandvars(prefs.config_path))
|
||||
|
||||
|
|
|
@ -166,7 +166,7 @@ class VSETB_OT_export_spreadsheet(Operator):
|
|||
spreadsheet = project.spreadsheet_export
|
||||
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 = []
|
||||
|
||||
# Header
|
||||
|
|
|
@ -101,7 +101,7 @@ def rename_strips(
|
|||
sequence_name = get_strip_sequence_name(strip)
|
||||
|
||||
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
|
||||
|
||||
name = template.format(
|
||||
|
@ -239,9 +239,9 @@ def render_strips(strips, template):
|
|||
scn.render.filepath = render_path
|
||||
|
||||
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,
|
||||
ExternalReference,
|
||||
Gap,
|
||||
|
@ -254,13 +254,9 @@ def import_edit(filepath, adapter="cmx_3600", channel='Shots'):
|
|||
scn = bpy.context.scene
|
||||
sequencer = scn.sequence_editor.sequences
|
||||
|
||||
if clear:
|
||||
for strip in get_strips(channel='Shots'):
|
||||
sequencer.remove(strip)
|
||||
|
||||
edl = Path(filepath)
|
||||
try:
|
||||
timeline = otio.adapters.read_from_file(
|
||||
timeline = opentimelineio.adapters.read_from_file(
|
||||
str(edl), adapter, rate=scn.render.fps, ignore_timecode_mismatch=True)
|
||||
except:
|
||||
print("[>.] read_from_file Failed. Using read_from_string method.")
|
||||
|
@ -284,17 +280,18 @@ def import_edit(filepath, adapter="cmx_3600", channel='Shots'):
|
|||
continue
|
||||
|
||||
channel = get_channel_index('Shots')
|
||||
frame_start = otio.opentime.to_frames(
|
||||
frame_start = opentimelineio.opentime.to_frames(
|
||||
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)
|
||||
|
||||
try:
|
||||
strip = next((s for s in sequencer.sequences if s.vsetb_strip_settings.source_name == child.name))
|
||||
#try:
|
||||
strip = next((s for s in sequencer if s.vsetb_strip_settings.source_name == child.name), None)
|
||||
if strip:
|
||||
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_end = frame_end
|
||||
|
@ -311,9 +308,9 @@ def import_edit(filepath, adapter="cmx_3600", channel='Shots'):
|
|||
strip.select = False
|
||||
strip.vsetb_strip_settings.source_name = child.name
|
||||
|
||||
except Exception as e:
|
||||
print('e: ', e)
|
||||
continue
|
||||
#except Exception as e:
|
||||
# print('e: ', e)
|
||||
# continue
|
||||
|
||||
scn.frame_end = frame_end-1
|
||||
return timeline
|
||||
|
@ -377,23 +374,28 @@ def clean_sequencer(edit=False, movie=False, sound=False):
|
|||
|
||||
@persistent
|
||||
def set_active_strip(scene):
|
||||
#scn = bpy.context.scene
|
||||
settings = get_scene_settings()
|
||||
|
||||
if not settings.auto_select_strip:
|
||||
scn = bpy.context.scene
|
||||
if not scn.sequence_editor:
|
||||
return
|
||||
|
||||
bpy.ops.sequencer.select_all(action="DESELECT")
|
||||
if not get_scene_settings().auto_select_strip:
|
||||
return
|
||||
|
||||
|
||||
#scene.sequence_editor.active_strip = None
|
||||
|
||||
shot_strip = get_strip_at('Shots')
|
||||
if shot_strip:
|
||||
bpy.ops.sequencer.select_all(action="DESELECT")
|
||||
shot_strip.select = True
|
||||
scene.sequence_editor.active_strip = shot_strip
|
||||
|
||||
@persistent
|
||||
def update_text_strips(scene):
|
||||
#scn = bpy.context.scene
|
||||
scn = bpy.context.scene
|
||||
if not scn.sequence_editor:
|
||||
return
|
||||
|
||||
format_data = {
|
||||
'scene': scene,
|
||||
'active_shot_name': 'None',
|
||||
|
|
|
@ -280,6 +280,8 @@ class VSETB_PT_metadata(VSETB_main, Panel):
|
|||
if metadata_type.entity_type == 'SHOT':
|
||||
row = layout.row(align=False)
|
||||
metadata_key = metadata_type.field_name
|
||||
metadata_label = metadata_key.upper()
|
||||
|
||||
if metadata_type.choices:
|
||||
metadata_value = getattr(strip_settings.metadata, metadata_key)
|
||||
icon = 'LAYER_USED'
|
||||
|
@ -289,11 +291,11 @@ class VSETB_PT_metadata(VSETB_main, Panel):
|
|||
else:
|
||||
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)
|
||||
|
||||
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
|
||||
|
||||
|
|
Loading…
Reference in New Issue