fix otio and refacto

pull/5/head
“christopheseux” 2023-05-04 11:32:36 +02:00
parent f9384c3d89
commit 706fcb2ee1
4 changed files with 25 additions and 17 deletions

View File

@ -170,12 +170,16 @@ class VSETB_OT_import_files(Operator):
import_movie(movie_filepath)
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)
if self.import_sound:
print(f'[>.] Loading Audio from: {str(sound_filepath)}')
import_sound(sound_filepath)
else:
print(f'[>.] Loading Audio from: {str(movie_filepath)}')
import_sound(movie_filepath)
context.scene.sequence_editor.sequences.update()

View File

@ -80,6 +80,7 @@ class VSETB_OT_rename(Operator):
return {"FINISHED"}
class VSETB_OT_show_waveform(Operator):
bl_idname = "vse_toolbox.show_waveform"
bl_label = "Show Waveform"
@ -156,12 +157,19 @@ class VSETB_OT_set_stamps(Operator):
bpy.ops.sequencer.select_all(action='DESELECT')
crop_x = int(scn.render.resolution_x * 0.4)
crop_max_y = int(scn.render.resolution_y * 0.96)
crop_min_y = int(scn.render.resolution_y * 0.01)
height = scn.render.resolution_y
width = scn.render.resolution_x
ratio = (height / 1080)
margin = 0.01
box_margin = 0.005
font_size = int(24*ratio)
crop_x = int(width * 0.4)
crop_max_y = int(height - font_size*2)
#crop_min_y = int(scn.render.resolution_y * 0.01)
stamp_params = dict(start=scn.frame_start, end=scn.frame_end,
font_size=22, y=0.015, box_margin=0.005, select=True, box_color=(0, 0, 0, 0.5))
font_size=font_size, y=margin, box_margin=box_margin, select=True, box_color=(0, 0, 0, 0.5))
# Project Name
project_strip_stamp = new_text_strip('project_name_stamp', channel=1, **stamp_params,
@ -169,7 +177,6 @@ class VSETB_OT_set_stamps(Operator):
project_strip_stamp.crop.max_x = crop_x * 2
project_strip_stamp.crop.max_y = crop_max_y
project_strip_stamp.crop.min_y = crop_min_y
# Shot Name
shot_strip_stamp = new_text_strip('shot_name_stamp', channel=2, **stamp_params,
@ -178,7 +185,6 @@ class VSETB_OT_set_stamps(Operator):
shot_strip_stamp.crop.min_x = crop_x
shot_strip_stamp.crop.max_x = crop_x
shot_strip_stamp.crop.max_y = crop_max_y
shot_strip_stamp.crop.min_y = crop_min_y
# Frame Range
frame_strip_stamp = new_text_strip('frame_range_stamp', channel=3, **stamp_params,
@ -186,7 +192,6 @@ class VSETB_OT_set_stamps(Operator):
frame_strip_stamp.crop.min_x = crop_x *2
frame_strip_stamp.crop.max_y = crop_max_y
frame_strip_stamp.crop.min_y = crop_min_y
bpy.ops.sequencer.meta_make()
stamps_strip = context.active_sequence_strip

View File

@ -261,7 +261,7 @@ def import_edit(filepath, adapter="cmx_3600", channel='Shots'):
except:
print("[>.] read_from_file Failed. Using read_from_string method.")
data = edl.read_text(encoding='latin-1')
timeline = otio.adapters.read_from_string(
timeline = opentimelineio.adapters.read_from_string(
data, adapter, rate=scn.render.fps, ignore_timecode_mismatch=True)
scn.frame_start = (

View File

@ -272,13 +272,12 @@ class VSETB_PT_metadata(VSETB_main, Panel):
if not project:
return
row = layout.row()
layout.prop(strip_settings, 'description', text='DESCRIPTION')
col = layout.column(align=True)
col.prop(strip_settings, 'description', text='DESCRIPTION')
#col = layout.column()
for metadata_type in project.metadata_types:
if metadata_type.entity_type == 'SHOT':
row = layout.row(align=False)
#row = layout.row(align=False)
metadata_key = metadata_type.field_name
metadata_label = metadata_key.upper()
@ -291,11 +290,11 @@ class VSETB_PT_metadata(VSETB_main, Panel):
else:
icon = 'ADD'
row.prop_search(strip_settings.metadata, metadata_label, metadata_type, 'choices',
results_are_suggestions=True, icon=icon)
col.prop_search(strip_settings.metadata, metadata_key, metadata_type, 'choices',
results_are_suggestions=True, icon=icon, text=metadata_label)
else:
row.prop(strip_settings.metadata, metadata_key, text=metadata_label)
col.prop(strip_settings.metadata, metadata_key, text=metadata_label)
#row.operator('vse_toolbox.copy_metadata', icon='PASTEDOWN', text='', emboss=False).metadata = metadata_key