I want to create an addon that will allow me to copy and paste video and image clips from one blender window(VSE) to another separately opened blender window(another VSE window). But I've been struggling with understanding how to code the operator for the task. Any tips or good examples on how to structure the code?
The keyword you need is
def menu_func(self, context): self.layout.operator(ScriptClassNameHere.bl_idname) def register(): bpy.utils.register_class(ScriptClassNameHere) bpy.types.SEQUENCER_MT_context_menu.append(menu_func) def unregister(): bpy.types.SEQUENCER_MT_context_menu.remove(menu_func) bpy.utils.unregister_class(ScriptClassNameHere)
How I found this out:
Opening up the right-click menu on the VSE lets me know it's called a "Sequencer Context Menu" (it's written at the top before any of the menu items).
Notice the ‘CATEGORY_MT_name’ in Menu.bl_idname, this is a naming convention for menus.
Maybe this is clear enough to Blender developers, but it took me a while. I couldn't find any documentation that lists these properly. What I did find is a Blender translation file where I looked up
_MT_ and eventually found
SEQUENCER_MT_context_menu, which worked after testing.
For posterity, here are some other Sequencer-related menus (
bpy.types.SEQUENCER_MT_*) in that file that would be useful for extending menus via add-ons:
add add_effect add_empty add_transitions change context_menu marker navigation preview_zoom proxy range select select_channel select_handle select_linked strip strip_effect strip_image_transform strip_input strip_lock_mute strip_movie strip_transform view view_cache
bpy.types. categories are:
CLIP COLLECTION CONSOLE DATA DOPESHEET FILEBROWSER GPENCIL GRAPH HAIR IMAGE INFO MASK MATERIAL MESH NLA NODE OUTLINER PARTICLE POINTCLOUD RENDER SEQUENCER TEXT TEXTURE TIME TOPBAR USERPREF VIEW3D WM
The rest of the code is taken straight out of The Blender Add-on Tutorial.