Pie Menus (official) Customization

@Bastien thanks for the origin example I was looking for it !

i just found the list of key names

‘A’, ‘B’, ‘C’, ‘D’, ‘E’, ‘F’, ‘G’, ‘H’, ‘I’, ‘J’, ‘K’, ‘L’, ‘M’,
‘N’, ‘O’, ‘P’, ‘Q’, ‘R’, ‘S’, ‘T’, ‘U’, ‘V’, ‘W’, ‘X’, ‘Y’, ‘Z’,

‘ZERO’, ‘ONE’, ‘TWO’, ‘THREE’, ‘FOUR’, ‘FIVE’, ‘SIX’, ‘SEVEN’, ‘EIGHT’, ‘NINE’,

‘NONE’, ‘LEFTMOUSE’, ‘MIDDLEMOUSE’, ‘RIGHTMOUSE’, ‘BUTTON4MOUSE’, ‘BUTTON5MOUSE’, ‘ACTIONMOUSE’, ‘SELECTMOUSE’, ‘MOUSEMOVE’,
‘INBETWEEN_MOUSEMOVE’, ‘TRACKPADPAN’, ‘TRACKPADZOOM’, ‘MOUSEROTATE’, ‘WHEELUPMOUSE’, ‘WHEELDOWNMOUSE’, ‘WHEELINMOUSE’, ‘WHEELOUTMOUSE’,
‘EVT_TWEAK_L’, ‘EVT_TWEAK_M’, ‘EVT_TWEAK_R’, ‘EVT_TWEAK_A’, ‘EVT_TWEAK_S’,

‘LEFT_CTRL’, ‘LEFT_ALT’, ‘LEFT_SHIFT’, ‘RIGHT_ALT’, ‘RIGHT_CTRL’, ‘RIGHT_SHIFT’, ‘OSKEY’, ‘GRLESS’, ‘ESC’, ‘TAB’, ‘RET’, ‘SPACE’,
‘LINE_FEED’,‘BACK_SPACE’, ‘DEL’, ‘SEMI_COLON’, ‘PERIOD’, ‘COMMA’, ‘QUOTE’, ‘ACCENT_GRAVE’, ‘MINUS’, ‘SLASH’, ‘BACK_SLASH’, ‘EQUAL’,
‘LEFT_BRACKET’, ‘RIGHT_BRACKET’, ‘LEFT_ARROW’, ‘DOWN_ARROW’, ‘RIGHT_ARROW’, ‘UP_ARROW’,

‘NUMPAD_2’, ‘NUMPAD_4’, ‘NUMPAD_6’, ‘NUMPAD_8’, ‘NUMPAD_1’, ‘NUMPAD_3’, ‘NUMPAD_5’, ‘NUMPAD_7’,
‘NUMPAD_9’, ‘NUMPAD_PERIOD’, ‘NUMPAD_SLASH’, ‘NUMPAD_ASTERIX’, ‘NUMPAD_0’, ‘NUMPAD_MINUS’, ‘NUMPAD_ENTER’, ‘NUMPAD_PLUS’,
‘F1’, ‘F2’, ‘F3’, ‘F4’, ‘F5’, ‘F6’, ‘F7’, ‘F8’, ‘F9’, ‘F10’, ‘F11’, ‘F12’, ‘F13’, ‘F14’, ‘F15’, ‘F16’, ‘F17’, ‘F18’, ‘F19’,

