What would be the nicest way to code(in Python) a pie menu in Blender 2.79 or 2.8, that would have another menu as an addition to the standard 8 pie menu choices?

pie menu with an additional traditional menu beneath it


After playing with it for some time I found that this kind of works:

import bpy
from bpy.types import Menu
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("mesh.primitive_cube_add")
        pie.operator("mesh.primitive_cube_add")
        pie.operator("mesh.primitive_cube_add")
        pie.operator("mesh.primitive_cube_add")
        pie.operator("mesh.primitive_cube_add")
        pie.operator("mesh.primitive_cube_add")
        pie.operator("mesh.primitive_cube_add")
        pie.operator("mesh.primitive_cube_add")
        pie.separator()
        pie.separator()
        gap = pie.column()
        gap.separator()
        gap.separator()
        gap.separator()
        gap.separator()
        gap.separator()
        gap.separator()
        gap.separator()
        menu = gap.box()
        menu.scale_x = 2.5
        menu.operator("mesh.primitive_monkey_add")
        menu.operator("mesh.primitive_monkey_add")

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

def unregister():
    bpy.utils.unregister_class(VIEW3D_PIE_template)

if __name__ == "__main__":
    register()

    bpy.ops.wm.call_menu_pie(name="VIEW3D_PIE_template")

enter image description here

I wonder if there is a nicer way. This feels 'hacky' and it would be nice to have a menu that would have expandable sub-menus if that is possible at all. I realize that might be too much to wish for... Any advice?

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.