In all the tutorials considering custom (pie) menus there’s always one operation assigned for a given (pie) menu slot.
But I want to make a (pie) menu that executes a series of operations by the click of one button.
So I don’t want a (pie) menu where I have a slot “Add Cube”, one slot “Toggle Edit Mode” and one slot “Subdivide”, like
class VIEW3D_PIE_template(Menu):
# label is displayed at the center of the pie menu.
bl_label = "Select Mode"
def draw(self, context):
layout = self.layout
pie = layout.menu_pie()
pie.operator("bpy.ops.mesh.primitive_cube_add(size=2)")
pie.operator("bpy.ops.object.editmode_toggle()")
pie.operator("bpy.ops.mesh.subdivide()")
)
I want one automated process where I click the button and it will “add a cube, change to edit mode and subdevide the cube” all in one go, like
def foo():
pie.operator("bpy.ops.mesh.primitive_cube_add(size=2)")
pie.operator("bpy.ops.object.editmode_toggle()")
pie.operator("bpy.ops.mesh.subdivide()")
class VIEW3D_PIE_template(Menu):
# label is displayed at the center of the pie menu.
bl_label = "Select Mode"
def draw(self, context):
layout = self.layout
pie = layout.menu_pie()
pie.operator("foo()")
)
if that makes sense. I know the above example is technically wrong, it’s just to illustrate what my desired functionallity is.
Of course my usecase is a little more complex than this example but I wanna know about the general concept of using custom functions in a (pie) menu.
Since I haven’t found anything about that in the “Make a custom menu” tutorials and I don’t know what to search for any further, any help is appreciated.