‘PAUSE’, ‘INSERT’, ‘HOME’, ‘PAGE_UP’, ‘PAGE_DOWN’, ‘END’, ‘MEDIA_PLAY’, ‘MEDIA_STOP’, ‘MEDIA_FIRST’, ‘MEDIA_LAST’, ‘TEXTINPUT’,
‘WINDOW_DEACTIVATE’,
‘TIMER’, ‘TIMER0’, ‘TIMER1’, ‘TIMER2’, ‘TIMER_JOBS’, ‘TIMER_AUTOSAVE’, ‘TIMER_REPORT’, ‘TIMER_REGION’,
‘NDOF_MOTION’,‘NDOF_BUTTON_MENU’, ‘NDOF_BUTTON_FIT’, ‘NDOF_BUTTON_TOP’, ‘NDOF_BUTTON_BOTTOM’, ‘NDOF_BUTTON_LEFT’, ‘NDOF_BUTTON_RIGHT’,
‘NDOF_BUTTON_FRONT’, ‘NDOF_BUTTON_BACK’, ‘NDOF_BUTTON_ISO1’, ‘NDOF_BUTTON_ISO2’, ‘NDOF_BUTTON_ROLL_CW’, ‘NDOF_BUTTON_ROLL_CCW’,
‘NDOF_BUTTON_SPIN_CW’,‘NDOF_BUTTON_SPIN_CCW’, ‘NDOF_BUTTON_TILT_CW’, ‘NDOF_BUTTON_TILT_CCW’, ‘NDOF_BUTTON_ROTATE’, ‘NDOF_BUTTON_PANZOOM’,
‘NDOF_BUTTON_DOMINANT’,‘NDOF_BUTTON_PLUS’, ‘NDOF_BUTTON_MINUS’, ‘NDOF_BUTTON_ESC’, ‘NDOF_BUTTON_ALT’, ‘NDOF_BUTTON_SHIFT’,
‘NDOF_BUTTON_CTRL’, ‘NDOF_BUTTON_1’, ‘NDOF_BUTTON_2’, ‘NDOF_BUTTON_3’, ‘NDOF_BUTTON_4’, ‘NDOF_BUTTON_5’, ‘NDOF_BUTTON_6’,
‘NDOF_BUTTON_7’, ‘NDOF_BUTTON_8’, ‘NDOF_BUTTON_9’,‘NDOF_BUTTON_10’, ‘NDOF_BUTTON_A’, ‘NDOF_BUTTON_B’, ‘NDOF_BUTTON_C’], default ‘NONE’

but dont’ see any lower case letters is this normal ?

also any example showing how to call a second level pie menu from an item in first menu ?

thanks

And maybe you have implemented the best two of them, amazing. Everyone had to try this! The C-key PM for example is a BLESSING!! No more Shift+S and/or the (sorry but… awful “shortcut”) Shift+Ctrl+Alt+C! And SOOOO FAST!!!

trying to do a pie menu to change view area type, I have it in a old script, the python to code to change the area is

bpy.context.area.type

and you set it to enum strings, like “VIEW_3D”

but can’t get it to bake a pie! … I was hoping

pie.operator_enum(“bpy.context.area”,“type”)

should spit out a huge pie with all the enums available for bpy.context.area

note,

bpy.context.area.type = “VIEW_3D” etc I think are a bit hacky, it’s not documented. Also why it wont work in the pie menues I think is because there’s not a operator to call to do this, only a “read-only” value to set. But it works in my other scripts.

I did a new pie menu option for quick edit of meshes

it is activated with the Slash key


you can add codes in pie script to test this




class VIEW3D_PIE_editquick1(Menu):        #    'BACK_SLASH'

    bl_label = "Quick-Edit"

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

        toolsettings = context.tool_settings
        pie = layout.menu_pie()
        
        if context.active_object:
        
            if(context.mode == 'EDIT_MESH'):
            
                pie.operator("MESH_OT_faces_shade_smooth")
                pie.operator("MESH_OT_faces_shade_flat")
                pie.operator("MESH_OT_flip_normals")
                pie.operator("MESH_OT_normals_make_consistent")
                
            else:
            
                pie.operator("OBJECT_OT_shade_smooth")
                pie.operator("OBJECT_OT_shade_flat")
                
                pie.operator("object.origin_set",icon="EMPTY_DATA", text="Origin to Geometry").type="ORIGIN_GEOMETRY"
                pie.operator("object.origin_set",icon="EMPTY_DATA", text="Origin to Cursor").type="ORIGIN_CURSOR"
                pie.operator("object.origin_set",icon="EMPTY_DATA", text="Geometry to Origin").type="GEOMETRY_ORIGIN"
                pie.operator("object.origin_set",icon="EMPTY_DATA", text="Origin to Center of Mass").type="ORIGIN_CENTER_OF_MASS"
                
                # Set origin
             
             


