update media operator

master
florentin.luce 2024-12-19 16:15:34 +01:00
parent 2690a197c6
commit 23093a72e7
2 changed files with 33 additions and 2 deletions

View File

@ -10,7 +10,7 @@ from vse_toolbox.sequencer_utils import (get_strips, rename_strips, set_channels
create_shot_strip) create_shot_strip)
from vse_toolbox import auto_splitter from vse_toolbox import auto_splitter
from vse_toolbox.bl_utils import get_scene_settings, get_strip_settings from vse_toolbox.bl_utils import get_scene_settings, get_strip_settings, get_addon_prefs
from shutil import copy2 from shutil import copy2
@ -695,6 +695,34 @@ class VSETB_OT_merge_shot_strips(Operator):
return {"FINISHED"} return {"FINISHED"}
class VSETB_OT_update_media(Operator):
bl_idname = "vse_toolbox.update_media"
bl_label = "Update Media"
bl_description = "Update selected source"
bl_options = {"REGISTER", "UNDO"}
@classmethod
def poll(cls, context):
if context.active_sequence_strip .type not in ('MOVIE', 'SOUND'):
cls.poll_message_set('No active AUDIO or MOVIE strips')
return
prefs = get_addon_prefs()
if prefs.tracker:
return True
def execute(self, context):
for strip in context.selected_sequences:
current_movie = Path(abspath(bpy.path.abspath(strip.filepath)))
latest_file = sorted(list(current_movie.parent.glob('*.*')))[-1]
if latest_file != current_movie:
print(latest_file)
strip.filepath = str(latest_file)
return {'FINISHED'}
addon_keymaps = [] addon_keymaps = []
def register_keymaps(): def register_keymaps():
addon = bpy.context.window_manager.keyconfigs.addon addon = bpy.context.window_manager.keyconfigs.addon
@ -739,6 +767,7 @@ classes = (
VSETB_OT_insert_channel, VSETB_OT_insert_channel,
VSETB_OT_remove_channel, VSETB_OT_remove_channel,
VSETB_OT_merge_shot_strips, VSETB_OT_merge_shot_strips,
VSETB_OT_update_media,
WM_OT_split_view, WM_OT_split_view,
) )

View File

@ -447,8 +447,10 @@ class VSETB_MT_main_menu(Menu):
op.filepath = str(REVIEW_TEMPLATE_BLEND) op.filepath = str(REVIEW_TEMPLATE_BLEND)
layout.operator("wm.split_view", icon="ARROW_LEFTRIGHT") layout.operator("wm.split_view", icon="ARROW_LEFTRIGHT")
layout.operator('vse_toolbox.open_strip_folder', text='Open Strip Folder', icon='FILE_FOLDER') layout.separator()
layout.operator('vse_toolbox.update_media', text='Update Media', icon='FILE_REFRESH')
layout.operator('vse_toolbox.open_shot_on_tracker', text='Open Shot on Tracker', icon='URL') layout.operator('vse_toolbox.open_shot_on_tracker', text='Open Shot on Tracker', icon='URL')
layout.operator('vse_toolbox.open_strip_folder', text='Open Strip Folder', icon='FILE_FOLDER')
layout.separator() layout.separator()
layout.operator('vse_toolbox.insert_channel', text='Insert Channel', icon='TRIA_UP_BAR') layout.operator('vse_toolbox.insert_channel', text='Insert Channel', icon='TRIA_UP_BAR')
layout.operator('vse_toolbox.remove_channel', text='Remove Channel', icon='TRIA_DOWN_BAR') layout.operator('vse_toolbox.remove_channel', text='Remove Channel', icon='TRIA_DOWN_BAR')