Revert changes to 'object_fracture_cell'
[blender-addons.git] / space_view3d_spacebar_menu.py
blob67ed8716d7268e75408ae4e5e0cc351c6865e022
1 # ##### BEGIN GPL LICENSE BLOCK #####
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 # ##### END GPL LICENSE BLOCK #####
18 # Contributed to by: meta-androcto, JayDez, sim88, sam, lijenstina, mkb, wisaac, CoDEmanX #
20 bl_info = {
21 "name": "Dynamic Context Menu",
22 "author": "meta-androcto",
23 "version": (1, 9, 3),
24 "blender": (2, 80, 0),
25 "location": "View3D > Spacebar",
26 "description": "Object Mode Context Sensitive Spacebar Menu",
27 "warning": "",
28 "wiki_url": "https://wiki.blender.org/index.php/Extensions:2.6/Py/"
29 "Scripts/3D_interaction/Dynamic_Spacebar_Menu",
30 "category": "3D View",
33 import bpy
34 from bpy.types import (
35 Operator,
36 Menu,
37 AddonPreferences,
39 from bpy.props import (
40 BoolProperty,
41 StringProperty,
44 from bl_ui.properties_paint_common import UnifiedPaintPanel
47 # Dynamic Context Sensitive Menu #
48 # Main Menu based on Object Type & 3d View Editor Mode #
50 class VIEW3D_MT_Space_Dynamic_Menu(Menu):
51 bl_label = "Dynamic Context Menu"
53 def draw(self, context):
54 layout = self.layout
55 settings = context.tool_settings
56 layout.operator_context = 'INVOKE_REGION_WIN'
57 obj = context.active_object
58 view = context.space_data
59 # No Object Selected #
60 ob = bpy.context.object
61 if not ob or not ob.select_get():
63 layout.operator_context = 'INVOKE_REGION_WIN'
64 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
65 layout.menu("VIEW3D_MT_Animation_Player",
66 text="Animation", icon='PLAY')
67 UseSeparator(self, context)
68 layout.menu("INFO_MT_area", icon='WORKSPACE')
69 layout.menu("VIEW3D_MT_View_Directions", icon='ZOOM_ALL')
70 layout.menu("VIEW3D_MT_View_Navigation", icon='PIVOT_BOUNDBOX')
71 UseSeparator(self, context)
72 layout.menu("VIEW3D_MT_AddMenu", icon='OBJECT_DATAMODE')
73 UseSeparator(self, context)
74 layout.operator("view3d.snap_cursor_to_center",
75 text="Cursor to World Origin")
76 layout.operator("view3d.snap_cursor_to_grid",
77 text="Cursor to Grid")
78 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
79 UseSeparator(self, context)
80 layout.prop(view, "show_region_toolbar", icon='MENU_PANEL')
81 layout.prop(view, "show_region_ui", icon='MENU_PANEL')
83 else:
84 # Mesh Object Mode #
86 if obj and obj.type == 'MESH' and obj.mode in {'OBJECT'}:
88 layout.operator_context = 'INVOKE_REGION_WIN'
89 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
90 layout.menu("VIEW3D_MT_Animation_Player",
91 text="Animation", icon='PLAY')
92 UseSeparator(self, context)
93 layout.menu("VIEW3D_MT_InteractiveMode", icon='EDITMODE_HLT')
94 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
95 layout.menu("VIEW3D_MT_Select_Object", icon='RESTRICT_SELECT_OFF')
96 UseSeparator(self, context)
97 layout.menu("VIEW3D_MT_AddMenu", icon='OBJECT_DATAMODE')
98 layout.menu("VIEW3D_MT_Object", icon='VIEW3D')
99 UseSeparator(self, context)
100 layout.menu("VIEW3D_MT_TransformMenu", icon='EMPTY_ARROWS')
101 layout.menu("VIEW3D_MT_MirrorMenu", icon='MOD_MIRROR')
102 layout.menu("VIEW3D_MT_CursorMenu", icon='PIVOT_CURSOR')
103 UseSeparator(self, context)
104 layout.menu("VIEW3D_MT_ParentMenu", icon='PIVOT_ACTIVE')
105 layout.menu("VIEW3D_MT_GroupMenu", icon='GROUP')
106 UseSeparator(self, context)
107 layout.menu("VIEW3D_MT_object_context_menu", text="Specials", icon='SOLO_OFF')
108 # if context.gpencil_data and context.gpencil_data.use_stroke_edit_mode:
109 # layout.menu("VIEW3D_MT_Edit_Gpencil", icon='GREASEPENCIL')
110 layout.menu("VIEW3D_MT_Camera_Options", icon='OUTLINER_OB_CAMERA')
111 layout.operator_menu_enum("object.modifier_add", "type", icon='MODIFIER')
112 layout.operator_menu_enum("object.constraint_add",
113 "type", text="Add Constraint", icon='CONSTRAINT')
114 UseSeparator(self, context)
115 layout.operator("object.delete", text="Delete Object", icon='X')
116 UseSeparator(self, context)
117 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
118 UseSeparator(self, context)
119 layout.prop(view, "show_region_toolbar", icon='MENU_PANEL')
120 layout.prop(view, "show_region_ui", icon='MENU_PANEL')
122 # Mesh Edit Mode #
123 if obj and obj.type == 'MESH' and obj.mode in {'EDIT'}:
125 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
126 layout.menu("VIEW3D_MT_Animation_Player",
127 text="Animation", icon='PLAY')
128 UseSeparator(self, context)
129 layout.menu("VIEW3D_MT_InteractiveMode", icon='EDITMODE_HLT')
130 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
131 layout.menu("VIEW3D_MT_Select_Edit_Mesh", icon='RESTRICT_SELECT_OFF')
132 layout.menu("VIEW3D_MT_Edit_Multi", icon='VERTEXSEL')
133 UseSeparator(self, context)
134 layout.menu("VIEW3D_MT_mesh_add", text="Add Mesh", icon='OUTLINER_OB_MESH')
135 layout.menu("VIEW3D_MT_Edit_Mesh", text="Mesh", icon='MESH_DATA')
136 UseSeparator(self, context)
137 layout.menu("VIEW3D_MT_TransformMenuEdit", icon='EMPTY_ARROWS')
138 layout.menu("VIEW3D_MT_MirrorMenu", icon='MOD_MIRROR')
139 layout.menu("VIEW3D_MT_EditCursorMenu", icon='PIVOT_CURSOR')
140 UseSeparator(self, context)
141 layout.menu("VIEW3D_MT_UV_Map", icon='MOD_UVPROJECT')
142 layout.menu("VIEW3D_MT_edit_mesh_context_menu", text="Specials", icon='SOLO_OFF')
143 layout.menu("VIEW3D_MT_edit_mesh_extrude", icon='XRAY')
144 UseSeparator(self, context)
145 layout.operator_menu_enum("object.modifier_add", "type", icon='MODIFIER')
146 layout.operator_menu_enum("object.constraint_add",
147 "type", text="Add Constraint", icon='CONSTRAINT')
148 UseSeparator(self, context)
149 layout.menu("VIEW3D_MT_edit_mesh_delete", icon='X')
150 UseSeparator(self, context)
151 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
152 UseSeparator(self, context)
153 layout.prop(view, "show_region_toolbar", icon='MENU_PANEL')
154 layout.prop(view, "show_region_ui", icon='MENU_PANEL')
156 # Sculpt Mode #
157 if obj and obj.type == 'MESH' and obj.mode in {'SCULPT'}:
159 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
160 UseSeparator(self, context)
161 layout.menu("VIEW3D_MT_InteractiveMode", icon='EDITMODE_HLT')
162 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
163 UseSeparator(self, context)
164 layout.menu("VIEW3D_MT_Sculpts", icon='SCULPTMODE_HLT')
165 # layout.menu("VIEW3D_MT_Brush_Selection", text="Sculpt Tool", icon='BRUSH_SCULPT_DRAW')
166 layout.menu("VIEW3D_MT_Brush_Settings", icon='BRUSH_DATA')
167 layout.menu("VIEW3D_MT_Hide_Masks", icon='RESTRICT_VIEW_OFF')
168 UseSeparator(self, context)
169 layout.menu("VIEW3D_MT_Sculpt_Specials", icon='SOLO_OFF')
170 UseSeparator(self, context)
171 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
172 UseSeparator(self, context)
173 layout.prop(view, "show_region_toolbar", icon='MENU_PANEL')
174 layout.prop(view, "show_region_ui", icon='MENU_PANEL')
176 # Vertex Paint #
177 if obj and obj.type == 'MESH' and obj.mode in {'VERTEX_PAINT'}:
179 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
180 UseSeparator(self, context)
181 layout.menu("VIEW3D_MT_InteractiveMode", icon='EDITMODE_HLT')
182 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
183 UseSeparator(self, context)
184 # layout.menu("VIEW3D_MT_Brush_Settings", icon='BRUSH_DATA')
185 layout.menu("VIEW3D_MT_Brush_Selection",
186 text="Vertex Paint Tool")
187 layout.menu("VIEW3D_MT_Vertex_Colors", icon='GROUP_VCOL')
188 UseSeparator(self, context)
189 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
190 UseSeparator(self, context)
191 layout.prop(view, "show_region_toolbar", icon='MENU_PANEL')
192 layout.prop(view, "show_region_ui", icon='MENU_PANEL')
194 # Weight Paint Menu #
195 if obj and obj.type == 'MESH' and obj.mode in {'WEIGHT_PAINT'}:
197 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
198 UseSeparator(self, context)
199 layout.menu("VIEW3D_MT_InteractiveMode", icon='EDITMODE_HLT')
200 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
201 UseSeparator(self, context)
202 layout.menu("VIEW3D_MT_Paint_Weights", icon='WPAINT_HLT')
203 # layout.menu("VIEW3D_MT_Brush_Settings", icon='BRUSH_DATA')
204 layout.menu("VIEW3D_MT_Brush_Selection",
205 text="Weight Paint Tool", icon='BRUSH_TEXMASK')
206 UseSeparator(self, context)
207 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
208 UseSeparator(self, context)
209 layout.prop(view, "show_region_toolbar", icon='MENU_PANEL')
210 layout.prop(view, "show_region_ui", icon='MENU_PANEL')
212 # Texture Paint #
213 if obj and obj.type == 'MESH' and obj.mode in {'TEXTURE_PAINT'}:
215 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
216 UseSeparator(self, context)
217 layout.menu("VIEW3D_MT_InteractiveMode", icon='EDITMODE_HLT')
218 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
219 # layout.menu("VIEW3D_MT_Brush_Settings", icon='BRUSH_DATA')
220 layout.menu("VIEW3D_MT_Brush_Selection",
221 text="Texture Paint Tool", icon='SCULPTMODE_HLT')
222 UseSeparator(self, context)
223 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
224 UseSeparator(self, context)
225 layout.prop(view, "show_region_toolbar", icon='MENU_PANEL')
226 layout.prop(view, "show_region_ui", icon='MENU_PANEL')
228 # Curve Object Mode #
229 if obj and obj.type == 'CURVE' and obj.mode in {'OBJECT'}:
231 layout.operator_context = 'INVOKE_REGION_WIN'
232 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
233 layout.menu("VIEW3D_MT_Animation_Player",
234 text="Animation", icon='PLAY')
235 UseSeparator(self, context)
236 layout.menu("VIEW3D_MT_Object_Interactive_Other", icon='OBJECT_DATA')
237 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
238 layout.menu("VIEW3D_MT_Select_Object", icon='RESTRICT_SELECT_OFF')
239 UseSeparator(self, context)
240 layout.menu("VIEW3D_MT_AddMenu", icon='OBJECT_DATAMODE')
241 layout.menu("VIEW3D_MT_Object", icon='VIEW3D')
242 UseSeparator(self, context)
243 layout.menu("VIEW3D_MT_TransformMenu", icon='EMPTY_ARROWS')
244 layout.menu("VIEW3D_MT_MirrorMenu", icon='MOD_MIRROR')
245 layout.menu("VIEW3D_MT_CursorMenu", icon='PIVOT_CURSOR')
246 UseSeparator(self, context)
247 layout.menu("VIEW3D_MT_ParentMenu", icon='PIVOT_ACTIVE')
248 layout.menu("VIEW3D_MT_GroupMenu", icon='GROUP')
249 UseSeparator(self, context)
250 layout.menu("VIEW3D_MT_object_context_menu", text="Specials", icon='SOLO_OFF')
251 layout.menu("VIEW3D_MT_Camera_Options", icon='OUTLINER_OB_CAMERA')
252 UseSeparator(self, context)
253 layout.operator_menu_enum("object.modifier_add", "type", icon='MODIFIER')
254 layout.operator_menu_enum("object.constraint_add",
255 "type", text="Add Constraint", icon='CONSTRAINT')
256 UseSeparator(self, context)
257 layout.operator("object.delete", text="Delete Object", icon='X')
258 UseSeparator(self, context)
259 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
260 UseSeparator(self, context)
261 layout.prop(view, "show_region_toolbar", icon='MENU_PANEL')
262 layout.prop(view, "show_region_ui", icon='MENU_PANEL')
264 # Edit Curve #
265 if obj and obj.type == 'CURVE' and obj.mode in {'EDIT'}:
267 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
268 layout.menu("VIEW3D_MT_Animation_Player",
269 text="Animation", icon='PLAY')
270 UseSeparator(self, context)
271 layout.menu("VIEW3D_MT_Object_Interactive_Other", icon='OBJECT_DATA')
272 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
273 layout.menu("VIEW3D_MT_Select_Edit_Curve",
274 icon='RESTRICT_SELECT_OFF')
275 UseSeparator(self, context)
276 layout.menu("VIEW3D_MT_curve_add", text="Add Curve",
277 icon='OUTLINER_OB_CURVE')
278 layout.menu("VIEW3D_MT_Edit_Curve", icon='CURVE_DATA')
279 UseSeparator(self, context)
280 layout.menu("VIEW3D_MT_TransformMenu", icon='EMPTY_ARROWS')
281 layout.menu("VIEW3D_MT_MirrorMenu", icon='MOD_MIRROR')
282 layout.menu("VIEW3D_MT_CursorMenu", icon='PIVOT_CURSOR')
283 layout.menu("VIEW3D_MT_EditCurveCtrlpoints",
284 icon='CURVE_BEZCURVE')
285 layout.menu("VIEW3D_MT_EditCurveSpecials",
286 icon='SOLO_OFF')
287 UseSeparator(self, context)
288 layout.operator("curve.delete", text="Delete Object",
289 icon='X')
290 UseSeparator(self, context)
291 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
292 UseSeparator(self, context)
293 layout.prop(view, "show_region_toolbar", icon='MENU_PANEL')
294 layout.prop(view, "show_region_ui", icon='MENU_PANEL')
296 # Surface Object Mode #
297 if obj and obj.type == 'SURFACE' and obj.mode in {'OBJECT'}:
299 layout.operator_context = 'INVOKE_REGION_WIN'
300 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
301 layout.menu("VIEW3D_MT_Animation_Player",
302 text="Animation", icon='PLAY')
303 UseSeparator(self, context)
304 layout.menu("VIEW3D_MT_Object_Interactive_Other", icon='OBJECT_DATA')
305 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
306 layout.menu("VIEW3D_MT_Select_Object", icon='RESTRICT_SELECT_OFF')
307 UseSeparator(self, context)
308 layout.menu("VIEW3D_MT_AddMenu", icon='OBJECT_DATAMODE')
309 layout.menu("VIEW3D_MT_Object", icon='VIEW3D')
310 UseSeparator(self, context)
311 layout.menu("VIEW3D_MT_TransformMenu", icon='EMPTY_ARROWS')
312 layout.menu("VIEW3D_MT_MirrorMenu", icon='MOD_MIRROR')
313 layout.menu("VIEW3D_MT_CursorMenu", icon='PIVOT_CURSOR')
314 UseSeparator(self, context)
315 layout.menu("VIEW3D_MT_ParentMenu", icon='PIVOT_ACTIVE')
316 layout.menu("VIEW3D_MT_GroupMenu", icon='GROUP')
317 UseSeparator(self, context)
318 layout.menu("VIEW3D_MT_object_context_menu", text="Specials", icon='SOLO_OFF')
319 layout.menu("VIEW3D_MT_Camera_Options", icon='OUTLINER_OB_CAMERA')
320 layout.operator_menu_enum("object.modifier_add", "type", icon='MODIFIER')
321 layout.operator_menu_enum("object.constraint_add",
322 "type", text="Add Constraint", icon='CONSTRAINT')
323 UseSeparator(self, context)
324 layout.operator("object.delete", text="Delete Object", icon='X')
325 UseSeparator(self, context)
326 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
327 UseSeparator(self, context)
328 layout.prop(view, "show_region_toolbar", icon='MENU_PANEL')
329 layout.prop(view, "show_region_ui", icon='MENU_PANEL')
331 # Edit Surface #
332 if obj and obj.type == 'SURFACE' and obj.mode in {'EDIT'}:
334 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
335 layout.menu("VIEW3D_MT_Animation_Player",
336 text="Animation", icon='PLAY')
337 UseSeparator(self, context)
338 layout.menu("VIEW3D_MT_Object_Interactive_Other", icon='OBJECT_DATA')
339 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
340 layout.menu("VIEW3D_MT_Select_Edit_Surface", icon='RESTRICT_SELECT_OFF')
341 UseSeparator(self, context)
342 layout.menu("VIEW3D_MT_surface_add", text="Add Surface",
343 icon='OUTLINER_OB_SURFACE')
344 layout.menu("VIEW3D_MT_TransformMenu", icon='EMPTY_ARROWS')
345 layout.menu("VIEW3D_MT_MirrorMenu", icon='MOD_MIRROR')
346 layout.menu("VIEW3D_MT_CursorMenu", icon='PIVOT_CURSOR')
347 UseSeparator(self, context)
348 layout.prop_menu_enum(settings, "proportional_edit",
349 icon="PROP_CON")
350 layout.prop_menu_enum(settings, "proportional_edit_falloff",
351 icon="SMOOTHCURVE")
352 layout.menu("VIEW3D_MT_EditCurveSpecials",
353 icon='SOLO_OFF')
354 UseSeparator(self, context)
355 layout.operator("curve.delete", text="Delete Object",
356 icon='CANCEL')
357 UseSeparator(self, context)
358 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
359 UseSeparator(self, context)
360 layout.prop(view, "show_region_toolbar", icon='MENU_PANEL')
361 layout.prop(view, "show_region_ui", icon='MENU_PANEL')
363 # Metaball Object Mode #
364 if obj and obj.type == 'META' and obj.mode in {'OBJECT'}:
366 layout.operator_context = 'INVOKE_REGION_WIN'
367 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
368 layout.menu("VIEW3D_MT_Animation_Player",
369 text="Animation", icon='PLAY')
370 UseSeparator(self, context)
371 layout.menu("VIEW3D_MT_Object_Interactive_Other", icon='OBJECT_DATA')
372 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
373 layout.menu("VIEW3D_MT_Select_Object", icon='RESTRICT_SELECT_OFF')
374 UseSeparator(self, context)
375 layout.menu("VIEW3D_MT_AddMenu", icon='OBJECT_DATAMODE')
376 layout.menu("VIEW3D_MT_Object", icon='VIEW3D')
377 UseSeparator(self, context)
378 layout.menu("VIEW3D_MT_TransformMenu", icon='EMPTY_ARROWS')
379 layout.menu("VIEW3D_MT_MirrorMenu", icon='MOD_MIRROR')
380 layout.menu("VIEW3D_MT_CursorMenu", icon='PIVOT_CURSOR')
381 UseSeparator(self, context)
382 layout.menu("VIEW3D_MT_ParentMenu", icon='PIVOT_ACTIVE')
383 layout.menu("VIEW3D_MT_GroupMenu", icon='GROUP')
384 UseSeparator(self, context)
385 layout.menu("VIEW3D_MT_object_context_menu", text="Specials", icon='SOLO_OFF')
386 layout.menu("VIEW3D_MT_Camera_Options", icon='OUTLINER_OB_CAMERA')
387 UseSeparator(self, context)
388 layout.operator_menu_enum("object.constraint_add",
389 "type", text="Add Constraint", icon='CONSTRAINT')
390 layout.operator("object.delete", text="Delete Object", icon='X')
391 UseSeparator(self, context)
392 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
393 UseSeparator(self, context)
394 layout.prop(view, "show_region_toolbar", icon='MENU_PANEL')
395 layout.prop(view, "show_region_ui", icon='MENU_PANEL')
397 # Edit Metaball #
398 if obj and obj.type == 'META' and obj.mode in {'EDIT'}:
400 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
401 layout.menu("VIEW3D_MT_Animation_Player",
402 text="Animation", icon='PLAY')
403 UseSeparator(self, context)
404 layout.menu("VIEW3D_MT_Object_Interactive_Other", icon='OBJECT_DATA')
405 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
406 layout.menu("VIEW3D_MT_SelectMetaball", icon='RESTRICT_SELECT_OFF')
407 UseSeparator(self, context)
408 layout.operator_menu_enum("object.metaball_add", "type",
409 text="Add Metaball",
410 icon='OUTLINER_OB_META')
411 layout.menu("VIEW3D_MT_TransformMenu", icon='EMPTY_ARROWS')
412 layout.menu("VIEW3D_MT_MirrorMenu", icon='MOD_MIRROR')
413 layout.menu("VIEW3D_MT_CursorMenu", icon='PIVOT_CURSOR')
414 UseSeparator(self, context)
415 layout.prop_menu_enum(settings, "proportional_edit",
416 icon="PROP_CON")
417 layout.prop_menu_enum(settings, "proportional_edit_falloff",
418 icon="SMOOTHCURVE")
419 UseSeparator(self, context)
420 layout.operator("mball.delete_metaelems", text="Delete Object",
421 icon='CANCEL')
422 UseSeparator(self, context)
423 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
424 UseSeparator(self, context)
425 layout.prop(view, "show_region_toolbar", icon='MENU_PANEL')
426 layout.prop(view, "show_region_ui", icon='MENU_PANEL')
428 # Text Object Mode #
429 if obj and obj.type == 'FONT' and obj.mode in {'OBJECT'}:
431 layout.operator_context = 'INVOKE_REGION_WIN'
432 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
433 layout.menu("VIEW3D_MT_Animation_Player",
434 text="Animation", icon='PLAY')
435 UseSeparator(self, context)
436 layout.operator("view3d.interactive_mode_text", icon='VIEW3D')
437 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
438 layout.menu("VIEW3D_MT_Select_Object", icon='RESTRICT_SELECT_OFF')
439 UseSeparator(self, context)
440 layout.menu("VIEW3D_MT_AddMenu", icon='OBJECT_DATAMODE')
441 layout.menu("VIEW3D_MT_Object", icon='VIEW3D')
442 UseSeparator(self, context)
443 layout.menu("VIEW3D_MT_TransformMenu", icon='EMPTY_ARROWS')
444 layout.menu("VIEW3D_MT_MirrorMenu", icon='MOD_MIRROR')
445 layout.menu("VIEW3D_MT_CursorMenu", icon='PIVOT_CURSOR')
446 UseSeparator(self, context)
447 layout.menu("VIEW3D_MT_ParentMenu", icon='PIVOT_ACTIVE')
448 layout.menu("VIEW3D_MT_GroupMenu", icon='GROUP')
449 UseSeparator(self, context)
450 layout.menu("VIEW3D_MT_object_context_menu", text="Specials", icon='SOLO_OFF')
451 layout.menu("VIEW3D_MT_Camera_Options", icon='OUTLINER_OB_CAMERA')
452 UseSeparator(self, context)
453 layout.operator_menu_enum("object.modifier_add", "type", icon='MODIFIER')
454 layout.operator_menu_enum("object.constraint_add",
455 "type", text="Add Constraint", icon='CONSTRAINT')
456 UseSeparator(self, context)
457 layout.operator("object.delete", text="Delete Object", icon='X')
458 UseSeparator(self, context)
459 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
460 UseSeparator(self, context)
461 layout.prop(view, "show_region_toolbar", icon='MENU_PANEL')
462 layout.prop(view, "show_region_ui", icon='MENU_PANEL')
464 # Text Edit Mode #
465 # To Do: Space is already reserved for the typing tool
466 if obj and obj.type == 'FONT' and obj.mode in {'EDIT'}:
468 layout.operator_context = 'INVOKE_REGION_WIN'
469 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
470 layout.menu("VIEW3D_MT_Animation_Player",
471 text="Animation", icon='PLAY')
472 UseSeparator(self, context)
473 layout.operator("object.editmode_toggle", text="Enter Object Mode",
474 icon='OBJECT_DATA')
475 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
476 layout.menu("VIEW3D_MT_select_edit_text", icon='VIEW3D')
477 layout.menu("VIEW3D_MT_edit_font", icon='RESTRICT_SELECT_OFF')
478 UseSeparator(self, context)
479 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
480 UseSeparator(self, context)
481 layout.prop(view, "show_region_toolbar", icon='MENU_PANEL')
482 layout.prop(view, "show_region_ui", icon='MENU_PANEL')
484 # Camera Object Mode #
485 if obj and obj.type == 'CAMERA' and obj.mode in {'OBJECT'}:
487 layout.operator_context = 'INVOKE_REGION_WIN'
488 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
489 layout.menu("VIEW3D_MT_Animation_Player",
490 text="Animation", icon='PLAY')
491 UseSeparator(self, context)
492 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
493 layout.menu("VIEW3D_MT_Select_Object", icon='RESTRICT_SELECT_OFF')
494 UseSeparator(self, context)
495 layout.menu("VIEW3D_MT_AddMenu", icon='OBJECT_DATAMODE')
496 layout.menu("VIEW3D_MT_Object", icon='VIEW3D')
497 UseSeparator(self, context)
498 layout.menu("VIEW3D_MT_TransformMenu", icon='EMPTY_ARROWS')
499 layout.menu("VIEW3D_MT_CursorMenuLite", icon='PIVOT_CURSOR')
500 UseSeparator(self, context)
501 layout.menu("VIEW3D_MT_ParentMenu", icon='PIVOT_ACTIVE')
502 layout.menu("VIEW3D_MT_GroupMenu", icon='GROUP')
503 UseSeparator(self, context)
504 layout.menu("VIEW3D_MT_object_context_menu", text="Specials", icon='SOLO_OFF')
505 layout.menu("VIEW3D_MT_Camera_Options", icon='OUTLINER_OB_CAMERA')
506 UseSeparator(self, context)
507 layout.operator_menu_enum("object.constraint_add",
508 "type", text="Add Constraint", icon='CONSTRAINT')
509 UseSeparator(self, context)
510 layout.operator("object.delete", text="Delete Object", icon='X')
511 UseSeparator(self, context)
512 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
513 UseSeparator(self, context)
514 layout.prop(view, "show_region_toolbar", icon='MENU_PANEL')
515 layout.prop(view, "show_region_ui", icon='MENU_PANEL')
517 # Lamp Object Mode #
518 if obj and obj.type == 'LIGHT' and obj.mode in {'OBJECT'}:
520 layout.operator_context = 'INVOKE_REGION_WIN'
521 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
522 layout.menu("VIEW3D_MT_Animation_Player",
523 text="Animation", icon='PLAY')
524 UseSeparator(self, context)
525 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
526 layout.menu("VIEW3D_MT_Select_Object", icon='RESTRICT_SELECT_OFF')
527 UseSeparator(self, context)
528 layout.menu("VIEW3D_MT_AddMenu", icon='OBJECT_DATAMODE')
529 layout.menu("VIEW3D_MT_Object", icon='VIEW3D')
530 UseSeparator(self, context)
531 layout.menu("VIEW3D_MT_TransformMenuLite", icon='EMPTY_ARROWS')
532 layout.menu("VIEW3D_MT_CursorMenuLite", icon='PIVOT_CURSOR')
533 UseSeparator(self, context)
534 layout.menu("VIEW3D_MT_ParentMenu", icon='PIVOT_ACTIVE')
535 layout.menu("VIEW3D_MT_GroupMenu", icon='GROUP')
536 UseSeparator(self, context)
537 layout.menu("VIEW3D_MT_object_context_menu", text="Specials", icon='SOLO_OFF')
538 layout.menu("VIEW3D_MT_Camera_Options", icon='OUTLINER_OB_CAMERA')
539 UseSeparator(self, context)
540 layout.operator_menu_enum("object.constraint_add",
541 "type", text="Add Constraint", icon='CONSTRAINT')
542 UseSeparator(self, context)
543 layout.operator("object.delete", text="Delete Object", icon='X')
544 UseSeparator(self, context)
545 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
546 UseSeparator(self, context)
547 layout.prop(view, "show_region_toolbar", icon='MENU_PANEL')
548 layout.prop(view, "show_region_ui", icon='MENU_PANEL')
550 # Armature Object Mode #
551 if obj and obj.type == 'ARMATURE' and obj.mode in {'OBJECT'}:
553 layout.operator_context = 'INVOKE_REGION_WIN'
554 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
555 layout.menu("VIEW3D_MT_Animation_Player",
556 text="Animation", icon='PLAY')
557 UseSeparator(self, context)
558 layout.menu("VIEW3D_MT_Object_Interactive_Armature", icon='VIEW3D')
559 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
560 layout.menu("VIEW3D_MT_Select_Object", icon='RESTRICT_SELECT_OFF')
561 UseSeparator(self, context)
562 layout.menu("VIEW3D_MT_AddMenu", icon='OBJECT_DATAMODE')
563 layout.menu("VIEW3D_MT_Object", icon='VIEW3D')
564 UseSeparator(self, context)
565 layout.menu("VIEW3D_MT_TransformMenuArmature", icon='EMPTY_ARROWS')
566 layout.menu("VIEW3D_MT_MirrorMenu", icon='MOD_MIRROR')
567 layout.menu("VIEW3D_MT_CursorMenuLite", icon='PIVOT_CURSOR')
568 UseSeparator(self, context)
569 layout.menu("VIEW3D_MT_ParentMenu", icon='PIVOT_ACTIVE')
570 layout.menu("VIEW3D_MT_GroupMenu", icon='GROUP')
571 UseSeparator(self, context)
572 layout.menu("VIEW3D_MT_object_context_menu", text="Specials", icon='SOLO_OFF')
573 layout.menu("VIEW3D_MT_Camera_Options", icon='OUTLINER_OB_CAMERA')
574 UseSeparator(self, context)
575 layout.operator_menu_enum("object.constraint_add",
576 "type", text="Add Constraint", icon='CONSTRAINT')
577 UseSeparator(self, context)
578 layout.operator("object.delete", text="Delete Object", icon='X')
579 UseSeparator(self, context)
580 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
581 UseSeparator(self, context)
582 layout.prop(view, "show_region_toolbar", icon='MENU_PANEL')
583 layout.prop(view, "show_region_ui", icon='MENU_PANEL')
585 # Armature Edit #
586 if obj and obj.type == 'ARMATURE' and obj.mode in {'EDIT'}:
588 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
589 layout.menu("VIEW3D_MT_Animation_Player",
590 text="Animation", icon='PLAY')
591 UseSeparator(self, context)
592 layout.menu("VIEW3D_MT_Object_Interactive_Armature", icon='VIEW3D')
593 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
594 layout.menu("VIEW3D_MT_Select_Edit_Armature",
595 icon='RESTRICT_SELECT_OFF')
596 UseSeparator(self, context)
597 layout.menu("VIEW3D_MT_armature_add", text="Add Armature",
598 icon='ARMATURE_DATA')
599 layout.menu("VIEW3D_MT_Edit_Armature", text="Armature",
600 icon='OUTLINER_DATA_ARMATURE')
601 layout.menu("VIEW3D_MT_EditArmatureTK",
602 icon='ARMATURE_DATA')
603 UseSeparator(self, context)
604 layout.menu("VIEW3D_MT_TransformMenuArmatureEdit", icon='EMPTY_ARROWS')
605 layout.menu("VIEW3D_MT_MirrorMenu", icon='MOD_MIRROR')
606 layout.menu("VIEW3D_MT_CursorMenuLite", icon='PIVOT_CURSOR')
607 layout.menu("VIEW3D_MT_ParentMenu", icon='PIVOT_ACTIVE')
608 layout.menu("VIEW3D_MT_armature_context_menu", icon='SOLO_OFF')
609 layout.menu("VIEW3D_MT_edit_armature_roll",
610 icon='BONE_DATA')
611 UseSeparator(self, context)
612 layout.operator("armature.delete", text="Delete Object",
613 icon='X')
614 UseSeparator(self, context)
615 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
616 UseSeparator(self, context)
617 layout.prop(view, "show_region_toolbar", icon='MENU_PANEL')
618 layout.prop(view, "show_region_ui", icon='MENU_PANEL')
620 # Armature Pose #
621 if obj and obj.type == 'ARMATURE' and obj.mode in {'POSE'}:
623 arm = context.active_object.data
625 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
626 layout.menu("VIEW3D_MT_Animation_Player",
627 text="Animation", icon='PLAY')
628 UseSeparator(self, context)
629 layout.menu("VIEW3D_MT_Object_Interactive_Armature", icon='VIEW3D')
630 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
631 layout.menu("VIEW3D_MT_Select_Pose", icon='RESTRICT_SELECT_OFF')
632 UseSeparator(self, context)
633 layout.menu("VIEW3D_MT_Pose", icon='ARMATURE_DATA')
634 layout.menu("VIEW3D_MT_TransformMenuArmaturePose", icon='EMPTY_ARROWS')
635 layout.menu("VIEW3D_MT_pose_transform", icon='EMPTY_DATA')
636 UseSeparator(self, context)
637 layout.menu("VIEW3D_MT_CursorMenuLite", icon='PIVOT_CURSOR')
638 layout.menu("VIEW3D_MT_PoseCopy", icon='FILE')
640 if arm.display_type in {'BBONE', 'ENVELOPE'}:
641 layout.operator("transform.transform",
642 text="Scale Envelope Distance").mode = 'BONE_SIZE'
644 layout.menu("VIEW3D_MT_pose_apply", icon='AUTO')
645 layout.operator("pose.relax", icon='ARMATURE_DATA')
646 layout.menu("VIEW3D_MT_KeyframeMenu", icon='KEY_HLT')
647 layout.menu("VIEW3D_MT_pose_context_menu", icon='SOLO_OFF')
648 layout.menu("VIEW3D_MT_pose_group", icon='GROUP_BONE')
649 UseSeparator(self, context)
650 layout.operator_menu_enum("pose.constraint_add",
651 "type", text="Add Constraint", icon='CONSTRAINT_BONE')
652 UseSeparator(self, context)
653 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
655 UseSeparator(self, context)
656 layout.prop(view, "show_region_toolbar", icon='MENU_PANEL')
657 layout.prop(view, "show_region_ui", icon='MENU_PANEL')
659 # Lattice Object Mode #
660 if obj and obj.type == 'LATTICE' and obj.mode in {'OBJECT'}:
662 layout.operator_context = 'INVOKE_REGION_WIN'
663 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
664 layout.menu("VIEW3D_MT_Animation_Player",
665 text="Animation", icon='PLAY')
666 UseSeparator(self, context)
667 layout.menu("VIEW3D_MT_Object_Interactive_Other", icon='OBJECT_DATA')
668 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
669 layout.menu("VIEW3D_MT_Select_Object", icon='RESTRICT_SELECT_OFF')
670 UseSeparator(self, context)
671 layout.menu("VIEW3D_MT_AddMenu", icon='OBJECT_DATAMODE')
672 layout.menu("VIEW3D_MT_Object", icon='VIEW3D')
673 UseSeparator(self, context)
674 layout.menu("VIEW3D_MT_TransformMenu", icon='EMPTY_ARROWS')
675 layout.menu("VIEW3D_MT_MirrorMenu", icon='MOD_MIRROR')
676 layout.menu("VIEW3D_MT_CursorMenu", icon='PIVOT_CURSOR')
677 UseSeparator(self, context)
678 layout.menu("VIEW3D_MT_ParentMenu", icon='PIVOT_ACTIVE')
679 layout.menu("VIEW3D_MT_GroupMenu", icon='GROUP')
680 UseSeparator(self, context)
681 layout.menu("VIEW3D_MT_object_context_menu", text="Specials", icon='SOLO_OFF')
682 layout.menu("VIEW3D_MT_Camera_Options", icon='OUTLINER_OB_CAMERA')
683 UseSeparator(self, context)
684 layout.operator_menu_enum("object.modifier_add", "type", icon='MODIFIER')
685 layout.operator_menu_enum("object.constraint_add",
686 "type", text="Add Constraint", icon='CONSTRAINT')
687 UseSeparator(self, context)
688 layout.operator("object.delete", text="Delete Object", icon='X')
689 UseSeparator(self, context)
690 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
691 UseSeparator(self, context)
692 layout.prop(view, "show_region_toolbar", icon='MENU_PANEL')
693 layout.prop(view, "show_region_ui", icon='MENU_PANEL')
695 # Edit Lattice #
696 if obj and obj.type == 'LATTICE' and obj.mode in {'EDIT'}:
698 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
699 layout.menu("VIEW3D_MT_Animation_Player",
700 text="Animation", icon='PLAY')
701 UseSeparator(self, context)
702 layout.menu("VIEW3D_MT_Object_Interactive_Other", icon='OBJECT_DATA')
703 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
704 layout.menu("VIEW3D_MT_Select_Edit_Lattice",
705 icon='RESTRICT_SELECT_OFF')
706 UseSeparator(self, context)
707 layout.menu("VIEW3D_MT_TransformMenu", icon='EMPTY_ARROWS')
708 layout.menu("VIEW3D_MT_MirrorMenu", icon='MOD_MIRROR')
709 layout.menu("VIEW3D_MT_CursorMenu", icon='PIVOT_CURSOR')
710 UseSeparator(self, context)
711 layout.prop_menu_enum(settings, "proportional_edit",
712 icon="PROP_CON")
713 layout.prop_menu_enum(settings, "proportional_edit_falloff",
714 icon="SMOOTHCURVE")
715 UseSeparator(self, context)
716 layout.operator("lattice.make_regular")
717 UseSeparator(self, context)
718 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
719 UseSeparator(self, context)
720 layout.prop(view, "show_region_toolbar", icon='MENU_PANEL')
721 layout.prop(view, "show_region_ui", icon='MENU_PANEL')
723 # Empty Object Mode #
724 if obj and obj.type == 'EMPTY' and obj.mode in {'OBJECT'}:
726 layout.operator_context = 'INVOKE_REGION_WIN'
727 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
728 layout.menu("VIEW3D_MT_Animation_Player",
729 text="Animation", icon='PLAY')
730 UseSeparator(self, context)
731 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
732 layout.menu("VIEW3D_MT_Select_Object", icon='RESTRICT_SELECT_OFF')
733 UseSeparator(self, context)
734 layout.menu("VIEW3D_MT_AddMenu", icon='OBJECT_DATAMODE')
735 layout.menu("VIEW3D_MT_Object", icon='VIEW3D')
736 UseSeparator(self, context)
737 layout.menu("VIEW3D_MT_TransformMenuLite", icon='EMPTY_ARROWS')
738 layout.menu("VIEW3D_MT_MirrorMenu", icon='MOD_MIRROR')
739 layout.menu("VIEW3D_MT_CursorMenuLite", icon='PIVOT_CURSOR')
740 UseSeparator(self, context)
741 layout.menu("VIEW3D_MT_ParentMenu", icon='PIVOT_ACTIVE')
742 layout.menu("VIEW3D_MT_GroupMenu", icon='GROUP')
743 UseSeparator(self, context)
744 layout.menu("VIEW3D_MT_object_context_menu", text="Specials", icon='SOLO_OFF')
745 layout.menu("VIEW3D_MT_Camera_Options", icon='OUTLINER_OB_CAMERA')
746 UseSeparator(self, context)
747 layout.operator_menu_enum("object.constraint_add",
748 "type", text="Add Constraint", icon='CONSTRAINT')
749 UseSeparator(self, context)
750 layout.operator("object.delete", text="Delete Object", icon='X')
751 UseSeparator(self, context)
752 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
753 UseSeparator(self, context)
754 layout.prop(view, "show_region_toolbar", icon='MENU_PANEL')
755 layout.prop(view, "show_region_ui", icon='MENU_PANEL')
757 # Speaker Object Mode #
758 if obj and obj.type == 'SPEAKER' and obj.mode in {'OBJECT'}:
760 layout.operator_context = 'INVOKE_REGION_WIN'
761 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
762 layout.menu("VIEW3D_MT_Animation_Player",
763 text="Animation", icon='PLAY')
764 UseSeparator(self, context)
765 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
766 layout.menu("VIEW3D_MT_Select_Object", icon='RESTRICT_SELECT_OFF')
767 UseSeparator(self, context)
768 layout.menu("VIEW3D_MT_AddMenu", icon='OBJECT_DATAMODE')
769 layout.menu("VIEW3D_MT_Object", icon='VIEW3D')
770 UseSeparator(self, context)
771 layout.menu("VIEW3D_MT_TransformMenuLite", icon='EMPTY_ARROWS')
772 layout.menu("VIEW3D_MT_CursorMenuLite", icon='PIVOT_CURSOR')
773 UseSeparator(self, context)
774 layout.menu("VIEW3D_MT_ParentMenu", icon='PIVOT_ACTIVE')
775 layout.menu("VIEW3D_MT_GroupMenu", icon='GROUP')
776 UseSeparator(self, context)
777 layout.operator_menu_enum("object.constraint_add",
778 "type", text="Add Constraint", icon='CONSTRAINT')
779 UseSeparator(self, context)
780 layout.operator("object.delete", text="Delete Object", icon='X')
781 UseSeparator(self, context)
782 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
783 UseSeparator(self, context)
784 layout.prop(view, "show_region_toolbar", icon='MENU_PANEL')
785 layout.prop(view, "show_region_ui", icon='MENU_PANEL')
787 # Particle Menu #
788 if obj and context.mode == 'PARTICLE':
790 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
791 layout.menu("VIEW3D_MT_Animation_Player",
792 text="Animation", icon='PLAY')
793 UseSeparator(self, context)
794 layout.menu("VIEW3D_MT_Object_Interactive_Mode", icon='VIEW3D')
795 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
796 layout.menu("VIEW3D_MT_Select_Particle",
797 icon='RESTRICT_SELECT_OFF')
798 layout.menu("VIEW3D_MT_Selection_Mode_Particle",
799 text="Select and Display Mode", icon='PARTICLE_PATH')
800 UseSeparator(self, context)
801 layout.menu("VIEW3D_MT_TransformMenu", icon='EMPTY_ARROWS')
802 layout.menu("VIEW3D_MT_MirrorMenu", icon='MOD_MIRROR')
803 layout.menu("VIEW3D_MT_CursorMenuLite", icon='PIVOT_CURSOR')
804 UseSeparator(self, context)
805 layout.prop_menu_enum(settings, "proportional_edit",
806 icon="PROP_CON")
807 layout.prop_menu_enum(settings, "proportional_edit_falloff",
808 icon="SMOOTHCURVE")
809 UseSeparator(self, context)
810 layout.menu("VIEW3D_MT_particle", icon='PARTICLEMODE')
811 layout.menu("VIEW3D_MT_particle_context_menu", text="Hair Specials", icon='HAIR')
812 UseSeparator(self, context)
813 layout.operator("object.delete", text="Delete Object", icon='X')
814 UseSeparator(self, context)
815 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
816 UseSeparator(self, context)
817 layout.prop(view, "show_region_toolbar", icon='MENU_PANEL')
818 layout.prop(view, "show_region_ui", icon='MENU_PANEL')
820 # Grease Pencil Object Mode #
821 if obj and obj.type == 'GPENCIL' and obj.mode in {'OBJECT'}:
822 layout.operator_context = 'INVOKE_REGION_WIN'
823 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
824 layout.menu("VIEW3D_MT_Animation_Player",
825 text="Animation", icon='PLAY')
826 UseSeparator(self, context)
827 layout.menu("VIEW3D_MT_interactive_mode_gpencil", icon='EDITMODE_HLT')
828 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
829 layout.menu("VIEW3D_MT_Select_Object", icon='RESTRICT_SELECT_OFF')
830 UseSeparator(self, context)
831 layout.menu("VIEW3D_MT_AddMenu", icon='OBJECT_DATAMODE')
832 layout.menu("VIEW3D_MT_Object", icon='VIEW3D')
833 UseSeparator(self, context)
834 layout.menu("VIEW3D_MT_TransformMenu", icon='EMPTY_ARROWS')
835 layout.menu("VIEW3D_MT_MirrorMenu", icon='MOD_MIRROR')
836 layout.menu("VIEW3D_MT_CursorMenu", icon='PIVOT_CURSOR')
837 UseSeparator(self, context)
838 layout.menu("VIEW3D_MT_ParentMenu", icon='PIVOT_ACTIVE')
839 layout.menu("VIEW3D_MT_GroupMenu", icon='GROUP')
840 UseSeparator(self, context)
841 layout.menu("VIEW3D_MT_object_context_menu", text="Specials", icon='SOLO_OFF')
842 layout.menu("VIEW3D_MT_Camera_Options", icon='OUTLINER_OB_CAMERA')
843 UseSeparator(self, context)
844 layout.operator_menu_enum("object.gpencil_modifier_add", "type", icon='MODIFIER')
845 layout.operator_menu_enum("object.shaderfx_add", "type", icon ='SHADERFX')
846 layout.operator_menu_enum("object.constraint_add",
847 "type", text="Add Constraint", icon='CONSTRAINT')
848 UseSeparator(self, context)
849 layout.operator("object.delete", text="Delete Object", icon='X')
850 UseSeparator(self, context)
851 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
852 UseSeparator(self, context)
853 layout.prop(view, "show_region_toolbar", icon='MENU_PANEL')
854 layout.prop(view, "show_region_ui", icon='MENU_PANEL')
856 # Grease Pencil Edit Mode #
857 if obj and obj.type == 'GPENCIL' and obj.mode in {'EDIT_GPENCIL'}:
858 layout.operator_context = 'INVOKE_REGION_WIN'
860 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
861 layout.menu("VIEW3D_MT_Animation_Player",
862 text="Animation", icon='PLAY')
863 UseSeparator(self, context)
864 layout.menu("VIEW3D_MT_interactive_mode_gpencil", icon='EDITMODE_HLT')
865 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
866 layout.menu("VIEW3D_MT_select_gpencil", icon='RESTRICT_SELECT_OFF')
867 layout.menu("VIEW3D_MT_edit_gpencil", icon='GREASEPENCIL')
868 UseSeparator(self, context)
869 layout.menu("VIEW3D_MT_AddMenu", icon='OBJECT_DATAMODE')
870 UseSeparator(self, context)
871 layout.operator("view3d.snap_cursor_to_center",
872 text="Cursor to World Origin", icon='CURSOR')
873 layout.operator("view3d.snap_cursor_to_grid",
874 text="Cursor to Grid", icon='SNAP_GRID')
875 UseSeparator(self, context)
876 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
877 UseSeparator(self, context)
878 layout.prop(view, "show_region_toolbar", icon='MENU_PANEL')
879 layout.prop(view, "show_region_ui", icon='MENU_PANEL')
881 # Grease Pencil Sculpt Mode #
882 if obj and obj.type == 'GPENCIL' and obj.mode in {'SCULPT_GPENCIL'}:
883 layout.operator_context = 'INVOKE_REGION_WIN'
885 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
886 layout.menu("VIEW3D_MT_Animation_Player",
887 text="Animation", icon='PLAY')
888 UseSeparator(self, context)
889 layout.menu("VIEW3D_MT_interactive_mode_gpencil", icon='EDITMODE_HLT')
890 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
891 layout.menu("VIEW3D_MT_select_gpencil", icon='RESTRICT_SELECT_OFF')
892 UseSeparator(self, context)
893 layout.menu("VIEW3D_MT_AddMenu", icon='OBJECT_DATAMODE')
894 UseSeparator(self, context)
895 layout.operator("view3d.snap_cursor_to_center",
896 text="Cursor to World Origin", icon='CURSOR')
897 layout.operator("view3d.snap_cursor_to_grid",
898 text="Cursor to Grid", icon='SNAP_GRID')
899 UseSeparator(self, context)
900 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
901 UseSeparator(self, context)
902 layout.prop(view, "show_region_toolbar", icon='MENU_PANEL')
903 layout.prop(view, "show_region_ui", icon='MENU_PANEL')
905 # Grease Pencil Paint Mode #
906 if obj and obj.type == 'GPENCIL' and obj.mode in {'PAINT_GPENCIL'}:
907 layout.operator_context = 'INVOKE_REGION_WIN'
909 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
910 layout.menu("VIEW3D_MT_Animation_Player",
911 text="Animation", icon='PLAY')
912 UseSeparator(self, context)
913 layout.menu("VIEW3D_MT_interactive_mode_gpencil", icon='EDITMODE_HLT')
914 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
915 layout.menu("VIEW3D_MT_paint_gpencil", icon='RESTRICT_SELECT_OFF')
916 UseSeparator(self, context)
917 layout.menu("VIEW3D_MT_AddMenu", icon='OBJECT_DATAMODE')
918 UseSeparator(self, context)
919 layout.operator("view3d.snap_cursor_to_center",
920 text="Cursor to World Origin", icon='CURSOR')
921 layout.operator("view3d.snap_cursor_to_grid",
922 text="Cursor to Grid", icon='SNAP_GRID')
923 UseSeparator(self, context)
924 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
925 UseSeparator(self, context)
926 layout.prop(view, "show_region_toolbar", icon='MENU_PANEL')
927 layout.prop(view, "show_region_ui", icon='MENU_PANEL')
929 # Grease Pencil Weight Mode #
930 if obj and obj.type == 'GPENCIL' and obj.mode in {'WEIGHT_GPENCIL'}:
931 layout.operator_context = 'INVOKE_REGION_WIN'
933 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
934 layout.menu("VIEW3D_MT_Animation_Player",
935 text="Animation", icon='PLAY')
936 UseSeparator(self, context)
937 layout.menu("VIEW3D_MT_interactive_mode_gpencil", icon='EDITMODE_HLT')
938 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
939 layout.menu("VIEW3D_MT_weight_gpencil", icon="GPBRUSH_WEIGHT")
940 UseSeparator(self, context)
941 layout.menu("VIEW3D_MT_AddMenu", icon='OBJECT_DATAMODE')
942 UseSeparator(self, context)
943 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
944 UseSeparator(self, context)
945 layout.prop(view, "show_region_toolbar", icon='MENU_PANEL')
946 layout.prop(view, "show_region_ui", icon='MENU_PANEL')
948 # Light Probe Menu #
949 if obj and obj.type == 'LIGHT_PROBE':
950 layout.operator_context = 'INVOKE_REGION_WIN'
952 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
953 layout.menu("VIEW3D_MT_Animation_Player",
954 text="Animation", icon='PLAY')
955 UseSeparator(self, context)
956 layout.menu("INFO_MT_area", icon='WORKSPACE')
957 layout.menu("VIEW3D_MT_View_Directions", icon='ZOOM_ALL')
958 layout.menu("VIEW3D_MT_View_Navigation", icon='PIVOT_BOUNDBOX')
959 UseSeparator(self, context)
960 layout.menu("VIEW3D_MT_AddMenu", icon='OBJECT_DATAMODE')
961 UseSeparator(self, context)
962 layout.operator("view3d.snap_cursor_to_center",
963 text="Cursor to World Origin", icon='CURSOR')
964 layout.operator("view3d.snap_cursor_to_grid",
965 text="Cursor to Grid", icon='SNAP_GRID')
966 UseSeparator(self, context)
967 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
968 UseSeparator(self, context)
969 layout.prop(view, "show_region_toolbar", icon='MENU_PANEL')
970 layout.prop(view, "show_region_ui", icon='MENU_PANEL')
972 # Object Menus #
974 # ********** Object Menu **********
975 class VIEW3D_MT_Object(Menu):
976 bl_context = "objectmode"
977 bl_label = "Object"
979 def draw(self, context):
980 layout = self.layout
981 view = context.space_data
982 is_local_view = (view.local_view is not None)
984 layout.operator("object.delete", text="Delete...").use_global = False
985 UseSeparator(self, context)
986 layout.menu("VIEW3D_MT_object_parent")
987 layout.menu("VIEW3D_MT_Duplicate")
988 layout.operator("object.join")
990 if is_local_view:
991 layout.operator_context = 'EXEC_REGION_WIN'
992 layout.operator("object.move_to_layer", text="Move out of Local View")
993 layout.operator_context = 'INVOKE_REGION_WIN'
995 layout.menu("VIEW3D_MT_make_links", text="Make Links...")
996 layout.menu("VIEW3D_MT_Object_Data_Link")
997 UseSeparator(self, context)
998 layout.menu("VIEW3D_MT_AutoSmooth", icon='ALIASED')
999 UseSeparator(self, context)
1000 layout.menu("VIEW3D_MT_object_constraints")
1001 layout.menu("VIEW3D_MT_object_track")
1002 layout.menu("VIEW3D_MT_object_animation")
1003 UseSeparator(self, context)
1004 layout.menu("VIEW3D_MT_object_showhide")
1005 UseSeparator(self, context)
1006 layout.operator_menu_enum("object.convert", "target")
1009 # ********** Object Add **********
1010 class VIEW3D_MT_AddMenu(Menu):
1011 bl_label = "Add Object"
1013 def draw(self, context):
1014 layout = self.layout
1015 layout.operator_context = 'EXEC_REGION_WIN'
1017 layout.menu("VIEW3D_MT_mesh_add", text="Add Mesh",
1018 icon='OUTLINER_OB_MESH')
1019 layout.menu("VIEW3D_MT_curve_add", text="Add Curve",
1020 icon='OUTLINER_OB_CURVE')
1021 layout.menu("VIEW3D_MT_surface_add", text="Add Surface",
1022 icon='OUTLINER_OB_SURFACE')
1023 layout.operator_menu_enum("object.metaball_add", "type",
1024 icon='OUTLINER_OB_META')
1025 layout.operator("object.text_add", text="Add Text",
1026 icon='OUTLINER_OB_FONT')
1027 layout.operator_menu_enum("object.gpencil_add", "type", text="Grease Pencil", icon='OUTLINER_OB_GREASEPENCIL')
1028 UseSeparator(self, context)
1030 layout.menu("VIEW3D_MT_armature_add", text="Add Armature",
1031 icon='OUTLINER_OB_ARMATURE')
1032 layout.operator("object.add", text="Lattice",
1033 icon='OUTLINER_OB_LATTICE').type = 'LATTICE'
1034 UseSeparator(self, context)
1036 layout.operator_menu_enum("object.empty_add", "type", text="Empty", icon='OUTLINER_OB_EMPTY')
1037 layout.menu("VIEW3D_MT_image_add", text="Image", icon='OUTLINER_OB_IMAGE')
1038 UseSeparator(self, context)
1040 layout.operator_menu_enum("object.light_add", "type",
1041 icon="OUTLINER_OB_LIGHT")
1042 layout.menu("VIEW3D_MT_lightprobe_add", icon='OUTLINER_OB_LIGHTPROBE')
1043 UseSeparator(self, context)
1045 layout.operator("object.camera_add", text="Camera",
1046 icon='OUTLINER_OB_CAMERA')
1047 UseSeparator(self, context)
1049 layout.operator("object.speaker_add", text="Speaker", icon='OUTLINER_OB_SPEAKER')
1050 UseSeparator(self, context)
1052 layout.operator_menu_enum("object.effector_add", "type",
1053 text="Force Field",
1054 icon='FORCE_FORCE')
1055 layout.menu("VIEW3D_MT_object_quick_effects", text="Quick Effects", icon='PARTICLES')
1056 UseSeparator(self, context)
1058 has_collections = bool(bpy.data.collections)
1059 col = layout.column()
1060 col.enabled = has_collections
1062 if not has_collections or len(bpy.data.collections) > 10:
1063 col.operator_context = 'INVOKE_REGION_WIN'
1064 col.operator(
1065 "object.collection_instance_add",
1066 text="Collection Instance..." if has_collections else "No Collections to Instance",
1067 icon='OUTLINER_OB_GROUP_INSTANCE',
1069 else:
1070 col.operator_menu_enum(
1071 "object.collection_instance_add",
1072 "collection",
1073 text="Collection Instance",
1074 icon='OUTLINER_OB_GROUP_INSTANCE',
1078 # ********** Object Mirror **********
1079 class VIEW3D_MT_MirrorMenu(Menu):
1080 bl_label = "Mirror"
1082 def draw(self, context):
1083 layout = self.layout
1084 layout.operator("transform.mirror", text="Interactive Mirror")
1085 UseSeparator(self, context)
1086 layout.operator_context = 'INVOKE_REGION_WIN'
1087 props = layout.operator("transform.mirror", text="X Global")
1088 props.constraint_axis = (True, False, False)
1089 props.orient_type = 'GLOBAL'
1090 props = layout.operator("transform.mirror", text="Y Global")
1091 props.constraint_axis = (False, True, False)
1092 props.orient_type = 'GLOBAL'
1093 props = layout.operator("transform.mirror", text="Z Global")
1094 props.constraint_axis = (False, False, True)
1095 props.orient_type = 'GLOBAL'
1097 if context.edit_object:
1099 UseSeparator(self, context)
1100 props = layout.operator("transform.mirror", text="X Local")
1101 props.constraint_axis = (True, False, False)
1102 props.orient_type = 'LOCAL'
1103 props = layout.operator("transform.mirror", text="Y Local")
1104 props.constraint_axis = (False, True, False)
1105 props.orient_type = 'LOCAL'
1106 props = layout.operator("transform.mirror", text="Z Local")
1107 props.constraint_axis = (False, False, True)
1108 props.orient_type = 'LOCAL'
1109 UseSeparator(self, context)
1110 layout.operator("object.vertex_group_mirror")
1113 # ********** Object Snap Cursor **********
1114 class VIEW3D_MT_Snap_Context(Menu):
1115 bl_label = "Snapping"
1117 def draw(self, context):
1118 layout = self.layout
1119 toolsettings = context.tool_settings
1120 # layout.prop(toolsettings, "snap_element", expand=True)
1121 layout.prop(toolsettings, "use_snap")
1124 class VIEW3D_MT_Snap_Origin(Menu):
1125 bl_label = "Snap "
1127 def draw(self, context):
1128 layout = self.layout
1129 layout.operator_context = 'EXEC_AREA'
1130 layout.operator("object.origin_set",
1131 text="Geometry to Origin").type = 'GEOMETRY_ORIGIN'
1132 UseSeparator(self, context)
1133 layout.operator("object.origin_set",
1134 text="Origin to Geometry").type = 'ORIGIN_GEOMETRY'
1135 layout.operator("object.origin_set",
1136 text="Origin to 3D Cursor").type = 'ORIGIN_CURSOR'
1137 layout.operator("object.origin_set",
1138 text="Origin to Center of Mass").type = 'ORIGIN_CENTER_OF_MASS'
1141 class VIEW3D_MT_CursorMenu(Menu):
1142 bl_label = "Snap Cursor"
1144 def draw(self, context):
1145 layout = self.layout
1146 layout.operator_context = 'INVOKE_REGION_WIN'
1147 layout.menu("VIEW3D_MT_Snap_Origin")
1148 # layout.menu("VIEW3D_Snap_Context")
1149 UseSeparator(self, context)
1150 layout.operator("view3d.snap_cursor_to_selected",
1151 text="Cursor to Selected")
1152 layout.operator("view3d.snap_cursor_to_center",
1153 text="Cursor to World Origin")
1154 layout.operator("view3d.snap_cursor_to_grid",
1155 text="Cursor to Grid")
1156 layout.operator("view3d.snap_cursor_to_active",
1157 text="Cursor to Active")
1158 UseSeparator(self, context)
1159 layout.operator("view3d.snap_selected_to_cursor",
1160 text="Selection to Cursor").use_offset = False
1161 layout.operator("view3d.snap_selected_to_cursor",
1162 text="Selection to Cursor (Keep Offset)").use_offset = True
1163 layout.operator("view3d.snap_selected_to_grid",
1164 text="Selection to Grid")
1165 layout.operator("view3d.snap_cursor_selected_to_center",
1166 text="Selection and Cursor to World Origin")
1169 class VIEW3D_MT_CursorMenuLite(Menu):
1170 bl_label = "Snap Cursor"
1172 def draw(self, context):
1173 layout = self.layout
1174 layout.operator_context = 'INVOKE_REGION_WIN'
1175 layout.menu("VIEW3D_Snap_Origin")
1176 UseSeparator(self, context)
1177 layout.operator("view3d.snap_cursor_to_selected",
1178 text="Cursor to Selected")
1179 layout.operator("view3d.snap_cursor_to_center",
1180 text="Cursor to World Origin")
1181 layout.operator("view3d.snap_cursor_to_grid",
1182 text="Cursor to Grid")
1183 layout.operator("view3d.snap_cursor_to_active",
1184 text="Cursor to Active")
1185 UseSeparator(self, context)
1186 layout.operator("view3d.snap_selected_to_cursor",
1187 text="Selection to Cursor").use_offset = False
1188 layout.operator("view3d.snap_selected_to_cursor",
1189 text="Selection to Cursor (Keep Offset)").use_offset = True
1190 layout.operator("view3d.snap_selected_to_grid",
1191 text="Selection to Grid")
1192 layout.operator("view3d.snap_cursor_selected_to_center",
1193 text="Selection and Cursor to World Origin")
1196 # ********** Object Interactive Mode **********
1197 class VIEW3D_MT_InteractiveMode(Menu):
1198 bl_label = "Interactive Mode"
1199 bl_description = "Menu of objects' interactive modes (Window Types)"
1201 def draw(self, context):
1202 layout = self.layout
1203 obj = context.active_object
1204 psys = hasattr(obj, "particle_systems")
1205 psys_items = len(obj.particle_systems.items()) > 0 if psys else False
1207 layout.operator(VIEW3D_OT_SetObjectMode.bl_idname, text="Object", icon="OBJECT_DATAMODE").mode = "OBJECT"
1208 layout.operator(VIEW3D_OT_SetObjectMode.bl_idname, text="Edit", icon="EDITMODE_HLT").mode = "EDIT"
1209 layout.operator(VIEW3D_OT_SetObjectMode.bl_idname, text="Sculpt", icon="SCULPTMODE_HLT").mode = "SCULPT"
1210 layout.operator(VIEW3D_OT_SetObjectMode.bl_idname, text="Vertex Paint", icon="VPAINT_HLT").mode = "VERTEX_PAINT"
1211 layout.operator(VIEW3D_OT_SetObjectMode.bl_idname, text="Weight Paint", icon="WPAINT_HLT").mode = "WEIGHT_PAINT"
1212 layout.operator(VIEW3D_OT_SetObjectMode.bl_idname, text="Texture Paint", icon="TPAINT_HLT").mode = "TEXTURE_PAINT"
1213 if obj and psys_items:
1214 layout.operator(VIEW3D_OT_SetObjectMode.bl_idname, text="Particle Edit",
1215 icon="PARTICLEMODE").mode = "PARTICLE_EDIT"
1216 # if context.gpencil_data:
1217 # layout.operator("view3d.interactive_mode_grease_pencil", icon="GREASEPENCIL")
1220 # ********** Object Armature Interactive Mode **********
1221 class VIEW3D_MT_InteractiveModeArmature(Menu):
1222 bl_idname = "VIEW3D_MT_Object_Interactive_Armature"
1223 bl_label = "Interactive Mode"
1224 bl_description = "Menu of objects interactive mode"
1226 def draw(self, context):
1227 layout = self.layout
1229 layout.operator(VIEW3D_OT_SetObjectMode.bl_idname, text="Object", icon="OBJECT_DATAMODE").mode = "OBJECT"
1230 layout.operator(VIEW3D_OT_SetObjectMode.bl_idname, text="Edit", icon="EDITMODE_HLT").mode = "EDIT"
1231 layout.operator(VIEW3D_OT_SetObjectMode.bl_idname, text="Pose", icon="POSE_HLT").mode = "POSE"
1232 # if context.gpencil_data:
1233 # layout.operator("view3d.interactive_mode_grease_pencil", icon="GREASEPENCIL")
1236 # ********** Interactive Mode Other **********
1237 class VIEW3D_MT_InteractiveModeOther(Menu):
1238 bl_idname = "VIEW3D_MT_Object_Interactive_Other"
1239 bl_label = "Interactive Mode"
1240 bl_description = "Menu of objects interactive mode"
1242 def draw(self, context):
1243 layout = self.layout
1244 layout.operator("object.editmode_toggle", text="Edit/Object Toggle",
1245 icon='OBJECT_DATA')
1248 # ********** Grease Pencil Interactive Mode **********
1249 class VIEW3D_OT_Interactive_Mode_Grease_Pencil(Operator):
1250 bl_idname = "view3d.interactive_mode_grease_pencil"
1251 bl_label = "Edit Strokes"
1252 bl_description = "Toggle Edit Strokes for Grease Pencil"
1254 @classmethod
1255 def poll(cls, context):
1256 return (context.gpencil_data is not None)
1258 def execute(self, context):
1259 try:
1260 bpy.ops.gpencil.editmode_toggle()
1261 except:
1262 self.report({'WARNING'}, "It is not possible to enter into the interactive mode")
1263 return {'FINISHED'}
1265 class VIEW3D_MT_Interactive_Mode_GPencil(Menu):
1266 bl_idname = "VIEW3D_MT_interactive_mode_gpencil"
1267 bl_label = "Interactive Mode"
1268 bl_description = "Menu of objects interactive mode"
1270 def draw(self, context):
1271 toolsettings = context.tool_settings
1272 layout = self.layout
1273 layout.operator(VIEW3D_OT_SetObjectMode.bl_idname, text="Object", icon="OBJECT_DATAMODE").mode = "OBJECT"
1274 layout.operator(VIEW3D_OT_SetObjectMode.bl_idname, text="Edit", icon="EDITMODE_HLT").mode = "EDIT_GPENCIL"
1275 layout.operator(VIEW3D_OT_SetObjectMode.bl_idname, text="Sculpt", icon="SCULPTMODE_HLT").mode = "SCULPT_GPENCIL"
1276 layout.operator(VIEW3D_OT_SetObjectMode.bl_idname, text="Draw", icon="GREASEPENCIL").mode = "PAINT_GPENCIL"
1277 layout.operator(VIEW3D_OT_SetObjectMode.bl_idname, text="Weight Paint", icon="WPAINT_HLT").mode = "WEIGHT_GPENCIL"
1279 # currently unused
1280 class VIEW3D_MT_Edit_Gpencil(Menu):
1281 bl_label = "GPencil"
1283 def draw(self, context):
1284 toolsettings = context.tool_settings
1285 layout = self.layout
1287 layout.operator("gpencil.brush_paint", text="Sculpt Strokes").wait_for_input = True
1288 layout.prop_menu_enum(toolsettings.gpencil_sculpt, "tool", text="Sculpt Brush")
1289 UseSeparator(self, context)
1290 layout.menu("VIEW3D_MT_edit_gpencil_transform")
1291 layout.operator("transform.mirror", text="Mirror")
1292 layout.menu("GPENCIL_MT_snap")
1293 UseSeparator(self, context)
1294 layout.menu("VIEW3D_MT_object_animation") # NOTE: provides keyingset access...
1295 UseSeparator(self, context)
1296 layout.menu("VIEW3D_MT_edit_gpencil_delete")
1297 layout.operator("gpencil.duplicate_move", text="Duplicate")
1298 UseSeparator(self, context)
1299 layout.menu("VIEW3D_MT_select_gpencil")
1300 UseSeparator(self, context)
1301 layout.operator("gpencil.copy", text="Copy")
1302 layout.operator("gpencil.paste", text="Paste")
1303 UseSeparator(self, context)
1304 layout.prop_menu_enum(toolsettings, "proportional_edit")
1305 layout.prop_menu_enum(toolsettings, "proportional_edit_falloff")
1306 UseSeparator(self, context)
1307 layout.operator("gpencil.reveal")
1308 layout.operator("gpencil.hide", text="Show Active Layer Only").unselected = True
1309 layout.operator("gpencil.hide", text="Hide Active Layer").unselected = False
1310 UseSeparator(self, context)
1311 layout.operator_menu_enum("gpencil.move_to_layer", "layer", text="Move to Layer")
1312 layout.operator_menu_enum("gpencil.convert", "type", text="Convert to Geometry...")
1315 # ********** Text Interactive Mode **********
1316 class VIEW3D_OT_Interactive_Mode_Text(Operator):
1317 bl_idname = "view3d.interactive_mode_text"
1318 bl_label = "Enter Edit Mode"
1319 bl_description = "Toggle object's editmode"
1321 @classmethod
1322 def poll(cls, context):
1323 return (context.active_object is not None)
1325 def execute(self, context):
1326 bpy.ops.object.editmode_toggle()
1327 self.report({'INFO'}, "Spacebar shortcut won't work in the Text Edit mode")
1328 return {'FINISHED'}
1331 # ********** Object Parent **********
1332 class VIEW3D_MT_ParentMenu(Menu):
1333 bl_label = "Parent"
1335 def draw(self, context):
1336 layout = self.layout
1338 layout.operator("object.parent_set", text="Set")
1339 layout.operator("object.parent_clear", text="Clear")
1342 # ********** Object Group **********
1343 class VIEW3D_MT_GroupMenu(Menu):
1344 bl_label = "Group"
1346 def draw(self, context):
1347 layout = self.layout
1348 layout.operator("collection.create")
1349 layout.operator("collection.objects_add_active")
1350 UseSeparator(self, context)
1351 layout.operator("collection.objects_remove")
1352 layout.operator("collection.objects_remove_all")
1353 layout.operator("collection.objects_remove_active")
1356 # ********** Object Camera Options **********
1357 class VIEW3D_MT_Camera_Options(Menu):
1358 bl_label = "Camera"
1360 def draw(self, context):
1361 layout = self.layout
1362 layout.operator_context = 'EXEC_REGION_WIN'
1363 layout.operator("object.camera_add", text="Add Camera", icon='OUTLINER_OB_CAMERA')
1364 layout.operator("view3d.object_as_camera", text="Object As Camera", icon='OUTLINER_OB_CAMERA')
1366 class VIEW3D_MT_Object_Data_Link(Menu):
1367 bl_label = "Object Data"
1369 def draw(self, context):
1370 layout = self.layout
1372 layout.operator_menu_enum("object.make_local", "type", text="Make Local...")
1373 layout.menu("VIEW3D_MT_make_single_user")
1374 layout.operator("object.proxy_make", text="Make Proxy...")
1375 layout.operator("object.make_dupli_face")
1376 UseSeparator(self, context)
1377 layout.operator("object.data_transfer")
1378 layout.operator("object.datalayout_transfer")
1381 class VIEW3D_MT_Duplicate(Menu):
1382 bl_label = "Duplicate"
1384 def draw(self, context):
1385 layout = self.layout
1387 layout.operator("object.duplicate_move")
1388 layout.operator("object.duplicate_move_linked")
1391 class VIEW3D_MT_KeyframeMenu(Menu):
1392 bl_label = "Keyframe"
1394 def draw(self, context):
1395 layout = self.layout
1396 layout.operator("anim.keyframe_insert_menu",
1397 text="Insert Keyframe...")
1398 layout.operator("anim.keyframe_delete_v3d",
1399 text="Delete Keyframe...")
1400 layout.operator("anim.keying_set_active_set",
1401 text="Change Keying Set...")
1404 class VIEW3D_MT_UndoS(Menu):
1405 bl_label = "Undo/Redo"
1407 def draw(self, context):
1408 layout = self.layout
1410 layout.operator("ed.undo")
1411 layout.operator("ed.redo")
1412 UseSeparator(self, context)
1413 layout.operator("ed.undo_history")
1416 # ********** Normals / Auto Smooth Menu **********
1417 # Thanks to marvin.k.breuer for the Autosmooth part of the menu
1418 class VIEW3D_MT_AutoSmooth(Menu):
1419 bl_label = "Normals / Auto Smooth"
1421 def draw(self, context):
1422 layout = self.layout
1423 obj = context.object
1424 obj_data = context.active_object.data
1426 # moved the VIEW3D_MT_edit_mesh_normals contents here under an Edit mode check
1427 if obj and obj.type == 'MESH' and obj.mode in {'EDIT'}:
1428 layout.operator("mesh.normals_make_consistent",
1429 text="Recalculate Outside").inside = False
1430 layout.operator("mesh.normals_make_consistent",
1431 text="Recalculate Inside").inside = True
1432 layout.operator("mesh.flip_normals")
1433 UseSeparator(self, context)
1435 UseSeparator(self, context)
1436 layout.prop(obj_data, "use_auto_smooth", text="Normals: Auto Smooth")
1438 # Auto Smooth Angle - two tab spaces to align it with the rest of the menu
1439 layout.prop(obj_data, "auto_smooth_angle",
1440 text=" Auto Smooth Angle")
1443 # Edit Mode Menu's #
1445 # ********** Edit Mesh **********
1446 class VIEW3D_MT_Edit_Mesh(Menu):
1447 bl_label = "Mesh"
1449 def draw(self, context):
1450 layout = self.layout
1451 toolsettings = context.tool_settings
1452 view = context.space_data
1454 layout.menu("VIEW3D_MT_edit_mesh_vertices", icon='VERTEXSEL')
1455 layout.menu("VIEW3D_MT_edit_mesh_edges", icon='EDGESEL')
1456 layout.menu("VIEW3D_MT_edit_mesh_faces", icon='FACESEL')
1457 UseSeparator(self, context)
1458 layout.operator("mesh.duplicate_move")
1459 UseSeparator(self, context)
1460 layout.menu("VIEW3D_MT_edit_mesh_clean", icon='AUTO')
1461 # layout.prop(view, "use_occlude_geometry")
1462 UseSeparator(self, context)
1463 layout.menu("VIEW3D_MT_AutoSmooth", icon='META_DATA')
1464 layout.operator("mesh.loopcut_slide",
1465 text="Loopcut", icon='UV_EDGESEL')
1466 UseSeparator(self, context)
1467 layout.operator("mesh.symmetrize")
1468 layout.operator("mesh.symmetry_snap")
1469 UseSeparator(self, context)
1470 layout.operator("mesh.bisect")
1471 layout.operator_menu_enum("mesh.sort_elements", "type", text="Sort Elements...")
1472 UseSeparator(self, context)
1473 layout.prop_menu_enum(toolsettings, "proportional_edit")
1474 layout.prop_menu_enum(toolsettings, "proportional_edit_falloff")
1475 UseSeparator(self, context)
1477 layout.prop(toolsettings, "use_mesh_automerge")
1478 # Double Threshold - two tab spaces to align it with the rest of the menu
1479 layout.prop(toolsettings, "double_threshold", text="Double Threshold")
1481 UseSeparator(self, context)
1482 layout.menu("VIEW3D_MT_edit_mesh_showhide")
1485 # ********** Edit Multiselect **********
1486 class VIEW3D_MT_Edit_Multi(Menu):
1487 bl_label = "Mode Select"
1489 def draw(self, context):
1490 layout = self.layout
1492 layout.operator("selectedit.vertex", text="Vertex", icon='VERTEXSEL')
1493 layout.operator("selectedit.edge", text="Edge", icon='EDGESEL')
1494 layout.operator("selectedit.face", text="Face", icon='FACESEL')
1495 layout.operator("selectedit.vertsfaces", text="Vertex/Faces", icon='VERTEXSEL')
1496 layout.operator("selectedit.vertsedges", text="Vertex/Edges", icon='EDGESEL')
1497 layout.operator("selectedit.edgesfaces", text="Edges/Faces", icon='FACESEL')
1498 layout.operator("selectedit.vertsedgesfaces", text="Vertex/Edges/Faces", icon='OBJECT_DATAMODE')
1501 # ********** Edit Mesh Edge **********
1502 class VIEW3D_MT_EditM_Edge(Menu):
1503 bl_label = "Edges"
1505 def draw(self, context):
1506 layout = self.layout
1507 layout.operator_context = 'INVOKE_REGION_WIN'
1509 layout.operator("mesh.mark_seam")
1510 layout.operator("mesh.mark_seam", text="Clear Seam").clear = True
1511 UseSeparator(self, context)
1513 layout.operator("mesh.mark_sharp")
1514 layout.operator("mesh.mark_sharp", text="Clear Sharp").clear = True
1515 layout.operator("mesh.extrude_move_along_normals", text="Extrude")
1516 UseSeparator(self, context)
1518 layout.operator("mesh.edge_rotate",
1519 text="Rotate Edge CW").direction = 'CW'
1520 layout.operator("mesh.edge_rotate",
1521 text="Rotate Edge CCW").direction = 'CCW'
1522 UseSeparator(self, context)
1524 layout.operator("TFM_OT_edge_slide", text="Edge Slide")
1525 layout.operator("mesh.loop_multi_select", text="Edge Loop")
1526 layout.operator("mesh.loop_multi_select", text="Edge Ring").ring = True
1527 layout.operator("mesh.loop_to_region")
1528 layout.operator("mesh.region_to_loop")
1531 # ********** Edit Mesh Cursor **********
1532 class VIEW3D_MT_EditCursorMenu(Menu):
1533 bl_label = "Snap Cursor"
1535 def draw(self, context):
1536 layout = self.layout
1537 layout.operator_context = 'INVOKE_REGION_WIN'
1538 layout.operator("object.setorigintoselected",
1539 text="Origin to Selected V/F/E")
1540 UseSeparator(self, context)
1541 layout.menu("VIEW3D_MT_Snap_Origin")
1542 layout.menu("VIEW3D_MT_Snap_Context")
1543 UseSeparator(self, context)
1544 layout.operator("view3d.snap_cursor_to_selected",
1545 text="Cursor to Selected")
1546 layout.operator("view3d.snap_cursor_to_center",
1547 text="Cursor to World Origin")
1548 layout.operator("view3d.snap_cursor_to_grid",
1549 text="Cursor to Grid")
1550 layout.operator("view3d.snap_cursor_to_active",
1551 text="Cursor to Active")
1552 layout.operator("view3d.snap_cursor_to_edge_intersection",
1553 text="Cursor to Edge Intersection")
1554 UseSeparator(self, context)
1555 layout.operator("view3d.snap_selected_to_cursor",
1556 text="Selection to Cursor").use_offset = False
1557 layout.operator("view3d.snap_selected_to_cursor",
1558 text="Selection to Cursor (Keep Offset)").use_offset = True
1559 layout.operator("view3d.snap_selected_to_grid",
1560 text="Selection to Grid")
1564 # ********** Edit Mesh UV **********
1565 class VIEW3D_MT_UV_Map(Menu):
1566 bl_label = "UV Mapping"
1568 def draw(self, context):
1569 layout = self.layout
1570 layout.operator("uv.unwrap")
1571 UseSeparator(self, context)
1572 layout.operator_context = 'INVOKE_DEFAULT'
1573 layout.operator("uv.smart_project")
1574 layout.operator("uv.lightmap_pack")
1575 layout.operator("uv.follow_active_quads")
1576 layout.operator_context = 'EXEC_REGION_WIN'
1577 layout.operator("uv.cube_project")
1578 layout.operator("uv.cylinder_project")
1579 layout.operator("uv.sphere_project")
1580 layout.operator_context = 'INVOKE_REGION_WIN'
1581 UseSeparator(self, context)
1582 layout.operator("uv.project_from_view").scale_to_bounds = False
1583 layout.operator("uv.project_from_view", text="Project from View (Bounds)").scale_to_bounds = True
1584 UseSeparator(self, context)
1585 layout.operator("uv.reset")
1588 # ********** Edit Curve **********
1589 class VIEW3D_MT_Edit_Curve(Menu):
1590 bl_label = "Curve"
1592 def draw(self, context):
1593 layout = self.layout
1595 toolsettings = context.tool_settings
1597 layout.operator("curve.extrude_move")
1598 layout.operator("curve.spin")
1599 layout.operator("curve.duplicate_move")
1600 layout.operator("curve.split")
1601 layout.operator("curve.separate")
1602 layout.operator("curve.make_segment")
1603 layout.operator("curve.cyclic_toggle")
1604 UseSeparator(self, context)
1605 layout.operator("curve.delete", text="Delete...")
1606 UseSeparator(self, context)
1607 layout.menu("VIEW3D_MT_edit_curve_segments")
1608 layout.prop_menu_enum(toolsettings, "proportional_edit",
1609 icon="PROP_CON")
1610 layout.prop_menu_enum(toolsettings, "proportional_edit_falloff",
1611 icon="SMOOTHCURVE")
1612 layout.menu("VIEW3D_MT_edit_curve_showhide")
1615 class VIEW3D_MT_EditCurveCtrlpoints(Menu):
1616 bl_label = "Control Points"
1618 def draw(self, context):
1619 layout = self.layout
1621 edit_object = context.edit_object
1623 if edit_object.type == 'CURVE':
1624 layout.operator("transform.transform").mode = 'TILT'
1625 layout.operator("curve.tilt_clear")
1626 layout.operator("curve.separate")
1627 layout.operator_menu_enum("curve.handle_type_set", "type")
1628 layout.menu("VIEW3D_MT_hook")
1631 class VIEW3D_MT_EditCurveSegments(Menu):
1632 bl_label = "Curve Segments"
1634 def draw(self, context):
1635 layout = self.layout
1636 layout.operator("curve.subdivide")
1637 layout.operator("curve.switch_direction")
1640 class VIEW3D_MT_EditCurveSpecials(Menu):
1641 bl_label = "Specials"
1643 def draw(self, context):
1644 layout = self.layout
1645 layout.operator("curve.subdivide")
1646 UseSeparator(self, context)
1647 layout.operator("curve.switch_direction")
1648 layout.operator("curve.spline_weight_set")
1649 layout.operator("curve.radius_set")
1650 UseSeparator(self, context)
1651 layout.operator("curve.smooth")
1652 layout.operator("curve.smooth_weight")
1653 layout.operator("curve.smooth_radius")
1654 layout.operator("curve.smooth_tilt")
1657 # Brushes Menu's #
1658 # Thanks to CoDEmanX for the code
1659 class VIEW3D_MT_Brush_Selection(Menu):
1660 bl_label = "Brush Tool"
1662 def draw(self, context):
1663 layout = self.layout
1664 settings = UnifiedPaintPanel.paint_settings(context)
1666 # check if brush exists (for instance, in paint mode before adding a slot)
1667 if hasattr(settings, 'brush'):
1668 brush = settings.brush
1669 else:
1670 brush = None
1672 if not brush:
1673 layout.label(text="No Brushes currently available", icon="INFO")
1674 return
1676 if not context.particle_edit_object:
1677 if UseBrushesLists():
1678 flow = layout.column_flow(columns=3)
1680 for brsh in bpy.data.brushes:
1681 if (context.sculpt_object and brsh.use_paint_sculpt):
1682 props = flow.operator("wm.context_set_id", text=brsh.name,
1683 icon_value=layout.icon(brsh))
1684 props.data_path = "tool_settings.sculpt.brush"
1685 props.value = brsh.name
1686 elif (context.image_paint_object and brsh.use_paint_image):
1687 props = flow.operator("wm.context_set_id", text=brsh.name,
1688 icon_value=layout.icon(brsh))
1689 props.data_path = "tool_settings.image_paint.brush"
1690 props.value = brsh.name
1691 elif (context.vertex_paint_object and brsh.use_paint_vertex):
1692 props = flow.operator("wm.context_set_id", text=brsh.name,
1693 icon_value=layout.icon(brsh))
1694 props.data_path = "tool_settings.vertex_paint.brush"
1695 props.value = brsh.name
1696 elif (context.weight_paint_object and brsh.use_paint_weight):
1697 props = flow.operator("wm.context_set_id", text=brsh.name,
1698 icon_value=layout.icon(brsh))
1699 props.data_path = "tool_settings.weight_paint.brush"
1700 props.value = brsh.name
1701 else:
1702 layout.template_ID_preview(settings, "brush", new="brush.add", rows=3, cols=8)
1705 class VIEW3D_MT_Brush_Settings(Menu):
1706 bl_label = "Brush Settings"
1708 def draw(self, context):
1709 layout = self.layout
1710 settings = UnifiedPaintPanel.paint_settings(context)
1711 brush = getattr(settings, "brush", None)
1713 ups = context.tool_settings.unified_paint_settings
1714 layout.prop(ups, "use_unified_size", text="Unified Size")
1715 layout.prop(ups, "use_unified_strength", text="Unified Strength")
1716 if context.image_paint_object or context.vertex_paint_object:
1717 layout.prop(ups, "use_unified_color", text="Unified Color")
1718 UseSeparator(self, context)
1720 if not brush:
1721 layout.label(text="No Brushes currently available", icon="INFO")
1722 return
1724 layout.menu("VIEW3D_MT_brush_paint_modes")
1726 if context.sculpt_object:
1727 sculpt_tool = brush.sculpt_tool
1729 UseSeparator(self, context)
1730 layout.operator_menu_enum("brush.curve_preset", "shape", text="Curve Preset")
1731 UseSeparator(self, context)
1733 if sculpt_tool != 'GRAB':
1734 layout.prop_menu_enum(brush, "stroke_method")
1736 if sculpt_tool in {'DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'}:
1737 layout.prop_menu_enum(brush, "direction")
1739 if sculpt_tool == 'LAYER':
1740 layout.prop(brush, "use_persistent")
1741 layout.operator("sculpt.set_persistent_base")
1744 # Sculpt Menu's #
1745 class VIEW3D_MT_Sculpts(Menu):
1746 bl_label = "Sculpt"
1748 def draw(self, context):
1749 layout = self.layout
1750 toolsettings = context.tool_settings
1751 sculpt = toolsettings.sculpt
1753 layout.prop(sculpt, "use_symmetry_x")
1754 layout.prop(sculpt, "use_symmetry_y")
1755 layout.prop(sculpt, "use_symmetry_z")
1757 UseSeparator(self, context)
1758 layout.prop(sculpt, "lock_x")
1759 layout.prop(sculpt, "lock_y")
1760 layout.prop(sculpt, "lock_z")
1762 UseSeparator(self, context)
1763 layout.prop(sculpt, "use_threaded", text="Threaded Sculpt")
1764 layout.prop(sculpt, "show_low_resolution")
1765 layout.prop(sculpt, "use_deform_only")
1767 UseSeparator(self, context)
1768 layout.prop(sculpt, "show_brush")
1769 layout.prop(sculpt, "show_diffuse_color")
1772 class VIEW3D_MT_Hide_Masks(Menu):
1773 bl_label = "Hide/Mask"
1775 def draw(self, context):
1776 layout = self.layout
1778 props = layout.operator("paint.mask_lasso_gesture", text="Lasso Mask")
1779 UseSeparator(self, context)
1780 props = layout.operator("view3d.select_box", text="Box Mask")
1781 props = layout.operator("paint.hide_show", text="Box Hide")
1782 props.action = 'HIDE'
1783 props.area = 'INSIDE'
1785 props = layout.operator("paint.hide_show", text="Box Show")
1786 props.action = 'SHOW'
1787 props.area = 'INSIDE'
1788 UseSeparator(self, context)
1790 props = layout.operator("paint.mask_flood_fill", text="Fill Mask")
1791 props.mode = 'VALUE'
1792 props.value = 1
1794 props = layout.operator("paint.mask_flood_fill", text="Clear Mask")
1795 props.mode = 'VALUE'
1796 props.value = 0
1798 layout.operator("paint.mask_flood_fill", text="Invert Mask").mode = 'INVERT'
1799 UseSeparator(self, context)
1801 props = layout.operator("paint.hide_show", text="Show All", icon="RESTRICT_VIEW_OFF")
1802 props.action = 'SHOW'
1803 props.area = 'ALL'
1805 props = layout.operator("paint.hide_show", text="Hide Masked", icon="RESTRICT_VIEW_ON")
1806 props.area = 'MASKED'
1807 props.action = 'HIDE'
1810 # Sculpt Specials Menu (Thanks to marvin.k.breuer) #
1811 class VIEW3D_MT_Sculpt_Specials(Menu):
1812 bl_label = "Sculpt Specials"
1814 def draw(self, context):
1815 layout = self.layout
1816 settings = context.tool_settings
1818 if context.sculpt_object.use_dynamic_topology_sculpting:
1819 layout.operator("sculpt.dynamic_topology_toggle",
1820 icon='X', text="Disable Dyntopo")
1821 UseSeparator(self, context)
1823 if (settings.sculpt.detail_type_method == 'CONSTANT'):
1824 layout.prop(settings.sculpt, "constant_detail", text="Const.")
1825 layout.operator("sculpt.sample_detail_size", text="", icon='EYEDROPPER')
1826 else:
1827 layout.prop(settings.sculpt, "detail_size", text="Detail")
1828 UseSeparator(self, context)
1830 layout.operator("sculpt.symmetrize", icon='ARROW_LEFTRIGHT')
1831 layout.prop(settings.sculpt, "symmetrize_direction", "")
1832 UseSeparator(self, context)
1834 layout.operator("sculpt.optimize")
1835 if (settings.sculpt.detail_type_method == 'CONSTANT'):
1836 layout.operator("sculpt.detail_flood_fill")
1837 UseSeparator(self, context)
1839 layout.prop(settings.sculpt, "detail_refine_method", text="")
1840 layout.prop(settings.sculpt, "detail_type_method", text="")
1841 UseSeparator(self, context)
1842 layout.prop(settings.sculpt, "use_smooth_shading", "Smooth")
1843 else:
1844 layout.operator("sculpt.dynamic_topology_toggle", text="Enable Dyntopo")
1847 # Display Wire (Thanks to marvin.k.breuer) #
1848 class VIEW3D_OT_Display_Wire_All(Operator):
1849 bl_label = "Wire on All Objects"
1850 bl_idname = "view3d.display_wire_all"
1851 bl_description = "Enable/Disable Display Wire on All Objects"
1853 @classmethod
1854 def poll(cls, context):
1855 return context.active_object is not None
1857 def execute(self, context):
1858 is_error = False
1859 for obj in bpy.data.objects:
1860 try:
1861 if obj.show_wire:
1862 obj.show_all_edges = False
1863 obj.show_wire = False
1864 else:
1865 obj.show_all_edges = True
1866 obj.show_wire = True
1867 except:
1868 is_error = True
1869 pass
1871 if is_error:
1872 self.report({'WARNING'},
1873 "Wire on All Objects could not be completed for some objects")
1875 return {'FINISHED'}
1878 # Vertex Color Menu #
1879 class VIEW3D_MT_Vertex_Colors(Menu):
1880 bl_label = "Vertex Colors"
1882 def draw(self, context):
1883 layout = self.layout
1884 layout.operator("paint.vertex_color_set")
1885 UseSeparator(self, context)
1887 layout.operator("paint.vertex_color_smooth")
1888 layout.operator("paint.vertex_color_dirt")
1891 # Weight Paint Menu #
1892 class VIEW3D_MT_Paint_Weights(Menu):
1893 bl_label = "Weights"
1895 def draw(self, context):
1896 layout = self.layout
1898 layout.operator("paint.weight_from_bones",
1899 text="Assign Automatic From Bones").type = 'AUTOMATIC'
1900 layout.operator("paint.weight_from_bones",
1901 text="Assign From Bone Envelopes").type = 'ENVELOPES'
1902 UseSeparator(self, context)
1904 layout.operator("object.vertex_group_normalize_all", text="Normalize All")
1905 layout.operator("object.vertex_group_normalize", text="Normalize")
1906 UseSeparator(self, context)
1908 layout.operator("object.vertex_group_mirror", text="Mirror")
1909 layout.operator("object.vertex_group_invert", text="Invert")
1910 UseSeparator(self, context)
1912 layout.operator("object.vertex_group_clean", text="Clean")
1913 layout.operator("object.vertex_group_quantize", text="Quantize")
1914 UseSeparator(self, context)
1916 layout.operator("object.vertex_group_levels", text="Levels")
1917 layout.operator("object.vertex_group_smooth", text="Smooth")
1918 UseSeparator(self, context)
1920 props = layout.operator("object.data_transfer", text="Transfer Weights")
1921 props.use_reverse_transfer = True
1922 props.data_type = 'VGROUP_WEIGHTS'
1923 UseSeparator(self, context)
1925 layout.operator("object.vertex_group_limit_total", text="Limit Total")
1926 layout.operator("object.vertex_group_fix", text="Fix Deforms")
1927 UseSeparator(self, context)
1929 layout.operator("paint.weight_set")
1932 # Armature Menu's #
1934 class VIEW3D_MT_Edit_Armature(Menu):
1935 bl_label = "Armature"
1937 def draw(self, context):
1938 layout = self.layout
1939 toolsettings = context.tool_settings
1941 layout.prop_menu_enum(toolsettings, "proportional_edit", icon="PROP_CON")
1942 layout.prop_menu_enum(toolsettings, "proportional_edit_falloff", icon="SMOOTHCURVE")
1943 UseSeparator(self, context)
1945 layout.menu("VIEW3D_MT_bone_options_toggle", text="Bone Settings")
1946 layout.operator("armature.merge")
1947 layout.operator("armature.fill")
1948 layout.operator("armature.split")
1949 layout.operator("armature.separate")
1950 layout.operator("armature.switch_direction", text="Switch Direction")
1952 layout.operator_context = 'EXEC_AREA'
1953 layout.operator("armature.symmetrize")
1954 UseSeparator(self, context)
1956 layout.operator("armature.delete")
1957 UseSeparator(self, context)
1959 layout.operator_context = 'INVOKE_DEFAULT'
1960 layout.operator("armature.armature_layers")
1961 layout.operator("armature.bone_layers")
1964 class VIEW3D_MT_EditArmatureTK(Menu):
1965 bl_label = "Armature Tools"
1967 def draw(self, context):
1968 layout = self.layout
1969 layout.operator("armature.subdivide", text="Subdivide")
1970 layout.operator("armature.extrude_move")
1971 layout.operator("armature.extrude_forked")
1972 layout.operator("armature.duplicate_move")
1973 UseSeparator(self, context)
1974 layout.menu("VIEW3D_MT_edit_armature_delete")
1975 UseSeparator(self, context)
1976 layout.operator("transform.transform",
1977 text="Scale Envelope Distance").mode = 'BONE_SIZE'
1978 layout.operator("transform.transform",
1979 text="Scale B-Bone Width").mode = 'BONE_SIZE'
1982 # Armature Pose Menu's #
1984 class VIEW3D_MT_Pose(Menu):
1985 bl_label = "Pose"
1987 def draw(self, context):
1988 layout = self.layout
1990 layout.menu("VIEW3D_MT_object_animation")
1991 layout.menu("VIEW3D_MT_pose_slide")
1992 layout.menu("VIEW3D_MT_pose_propagate")
1993 layout.menu("VIEW3D_MT_pose_library")
1994 layout.menu("VIEW3D_MT_pose_motion")
1995 UseSeparator(self, context)
1996 layout.menu("VIEW3D_MT_pose_group")
1997 layout.menu("VIEW3D_MT_object_parent")
1998 UseSeparator(self, context)
1999 layout.menu("VIEW3D_MT_pose_ik")
2000 layout.menu("VIEW3D_MT_pose_constraints")
2001 layout.menu("VIEW3D_MT_PoseNames")
2002 layout.operator("pose.quaternions_flip")
2003 layout.operator_context = 'INVOKE_AREA'
2004 UseSeparator(self, context)
2005 layout.operator("armature.armature_layers", text="Change Armature Layers...")
2006 layout.operator("pose.bone_layers", text="Change Bone Layers...")
2007 UseSeparator(self, context)
2008 layout.menu("VIEW3D_MT_pose_showhide")
2009 layout.menu("VIEW3D_MT_bone_options_toggle", text="Bone Settings")
2012 # Transform Menu's #
2014 class VIEW3D_MT_TransformMenu(Menu):
2015 bl_label = "Transform"
2017 def draw(self, context):
2018 layout = self.layout
2019 layout.operator("transform.translate", text="Move")
2020 layout.operator("transform.rotate", text="Rotate")
2021 layout.operator("transform.resize", text="Scale")
2022 UseSeparator(self, context)
2023 layout.menu("VIEW3D_MT_object_clear")
2024 layout.menu("VIEW3D_MT_object_apply")
2025 UseSeparator(self, context)
2026 layout.operator("transform.translate", text="Move Texture Space").texture_space = True
2027 layout.operator("transform.resize", text="Scale Texture Space").texture_space = True
2028 UseSeparator(self, context)
2029 layout.operator("object.randomize_transform")
2030 layout.operator("transform.tosphere", text="To Sphere")
2031 layout.operator("transform.shear", text="Shear")
2032 layout.operator("transform.bend", text="Bend")
2033 layout.operator("transform.push_pull", text="Push/Pull")
2034 UseSeparator(self, context)
2035 layout.operator("object.align")
2036 layout.operator_context = 'EXEC_REGION_WIN'
2037 layout.operator("transform.transform",
2038 text="Align to Transform Orientation").mode = 'ALIGN'
2041 # ********** Edit Mesh Transform **********
2042 class VIEW3D_MT_TransformMenuEdit(Menu):
2043 bl_label = "Transform"
2045 def draw(self, context):
2046 layout = self.layout
2047 layout.operator("transform.translate", text="Move")
2048 layout.operator("transform.rotate", text="Rotate")
2049 layout.operator("transform.resize", text="Scale")
2050 UseSeparator(self, context)
2051 layout.operator("transform.tosphere", text="To Sphere")
2052 layout.operator("transform.shear", text="Shear")
2053 layout.operator("transform.bend", text="Bend")
2054 layout.operator("transform.push_pull", text="Push/Pull")
2055 layout.operator("transform.vertex_warp", text="Warp")
2056 layout.operator("transform.vertex_random", text="Randomize")
2057 UseSeparator(self, context)
2058 layout.operator("transform.translate", text="Move Texture Space").texture_space = True
2059 layout.operator("transform.resize", text="Scale Texture Space").texture_space = True
2060 UseSeparator(self, context)
2061 layout.operator_context = 'EXEC_REGION_WIN'
2062 layout.operator("transform.transform",
2063 text="Align to Transform Orientation").mode = 'ALIGN'
2064 layout.operator_context = 'EXEC_AREA'
2065 layout.operator("object.origin_set",
2066 text="Geometry to Origin").type = 'GEOMETRY_ORIGIN'
2069 # ********** Transform Lite/Short **********
2070 class VIEW3D_MT_TransformMenuLite(Menu):
2071 bl_label = "Transform"
2073 def draw(self, context):
2074 layout = self.layout
2075 layout.operator("transform.translate", text="Move")
2076 layout.operator("transform.rotate", text="Rotate")
2077 layout.operator("transform.resize", text="Scale")
2078 UseSeparator(self, context)
2079 layout.menu("VIEW3D_MT_object_clear")
2080 layout.menu("VIEW3D_MT_object_apply")
2081 UseSeparator(self, context)
2082 layout.operator("transform.transform",
2083 text="Align to Transform Orientation").mode = 'ALIGN'
2086 # ********** Transform Camera **********
2087 class VIEW3D_MT_TransformMenuCamera(Menu):
2088 bl_label = "Transform"
2090 def draw(self, context):
2091 layout = self.layout
2092 layout.menu("VIEW3D_MT_object_clear")
2093 layout.menu("VIEW3D_MT_object_apply")
2094 layout.operator("transform.translate", text="Move")
2095 layout.operator("transform.rotate", text="Rotate")
2096 layout.operator("transform.resize", text="Scale")
2097 layout.operator("object.align")
2098 layout.operator_context = 'EXEC_REGION_WIN'
2099 UseSeparator(self, context)
2100 layout.operator("transform.transform",
2101 text="Align to Transform Orientation").mode = 'ALIGN'
2104 # ********** Transform Armature **********
2105 class VIEW3D_MT_TransformMenuArmature(Menu):
2106 bl_label = "Transform"
2108 def draw(self, context):
2109 layout = self.layout
2110 layout.operator("transform.translate", text="Move")
2111 layout.operator("transform.rotate", text="Rotate")
2112 layout.operator("transform.resize", text="Scale")
2113 UseSeparator(self, context)
2114 layout.operator("armature.align")
2115 layout.operator("object.align")
2116 layout.operator_context = 'EXEC_AREA'
2117 UseSeparator(self, context)
2118 layout.operator("object.origin_set",
2119 text="Geometry to Origin").type = 'GEOMETRY_ORIGIN'
2120 layout.operator("object.origin_set",
2121 text="Origin to Geometry").type = 'ORIGIN_GEOMETRY'
2122 layout.operator("object.origin_set",
2123 text="Origin to 3D Cursor").type = 'ORIGIN_CURSOR'
2124 layout.operator("object.origin_set",
2125 text="Origin to Center of Mass").type = 'ORIGIN_CENTER_OF_MASS'
2128 # ********** Transform Armature Edit **********
2129 class VIEW3D_MT_TransformMenuArmatureEdit(Menu):
2130 bl_label = "Transform"
2132 def draw(self, context):
2133 layout = self.layout
2134 layout.operator("transform.translate", text="Move")
2135 layout.operator("transform.rotate", text="Rotate")
2136 layout.operator("transform.resize", text="Scale")
2137 UseSeparator(self, context)
2138 layout.operator("transform.tosphere", text="To Sphere")
2139 layout.operator("transform.shear", text="Shear")
2140 layout.operator("transform.bend", text="Bend")
2141 layout.operator("transform.push_pull", text="Push/Pull")
2142 layout.operator("transform.vertex_warp", text="Warp")
2143 UseSeparator(self, context)
2144 layout.operator("transform.vertex_random", text="Randomize")
2145 layout.operator("armature.align")
2146 layout.operator_context = 'EXEC_AREA'
2149 # ********** Transform Armature Pose **********
2150 class VIEW3D_MT_TransformMenuArmaturePose(Menu):
2151 bl_label = "Transform"
2153 def draw(self, context):
2154 layout = self.layout
2155 layout.operator("transform.translate", text="Move")
2156 layout.operator("transform.rotate", text="Rotate")
2157 layout.operator("transform.resize", text="Scale")
2158 UseSeparator(self, context)
2159 layout.operator("pose.transforms_clear", text="Clear All")
2160 layout.operator("pose.loc_clear", text="Location")
2161 layout.operator("pose.rot_clear", text="Rotation")
2162 layout.operator("pose.scale_clear", text="Scale")
2164 UseSeparator(self, context)
2166 layout.operator("pose.user_transforms_clear", text="Reset unkeyed")
2167 obj = context.object
2168 if obj.type == 'ARMATURE' and obj.mode in {'EDIT', 'POSE'}:
2169 if obj.data.display_type == 'BBONE':
2170 layout.operator("transform.transform", text="Scale BBone").mode = 'BONE_SIZE'
2171 elif obj.data.display_type == 'ENVELOPE':
2172 layout.operator("transform.transform", text="Scale Envelope Distance").mode = 'BONE_SIZE'
2173 layout.operator("transform.transform", text="Scale Radius").mode = 'BONE_ENVELOPE'
2176 # View Menu's #
2178 class VIEW3D_MT_View_Directions(Menu):
2179 bl_label = "Viewpoint"
2181 def draw(self, context):
2182 layout = self.layout
2184 layout.operator("view3d.view_camera", text="Camera")
2186 UseSeparator(self, context)
2188 layout.operator("view3d.view_axis", text="Top").type = 'TOP'
2189 layout.operator("view3d.view_axis", text="Bottom").type = 'BOTTOM'
2191 UseSeparator(self, context)
2193 layout.operator("view3d.view_axis", text="Front").type = 'FRONT'
2194 layout.operator("view3d.view_axis", text="Back").type = 'BACK'
2196 UseSeparator(self, context)
2198 layout.operator("view3d.view_axis", text="Right").type = 'RIGHT'
2199 layout.operator("view3d.view_axis", text="Left").type = 'LEFT'
2202 class VIEW3D_MT_View_Border(Menu):
2203 bl_label = "View Border"
2205 def draw(self, context):
2206 layout = self.layout
2207 layout.operator_context = 'INVOKE_REGION_WIN'
2208 # layout.operator("view3d.clip_border", text="Clipping Border...")
2209 layout.operator("view3d.zoom_border", text="Zoom Border...")
2210 layout.operator("view3d.render_border", text="Render Border...")
2211 layout.operator("view3d.clear_render_border")
2214 class VIEW3D_MT_View_Menu(Menu):
2215 bl_label = "View"
2217 def draw(self, context):
2218 layout = self.layout
2219 view = context.space_data
2221 layout.menu("INFO_MT_area")
2222 UseSeparator(self, context)
2223 layout.operator("view3d.view_selected", text="Frame Selected").use_all_regions = False
2224 if view.region_quadviews:
2225 layout.operator("view3d.view_selected", text="Frame Selected (Quad View)").use_all_regions = True
2226 layout.operator("view3d.view_all", text="Frame All").center = False
2227 layout.operator("view3d.view_persportho", text="Perspective/Orthographic")
2228 layout.menu("VIEW3D_MT_View_Local")
2229 UseSeparator(self, context)
2230 layout.menu("VIEW3D_MT_view_cameras", text="Cameras")
2231 UseSeparator(self, context)
2232 layout.menu("VIEW3D_MT_View_Directions")
2233 layout.menu("VIEW3D_MT_View_Navigation")
2234 UseSeparator(self, context)
2235 layout.menu("VIEW3D_MT_View_Align")
2236 layout.menu("VIEW3D_MT_view_align_selected")
2237 UseSeparator(self, context)
2238 layout.operator_context = 'INVOKE_REGION_WIN'
2239 layout.menu("VIEW3D_MT_view_regions", text="View Regions")
2240 layout.menu("VIEW3D_MT_Shade")
2241 UseSeparator(self, context)
2242 layout.operator("render.opengl", icon='RENDER_STILL')
2243 layout.operator("render.opengl", text="Viewport Render Animation", icon='RENDER_ANIMATION').animation = True
2246 class VIEW3D_MT_View_Navigation(Menu):
2247 bl_label = "Navigation"
2249 def draw(self, context):
2250 from math import pi
2251 layout = self.layout
2252 layout.operator_enum("view3d.view_orbit", "type")
2253 props = layout.operator("view3d.view_orbit", text ="Orbit Opposite")
2254 props.type = 'ORBITRIGHT'
2255 props.angle = pi
2257 UseSeparator(self, context)
2258 layout.operator("view3d.view_roll", text="Roll Left").type = 'LEFT'
2259 layout.operator("view3d.view_roll", text="Roll Right").type = 'RIGHT'
2260 UseSeparator(self, context)
2261 layout.operator_enum("view3d.view_pan", "type")
2262 UseSeparator(self, context)
2263 layout.operator("view3d.zoom", text="Zoom In").delta = 1
2264 layout.operator("view3d.zoom", text="Zoom Out").delta = -1
2265 UseSeparator(self, context)
2266 layout.operator("view3d.zoom_camera_1_to_1", text="Zoom Camera 1:1")
2267 UseSeparator(self, context)
2268 layout.operator("view3d.fly")
2269 layout.operator("view3d.walk")
2272 class VIEW3D_MT_View_Align(Menu):
2273 bl_label = "Align View"
2275 def draw(self, context):
2276 layout = self.layout
2277 layout.operator("view3d.camera_to_view", text="Align Active Camera to View")
2278 layout.operator("view3d.camera_to_view_selected", text="Align Active Camera to Selected")
2279 UseSeparator(self, context)
2280 layout.operator("view3d.view_all", text="Center Cursor and View All").center = True
2281 layout.operator("view3d.view_center_cursor")
2282 UseSeparator(self, context)
2283 layout.operator("view3d.view_lock_to_active")
2284 layout.operator("view3d.view_lock_clear")
2287 class VIEW3D_MT_View_Align_Selected(Menu):
2288 bl_label = "Align View to Active"
2290 def draw(self, context):
2291 layout = self.layout
2292 props = layout.operator("view3d.viewnumpad", text="Top")
2293 props.align_active = True
2294 props.type = 'TOP'
2295 props = layout.operator("view3d.viewnumpad", text="Bottom")
2296 props.align_active = True
2297 props.type = 'BOTTOM'
2298 props = layout.operator("view3d.viewnumpad", text="Front")
2299 props.align_active = True
2300 props.type = 'FRONT'
2301 props = layout.operator("view3d.viewnumpad", text="Back")
2302 props.align_active = True
2303 props.type = 'BACK'
2304 props = layout.operator("view3d.viewnumpad", text="Right")
2305 props.align_active = True
2306 props.type = 'RIGHT'
2307 props = layout.operator("view3d.viewnumpad", text="Left")
2308 props.align_active = True
2309 props.type = 'LEFT'
2312 class VIEW3D_MT_View_Cameras(Menu):
2313 bl_label = "Cameras"
2315 def draw(self, context):
2316 layout = self.layout
2317 layout.operator("view3d.object_as_camera")
2318 layout.operator("view3d.viewnumpad", text="Active Camera").type = 'CAMERA'
2320 class VIEW3D_MT_View_Local(Menu):
2321 bl_label = "Local View"
2323 def draw(self, context):
2324 layout = self.layout
2325 view = context.space_data
2327 layout.operator("view3d.localview", text="Toggle Local View")
2328 layout.operator("view3d.localview_remove_from")
2329 layout.operator("view3d.view_persportho")
2331 # Matcap and AO, Wire all and X-Ray entries thanks to marvin.k.breuer
2332 class VIEW3D_MT_Shade(Menu):
2333 bl_label = "Shade"
2335 def draw(self, context):
2336 layout = self.layout
2338 # layout.prop(context.space_data, "viewport_shade", expand=True)
2340 if context.active_object:
2341 if(context.mode == 'EDIT_MESH'):
2342 layout.operator("MESH_OT_faces_shade_smooth", icon='SHADING_RENDERED')
2343 layout.operator("MESH_OT_faces_shade_flat", icon='SHADING_SOLID')
2344 else:
2345 layout.operator("OBJECT_OT_shade_smooth", icon='SHADING_RENDERED')
2346 layout.operator("OBJECT_OT_shade_flat", icon='SHADING_SOLID')
2348 UseSeparator(self, context)
2349 layout.operator("view3d.display_wire_all", text="Wire all", icon='SHADING_WIRE')
2350 layout.prop(context.object, "show_in_front", text="X-Ray", icon="META_CUBE")
2352 UseSeparator(self, context)
2353 layout.prop(context.space_data.fx_settings, "use_ssao",
2354 text="Ambient Occlusion", icon="GROUP")
2355 # layout.prop(context.space_data, "use_matcap", icon="MATCAP_01")
2357 # if context.space_data.use_matcap:
2358 # row = layout.column(1)
2359 # row.scale_y = 0.3
2360 # row.scale_x = 0.5
2361 # row.template_icon_view(context.space_data, "matcap_icon")
2364 # Animation Player (Thanks to marvin.k.breuer) #
2365 class VIEW3D_MT_Animation_Player(Menu):
2366 bl_label = "Animation"
2368 def draw(self, context):
2369 layout = self.layout
2371 layout.operator("screen.frame_jump", text="Jump REW", icon='REW').end = False
2372 layout.operator("screen.keyframe_jump", text="Previous FR", icon='PREV_KEYFRAME').next = False
2374 UseSeparator(self, context)
2375 layout.operator("screen.animation_play", text="Reverse", icon='PLAY_REVERSE').reverse = True
2376 layout.operator("screen.animation_play", text="PLAY", icon='PLAY')
2377 layout.operator("screen.animation_play", text="Stop", icon='PAUSE')
2378 UseSeparator(self, context)
2380 layout.operator("screen.keyframe_jump", text="Next FR", icon='NEXT_KEYFRAME').next = True
2381 layout.operator("screen.frame_jump", text="Jump FF", icon='FF').end = True
2382 layout.menu("VIEW3D_MT_KeyframeMenu", text="Keyframes", icon='DECORATE_ANIMATE')
2385 # Select Menu's #
2387 # Object Select #
2388 class VIEW3D_MT_Select_Object(Menu):
2389 bl_label = "Select"
2391 def draw(self, context):
2392 layout = self.layout
2393 layout.operator_context = 'INVOKE_REGION_WIN'
2394 layout.operator("view3d.select_box")
2395 layout.operator("view3d.select_circle")
2396 UseSeparator(self, context)
2397 layout.operator("object.select_all", text="All").action = 'SELECT'
2398 layout.operator("object.select_all", text="None").action = 'DESELECT'
2399 layout.operator("object.select_all", text="Invert").action = 'INVERT'
2400 UseSeparator(self, context)
2401 layout.operator("object.select_camera", text="Select Active Camera")
2402 layout.operator("object.select_mirror", text="Mirror Selection")
2403 layout.operator("object.select_random", text="Select Random")
2404 UseSeparator(self, context)
2405 layout.operator_menu_enum("object.select_by_type", "type", text="Select All by Type...")
2406 layout.operator_menu_enum("object.select_grouped", "type", text="Select Grouped")
2407 layout.operator_menu_enum("object.select_linked", "type", text="Select Linked")
2408 UseSeparator(self, context)
2409 layout.menu("VIEW3D_MT_Select_Object_More_Less", text="More/Less")
2410 layout.operator("object.select_pattern", text="Select Pattern...")
2413 class VIEW3D_MT_Select_Object_More_Less(Menu):
2414 bl_label = "Select More/Less"
2416 def draw(self, context):
2417 layout = self.layout
2418 layout.operator("object.select_more", text="More")
2419 layout.operator("object.select_less", text="Less")
2420 UseSeparator(self, context)
2421 props = layout.operator("object.select_hierarchy", text="Parent")
2422 props.extend = False
2423 props.direction = 'PARENT'
2424 props = layout.operator("object.select_hierarchy", text="Child")
2425 props.extend = False
2426 props.direction = 'CHILD'
2427 UseSeparator(self, context)
2428 props = layout.operator("object.select_hierarchy", text="Extend Parent")
2429 props.extend = True
2430 props.direction = 'PARENT'
2431 props = layout.operator("object.select_hierarchy", text="Extend Child")
2432 props.extend = True
2433 props.direction = 'CHILD'
2436 # Edit Select #
2437 class VIEW3D_MT_Select_Edit_Mesh(Menu):
2438 bl_label = "Select"
2440 def draw(self, context):
2441 layout = self.layout
2442 layout.operator("view3d.select_box")
2443 layout.operator("view3d.select_circle")
2444 UseSeparator(self, context)
2445 layout.operator("mesh.select_all").action = 'TOGGLE'
2446 layout.operator("mesh.select_all", text="Inverse").action = 'INVERT'
2447 layout.operator("mesh.select_linked", text="Linked")
2448 layout.operator("mesh.faces_select_linked_flat",
2449 text="Linked Flat Faces")
2450 layout.operator("mesh.select_random", text="Random")
2451 layout.operator("mesh.select_nth", text="Every N Number of Verts")
2452 UseSeparator(self, context)
2453 layout.menu("VIEW3D_MT_Edit_Mesh_Select_Trait")
2454 layout.menu("VIEW3D_MT_Edit_Mesh_Select_Similar")
2455 layout.menu("VIEW3D_MT_Edit_Mesh_Select_More_Less")
2456 UseSeparator(self, context)
2457 layout.operator("mesh.select_mirror", text="Mirror")
2458 layout.operator("mesh.edges_select_sharp", text="Sharp Edges")
2459 layout.operator("mesh.select_axis", text="Side of Active")
2460 layout.operator("mesh.shortest_path_select", text="Shortest Path")
2461 UseSeparator(self, context)
2462 layout.operator("mesh.loop_multi_select", text="Edge Loops").ring = False
2463 layout.operator("mesh.loop_multi_select", text="Edge Rings").ring = True
2464 layout.operator("mesh.loop_to_region")
2465 layout.operator("mesh.region_to_loop")
2468 class VIEW3D_MT_Edit_Mesh_Select_Similar(Menu):
2469 bl_label = "Select Similar"
2471 def draw(self, context):
2472 layout = self.layout
2473 layout.operator_enum("mesh.select_similar", "type")
2474 layout.operator("mesh.select_similar_region", text="Face Regions")
2477 class VIEW3D_MT_Edit_Mesh_Select_Trait(Menu):
2478 bl_label = "Select All by Trait"
2480 def draw(self, context):
2481 layout = self.layout
2482 if context.scene.tool_settings.mesh_select_mode[2] is False:
2483 layout.operator("mesh.select_non_manifold", text="Non Manifold")
2484 layout.operator("mesh.select_loose", text="Loose Geometry")
2485 layout.operator("mesh.select_interior_faces", text="Interior Faces")
2486 layout.operator("mesh.select_face_by_sides", text="By Number of Verts")
2487 layout.operator("mesh.select_ungrouped", text="Ungrouped Verts")
2490 class VIEW3D_MT_Edit_Mesh_Select_More_Less(Menu):
2491 bl_label = "Select More/Less"
2493 def draw(self, context):
2494 layout = self.layout
2495 layout.operator("mesh.select_more", text="More")
2496 layout.operator("mesh.select_less", text="Less")
2497 UseSeparator(self, context)
2498 layout.operator("mesh.select_next_item", text="Next Active")
2499 layout.operator("mesh.select_prev_item", text="Previous Active")
2502 # Edit Curve Select #
2503 class VIEW3D_MT_Select_Edit_Curve(Menu):
2504 bl_label = "Select"
2506 def draw(self, context):
2507 layout = self.layout
2508 layout.operator("view3d.select_box")
2509 layout.operator("view3d.select_circle")
2510 UseSeparator(self, context)
2511 layout.operator("curve.select_all").action = 'TOGGLE'
2512 layout.operator("curve.select_all", text="Inverse").action = 'INVERT'
2513 layout.operator("curve.select_nth")
2514 UseSeparator(self, context)
2515 layout.operator("curve.select_random")
2516 layout.operator("curve.select_linked", text="Select Linked")
2517 layout.operator("curve.select_similar", text="Select Similar")
2518 layout.operator("curve.de_select_first")
2519 layout.operator("curve.de_select_last")
2520 layout.operator("curve.select_next")
2521 layout.operator("curve.select_previous")
2522 UseSeparator(self, context)
2523 layout.operator("curve.select_more")
2524 layout.operator("curve.select_less")
2527 # Armature Select #
2528 class VIEW3D_MT_SelectArmatureMenu(Menu):
2529 bl_label = "Select"
2531 def draw(self, context):
2532 layout = self.layout
2533 layout.operator("view3d.select_box")
2534 layout.operator("armature.select_all")
2535 layout.operator("armature.select_inverse", text="Inverse")
2536 layout.operator("armature.select_hierarchy",
2537 text="Parent").direction = 'PARENT'
2538 layout.operator("armature.select_hierarchy",
2539 text="Child").direction = 'CHILD'
2540 props = layout.operator("armature.select_hierarchy",
2541 text="Extend Parent")
2542 props.extend = True
2543 props.direction = 'PARENT'
2544 props = layout.operator("armature.select_hierarchy",
2545 text="Extend Child")
2546 props.extend = True
2547 props.direction = 'CHILD'
2548 layout.operator("object.select_pattern", text="Select Pattern...")
2551 class VIEW3D_MT_Select_Edit_Armature(Menu):
2552 bl_label = "Select"
2554 def draw(self, context):
2555 layout = self.layout
2557 layout.operator("view3d.select_box")
2558 layout.operator("view3d.select_circle")
2560 UseSeparator(self, context)
2562 layout.operator("armature.select_all").action = 'TOGGLE'
2563 layout.operator("armature.select_all", text="Inverse").action = 'INVERT'
2564 layout.operator("armature.select_mirror", text="Mirror").extend = False
2566 UseSeparator(self, context)
2568 layout.operator("armature.select_more", text="More")
2569 layout.operator("armature.select_less", text="Less")
2571 UseSeparator(self, context)
2573 props = layout.operator("armature.select_hierarchy", text="Parent")
2574 props.extend = False
2575 props.direction = 'PARENT'
2577 props = layout.operator("armature.select_hierarchy", text="Child")
2578 props.extend = False
2579 props.direction = 'CHILD'
2581 UseSeparator(self, context)
2583 props = layout.operator("armature.select_hierarchy", text="Extend Parent")
2584 props.extend = True
2585 props.direction = 'PARENT'
2587 props = layout.operator("armature.select_hierarchy", text="Extend Child")
2588 props.extend = True
2589 props.direction = 'CHILD'
2591 layout.operator_menu_enum("armature.select_similar", "type", text="Similar")
2592 layout.operator("object.select_pattern", text="Select Pattern...")
2595 class VIEW3D_MT_Select_Pose(Menu):
2596 bl_label = "Select"
2598 def draw(self, context):
2599 layout = self.layout
2600 layout.operator("view3d.select_box")
2601 layout.operator("view3d.select_circle")
2602 UseSeparator(self, context)
2603 layout.operator("pose.select_all").action = 'TOGGLE'
2604 layout.operator("pose.select_all", text="Inverse").action = 'INVERT'
2605 layout.operator("pose.select_mirror", text="Flip Active")
2606 layout.operator("pose.select_constraint_target",
2607 text="Constraint Target")
2608 UseSeparator(self, context)
2609 layout.operator("pose.select_linked", text="Linked")
2610 layout.operator("pose.select_hierarchy",
2611 text="Parent").direction = 'PARENT'
2612 layout.operator("pose.select_hierarchy",
2613 text="Child").direction = 'CHILD'
2614 props = layout.operator("pose.select_hierarchy", text="Extend Parent")
2615 props.extend = True
2616 props.direction = 'PARENT'
2617 props = layout.operator("pose.select_hierarchy", text="Extend Child")
2618 props.extend = True
2619 props.direction = 'CHILD'
2620 layout.operator_menu_enum("pose.select_grouped", "type",
2621 text="Grouped")
2622 UseSeparator(self, context)
2623 layout.operator("object.select_pattern", text="Select Pattern...")
2624 layout.menu("VIEW3D_MT_select_pose_more_less")
2627 class VIEW3D_MT_Select_Pose_More_Less(Menu):
2628 bl_label = "Select More/Less"
2630 def draw(self, context):
2631 layout = self.layout
2632 props = layout.operator("pose.select_hierarchy", text="Parent")
2633 props.extend = False
2634 props.direction = 'PARENT'
2636 props = layout.operator("pose.select_hierarchy", text="Child")
2637 props.extend = False
2638 props.direction = 'CHILD'
2640 props = layout.operator("pose.select_hierarchy", text="Extend Parent")
2641 props.extend = True
2642 props.direction = 'PARENT'
2644 props = layout.operator("pose.select_hierarchy", text="Extend Child")
2645 props.extend = True
2646 props.direction = 'CHILD'
2649 class VIEW3D_MT_PoseCopy(Menu):
2650 bl_label = "Pose Copy"
2652 def draw(self, context):
2653 layout = self.layout
2654 layout.operator("pose.copy")
2655 layout.operator("pose.paste")
2656 layout.operator("pose.paste",
2657 text="Paste X-Flipped Pose").flipped = True
2660 class VIEW3D_MT_PoseNames(Menu):
2661 bl_label = "Pose Names"
2663 def draw(self, context):
2664 layout = self.layout
2665 layout.operator_context = 'EXEC_AREA'
2666 layout.operator("pose.autoside_names",
2667 text="AutoName Left/Right").axis = 'XAXIS'
2668 layout.operator("pose.autoside_names",
2669 text="AutoName Front/Back").axis = 'YAXIS'
2670 layout.operator("pose.autoside_names",
2671 text="AutoName Top/Bottom").axis = 'ZAXIS'
2672 layout.operator("pose.flip_names")
2675 # Surface Select #
2676 class VIEW3D_MT_Select_Edit_Surface(Menu):
2677 bl_label = "Select"
2679 def draw(self, context):
2680 layout = self.layout
2681 layout.operator("view3d.select_box")
2682 layout.operator("view3d.select_circle")
2683 UseSeparator(self, context)
2684 layout.operator("curve.select_all").action = 'TOGGLE'
2685 layout.operator("curve.select_all", text="Inverse").action = 'INVERT'
2686 layout.operator("curve.select_random")
2687 layout.operator("curve.select_nth")
2688 layout.operator("curve.select_linked", text="Select Linked")
2689 layout.operator("curve.select_similar", text="Select Similar")
2690 layout.operator("curve.select_row")
2691 UseSeparator(self, context)
2692 layout.operator("curve.select_more")
2693 layout.operator("curve.select_less")
2696 # Metaball Select #
2697 class VIEW3D_MT_SelectMetaball(Menu):
2698 bl_label = "Select"
2700 def draw(self, context):
2701 layout = self.layout
2702 layout.operator("view3d.select_box")
2703 layout.operator("view3d.select_circle")
2704 UseSeparator(self, context)
2705 layout.operator("mball.select_all").action = 'TOGGLE'
2706 layout.operator("mball.select_all").action = 'INVERT'
2707 layout.operator("mball.select_random_metaelems")
2710 class VIEW3D_MT_Select_Edit_Metaball(Menu):
2711 bl_label = "Select"
2713 def draw(self, context):
2714 layout = self.layout
2715 layout.operator("view3d.select_box")
2716 layout.operator("view3d.select_circle")
2717 layout.operator("mball.select_all").action = 'TOGGLE'
2718 layout.operator("mball.select_all", text="Inverse").action = 'INVERT'
2719 layout.operator("mball.select_random_metaelems")
2720 layout.operator_menu_enum("mball.select_similar", "type", text="Similar")
2723 # Particle Select #
2724 class VIEW3D_MT_Selection_Mode_Particle(Menu):
2725 bl_label = "Particle Select and Display Mode"
2727 def draw(self, context):
2728 layout = self.layout
2729 toolsettings = context.tool_settings
2731 layout.prop(toolsettings.particle_edit, "select_mode", expand=True)
2734 class VIEW3D_MT_Select_Particle(Menu):
2735 bl_label = "Select"
2737 def draw(self, context):
2738 layout = self.layout
2740 layout.operator("view3d.select_box")
2741 layout.operator("view3d.select_circle")
2742 UseSeparator(self, context)
2744 layout.operator("particle.select_all").action = 'TOGGLE'
2745 layout.operator("particle.select_linked")
2746 layout.operator("particle.select_all", text="Inverse").action = 'INVERT'
2748 UseSeparator(self, context)
2749 layout.operator("particle.select_more")
2750 layout.operator("particle.select_less")
2752 UseSeparator(self, context)
2753 layout.operator("particle.select_random")
2755 UseSeparator(self, context)
2756 layout.operator("particle.select_roots", text="Roots")
2757 layout.operator("particle.select_tips", text="Tips")
2760 # Lattice Edit Select #
2761 class VIEW3D_MT_Select_Edit_Lattice(Menu):
2762 bl_label = "Select"
2764 def draw(self, context):
2765 layout = self.layout
2767 layout.operator("view3d.select_box")
2768 layout.operator("view3d.select_circle")
2769 UseSeparator(self, context)
2770 layout.operator("lattice.select_mirror")
2771 layout.operator("lattice.select_random")
2772 layout.operator("lattice.select_all").action = 'TOGGLE'
2773 layout.operator("lattice.select_all", text="Inverse").action = 'INVERT'
2774 UseSeparator(self, context)
2775 layout.operator("lattice.select_ungrouped", text="Ungrouped Verts")
2778 # Grease Pencil Select #
2779 class VIEW3D_MT_Select_Gpencil(Menu):
2780 # To Do: used in 3dview header might work if mapped to mouse
2781 # Not in Class List yet
2782 bl_label = "Select"
2784 def draw(self, context):
2785 layout = self.layout
2787 layout.operator("gpencil.select_box")
2788 layout.operator("gpencil.select_circle")
2790 UseSeparator(self, context)
2792 layout.operator("gpencil.select_all", text="(De)select All").action = 'TOGGLE'
2793 layout.operator("gpencil.select_all", text="Inverse").action = 'INVERT'
2794 layout.operator("gpencil.select_linked", text="Linked")
2795 # layout.operator_menu_enum("gpencil.select_grouped", "type", text="Grouped")
2796 layout.operator("gpencil.select_grouped", text="Grouped")
2798 UseSeparator(self, context)
2800 layout.operator("gpencil.select_more")
2801 layout.operator("gpencil.select_less")
2804 # Text Select #
2805 class VIEW3D_MT_Select_Edit_Text(Menu):
2806 # To Do: used in 3dview header might work if mapped to mouse
2807 # Not in Class List yet
2808 bl_label = "Edit"
2810 def draw(self, context):
2811 layout = self.layout
2812 layout.operator("font.text_copy", text="Copy")
2813 layout.operator("font.text_cut", text="Cut")
2814 layout.operator("font.text_paste", text="Paste")
2815 layout.operator("font.text_paste_from_file")
2816 layout.operator("font.select_all")
2819 # Paint Mode Menus #
2820 class VIEW3D_MT_Select_Paint_Mask(Menu):
2821 bl_label = "Select"
2823 def draw(self, context):
2824 layout = self.layout
2825 layout.operator("view3d.select_box")
2826 layout.operator("view3d.select_circle")
2827 layout.operator("paint.face_select_all").action = 'TOGGLE'
2828 layout.operator("paint.face_select_all", text="Inverse").action = 'INVERT'
2829 layout.operator("paint.face_select_linked", text="Linked")
2832 class VIEW3D_MT_Select_Paint_Mask_Vertex(Menu):
2833 bl_label = "Select"
2835 def draw(self, context):
2836 layout = self.layout
2837 layout.operator("view3d.select_box")
2838 layout.operator("view3d.select_circle")
2839 layout.operator("paint.vert_select_all").action = 'TOGGLE'
2840 layout.operator("paint.vert_select_all", text="Inverse").action = 'INVERT'
2841 layout.operator("paint.vert_select_ungrouped", text="Ungrouped Verts")
2844 class VIEW3D_MT_Angle_Control(Menu):
2845 bl_label = "Angle Control"
2847 @classmethod
2848 def poll(cls, context):
2849 settings = UnifiedPaintPanel.paint_settings(context)
2850 if not settings:
2851 return False
2853 brush = settings.brush
2854 tex_slot = brush.texture_slot
2856 return tex_slot.has_texture_angle and tex_slot.has_texture_angle_source
2858 def draw(self, context):
2859 layout = self.layout
2861 settings = UnifiedPaintPanel.paint_settings(context)
2862 brush = settings.brush
2864 sculpt = (context.sculpt_object is not None)
2866 tex_slot = brush.texture_slot
2868 layout.prop(tex_slot, "use_rake", text="Rake")
2870 if brush.brush_capabilities.has_random_texture_angle and tex_slot.has_random_texture_angle:
2871 if sculpt:
2872 if brush.sculpt_capabilities.has_random_texture_angle:
2873 layout.prop(tex_slot, "use_random", text="Random")
2874 else:
2875 layout.prop(tex_slot, "use_random", text="Random")
2878 # Cursor Edge Intersection Defs #
2880 def abs(val):
2881 if val > 0:
2882 return val
2883 return -val
2886 def edgeIntersect(context, operator):
2887 from mathutils.geometry import intersect_line_line
2889 obj = context.active_object
2891 if (obj.type != "MESH"):
2892 operator.report({'ERROR'}, "Object must be a mesh")
2893 return None
2895 edges = []
2896 mesh = obj.data
2897 verts = mesh.vertices
2899 is_editmode = (obj.mode == 'EDIT')
2900 if is_editmode:
2901 bpy.ops.object.mode_set(mode='OBJECT')
2903 for e in mesh.edges:
2904 if e.select:
2905 edges.append(e)
2907 if len(edges) > 2:
2908 break
2910 if is_editmode:
2911 bpy.ops.object.mode_set(mode='EDIT')
2913 if len(edges) != 2:
2914 operator.report({'ERROR'},
2915 "Operator requires exactly 2 edges to be selected")
2916 return
2918 line = intersect_line_line(verts[edges[0].vertices[0]].co,
2919 verts[edges[0].vertices[1]].co,
2920 verts[edges[1].vertices[0]].co,
2921 verts[edges[1].vertices[1]].co)
2923 if line is None:
2924 operator.report({'ERROR'}, "Selected edges do not intersect")
2925 return
2927 point = line[0].lerp(line[1], 0.5)
2928 context.scene.cursor.location = obj.matrix_world * point
2931 # Cursor Edge Intersection Operator #
2932 class VIEW3D_OT_CursorToEdgeIntersection(Operator):
2933 bl_idname = "view3d.snap_cursor_to_edge_intersection"
2934 bl_label = "Cursor to Edge Intersection"
2935 bl_description = "Finds the mid-point of the shortest distance between two edges"
2937 @classmethod
2938 def poll(cls, context):
2939 obj = context.active_object
2940 return (obj is not None and obj.type == 'MESH')
2942 def execute(self, context):
2943 # Prevent unsupported Execution in Local View modes
2944 space_data = bpy.context.space_data
2945 if True in space_data.layers_local_view:
2946 self.report({'INFO'}, 'Global Perspective modes only unable to continue.')
2947 return {'FINISHED'}
2948 edgeIntersect(context, self)
2949 return {'FINISHED'}
2952 # Set Mode Operator #
2953 class VIEW3D_OT_SetObjectMode(Operator):
2954 bl_idname = "object.set_object_mode"
2955 bl_label = "Set the object interactive mode"
2956 bl_description = "I set the interactive mode of object"
2957 bl_options = {'REGISTER'}
2959 mode: StringProperty(
2960 name="Interactive mode",
2961 default="OBJECT"
2964 def execute(self, context):
2965 if (context.active_object):
2966 try:
2967 bpy.ops.object.mode_set(mode=self.mode)
2968 except TypeError:
2969 msg = context.active_object.name + ": It is not possible to enter into the interactive mode"
2970 self.report(type={"WARNING"}, message=msg)
2971 else:
2972 self.report(type={"WARNING"}, message="There is no active object")
2973 return {'FINISHED'}
2976 # Origin To Selected Edit Mode #
2977 def vfeOrigin(context):
2978 try:
2979 cursorPositionX = context.scene.cursor.location[0]
2980 cursorPositionY = context.scene.cursor.location[1]
2981 cursorPositionZ = context.scene.cursor.location[2]
2982 bpy.ops.view3d.snap_cursor_to_selected()
2983 bpy.ops.object.mode_set()
2984 bpy.ops.object.origin_set(type='ORIGIN_CURSOR', center='MEDIAN')
2985 bpy.ops.object.mode_set(mode='EDIT')
2986 context.scene.cursor.location[0] = cursorPositionX
2987 context.scene.cursor.location[1] = cursorPositionY
2988 context.scene.cursor.location[2] = cursorPositionZ
2989 return True
2990 except:
2991 return False
2994 class VIEW3D_OT_SetOriginToSelected(Operator):
2995 bl_idname = "object.setorigintoselected"
2996 bl_label = "Set Origin to Selected"
2997 bl_description = "Set Origin to Selected"
2999 @classmethod
3000 def poll(cls, context):
3001 return (context.area.type == "VIEW_3D" and context.active_object is not None)
3003 def execute(self, context):
3004 check = vfeOrigin(context)
3005 if not check:
3006 self.report({"ERROR"}, "Set Origin to Selected could not be performed")
3007 return {'CANCELLED'}
3009 return {'FINISHED'}
3011 # multiple edit select modes.
3012 class VIEW3D_OT_selecteditVertex(Operator):
3013 bl_idname = "selectedit.vertex"
3014 bl_label = "Vertex Mode"
3015 bl_description = "Vert Select"
3016 bl_options = {'REGISTER', 'UNDO'}
3018 def execute(self, context):
3019 if context.object.mode != "EDIT":
3020 bpy.ops.object.mode_set(mode="EDIT")
3021 bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='VERT')
3022 if bpy.ops.mesh.select_mode != "EDGE, FACE":
3023 bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='VERT')
3024 return {'FINISHED'}
3027 class VIEW3D_OT_selecteditEdge(Operator):
3028 bl_idname = "selectedit.edge"
3029 bl_label = "Edge Mode"
3030 bl_description = "Edge Select"
3031 bl_options = {'REGISTER', 'UNDO'}
3033 def execute(self, context):
3034 if context.object.mode != "EDIT":
3035 bpy.ops.object.mode_set(mode="EDIT")
3036 bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='EDGE')
3037 if bpy.ops.mesh.select_mode != "VERT, FACE":
3038 bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='EDGE')
3039 return {'FINISHED'}
3042 class VIEW3D_OT_selecteditFace(Operator):
3043 bl_idname = "selectedit.face"
3044 bl_label = "Multiedit Face"
3045 bl_description = "Face Mode"
3046 bl_options = {'REGISTER', 'UNDO'}
3048 def execute(self, context):
3049 if context.object.mode != "EDIT":
3050 bpy.ops.object.mode_set(mode="EDIT")
3051 bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='FACE')
3052 if bpy.ops.mesh.select_mode != "VERT, EDGE":
3053 bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='FACE')
3054 return {'FINISHED'}
3057 # Components Multi Selection Mode
3058 class VIEW3D_OT_selecteditVertsEdges(Operator):
3059 bl_idname = "selectedit.vertsedges"
3060 bl_label = "Verts Edges Mode"
3061 bl_description = "Vert/Edge Select"
3062 bl_options = {'REGISTER', 'UNDO'}
3064 def execute(self, context):
3065 if context.object.mode != "EDIT":
3066 bpy.ops.object.mode_set(mode="EDIT")
3067 bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='VERT')
3068 if bpy.ops.mesh.select_mode != "VERT, EDGE, FACE":
3069 bpy.ops.object.mode_set(mode="EDIT")
3070 bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='VERT')
3071 bpy.ops.mesh.select_mode(use_extend=True, use_expand=False, type='EDGE')
3072 return {'FINISHED'}
3075 class VIEW3D_OT_selecteditEdgesFaces(Operator):
3076 bl_idname = "selectedit.edgesfaces"
3077 bl_label = "Edges Faces Mode"
3078 bl_description = "Edge/Face Select"
3079 bl_options = {'REGISTER', 'UNDO'}
3081 def execute(self, context):
3082 if context.object.mode != "EDIT":
3083 bpy.ops.object.mode_set(mode="EDIT")
3084 bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='EDGE')
3085 if bpy.ops.mesh.select_mode != "VERT, EDGE, FACE":
3086 bpy.ops.object.mode_set(mode="EDIT")
3087 bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='EDGE')
3088 bpy.ops.mesh.select_mode(use_extend=True, use_expand=False, type='FACE')
3089 return {'FINISHED'}
3092 class VIEW3D_OT_selecteditVertsFaces(Operator):
3093 bl_idname = "selectedit.vertsfaces"
3094 bl_label = "Verts Faces Mode"
3095 bl_description = "Vert/Face Select"
3096 bl_options = {'REGISTER', 'UNDO'}
3098 def execute(self, context):
3099 if context.object.mode != "EDIT":
3100 bpy.ops.object.mode_set(mode="EDIT")
3101 bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='VERT')
3102 if bpy.ops.mesh.select_mode != "VERT, EDGE, FACE":
3103 bpy.ops.object.mode_set(mode="EDIT")
3104 bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='VERT')
3105 bpy.ops.mesh.select_mode(use_extend=True, use_expand=False, type='FACE')
3106 return {'FINISHED'}
3109 class VIEW3D_OT_selecteditVertsEdgesFaces(Operator):
3110 bl_idname = "selectedit.vertsedgesfaces"
3111 bl_label = "Verts Edges Faces Mode"
3112 bl_description = "Vert/Edge/Face Select"
3113 bl_options = {'REGISTER', 'UNDO'}
3115 def execute(self, context):
3116 if context.object.mode != "EDIT":
3117 bpy.ops.object.mode_set(mode="EDIT")
3118 bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='VERT')
3119 if bpy.ops.mesh.select_mode != "VERT, EDGE, FACE":
3120 bpy.ops.object.mode_set(mode="EDIT")
3121 bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='VERT')
3122 bpy.ops.mesh.select_mode(use_extend=True, use_expand=False, type='EDGE')
3123 bpy.ops.mesh.select_mode(use_extend=True, use_expand=False, type='FACE')
3124 return {'FINISHED'}
3126 # Code thanks to Isaac Weaver (wisaac) D1963
3127 class VIEW3D_OT_SnapCursSelToCenter(Operator):
3128 bl_idname = "view3d.snap_cursor_selected_to_center"
3129 bl_label = "Snap Cursor & Selection to World Origin"
3130 bl_description = ("Snap 3D cursor and selected objects to the center \n"
3131 "Works only in Object Mode")
3133 @classmethod
3134 def poll(cls, context):
3135 return (context.area.type == "VIEW_3D" and context.mode == "OBJECT")
3137 def execute(self, context):
3138 context.scene.cursor.location = (0, 0, 0)
3139 for obj in context.selected_objects:
3140 obj.location = (0, 0, 0)
3141 return {'FINISHED'}
3144 # Preferences utility functions
3146 # Draw Separator #
3147 def UseSeparator(operator, context):
3148 useSep = bpy.context.preferences.addons[__name__].preferences.use_separators
3149 if useSep:
3150 operator.layout.separator()
3153 # Use compact brushes menus #
3154 def UseBrushesLists():
3155 # separate function just for more convenience
3156 useLists = bpy.context.preferences.addons[__name__].preferences.use_brushes_lists
3158 return bool(useLists)
3161 # Addon Preferences #
3162 class VIEW3D_MT_Space_Dynamic_Menu_Pref(AddonPreferences):
3163 bl_idname = __name__
3165 use_separators: BoolProperty(
3166 name="Use Separators in the menus",
3167 default=True,
3168 description=("Use separators in the menus, a trade-off between \n"
3169 "readability vs. using more space for displaying items")
3171 use_brushes_lists: BoolProperty(
3172 name="Use compact menus for brushes",
3173 default=False,
3174 description=("Use more compact menus instead \n"
3175 "of thumbnails for displaying brushes")
3178 def draw(self, context):
3179 layout = self.layout
3180 row = layout.row(align=True)
3181 row.prop(self, "use_separators", toggle=True)
3182 row.prop(self, "use_brushes_lists", toggle=True)
3185 # List The Classes #
3187 classes = (
3188 VIEW3D_MT_Space_Dynamic_Menu,
3189 VIEW3D_MT_AddMenu,
3190 VIEW3D_MT_Object,
3191 VIEW3D_MT_Edit_Mesh,
3192 VIEW3D_MT_TransformMenu,
3193 VIEW3D_MT_TransformMenuEdit,
3194 VIEW3D_MT_TransformMenuArmature,
3195 VIEW3D_MT_TransformMenuArmatureEdit,
3196 VIEW3D_MT_TransformMenuArmaturePose,
3197 VIEW3D_MT_TransformMenuLite,
3198 VIEW3D_MT_TransformMenuCamera,
3199 VIEW3D_MT_MirrorMenu,
3200 VIEW3D_MT_ParentMenu,
3201 VIEW3D_MT_GroupMenu,
3202 VIEW3D_MT_Select_Object,
3203 VIEW3D_MT_Select_Object_More_Less,
3204 VIEW3D_MT_Select_Edit_Mesh,
3205 VIEW3D_MT_Edit_Mesh_Select_Similar,
3206 VIEW3D_MT_Edit_Mesh_Select_Trait,
3207 VIEW3D_MT_Edit_Mesh_Select_More_Less,
3208 VIEW3D_MT_Select_Edit_Curve,
3209 VIEW3D_MT_SelectArmatureMenu,
3210 VIEW3D_MT_Select_Pose,
3211 VIEW3D_MT_Select_Pose_More_Less,
3212 VIEW3D_MT_Pose,
3213 VIEW3D_MT_PoseCopy,
3214 VIEW3D_MT_PoseNames,
3215 VIEW3D_MT_Select_Edit_Surface,
3216 VIEW3D_MT_SelectMetaball,
3217 VIEW3D_MT_Select_Edit_Metaball,
3218 VIEW3D_MT_Select_Particle,
3219 VIEW3D_MT_Select_Edit_Lattice,
3220 VIEW3D_MT_Select_Edit_Armature,
3221 VIEW3D_MT_Select_Paint_Mask,
3222 VIEW3D_MT_Select_Paint_Mask_Vertex,
3223 VIEW3D_MT_Angle_Control,
3224 VIEW3D_MT_Edit_Multi,
3225 VIEW3D_MT_EditM_Edge,
3226 VIEW3D_MT_Edit_Curve,
3227 VIEW3D_MT_EditCurveCtrlpoints,
3228 VIEW3D_MT_EditCurveSegments,
3229 VIEW3D_MT_EditCurveSpecials,
3230 VIEW3D_MT_Edit_Armature,
3231 VIEW3D_MT_EditArmatureTK,
3232 VIEW3D_MT_KeyframeMenu,
3233 VIEW3D_MT_CursorMenu,
3234 VIEW3D_MT_CursorMenuLite,
3235 VIEW3D_MT_EditCursorMenu,
3236 VIEW3D_OT_CursorToEdgeIntersection,
3237 VIEW3D_MT_UndoS,
3238 VIEW3D_MT_Camera_Options,
3239 VIEW3D_MT_InteractiveMode,
3240 VIEW3D_MT_InteractiveModeArmature,
3241 VIEW3D_MT_InteractiveModeOther,
3242 VIEW3D_OT_SetObjectMode,
3243 VIEW3D_MT_View_Directions,
3244 VIEW3D_MT_View_Border,
3245 VIEW3D_MT_View_Menu,
3246 VIEW3D_MT_View_Navigation,
3247 VIEW3D_MT_View_Align,
3248 VIEW3D_MT_View_Align_Selected,
3249 VIEW3D_MT_View_Cameras,
3250 VIEW3D_MT_View_Local,
3251 VIEW3D_MT_UV_Map,
3252 VIEW3D_MT_Snap_Context,
3253 VIEW3D_MT_Snap_Origin,
3254 VIEW3D_MT_Shade,
3255 VIEW3D_OT_SetOriginToSelected,
3256 VIEW3D_MT_Object_Data_Link,
3257 VIEW3D_MT_Duplicate,
3258 VIEW3D_MT_Space_Dynamic_Menu_Pref,
3259 VIEW3D_MT_Selection_Mode_Particle,
3260 VIEW3D_MT_AutoSmooth,
3261 VIEW3D_MT_Animation_Player,
3262 VIEW3D_OT_Interactive_Mode_Text,
3263 VIEW3D_OT_SnapCursSelToCenter,
3264 VIEW3D_MT_Sculpt_Specials,
3265 VIEW3D_MT_Brush_Settings,
3266 VIEW3D_MT_Brush_Selection,
3267 VIEW3D_MT_Sculpts,
3268 VIEW3D_MT_Hide_Masks,
3269 VIEW3D_OT_Display_Wire_All,
3270 VIEW3D_MT_Vertex_Colors,
3271 VIEW3D_MT_Paint_Weights,
3272 VIEW3D_OT_Interactive_Mode_Grease_Pencil,
3273 VIEW3D_MT_Interactive_Mode_GPencil,
3274 VIEW3D_MT_Edit_Gpencil,
3275 VIEW3D_OT_selecteditVertex,
3276 VIEW3D_OT_selecteditEdge,
3277 VIEW3D_OT_selecteditFace,
3278 VIEW3D_OT_selecteditVertsEdges,
3279 VIEW3D_OT_selecteditEdgesFaces,
3280 VIEW3D_OT_selecteditVertsFaces,
3281 VIEW3D_OT_selecteditVertsEdgesFaces
3285 # Register Classes & Hotkeys #
3286 def register():
3287 for cls in classes:
3288 bpy.utils.register_class(cls)
3290 wm = bpy.context.window_manager
3291 kc = wm.keyconfigs.addon
3292 if kc:
3293 km = kc.keymaps.new(name='3D View', space_type='VIEW_3D')
3294 kmi = km.keymap_items.new('wm.call_menu', 'SPACE', 'PRESS')
3295 kmi.properties.name = "VIEW3D_MT_Space_Dynamic_Menu"
3298 # Unregister Classes & Hotkeys #
3299 def unregister():
3300 wm = bpy.context.window_manager
3301 kc = wm.keyconfigs.addon
3302 if kc:
3303 km = kc.keymaps['3D View']
3304 for kmi in km.keymap_items:
3305 if kmi.idname == 'wm.call_menu':
3306 if kmi.properties.name == "VIEW3D_MT_Space_Dynamic_Menu":
3307 km.keymap_items.remove(kmi)
3308 break
3309 for cls in reversed(classes):
3310 bpy.utils.unregister_class(cls)
3313 if __name__ == "__main__":
3314 register()