1
$\begingroup$

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?

$\endgroup$
4
  • $\begingroup$ How to append a menu: blender.stackexchange.com/questions/152525/… $\endgroup$ – tintwotin Oct 19 '20 at 21:04
  • $\begingroup$ Can you clarify a bit? Do you intend to copy strips between two Blender instances (you started Blender 2x, load a different project in each instance, and want to copy from one project to another) In that case, you should try with the operation of File > Append) . Or do you want to copy strips between scenes in one project? $\endgroup$ – Husch Oct 21 '20 at 9:22
  • $\begingroup$ i have two separate projects that I'm working on in two separate VSE windows. I want to be able to copy a clip or image from one project and paste into the other project. And i am using the same version/patch for both. $\endgroup$ – blenderuser001 Oct 21 '20 at 16:32
  • $\begingroup$ For more code examples for the VSE: blenderartists.org/t/video-sequence-editor-news-add-ons/1188770 $\endgroup$ – tintwotin Oct 25 '20 at 13:44
0
$\begingroup$

The keyword you need is SEQUENCER_MT_context_menu.

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).

The blender docs for bpy.types.Menu say:

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

Other 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.

Blender 2.93

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.