Skip to main content
added 6 characters in body
Source Link
tintwotin
  • 2.5k
  • 10
  • 24

There doesn't seem to be a casecontext-sensitive "Specials" menu for the Sequencer(like shortcut key 'w' in 3d View). How do I add one to the Sequencer with python scripting?

(I know about the "Add" menu in the sequencer, and options can be added to this one, but I need a new menu only containing casecontext-sensitive editing options. Ex. if there is a gap between two strips at the mouse cursor position, then a "Remove gap" option would become selectable in the menu.)

This is where I am at the moment(menu containing the add menu options):

import bpy
from bpy.types import Menu

class SEQUENCER_MT_edit(Menu):
    bl_label = "Edit"
    bl_idname = "sequencer.edit_menu"                        # ID name of the class that code will call, lowercase
    def draw(self, context):
        layout = self.layout

        layout.operator_context = 'INVOKE_REGION_WIN'

        layout.operator("sequencer.movie_strip_add", text="Movie") # Example options
        layout.operator("sequencer.image_strip_add", text="Image")
        layout.operator("sequencer.sound_strip_add", text="Sound")

        layout.menu("SEQUENCER_MT_add_effect")

addon_keymaps = []
def register():
    bpy.utils.register_class(SEQUENCER_MT_edit)

    # handle the keymap
    wm = bpy.context.window_manager
    kc = wm.keyconfigs.addon
    if kc:
        km = wm.keyconfigs.addon.keymaps.new(name='Sequencer', space_type='SEQUENCE_EDITOR')
        km = wm.keyconfigs.addon.keymaps.new(name='3D View', space_type='VIEW_3D')
        kmi = km.keymap_items.new(SEQUENCER_MT_edit.bl_idname, type='RIGHTMOUSE', value='PRESS', shift=True)
        addon_keymaps.append((km, kmi))

def unregister():

    for km, kmi in addon_keymaps:
        km.keymap_items.remove(kmi)
    addon_keymaps.clear()

    bpy.utils.unregister_class(SEQUENCER_MT_edit)


if __name__ == "__main__":
    register()

There doesn't seem to be a case-sensitive "Specials" menu for the Sequencer(like shortcut key 'w' in 3d View). How do I add one to the Sequencer with python scripting?

(I know about the "Add" menu in the sequencer, and options can be added to this one, but I need a new menu only containing case-sensitive editing options. Ex. if there is a gap between two strips at the mouse cursor position, then a "Remove gap" option would become selectable in the menu.)

This is where I am at the moment(menu containing the add menu options):

import bpy
from bpy.types import Menu

class SEQUENCER_MT_edit(Menu):
    bl_label = "Edit"
    bl_idname = "sequencer.edit_menu"                        # ID name of the class that code will call, lowercase
    def draw(self, context):
        layout = self.layout

        layout.operator_context = 'INVOKE_REGION_WIN'

        layout.operator("sequencer.movie_strip_add", text="Movie") # Example options
        layout.operator("sequencer.image_strip_add", text="Image")
        layout.operator("sequencer.sound_strip_add", text="Sound")

        layout.menu("SEQUENCER_MT_add_effect")

addon_keymaps = []
def register():
    bpy.utils.register_class(SEQUENCER_MT_edit)

    # handle the keymap
    wm = bpy.context.window_manager
    kc = wm.keyconfigs.addon
    if kc:
        km = wm.keyconfigs.addon.keymaps.new(name='Sequencer', space_type='SEQUENCE_EDITOR')
        km = wm.keyconfigs.addon.keymaps.new(name='3D View', space_type='VIEW_3D')
        kmi = km.keymap_items.new(SEQUENCER_MT_edit.bl_idname, type='RIGHTMOUSE', value='PRESS', shift=True)
        addon_keymaps.append((km, kmi))

def unregister():

    for km, kmi in addon_keymaps:
        km.keymap_items.remove(kmi)
    addon_keymaps.clear()

    bpy.utils.unregister_class(SEQUENCER_MT_edit)


if __name__ == "__main__":
    register()

There doesn't seem to be a context-sensitive "Specials" menu for the Sequencer(like shortcut key 'w' in 3d View). How do I add one to the Sequencer with python scripting?

(I know about the "Add" menu in the sequencer, and options can be added to this one, but I need a new menu only containing context-sensitive editing options. Ex. if there is a gap between two strips at the mouse cursor position, then a "Remove gap" option would become selectable in the menu.)

This is where I am at the moment(menu containing the add menu options):

import bpy
from bpy.types import Menu

