|
| 1 | +bl_info = { |
| 2 | + "name" : "Select Mode Pie Menu", |
| 3 | + "author" : "Stan Pancakes", |
| 4 | + "version" : (0, 1, 0), |
| 5 | + "blender" : (2, 72, 0), |
| 6 | + "description" : "Custom Pie Menus", |
| 7 | + "category" : "3D View",} |
| 8 | + |
| 9 | +import bpy |
| 10 | + |
| 11 | +class SelectModeCombined(bpy.types.Operator): |
| 12 | + bl_label = "Combined Select Mode" |
| 13 | + bl_idname = "edit.mesh_select_mode_combined" |
| 14 | + bl_options = {'INTERNAL'} |
| 15 | + |
| 16 | + mode = bpy.props.BoolVectorProperty(size=3) |
| 17 | + |
| 18 | + def execute(self, context): |
| 19 | + context.tool_settings.mesh_select_mode[:] = self.mode |
| 20 | + return {'FINISHED'} |
| 21 | + |
| 22 | +class MeshSelectMode(bpy.types.Menu): |
| 23 | + bl_label = "Select Mode" |
| 24 | + bl_idname = "VIEW3D_MT_edit_mesh_select_mode_pie" |
| 25 | + |
| 26 | + def draw(self, context): |
| 27 | + layout = self.layout |
| 28 | + pie = layout.menu_pie() |
| 29 | + |
| 30 | + # left |
| 31 | + pie.operator("edit.mesh_select_mode_combined", text='Vertex', icon='VERTEXSEL').mode=(True, False, False) |
| 32 | + # right |
| 33 | + pie.operator("edit.mesh_select_mode_combined", text='Face', icon='FACESEL').mode=(False, False, True) |
| 34 | + # bottom |
| 35 | + pie.operator("edit.mesh_select_mode_combined", text='Vertex & Edge & Face', icon='UV_FACESEL').mode=(True, True, True) |
| 36 | + # top |
| 37 | + pie.operator("edit.mesh_select_mode_combined", text='Edge', icon='EDGESEL').mode=(False, True, False) |
| 38 | + # topleft |
| 39 | + pie.operator("edit.mesh_select_mode_combined", text='Vertex & Edge', icon='UV_EDGESEL').mode=(True, True, False) |
| 40 | + # topright |
| 41 | + pie.operator("edit.mesh_select_mode_combined", text='Edge & Face', icon='SPACE2').mode=(False, True, True) |
| 42 | + # bottomleft |
| 43 | + pie.prop(context.space_data, "use_occlude_geometry", text='Limit to Visible') |
| 44 | + # bottomright |
| 45 | + pie.operator("edit.mesh_select_mode_combined", text='Vertex & Face', icon='LOOPSEL').mode=(True, False, True) |
| 46 | + |
| 47 | +def register(): |
| 48 | + bpy.utils.register_class(SelectModeCombined) |
| 49 | + bpy.utils.register_class(MeshSelectMode) |
| 50 | + |
| 51 | +def unregister(): |
| 52 | + bpy.utils.unregister_class(MeshSelectMode) |
| 53 | + bpy.utils.unregister_class(SelectModeCombined) |
0 commit comments