1 # SPDX-License-Identifier: GPL-2.0-or-later
5 "description": "Object/Edit mode Selection Menu",
6 "author": "pitiwazou, meta-androcto",
12 "category": "Select Pie"
16 from bpy
.types
import (
22 # Pie Selection Object Mode - A
23 class PIE_MT_SelectionsMore(Menu
):
24 bl_idname
= "PIE_MT_selectionsmore"
25 bl_label
= "Pie Selections Object Mode"
27 def draw(self
, context
):
29 pie
= layout
.menu_pie()
30 box
= pie
.split().column()
31 box
.operator("object.select_random", text
="Select Random")
32 box
.operator("object.select_linked", text
="Select Linked")
35 box
.operator("object.select_more", text
="More")
36 box
.operator("object.select_less", text
="Less")
39 props
= box
.operator("object.select_hierarchy", text
="Parent")
41 props
.direction
= 'PARENT'
43 props
= box
.operator("object.select_hierarchy", text
="Child")
45 props
.direction
= 'CHILD'
48 props
= box
.operator("object.select_hierarchy", text
="Extend Parent")
50 props
.direction
= 'PARENT'
52 props
= box
.operator("object.select_hierarchy", text
="Extend Child")
54 props
.direction
= 'CHILD'
56 # Pie Selection Object Mode - A
59 class PIE_MT_SelectionsOM(Menu
):
60 bl_idname
= "PIE_MT_selectionsom"
61 bl_label
= "Pie Selections Object Mode"
63 def draw(self
, context
):
65 pie
= layout
.menu_pie()
67 pie
.operator("object.select_grouped", text
="Select Grouped")
69 pie
.operator("object.select_by_type", text
="Select By Type")
71 pie
.operator("object.select_all", text
="Invert Selection", icon
='ZOOM_PREVIOUS').action
= 'INVERT'
73 pie
.operator("object.select_all", text
="Select All Toggle", icon
='NONE').action
= 'TOGGLE'
75 pie
.operator("view3d.select_circle", text
="Circle Select")
77 pie
.operator("view3d.select_box", text
="Box Select")
79 pie
.operator("object.select_camera", text
="Select Camera")
81 pie
.menu("PIE_MT_selectionsmore", text
="Select Menu")
84 # Pie Selection Edit Mode
85 class PIE_MT_SelectionsEM(Menu
):
86 bl_idname
= "PIE_MT_selectionsem"
87 bl_label
= "Pie Selections Edit Mode"
89 def draw(self
, context
):
91 pie
= layout
.menu_pie()
93 pie
.operator("mesh.select_less", text
="Select Less")
95 pie
.operator("mesh.select_more", text
="Select More")
97 pie
.menu("OBJECT_MT_selectloopselection", text
="Select Loop Menu")
99 pie
.operator("mesh.select_all", text
="Select All Toggle").action
= 'TOGGLE'
101 pie
.operator("view3d.select_circle", text
="Circle Select")
103 pie
.operator("view3d.select_box", text
="Box Select")
105 pie
.operator("mesh.select_all", text
="Invert Selection").action
= 'INVERT'
107 pie
.menu("PIE_MT_selectallbyselection", text
="Edit Modes", icon
='VERTEXSEL')
110 # Select All By Selection
111 class PIE_MT_SelectAllBySelection(Menu
):
112 bl_idname
= "PIE_MT_selectallbyselection"
113 bl_label
= "Verts Edges Faces"
114 bl_options
= {'REGISTER', 'UNDO'}
116 def draw(self
, context
):
118 pie
= layout
.menu_pie()
119 box
= pie
.split().column()
121 box
.operator("class.vertexop", text
="Vertex", icon
='VERTEXSEL')
122 box
.operator("class.edgeop", text
="Edge", icon
='EDGESEL')
123 box
.operator("class.faceop", text
="Face", icon
='FACESEL')
124 box
.operator("verts.edgesfacesop", text
="Vertex/Edges/Faces", icon
='OBJECT_DATAMODE')
127 # Edit Selection Modes
128 class PIE_OT_classvertexop(Operator
):
129 bl_idname
= "class.vertexop"
130 bl_label
= "Class Vertex"
131 bl_description
= "Vert Select Mode"
132 bl_options
= {'REGISTER', 'UNDO'}
134 def execute(self
, context
):
135 if context
.object.mode
!= "EDIT":
136 bpy
.ops
.object.mode_set(mode
="EDIT")
137 bpy
.ops
.mesh
.select_mode(use_extend
=False, use_expand
=False, type='VERT')
138 if bpy
.ops
.mesh
.select_mode
!= "EDGE, FACE":
139 bpy
.ops
.mesh
.select_mode(use_extend
=False, use_expand
=False, type='VERT')
143 class PIE_OT_classedgeop(Operator
):
144 bl_idname
= "class.edgeop"
145 bl_label
= "Class Edge"
146 bl_description
= "Edge Select Mode"
147 bl_options
= {'REGISTER', 'UNDO'}
149 def execute(self
, context
):
150 if context
.object.mode
!= "EDIT":
151 bpy
.ops
.object.mode_set(mode
="EDIT")
152 bpy
.ops
.mesh
.select_mode(use_extend
=False, use_expand
=False, type='EDGE')
153 if bpy
.ops
.mesh
.select_mode
!= "VERT, FACE":
154 bpy
.ops
.mesh
.select_mode(use_extend
=False, use_expand
=False, type='EDGE')
158 class PIE_OT_classfaceop(Operator
):
159 bl_idname
= "class.faceop"
160 bl_label
= "Class Face"
161 bl_description
= "Face Select Mode"
162 bl_options
= {'REGISTER', 'UNDO'}
164 def execute(self
, context
):
165 if context
.object.mode
!= "EDIT":
166 bpy
.ops
.object.mode_set(mode
="EDIT")
167 bpy
.ops
.mesh
.select_mode(use_extend
=False, use_expand
=False, type='FACE')
168 if bpy
.ops
.mesh
.select_mode
!= "VERT, EDGE":
169 bpy
.ops
.mesh
.select_mode(use_extend
=False, use_expand
=False, type='FACE')
173 # Combined Selection Mode
174 class PIE_OT_vertsedgesfacesop(Operator
):
175 bl_idname
= "verts.edgesfacesop"
176 bl_label
= "Verts Edges Faces"
177 bl_description
= "Vert/Edge/Face Select Mode"
178 bl_options
= {'REGISTER', 'UNDO'}
180 def execute(self
, context
):
181 if context
.object.mode
!= "EDIT":
182 bpy
.ops
.object.mode_set(mode
="EDIT")
183 bpy
.ops
.mesh
.select_mode(use_extend
=False, use_expand
=False, type='VERT')
184 if bpy
.ops
.mesh
.select_mode
!= "VERT, EDGE, FACE":
185 bpy
.ops
.object.mode_set(mode
="EDIT")
186 bpy
.ops
.mesh
.select_mode(use_extend
=False, use_expand
=False, type='VERT')
187 bpy
.ops
.mesh
.select_mode(use_extend
=True, use_expand
=False, type='EDGE')
188 bpy
.ops
.mesh
.select_mode(use_extend
=True, use_expand
=False, type='FACE')
192 class PIE_MT_SelectLoopSelection(Menu
):
193 bl_idname
= "OBJECT_MT_selectloopselection"
194 bl_label
= "Verts Edges Faces"
195 bl_options
= {'REGISTER', 'UNDO'}
197 def draw(self
, context
):
199 layout
.operator_context
= 'INVOKE_REGION_WIN'
201 layout
.operator("mesh.loop_multi_select", text
="Select Loop", icon
='NONE').ring
= False
202 layout
.operator("mesh.loop_multi_select", text
="Select Ring", icon
='NONE').ring
= True
203 layout
.operator("mesh.loop_to_region", text
="Select Loop Inner Region", icon
='NONE')
209 PIE_MT_SelectAllBySelection
,
210 PIE_MT_SelectionsMore
,
211 PIE_MT_SelectLoopSelection
,
212 PIE_OT_classvertexop
,
215 PIE_OT_vertsedgesfacesop
223 bpy
.utils
.register_class(cls
)
225 wm
= bpy
.context
.window_manager
226 if wm
.keyconfigs
.addon
:
227 # Selection Object Mode
228 km
= wm
.keyconfigs
.addon
.keymaps
.new(name
='Object Mode')
229 kmi
= km
.keymap_items
.new('wm.call_menu_pie', 'A', 'PRESS')
230 kmi
.properties
.name
= "PIE_MT_selectionsom"
231 addon_keymaps
.append((km
, kmi
))
233 # Selection Edit Mode
234 km
= wm
.keyconfigs
.addon
.keymaps
.new(name
='Mesh')
235 kmi
= km
.keymap_items
.new('wm.call_menu_pie', 'A', 'PRESS')
236 kmi
.properties
.name
= "PIE_MT_selectionsem"
237 addon_keymaps
.append((km
, kmi
))
242 bpy
.utils
.unregister_class(cls
)
244 wm
= bpy
.context
.window_manager
245 kc
= wm
.keyconfigs
.addon
247 for km
, kmi
in addon_keymaps
:
248 km
.keymap_items
.remove(kmi
)
249 addon_keymaps
.clear()
252 if __name__
== "__main__":