class SEQUENCER_MT_edit(Menu):
    bl_label = "Edit"
    bl_idname = "sequencer.edit_menu"                        # ID name of the class that code will call, lowercase
    def draw(self, context):
        layout = self.layout

        layout.operator_context = 'INVOKE_REGION_WIN'

        layout.operator("sequencer.movie_strip_add", text="Movie") # Example options
        layout.operator("sequencer.image_strip_add", text="Image")
        layout.operator("sequencer.sound_strip_add", text="Sound")

        layout.menu("SEQUENCER_MT_add_effect")

addon_keymaps = []
def register():
    bpy.utils.register_class(SEQUENCER_MT_edit)

    # handle the keymap
    wm = bpy.context.window_manager
    kc = wm.keyconfigs.addon
    if kc:
        km = wm.keyconfigs.addon.keymaps.new(name='Sequencer', space_type='SEQUENCE_EDITOR')
        km = wm.keyconfigs.addon.keymaps.new(name='3D View', space_type='VIEW_3D')
        kmi = km.keymap_items.new(SEQUENCER_MT_edit.bl_idname, type='RIGHTMOUSE', value='PRESS', shift=True)
        addon_keymaps.append((km, kmi))

def unregister():

    for km, kmi in addon_keymaps:
        km.keymap_items.remove(kmi)
    addon_keymaps.clear()

    bpy.utils.unregister_class(SEQUENCER_MT_edit)


if __name__ == "__main__":
    register()
added 20 characters in body
Source Link
tintwotin
  • 2.5k
  • 10
  • 24

There doesn't seem to be a case-sensitive "Specials" menu for the Sequencer(like shortcut key 'w' in 3d View). How do I add one to the Sequencer with python scripting?

(I know about the "Add" menu in the sequencer, and options can be added to this one, but I need a new menu only containing case-sensitive editing options. Ex. if there is a gap between two strips at the mouse cursor position, then a "Remove gap" option would become selectable in the menu.)

This is where I am at the moment(menu containing the add menu options):

import bpy
from bpy.types import Menu

class SEQUENCER_MT_edit(Menu):
    bl_label = "Edit"
    bl_idname = "sequencer.edit_menu"                        # ID name of the class that code will call, lowercase
    def draw(self, context):
        layout = self.layout

        layout.operator_context = 'INVOKE_REGION_WIN'

        layout.operator("sequencer.movie_strip_add", text="Movie") # Example options
        layout.operator("sequencer.image_strip_add", text="Image")
        layout.operator("sequencer.sound_strip_add", text="Sound")

        layout.menu("SEQUENCER_MT_add_effect")

addon_keymaps = []
def register():
    bpy.utils.register_class(SEQUENCER_MT_edit)

    # handle the keymap
    wm = bpy.context.window_manager
    kc = wm.keyconfigs.addon
    if kc:
        km = wm.keyconfigs.addon.keymaps.new(name='Sequencer', space_type='SEQUENCE_EDITOR')
        km = wm.keyconfigs.addon.keymaps.new(name='3D View', space_type='VIEW_3D')
        kmi = km.keymap_items.new(SEQUENCER_MT_edit.bl_idname, type='RIGHTMOUSE', value='PRESS', shift=True)
        addon_keymaps.append((km, kmi))

def unregister():

    for km, kmi in addon_keymaps:
        km.keymap_items.remove(kmi)
    addon_keymaps.clear()

    bpy.utils.unregister_class(SEQUENCER_MT_edit)


if __name__ == "__main__":
    register()

There doesn't seem to be a case-sensitive "Specials" menu for the Sequencer(like shortcut key 'w' in 3d View). How do I add one to the Sequencer with python scripting?

(I know about the "Add" menu in the sequencer, and options can be added to this one, but I need a new menu only containing case-sensitive editing options. Ex. if there is a gap between two strips at the mouse cursor position, then a "Remove gap" option would become selectable in the menu.)

This is where I am at the moment(menu containing the add menu options):

import bpy
from bpy.types import Menu

class SEQUENCER_MT_edit(Menu):
    bl_label = "Edit"
    bl_idname = "sequencer.edit_menu"                        # ID name of the class that code will call, lowercase
    def draw(self, context):
        layout = self.layout

        layout.operator_context = 'INVOKE_REGION_WIN'

        layout.operator("sequencer.movie_strip_add", text="Movie") # Example options
        layout.operator("sequencer.image_strip_add", text="Image")
        layout.operator("sequencer.sound_strip_add", text="Sound")

        layout.menu("SEQUENCER_MT_add_effect")