# then add these in register part of script

 bpy.utils.register_class(VIEW3D_PIE_editquick1)

 bpy.utils.unregister_class(VIEW3D_PIE_editquick1)


# add this in the key map part

    kmi = km.keymap_items.new('wm.call_menu_pie', 'SLASH', 'PRESS') 
    kmi.properties.name = 'VIEW3D_PIE_editquick1'



happy bl

Thanks sebastian_k.

I’ve been wanting something like that tutorial ever sense I started using pie menu’s.

I played a little with pie and finally i wrote my first script in blender.
it is replacement for special menu(W) with pie(trigger alt + W).



import bpy
from bpy.types import Menu, Operator
from bpy.props import EnumProperty


class VIEW3D_PIE_special_menu(Menu):
    # label is displayed at the center of the pie menu.
    bl_label = "Special"
    bl_idname = "VIEW3D_PIE_special_menu"


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


        pie = layout.menu_pie()
        
        box = pie.split().box().column()
        row = box.row(align=True)
        row.operator("mesh.subdivide", text="Subdivide", icon='NONE').smoothness = 0
        row.operator("mesh.subdivide", text="Smooth", icon='NONE').smoothness = 1
        box.operator("mesh.merge", text="Merge", icon="NONE")
#       box.menu("mesh.merge","type", text="Merge", icon="NONE")     
        box.operator("mesh.remove_doubles", text="Remove Doubles", icon="NONE")


        box = pie.split().box().column()
        
        box.operator("mesh.hide", text="Hide", icon="NONE").unselected = False
        box.operator("mesh.reveal", text="Revial", icon="NONE")
        box.operator("mesh.select_all", text="Select Inverse", icon="NONE").action = 'INVERT'
        
        box = pie.split().box().column()
        box.operator("mesh.flip_normals", text="Flip Normals", icon='NONE')
        box.operator("mesh.vertices_smooth", text="Smooth", icon='NONE')
        box.operator("mesh.vertices_smooth_laplacian", text="Smooth Laplacian", icon='NONE')


        box = pie.split().box().column()


        box.operator("mesh.inset", text="Insert Faces", icon='NONE')
        box.operator("mesh.bevel", text="Bevel", icon='NONE')
        box.operator("mesh.bridge_edge_loops", text="Bridge Edge Loops", icon='NONE')
        


        box = pie.split().box().column()
        box.operator("mesh.blend_from_shape", text="Blend From Shape", icon='NONE')
        box.operator("mesh.shape_propagate_to_all", text="Shape Propagate", icon='NONE')


        box = pie.split().box().column()


        box.operator("mesh.shortest_path_select", text="Select Shortest Path", icon='NONE')
        box.operator("mesh.sort_elements", text="Sort Mesh Elements", icon='NONE')
       
        box = pie.split().box().column()


        box.operator("mesh.symmetrize", text="Symmetrize", icon='NONE')
        box.operator("mesh.symmetry_snap", text="Snat To Symmetry", icon='NONE')
        
        box = pie.split().box().column()
        box.operator("mesh.faces_shade_smooth", text="Shade Smooth", icon='NONE')
        box.operator("mesh.faces_shade_flat", text="Shade Flat", icon='NONE')




        


        
        
addon_keymaps = []


def register():
    bpy.utils.register_class(VIEW3D_PIE_special_menu)
    
    wm = bpy.context.window_manager
    km = wm.keyconfigs.addon.keymaps.new(name="Mesh")
    kmi = km.keymap_items.new("wm.call_menu_pie" , "W" , "PRESS" , alt = True )
    kmi.properties.name="VIEW3D_PIE_special_menu"
    addon_keymaps.append(km)




