update media operator

This commit is contained in:
2024-12-19 16:15:34 +01:00
parent 2690a197c6
commit 23093a72e7
2 changed files with 33 additions and 2 deletions
+30 -1
View File
@@ -10,7 +10,7 @@ from vse_toolbox.sequencer_utils import (get_strips, rename_strips, set_channels
create_shot_strip)
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
@@ -695,6 +695,34 @@ class VSETB_OT_merge_shot_strips(Operator):
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 = []
def register_keymaps():
addon = bpy.context.window_manager.keyconfigs.addon
@@ -739,6 +767,7 @@ classes = (
VSETB_OT_insert_channel,
VSETB_OT_remove_channel,
VSETB_OT_merge_shot_strips,
VSETB_OT_update_media,
WM_OT_split_view,
)