def register():
    bpy.utils.register_class(SEQUENCER_MT_edit)

    # handle the keymap
    wm = bpy.context.window_manager
    kc = wm.keyconfigs.addon
    if kc:
        km = wm.keyconfigs.addon.keymaps.new(name='Sequencer', space_type='SEQUENCE_EDITOR')
        km = wm.keyconfigs.addon.keymaps.new(name='3D View', space_type='VIEW_3D')
        kmi = km.keymap_items.new(SEQUENCER_MT_edit.bl_idname, type='RIGHTMOUSE', value='PRESS', shift=True)
        addon_keymaps.append((km, kmi))

def unregister():

    for km, kmi in addon_keymaps:
        km.keymap_items.remove(kmi)
    addon_keymaps.clear()

    bpy.utils.unregister_class(SEQUENCER_MT_edit)


if __name__ == "__main__":
    register()

There doesn't seem to be a case-sensitive "Specials" menu for the Sequencer(like shortcut key 'w' in 3d View). How do I add one to the Sequencer with python scripting?

(I know about the "Add" menu in the sequencer, and options can be added to this one, but I need a new menu only containing case-sensitive editing options. Ex. if there is a gap between two strips at the mouse cursor position, then a "Remove gap" option would become selectable in the menu.)

This is where I am at the moment(menu containing the add menu options):

import bpy
from bpy.types import Menu

class SEQUENCER_MT_edit(Menu):
    bl_label = "Edit"
    bl_idname = "sequencer.edit_menu"                        # ID name of the class that code will call, lowercase
    def draw(self, context):
        layout = self.layout

        layout.operator_context = 'INVOKE_REGION_WIN'

        layout.operator("sequencer.movie_strip_add", text="Movie") # Example options
        layout.operator("sequencer.image_strip_add", text="Image")
        layout.operator("sequencer.sound_strip_add", text="Sound")

        layout.menu("SEQUENCER_MT_add_effect")

addon_keymaps = []
def register():
    bpy.utils.register_class(SEQUENCER_MT_edit)

    # handle the keymap
    wm = bpy.context.window_manager
    kc = wm.keyconfigs.addon
    if kc:
        km = wm.keyconfigs.addon.keymaps.new(name='Sequencer', space_type='SEQUENCE_EDITOR')
        km = wm.keyconfigs.addon.keymaps.new(name='3D View', space_type='VIEW_3D')
        kmi = km.keymap_items.new(SEQUENCER_MT_edit.bl_idname, type='RIGHTMOUSE', value='PRESS', shift=True)
        addon_keymaps.append((km, kmi))

def unregister():

    for km, kmi in addon_keymaps:
        km.keymap_items.remove(kmi)
    addon_keymaps.clear()

    bpy.utils.unregister_class(SEQUENCER_MT_edit)


if __name__ == "__main__":
    register()
deleted 893 characters in body
Source Link
tintwotin
  • 2.5k
  • 10
  • 24
import bpy
from bpy.types import Menu