def unregister():
    bpy.utils.unregister_class(VIEW3D_PIE_primitive_add)
    
    wm = bpy.context.window_manager
    for km in addon_keymaps:
        for kmi in km.keymap_items:
            km.keymap_items.remove(kmi)


        wm.keyconfigs.addon.keymaps.remove(km)


    # clear the list
    del addon_keymaps[:]




if __name__ == "__main__":
    register()


weedd



import bpy
from bpy.types import Menu, Operator
from bpy.props import EnumProperty


class VIEW3D_PIE_special_menu(Menu):
    # label is displayed at the center of the pie menu.
    bl_label = "Special"
    bl_idname = "VIEW3D_PIE_special_menu"


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


        pie = layout.menu_pie()
        
        box = pie.split().box().column()
        row = box.row(align=True)
        row.operator("mesh.subdivide", text="Subdivide", icon='NONE').smoothness = 0
        row.operator("mesh.subdivide", text="Smooth", icon='NONE').smoothness = 1
        box.operator("mesh.merge", text="Merge", icon="NONE")
#       box.menu("mesh.merge","type", text="Merge", icon="NONE")     
        box.operator("mesh.remove_doubles", text="Remove Doubles", icon="NONE")
      
        box.separator()
        
        box.operator("mesh.hide", text="Hide", icon="NONE").unselected = False
        box.operator("mesh.reveal", text="Revial", icon="NONE")
        box.operator("mesh.select_all", text="Select Inverse", icon="NONE").action = 'INVERT'
        
        box = pie.split().box().column()
        box.operator("mesh.flip_normals", text="Flip Normals", icon='NONE')
        box.operator("mesh.vertices_smooth", text="Smooth", icon='NONE')
        box.operator("mesh.vertices_smooth_laplacian", text="Smooth Laplacian", icon='NONE')


        box.separator()


        box.operator("mesh.inset", text="Insert Faces", icon='NONE')
        box.operator("mesh.bevel", text="Bevel", icon='NONE')
        box.operator("mesh.bridge_edge_loops", text="Bridge Edge Loops", icon='NONE')
        


        box = pie.split().box().column()
        box.operator("mesh.blend_from_shape", text="Blend From Shape", icon='NONE')
        box.operator("mesh.shape_propagate_to_all", text="Shape Propagate", icon='NONE')


        box.separator()


        box.operator("mesh.shortest_path_select", text="Select Shortest Path", icon='NONE')
        box.operator("mesh.sort_elements", text="Sort Mesh Elements", icon='NONE')
       
        box.separator()


        box.operator("mesh.symmetrize", text="Symmetrize", icon='NONE')
        box.operator("mesh.symmetry_snap", text="Snat To Symmetry", icon='NONE')
        
        box = pie.split().box().column()
        box.operator("mesh.faces_shade_smooth", text="Shade Smooth", icon='NONE')
        box.operator("mesh.faces_shade_flat", text="Shade Flat", icon='NONE')




        


        
        
addon_keymaps = []


def register():
    bpy.utils.register_class(VIEW3D_PIE_special_menu)
    
    wm = bpy.context.window_manager
    km = wm.keyconfigs.addon.keymaps.new(name="Mesh")
    kmi = km.keymap_items.new("wm.call_menu_pie" , "W" , "PRESS" , alt = True )
    kmi.properties.name="VIEW3D_PIE_special_menu"
    addon_keymaps.append(km)




def unregister():
    bpy.utils.unregister_class(VIEW3D_PIE_primitive_add)
    
    wm = bpy.context.window_manager
    for km in addon_keymaps:
        for kmi in km.keymap_items:
            km.keymap_items.remove(kmi)


        wm.keyconfigs.addon.keymaps.remove(km)


    # clear the list
    del addon_keymaps[:]




if __name__ == "__main__":
    register()





import bpy
from bpy.types import Menu, Operator
from bpy.props import EnumProperty


class VIEW3D_PIE_special_menu(Menu):
    # label is displayed at the center of the pie menu.
    bl_label = "Special"
    bl_idname = "VIEW3D_PIE_special_menu"


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


        pie = layout.menu_pie()
        
        box = pie.split().column()
        row = box.row(align=True)
        row.operator("mesh.subdivide", text="Subdivide", icon='NONE').smoothness = 0
        row.operator("mesh.subdivide", text="Smooth", icon='NONE').smoothness = 1
        box.operator("mesh.merge", text="Merge", icon="NONE")
