Mesh select mode pie menu

Hello. I was wondering if there was a way to make the mesh select mode menu in edit mode (ctrl+tab) a pie menu for blender 2.72? Thanks.

Yes. Here’s how mine looks:


And here’s the code:


bl_info = {
    "name" : "Select Mode Pie Menu",
    "author" : "Stan Pancakes",
    "version" : (0, 1, 0),
    "blender" : (2, 72, 0),
    "description" : "Custom Pie Menus",
    "category" : "3D View",}

import bpy

class SelectModeCombined(bpy.types.Operator):
    bl_label = "Combined Select Mode"
    bl_idname = "edit.mesh_select_mode_combined"
    bl_options = {'INTERNAL'}    
    
    mode = bpy.props.BoolVectorProperty(size=3)
          
    def execute(self, context):
        context.tool_settings.mesh_select_mode[:] = self.mode
        return {'FINISHED'}

class MeshSelectMode(bpy.types.Menu):
    bl_label = "Select Mode"
    bl_idname = "edit.mesh_select_mode"
    
    def draw(self, context):
        layout = self.layout
        pie = layout.menu_pie()
        
        # left
        pie.operator("edit.mesh_select_mode_combined", text='Vertex', icon='VERTEXSEL').mode=(True, False, False)
        # right
        pie.operator("edit.mesh_select_mode_combined", text='Face', icon='FACESEL').mode=(False, False, True)
        # bottom
        pie.operator("edit.mesh_select_mode_combined", text='Vertex & Edge & Face', icon='UV_FACESEL').mode=(True, True, True)
        # top
        pie.operator("edit.mesh_select_mode_combined", text='Edge', icon='EDGESEL').mode=(False, True, False)
        # topleft
        pie.operator("edit.mesh_select_mode_combined", text='Vertex & Edge', icon='UV_EDGESEL').mode=(True, True, False)
        # topright
        pie.operator("edit.mesh_select_mode_combined", text='Edge & Face', icon='SPACE2').mode=(False, True, True)
        # bottomleft
        pie.prop(context.space_data, "use_occlude_geometry", text='Limit to Visible')
        # bottomright
        pie.operator("edit.mesh_select_mode_combined", text='Vertex & Face', icon='LOOPSEL').mode=(True, False, True)
        
def register():   
    bpy.utils.register_class(SelectModeCombined)   
    bpy.utils.register_class(MeshSelectMode)

def unregister():
    bpy.utils.unregister_class(MeshSelectMode)
    bpy.utils.unregister_class(SelectModeCombined)        

You can put it in some .py file in your addons directory, activate the addon in user preferences, and then just rebind the Ctrl+Tab key in Input -> 3D View -> Mesh like this:


could anyone rewrite this for 2.80
or just hint what is 2.80 equivalent of:
pie.operator("edit.mesh_select_mode_combined", text='Vertex & Edge & Face', icon='UV_FACESEL').mode=(True, True, True)


bl_info = {
    "name" : "Select Mode Pie Menu",
    "author" : "Stan Pancakes",
    "version" : (0, 1, 0),
    "blender" : (2, 80, 0),
    "description" : "Custom Pie Menus",
    "category" : "3D View",}


import bpy


class VIEW3D_OT_SelectModeCombined(bpy.types.Operator):
    bl_label = "Combined Select Mode"
    bl_idname = "edit.mesh_select_mode_combined"
    bl_options = {'INTERNAL'}    
    
    mode: bpy.props.BoolVectorProperty(size=3)
          
    def execute(self, context):
        context.tool_settings.mesh_select_mode[:] = self.mode
        return {'FINISHED'}


class VIEW3D_MT_MeshSelectMode(bpy.types.Menu):
    bl_label = "Select Mode"
    bl_idname = "VIEW3D_MT_MeshSelectMode"
    
    def draw(self, context):
        layout = self.layout
        pie = layout.menu_pie()

        shad = context.space_data.shading
             
        # left
        pie.operator("edit.mesh_select_mode_combined", text='Vertex', icon='VERTEXSEL').mode=(True, False, False)
        # right
        pie.operator("edit.mesh_select_mode_combined", text='Face', icon='FACESEL').mode=(False, False, True)
        # bottom
        pie.operator("edit.mesh_select_mode_combined", text='Vertex & Edge & Face', icon='UV_FACESEL').mode=(True, True, True)
        # top
        pie.operator("edit.mesh_select_mode_combined", text='Edge', icon='EDGESEL').mode=(False, True, False)
        # topleft
        pie.operator("edit.mesh_select_mode_combined", text='Vertex & Edge', icon='UV_EDGESEL').mode=(True, True, False)
        # topright
        pie.operator("edit.mesh_select_mode_combined", text='Edge & Face', icon='KEYFRAME_HLT').mode=(False, True, True)
        # bottomleft
        pie.prop(shad, "show_xray", text='Limit to Visible', icon='XRAY')
        # bottomright
        pie.operator("edit.mesh_select_mode_combined", text='Vertex & Face', icon='SELECT_SUBTRACT').mode=(True, False, True)     


classes = (
    VIEW3D_MT_MeshSelectMode,
    VIEW3D_OT_SelectModeCombined, 
)


def register():
    from bpy.utils import register_class
    for cls in classes:
        register_class(cls) 


def unregister():
    from bpy.utils import unregister_class
    for cls in reversed(classes):
        unregister_class(cls)


if __name__ == "__main__":
    register()

uhmmm
hold shift
and press 1 2 3
not even kidding

great thanks for help
thou I could not assign shortcut to the script so, actually I can’t get it to work
I tried to set it up like I did in 2.79

2.79

2.80

any advise?

yes, I know I can do that but:

  • I find it quicker to use pie menu (especially when you use them as quick gestures)
  • it also gives you toggle for limit to visible (can’t live without it, well I can but don’t want to)
  • frees up keys for more custom shortcuts (and god knows you need lots of them to work proficiently in blender, and there is alway one more you would like to add)

use VIEW3D_MT_MeshSelectMode

thx, now it works
thx again

hi, this menu is built into the 3d viewport pie menus that comes with blender.

Hello!
I an coming late on this one…
I used this addon and it works just fine, thanks a lot!
But I wanted to know if there was a way to expend this script (or make another one) to allow the pie menu to work also in the UV Editor, to switch between Vert / UVs, Edges, and faces.

Thanks in advance if anyone is still following this :slight_smile:

I am trying to implement this but I am still a newbie, can you please explain where that line should be used in the code? Thank you for your help, much appreciated.