class SEQUENCER_MT_edit(Menu):
    bl_label = "Edit"
    bl_idname = "sequencer.edit_menu"                        # ID name of the class that code will call, lowercase
    def draw(self, context):
        layout = self.layout

        layout.operator_context = 'INVOKE_REGION_WIN'

        if len(bpy.data.scenes) > 10:
            layout.operator_context = 'INVOKE_DEFAULT'
            layout.operator("sequencer.scene_strip_add", text="Scene...")
        else:
            layout.operator_menu_enum("sequencer.scene_strip_add", "scene", text="Scene")

        if len(bpy.data.movieclips) > 10:
            layout.operator_context = 'INVOKE_DEFAULT'
            layout.operator("sequencer.movieclip_strip_add", text="Clips...")
        else:
            layout.operator_menu_enum("sequencer.movieclip_strip_add", "clip", text="Clip")

        if len(bpy.data.masks) > 10:
            layout.operator_context = 'INVOKE_DEFAULT'
            layout.operator("sequencer.mask_strip_add", text="Masks...")
        else:
            layout.operator_menu_enum("sequencer.mask_strip_add", "mask"movie_strip_add", text="Mask"text="Movie")

       # layout.operator("sequencer.movie_strip_add",Example text="Movie")options
        layout.operator("sequencer.image_strip_add", text="Image")
        layout.operator("sequencer.sound_strip_add", text="Sound")

        layout.menu("SEQUENCER_MT_add_effect")

def register():
    bpy.utils.register_class(SEQUENCER_MT_edit)

    # handle the keymap
    wm = bpy.context.window_manager
    kc = wm.keyconfigs.addon
    if kc:
        km = wm.keyconfigs.addon.keymaps.new(name='Sequencer', space_type='SEQUENCE_EDITOR')
        km = wm.keyconfigs.addon.keymaps.new(name='3D View', space_type='VIEW_3D')
        kmi = km.keymap_items.new(SEQUENCER_MT_edit.bl_idname, type='RIGHTMOUSE', value='PRESS', shift=True)
        addon_keymaps.append((km, kmi))

def unregister():

    for km, kmi in addon_keymaps:
        km.keymap_items.remove(kmi)
    addon_keymaps.clear()

    bpy.utils.unregister_class(SEQUENCER_MT_edit)


if __name__ == "__main__":
    register()
import bpy
from bpy.types import Menu

class SEQUENCER_MT_edit(Menu):
    bl_label = "Edit"
    bl_idname = "sequencer.edit_menu"                        # ID name of the class that code will call, lowercase
    def draw(self, context):
        layout = self.layout

        layout.operator_context = 'INVOKE_REGION_WIN'

        if len(bpy.data.scenes) > 10:
            layout.operator_context = 'INVOKE_DEFAULT'
            layout.operator("sequencer.scene_strip_add", text="Scene...")
        else:
            layout.operator_menu_enum("sequencer.scene_strip_add", "scene", text="Scene")

        if len(bpy.data.movieclips) > 10:
            layout.operator_context = 'INVOKE_DEFAULT'
            layout.operator("sequencer.movieclip_strip_add", text="Clips...")
        else:
            layout.operator_menu_enum("sequencer.movieclip_strip_add", "clip", text="Clip")

        if len(bpy.data.masks) > 10:
            layout.operator_context = 'INVOKE_DEFAULT'
            layout.operator("sequencer.mask_strip_add", text="Masks...")
        else:
            layout.operator_menu_enum("sequencer.mask_strip_add", "mask", text="Mask")

        layout.operator("sequencer.movie_strip_add", text="Movie")
        layout.operator("sequencer.image_strip_add", text="Image")
        layout.operator("sequencer.sound_strip_add", text="Sound")

        layout.menu("SEQUENCER_MT_add_effect")

def register():
    bpy.utils.register_class(SEQUENCER_MT_edit)

    # handle the keymap
    wm = bpy.context.window_manager
    kc = wm.keyconfigs.addon
    if kc:
        km = wm.keyconfigs.addon.keymaps.new(name='Sequencer', space_type='SEQUENCE_EDITOR')
        km = wm.keyconfigs.addon.keymaps.new(name='3D View', space_type='VIEW_3D')
        kmi = km.keymap_items.new(SEQUENCER_MT_edit.bl_idname, type='RIGHTMOUSE', value='PRESS', shift=True)
        addon_keymaps.append((km, kmi))

def unregister():

    for km, kmi in addon_keymaps:
        km.keymap_items.remove(kmi)
    addon_keymaps.clear()

    bpy.utils.unregister_class(SEQUENCER_MT_edit)


if __name__ == "__main__":
    register()
import bpy
from bpy.types import Menu

class SEQUENCER_MT_edit(Menu):
    bl_label = "Edit"
    bl_idname = "sequencer.edit_menu"                        # ID name of the class that code will call, lowercase
    def draw(self, context):
        layout = self.layout

        layout.operator_context = 'INVOKE_REGION_WIN'

        layout.operator("sequencer.movie_strip_add", text="Movie") # Example options
        layout.operator("sequencer.image_strip_add", text="Image")
        layout.operator("sequencer.sound_strip_add", text="Sound")

        layout.menu("SEQUENCER_MT_add_effect")

def register():
    bpy.utils.register_class(SEQUENCER_MT_edit)

    # handle the keymap
    wm = bpy.context.window_manager
    kc = wm.keyconfigs.addon
    if kc:
        km = wm.keyconfigs.addon.keymaps.new(name='Sequencer', space_type='SEQUENCE_EDITOR')
        km = wm.keyconfigs.addon.keymaps.new(name='3D View', space_type='VIEW_3D')
        kmi = km.keymap_items.new(SEQUENCER_MT_edit.bl_idname, type='RIGHTMOUSE', value='PRESS', shift=True)
        addon_keymaps.append((km, kmi))

def unregister():

    for km, kmi in addon_keymaps:
        km.keymap_items.remove(kmi)
    addon_keymaps.clear()

    bpy.utils.unregister_class(SEQUENCER_MT_edit)


if __name__ == "__main__":
    register()
added 2460 characters in body
Source Link
tintwotin
  • 2.5k
  • 10
  • 24
Loading
added 4 characters in body
Source Link
tintwotin
  • 2.5k
  • 10
  • 24
Loading
Source Link
tintwotin
  • 2.5k
  • 10
  • 24
Loading