#       box.menu("mesh.merge","type", text="Merge", icon="NONE")     
        box.operator("mesh.remove_doubles", text="Remove Doubles", icon="NONE")


        box = pie.split().column()
        
        box.operator("mesh.hide", text="Hide", icon="NONE").unselected = False
        box.operator("mesh.reveal", text="Revial", icon="NONE")
        box.operator("mesh.select_all", text="Select Inverse", icon="NONE").action = 'INVERT'
        
        box = pie.split().column()
        box.operator("mesh.flip_normals", text="Flip Normals", icon='NONE')
        box.operator("mesh.vertices_smooth", text="Smooth", icon='NONE')
        box.operator("mesh.vertices_smooth_laplacian", text="Smooth Laplacian", icon='NONE')


        box = pie.split().column()


        box.operator("mesh.inset", text="Insert Faces", icon='NONE')
        box.operator("mesh.bevel", text="Bevel", icon='NONE')
        box.operator("mesh.bridge_edge_loops", text="Bridge Edge Loops", icon='NONE')
        


        box = pie.split().column()
        box.operator("mesh.blend_from_shape", text="Blend From Shape", icon='NONE')
        box.operator("mesh.shape_propagate_to_all", text="Shape Propagate", icon='NONE')


        box = pie.split().column()


        box.operator("mesh.shortest_path_select", text="Select Shortest Path", icon='NONE')
        box.operator("mesh.sort_elements", text="Sort Mesh Elements", icon='NONE')
       
        box = pie.split().column()


        box.operator("mesh.symmetrize", text="Symmetrize", icon='NONE')
        box.operator("mesh.symmetry_snap", text="Snat To Symmetry", icon='NONE')
        
        box = pie.split().column()
        box.operator("mesh.faces_shade_smooth", text="Shade Smooth", icon='NONE')
        box.operator("mesh.faces_shade_flat", text="Shade Flat", icon='NONE')




        


        
        
addon_keymaps = []


def register():
    bpy.utils.register_class(VIEW3D_PIE_special_menu)
    
    wm = bpy.context.window_manager
    km = wm.keyconfigs.addon.keymaps.new(name="Mesh")
    kmi = km.keymap_items.new("wm.call_menu_pie" , "W" , "PRESS" , alt = True )
    kmi.properties.name="VIEW3D_PIE_special_menu"
    addon_keymaps.append(km)




def unregister():
    bpy.utils.unregister_class(VIEW3D_PIE_primitive_add)
    
    wm = bpy.context.window_manager
    for km in addon_keymaps:
        for kmi in km.keymap_items:
            km.keymap_items.remove(kmi)


        wm.keyconfigs.addon.keymaps.remove(km)


    # clear the list
    del addon_keymaps[:]




if __name__ == "__main__":
    register()



2 Likes

Great work Semaphore but IMHO with that setup you lose the speed that PMs bring to us. If you want a lot of options, a setup like this could be the solution (don´t ask me how to add those two columns, XD):


If you wanna have more than 20 options, with this setup you have 22 and you can access very very fast to 8 options (put there the most common used ones) and have other 14 options not so fast but fast alike.

PD: still thinking that sticky key and multilevel PMs are the optimal solution.

Being able to generate pies like this is on the todo. Right after sticky keys and direct placement of enumerated values (being able to choose exactly which slice each value lands on)

Good to hear that! The perfect PM is on the way!!

I’m trying to recriate a pie for all selection mode combinations in edit mode but its not working. Someone could help with the code?


import bpyfrom bpy.types import Menu


# spawn an edit mode selection pie (run while object is in edit mode to get a valid output)




class VIEW3D_PIE_multiselect(Menu):
    # label is displayed at the center of the pie menu.
    bl_label = "Select Mode"
    bl_idname ="mesh.multiselectpie"


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


        pie = layout.menu_pie()
        # operator_enum will just spread all available options
        # for the type enum of the operator on the pie


        op = pie.operator("wm.context_set_value", text="Vertices", icon='VERTEXSEL')
        op.value = "(True, False, False)"
        op = pie.operator("wm.context_set_value", text="Faces", icon='FACESEL')
        op.value = "(False, False, True)"
        op = pie.operator("wm.context_set_value", text="Edges", icon='EDGESEL')
        op.value = "(False, True, False)"
        op = pie.operator("wm.context_set_value", text="All", icon='FACESEL')
        op.value = "(True, True, False)"
        op = pie.operator("wm.context_set_value", text="Vertex+Faces", icon='FACESEL')
        op.value = "(True, False, True)"
        op = pie.operator("wm.context_set_value", text="Skip Occluded", icon='ORTHO')
        op.value = "(True)"
        op = pie.operator("wm.context_set_value", text="Vertices+Edges", icon='EDGESEL')
        op.value = "(True, True, False)"
        op = pie.operator("wm.context_set_value", text="Edges+Faces", icon='FACESEL')
        op.value = "(False, True, True)"




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


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




if __name__ == "__main__":
    register()


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

Hello !

I have a proposal to the pie menu, going directly in component mode and choose the component when entering in edit mode.

I have made a script for that and a video.

It’s an interesting idea, but I don’t think it would speed up my workflow.

the template for the pie menus is for edit mode operators, is there an example of object mode operators?
In my case I’m trying to build a pie menu for export ops…

pie.operator(“export_scene.fbx”)
pie.operator(“export_scene.obj”)
pie.operator(“wm.collada_export”)
pie.operator(“export_mesh.stl”)

a other example with default menus


            # Edit mode

            #_1_Left
            pie.menu("VIEW3D_MT_edit_mesh_vertices", text="Edit Vertices", icon="VERTEXSEL") 
            
            #_2_Right
            pie.menu("VIEW3D_MT_edit_mesh_edges", text="Edit Edges", icon="EDGESEL") 
                
            #_3_Bottom
            pie.menu("VIEW3D_MT_uv_map", text="Unwrap", icon="UV_FACESEL") 
            
            #_4_Top
            pie.menu("VIEW3D_MT_edit_mesh_faces", text="Edit Face", icon="FACESEL") 
       
            #_5_Top_Left
            pie.menu("INFO_MT_mesh_add", text="Add Mesh", icon="OBJECT_DATA")
            
            #_6_Top_Right
            pie.menu("VIEW3D_MT_snap", "Snap", icon="SNAP_ON")            

            #_7_Bottom_Left
            pie.menu("VIEW3D_MT_edit_mesh_specials", "Special", icon="OUTLINER_DATA_LAMP")

            #_8_Bottom_Right
            pie.menu("VIEW3D_MT_select_edit_mesh",text="Select Mesh", icon="UV_SYNC_SELECT")  



two other templates are under this thread
http://www.blenderartists.org/forum/showthread.php?347011-MENU-Pie-Template

I figured out the export operator in object mode stuff, thanks to @mkbreuer
not sure if it’s very good, but here it is as an example/sample of some hackish pie baking :slight_smile:



1 Like

Someone knows how to do this PM?


@RH2

can you explain a little how it works
multi level menu here which is very nice

also are these script included in build only and not the official version

thanks

Pie menus official is only in the builds from builder.blender.org, or you can build blender from source.

sorry was not talking about pie script!
but the reference scripts inside his pie script !

1- align simple which seems to be included anyway
2 - the UV align script

also did u test this script
or only an example !

you did not call the main with register
and BL id name have upper case letter !

the page up down is working

but the mouse button don’t work !

thanks

@RickyBlender, It’s based on @mkbreuer’s meta script, adds multiple pie menus instead of one. I thought it would be a good reference of some customization. installs as an add-on after enabling the official pie menu script.

Apparently pie menus work in edit mode, unless you check the active object to see what mode it’s in, or it’s registered to a different window type

1 Like