Hi all,
I’m working on a pie menu to speed up my workflow with VSE and I struggle with several issues as it is my first pie menu.
I’ve followed Sebastian Koening tutorial to create the my own pie and decided to create my own operators to allow more customization in the future. (For now, I only try to get basic operation in the pie.)
Here is my code :
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()
So, as you can see, it is really simple and for now, nothing is really happening and I have only a simple operation in each of my custom operator (I’ll add several operation for each operator later on)
The thing is my operator are called from the pie menu, operators bpy.ops.sequencer.select(left_right=‘LEFT’, linked_time=True) and bpy.ops.sequencer.select(left_right=‘RIGHT’, linked_time=True) won’t work.
In the console, I have :
wm_operator_invoke: invalid operator call 'SEQUENCER_OT_select'
I’ve done some research with on google and this topic comes first but it doesn’t answer my problem. I’m a python newbie so I may do something terribly wrong here but I don’t know why.
If you know where I’m wrong, could you please help me ?
Thanks a lot