1
$\begingroup$

How to code a working Pie Menu for the Sequencer? There has been coded pie menus for most elements in Blender, but not the Sequencer. I found this example, but it is not working for me. Nothing happens when pressing "S". Is the reason that it is not possible to do a pie menu for the sequencer?

import bpy
from bpy.types import Menu

# spawn a selection of tools for speeding up VSE workflow


#Select all strips to the left
class SelectAllToTheLeft(bpy.types.Operator):
    bl_idname = "sequencer.allleft"
    bl_label = "All strips to the left"

    def execute(self, context) : 
        bpy.ops.sequencer.select(left_right='LEFT', linked_time=True)
        return {'FINISHED'}



#Select all strips to the right
class SelectAllToTheRight(bpy.types.Operator):
    bl_idname = "sequencer.allright"
    bl_label = "All strips to the right"

    def execute(self, context) : 
        bpy.ops.sequencer.select(left_right='RIGHT', linked_time=True)
        return {'FINISHED'}

#Set current override camera as active camera in the viewport
class OverrideToActiveCamera(bpy.types.Operator):
    bl_idname = "sequencer.overrideactivecamera"
    bl_label = "Overide Camera to active"

    def execute(self, context) :
        print("coucou")
        return {"FINISHED"}


class VSE_PIE_riton(Menu):
    bl_idname = "pie.vsetools"
    bl_label = "VSE Tool"

    def draw(self, context):
        layout = self.layout

        pie = layout.menu_pie()

        pie.operator("sequencer.allleft", text = "All strips to the left", icon="BACK")
        pie.operator("sequencer.allright", text = "All strips to the right", icon="FORWARD")
        pie.operator("sequencer.reload", text = "Reload strips",icon="FILE_REFRESH")
        pie.operator("sequencer.overrideactivecamera", text = "Override to Active Camera", icon = "SCENE")


def register():
    #tools
    bpy.utils.register_class(SelectAllToTheLeft)
    bpy.utils.register_class(SelectAllToTheRight)
    bpy.utils.register_class(OverrideToActiveCamera)

    #pie
    bpy.utils.register_class(VSE_PIE_riton)

    wm = bpy.context.window_manager
    km = wm.keyconfigs.addon.keymaps.new(name="Sequencer")
    kmi = km.keymap_items.new("wm.call_menu_pie","S", "PRESS").properties.name="pie.vsetools"


def unregister():
    #tools
    bpy.utils.unregister_class(SelectAllToTheLeft)
    bpy.utils.unregister_class(SelectAllToTheRight)
    bpy.utils.unregister_class(OverrideToActiveCamera)

    #pie
    bpy.utils.unregister_class(VSE_PIE_riton)


if __name__ == "__main__":
    register()
$\endgroup$

1 Answer 1

2
$\begingroup$

Too many shortcuts in keymap def.

  • Define the space for keymap
  • Use keyword arguments to make sure they are assigned correctly.

edit:

wm = bpy.context.window_manager
km = wm.keyconfigs.addon.keymaps.new(name="Sequencer",
         space_type='SEQUENCE_EDITOR')
kmi = km.keymap_items.new("wm.call_menu_pie", 
        type="S", 
        value="PRESS")
kmi.properties.name = "pie.vsetools"
$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .