# SPDX-License-Identifier: GPL-2.0-or-later import bpy from bpy.types import Panel from vse_toolbox.bl_utils import get_addon_prefs, get_settings class VSETB_main: bl_space_type = "SEQUENCE_EDITOR" bl_region_type = "UI" bl_category = "VSE ToolBox" bl_label = "VSE ToolBox" class VSETB_PT_main(VSETB_main, Panel): def draw_header(self, context): layout = self.layout row = layout.row() row.operator('vse_toolbox.load_projects', icon='FILE_REFRESH', text='') def draw(self, context): wm = context.window_manager scn = context.scene settings = get_settings() prefs = get_addon_prefs() project = settings.active_project layout = self.layout col = layout.column() row = col.row(align=True) row.operator('scene.set_scene', text='Set Scene', icon='SCENE_DATA') row.prop(settings, 'toogle_prefs', text='', icon='PREFERENCES', toggle=True) if settings.toogle_prefs: box = col.box() box.use_property_split = True box.use_property_decorate = False box.prop(settings, 'project_name', text='Projects') if project: if project.episodes: box.prop(project, 'episode_name', text='Episodes') box.prop(project, 'shot_template') box.operator('vse_toolbox.new_episode', text='Add Episode', icon='IMPORT') # TODO FAIRE DES VRAIS OPS row = col.row(align=True) row.operator('sequencer.import', text='Import Edit', icon='IMPORT') row.operator('sequencer.export_csv', text='Export', icon='EXPORT') op = col.operator('sequencer.strips_render', text='Render Strips', icon='RENDER_ANIMATION') class VSETB_PT_rename(VSETB_main, Panel): bl_label = "Rename Strips" bl_parent_id = "VSETB_PT_main" def draw(self, context): prefs = get_addon_prefs() settings = get_settings() project = settings.active_project if not project: return episode = project.episode_name layout = self.layout col = layout.column() col.use_property_split = True row = col.row() shot_increment = project.shot_increment shot_template = project.shot_template.format( episode=episode, index=0 * shot_increment) row.separator() op = row.operator( 'sequencer.strips_rename', text='Rename Shots', icon='SORTALPHA') op.channel_name = 'Shots' op.template = project.shot_template op.increment = project.shot_increment op.start_number = 10 row.label(text=f'{shot_template}') #-# REGISTER classes=( VSETB_PT_main, VSETB_PT_rename, ) def register(): for cls in classes: bpy.utils.register_class(cls) def unregister(): for cls in reversed(classes): bpy.utils.unregister_class(cls)