blendfile: Python modules shouldn't set their own log level.
[blender-addons.git] / space_view3d_spacebar_menu.py
blob814fdcb00d666e03294dc80acc8a6be7189dfe1d
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, 8, 2),
24 "blender": (2, 77, 0),
25 "location": "View3D > Spacebar",
26 "description": "Object Mode Context Sensitive Spacebar Menu",
27 "warning": "",
28 "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/"
29 "Scripts/3D_interaction/Dynamic_Spacebar_Menu",
30 "tracker_url": "https://developer.blender.org/maniphest/task/create/?project=3&type=Bug",
31 "category": "3D View",
34 import bpy
35 from bpy.types import Operator, Menu
36 from bl_ui.properties_paint_common import UnifiedPaintPanel, brush_texture_settings
38 ### Dynamic Context Sensitive Menu ###
39 ### Main Menu based on Object Type & 3d View Editor Mode ###
41 class VIEW3D_MT_Space_Dynamic_Menu(bpy.types.Menu):
42 bl_label = "Dynamic Context Menu"
44 def draw(self, context):
45 layout = self.layout
46 settings = context.tool_settings
47 layout.operator_context = 'INVOKE_REGION_WIN'
48 scene = context.scene
49 obj = context.object
51 ### No Object Selected ###
52 if not context.active_object:
53 layout.operator_context = 'INVOKE_REGION_WIN'
54 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
55 UseSeparator(self,context)
56 layout.menu("VIEW3D_MT_AddMenu", icon='OBJECT_DATAMODE')
57 layout.menu("VIEW3D_MT_View_Directions", icon='ZOOM_ALL')
58 layout.menu("VIEW3D_MT_View_Navigation", icon='ROTATE')
59 layout.menu("VIEW3D_MT_View_Toggle", icon='SPLITSCREEN')
60 layout.operator("view3d.snap_cursor_to_center",
61 text="Cursor to Center")
62 layout.operator("view3d.snap_cursor_to_grid",
63 text="Cursor to Grid")
64 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
65 UseSeparator(self,context)
66 layout.operator("view3d.toolshelf", icon='MENU_PANEL')
67 layout.operator("view3d.properties", icon='MENU_PANEL')
69 ### Mesh Object Mode ###
70 if obj and obj.type == 'MESH' and obj.mode in {'OBJECT'}:
71 layout.operator_context = 'INVOKE_REGION_WIN'
72 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
73 UseSeparator(self,context)
74 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
75 layout.menu("VIEW3D_MT_Select_Object", icon='RESTRICT_SELECT_OFF')
76 UseSeparator(self,context)
77 layout.menu("VIEW3D_MT_AddMenu", icon='OBJECT_DATAMODE')
78 layout.menu("VIEW3D_MT_Object", icon='VIEW3D')
79 UseSeparator(self,context)
80 layout.menu("VIEW3D_MT_TransformMenu", icon='MANIPUL')
81 layout.menu("VIEW3D_MT_MirrorMenu", icon='MOD_MIRROR')
82 layout.menu("VIEW3D_MT_CursorMenu", icon='CURSOR')
83 UseSeparator(self,context)
84 layout.menu("VIEW3D_MT_ParentMenu", icon='ROTACTIVE')
85 layout.menu("VIEW3D_MT_GroupMenu", icon='GROUP')
86 UseSeparator(self,context)
87 layout.menu("VIEW3D_MT_object_specials", text = "Specials", icon='SOLO_OFF')
88 layout.menu("VIEW3D_MT_Camera_Options", icon='OUTLINER_OB_CAMERA')
89 layout.operator_menu_enum("object.modifier_add", "type", icon='MODIFIER')
90 UseSeparator(self,context)
91 layout.operator("object.delete", text="Delete Object", icon='X_VEC')
92 UseSeparator(self,context)
93 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
94 layout.menu("VIEW3D_MT_Object_Interactive_Mode", icon='EDIT')
95 UseSeparator(self,context)
96 layout.operator("view3d.toolshelf", icon='MENU_PANEL')
97 layout.operator("view3d.properties", icon='MENU_PANEL')
99 ## Mesh Edit Mode ##
100 if obj and obj.type == 'MESH' and obj.mode in {'EDIT'}:
101 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
102 UseSeparator(self,context)
103 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
104 layout.menu("VIEW3D_MT_Select_Edit_Mesh", icon='RESTRICT_SELECT_OFF')
105 layout.menu("VIEW3D_MT_Edit_Multi", icon='VERTEXSEL')
106 UseSeparator(self,context)
107 layout.menu("INFO_MT_mesh_add", text="Add Mesh", icon='OUTLINER_OB_MESH')
108 layout.menu("VIEW3D_MT_Edit_Mesh", text="Mesh", icon='MESH_DATA')
109 UseSeparator(self,context)
110 layout.menu("VIEW3D_MT_TransformMenuEdit", icon='MANIPUL')
111 layout.menu("VIEW3D_MT_MirrorMenu", icon='MOD_MIRROR')
112 layout.menu("VIEW3D_MT_EditCursorMenu", icon='CURSOR')
113 UseSeparator(self,context)
114 layout.menu("VIEW3D_MT_UV_Map", icon='MOD_UVPROJECT')
115 layout.menu("VIEW3D_MT_edit_mesh_specials", icon='SOLO_OFF')
116 layout.menu("VIEW3D_MT_edit_mesh_extrude", icon='ORTHO')
117 UseSeparator(self,context)
118 layout.menu("VIEW3D_MT_edit_mesh_delete", icon='X_VEC')
119 UseSeparator(self,context)
120 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
121 layout.menu("VIEW3D_MT_Object_Interactive_Mode", icon='EDIT')
122 UseSeparator(self,context)
123 layout.operator("view3d.toolshelf", icon='MENU_PANEL')
124 layout.operator("view3d.properties", icon='MENU_PANEL')
126 ## Sculpt Mode ##
127 if obj and obj.type == 'MESH' and obj.mode in {'SCULPT'}:
129 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
130 UseSeparator(self,context)
131 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
132 UseSeparator(self,context)
133 layout.menu("VIEW3D_MT_Sculpts", icon='SCULPTMODE_HLT')
134 layout.menu("VIEW3D_MT_Brush_Selection", text="Sculpt Tool", icon='BRUSH_SCULPT_DRAW')
135 layout.menu("VIEW3D_MT_Brush_Settings", icon='BRUSH_DATA')
136 layout.menu("VIEW3D_MT_Hide_Masks", icon='RESTRICT_VIEW_OFF')
137 UseSeparator(self,context)
138 layout.menu("VIEW3D_MT_Sculpt_Specials", icon='SOLO_OFF')
139 UseSeparator(self,context)
140 layout.menu("VIEW3D_MT_TransformMenu", icon='MANIPUL')
141 layout.menu("VIEW3D_MT_MirrorMenu", icon='MOD_MIRROR')
142 layout.menu("VIEW3D_MT_CursorMenu", icon='CURSOR')
143 UseSeparator(self,context)
144 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
145 layout.menu("VIEW3D_MT_Object_Interactive_Mode", icon='EDIT')
146 UseSeparator(self,context)
147 layout.operator("view3d.toolshelf", icon='MENU_PANEL')
148 layout.operator("view3d.properties", icon='MENU_PANEL')
150 ## Vertex Paint ##
151 if obj and obj.type == 'MESH' and obj.mode in {'VERTEX_PAINT'}:
153 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
154 UseSeparator(self,context)
155 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
156 UseSeparator(self,context)
157 layout.menu("VIEW3D_MT_Brush_Settings", icon='BRUSH_DATA')
158 layout.menu("VIEW3D_MT_Brush_Selection", text="Vertex Paint Tool", icon='BRUSH_VERTEXDRAW')
159 layout.menu("VIEW3D_MT_Vertex_Colors", icon='GROUP_VCOL')
160 UseSeparator(self,context)
161 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
162 layout.menu("VIEW3D_MT_Object_Interactive_Mode", icon='EDIT')
163 UseSeparator(self,context)
164 layout.operator("view3d.toolshelf", icon='MENU_PANEL')
165 layout.operator("view3d.properties", icon='MENU_PANEL')
167 ## Weight Paint Menu ##
168 if obj and obj.type == 'MESH' and obj.mode in {'WEIGHT_PAINT'}:
170 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
171 UseSeparator(self,context)
172 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
173 UseSeparator(self,context)
174 layout.menu("VIEW3D_MT_Paint_Weights", icon='WPAINT_HLT')
175 layout.menu("VIEW3D_MT_Brush_Settings", icon='BRUSH_DATA')
176 layout.menu("VIEW3D_MT_Brush_Selection", text="Weight Paint Tool", icon='BRUSH_TEXMASK')
177 UseSeparator(self,context)
178 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
179 layout.menu("VIEW3D_MT_Object_Interactive_Mode", icon='EDIT')
180 UseSeparator(self,context)
181 layout.operator("view3d.toolshelf", icon='MENU_PANEL')
182 layout.operator("view3d.properties", icon='MENU_PANEL')
184 ## Texture Paint ##
185 if obj and obj.type == 'MESH' and obj.mode in {'TEXTURE_PAINT'}:
187 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
188 UseSeparator(self,context)
189 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
190 layout.menu("VIEW3D_MT_Brush_Settings", icon='BRUSH_DATA')
191 layout.menu("VIEW3D_MT_Brush_Selection", text="Texture Paint Tool", icon='SCULPTMODE_HLT')
192 UseSeparator(self,context)
193 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
194 layout.menu("VIEW3D_MT_Object_Interactive_Mode", icon='EDIT')
195 UseSeparator(self,context)
196 layout.operator("view3d.toolshelf", icon='MENU_PANEL')
197 layout.operator("view3d.properties", icon='MENU_PANEL')
199 ### Curve Object Mode ###
200 if obj and obj.type == 'CURVE' and obj.mode in {'OBJECT'}:
202 layout.operator_context = 'INVOKE_REGION_WIN'
203 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
204 UseSeparator(self,context)
205 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
206 layout.menu("VIEW3D_MT_Select_Object", icon='RESTRICT_SELECT_OFF')
207 UseSeparator(self,context)
208 layout.menu("VIEW3D_MT_AddMenu", icon='OBJECT_DATAMODE')
209 layout.menu("VIEW3D_MT_Object", icon='VIEW3D')
210 UseSeparator(self,context)
211 layout.menu("VIEW3D_MT_TransformMenu", icon='MANIPUL')
212 layout.menu("VIEW3D_MT_MirrorMenu", icon='MOD_MIRROR')
213 layout.menu("VIEW3D_MT_CursorMenu", icon='CURSOR')
214 UseSeparator(self,context)
215 layout.menu("VIEW3D_MT_ParentMenu", icon='ROTACTIVE')
216 layout.menu("VIEW3D_MT_GroupMenu", icon='GROUP')
217 UseSeparator(self,context)
218 layout.menu("VIEW3D_MT_object_specials", text = "Specials", icon='SOLO_OFF')
219 layout.menu("VIEW3D_MT_Camera_Options", icon='OUTLINER_OB_CAMERA')
220 layout.operator_menu_enum("object.modifier_add", "type", icon='MODIFIER')
221 UseSeparator(self,context)
222 layout.operator("object.delete", text="Delete Object", icon='X_VEC')
223 UseSeparator(self,context)
224 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
225 layout.operator("object.editmode_toggle", text="Enter Edit Mode",
226 icon='OBJECT_DATA')
227 UseSeparator(self,context)
228 layout.operator("view3d.toolshelf", icon='MENU_PANEL')
229 layout.operator("view3d.properties", icon='MENU_PANEL')
231 ## Edit Curve ##
232 if obj and obj.type == 'CURVE' and obj.mode in {'EDIT'}:
234 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
235 UseSeparator(self,context)
236 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
237 layout.menu("VIEW3D_MT_Select_Edit_Curve",
238 icon='RESTRICT_SELECT_OFF')
239 UseSeparator(self,context)
240 layout.menu("INFO_MT_curve_add", text="Add Curve",
241 icon='OUTLINER_OB_CURVE')
242 layout.menu("VIEW3D_MT_Edit_Curve", icon='CURVE_DATA')
243 UseSeparator(self,context)
244 layout.menu("VIEW3D_MT_TransformMenu", icon='MANIPUL')
245 layout.menu("VIEW3D_MT_MirrorMenu", icon='MOD_MIRROR')
246 layout.menu("VIEW3D_MT_CursorMenu", icon='CURSOR')
247 layout.menu("VIEW3D_MT_EditCurveCtrlpoints",
248 icon='CURVE_BEZCURVE')
249 layout.menu("VIEW3D_MT_EditCurveSpecials",
250 icon= 'SOLO_OFF')
251 UseSeparator(self,context)
252 layout.operator("curve.delete", text="Delete Object",
253 icon='X_VEC')
254 UseSeparator(self,context)
255 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
256 layout.operator("object.editmode_toggle", text="Enter Object Mode",
257 icon='OBJECT_DATA')
258 UseSeparator(self,context)
259 layout.operator("view3d.toolshelf", icon='MENU_PANEL')
260 layout.operator("view3d.properties", icon='MENU_PANEL')
262 ### Surface Object Mode ###
263 if obj and obj.type == 'SURFACE' and obj.mode in {'OBJECT'}:
265 layout.operator_context = 'INVOKE_REGION_WIN'
266 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
267 UseSeparator(self,context)
268 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
269 layout.menu("VIEW3D_MT_Select_Object", icon='RESTRICT_SELECT_OFF')
270 UseSeparator(self,context)
271 layout.menu("VIEW3D_MT_AddMenu", icon='OBJECT_DATAMODE')
272 layout.menu("VIEW3D_MT_Object", icon='VIEW3D')
273 UseSeparator(self,context)
274 layout.menu("VIEW3D_MT_TransformMenu", icon='MANIPUL')
275 layout.menu("VIEW3D_MT_MirrorMenu", icon='MOD_MIRROR')
276 layout.menu("VIEW3D_MT_CursorMenu", icon='CURSOR')
277 UseSeparator(self,context)
278 layout.menu("VIEW3D_MT_ParentMenu", icon='ROTACTIVE')
279 layout.menu("VIEW3D_MT_GroupMenu", icon='GROUP')
280 UseSeparator(self,context)
281 layout.menu("VIEW3D_MT_object_specials", text = "Specials", icon='SOLO_OFF')
282 layout.menu("VIEW3D_MT_Camera_Options", icon='OUTLINER_OB_CAMERA')
283 layout.operator_menu_enum("object.modifier_add", "type", icon='MODIFIER')
284 UseSeparator(self,context)
285 layout.operator("object.delete", text="Delete Object", icon='X_VEC')
286 UseSeparator(self,context)
287 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
288 layout.operator("object.editmode_toggle", text="Enter Edit Mode",
289 icon='OBJECT_DATA')
290 UseSeparator(self,context)
291 layout.operator("view3d.toolshelf", icon='MENU_PANEL')
292 layout.operator("view3d.properties", icon='MENU_PANEL')
294 ## Edit Surface ##
295 if obj and obj.type == 'SURFACE' and obj.mode in {'EDIT'}:
297 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
298 UseSeparator(self,context)
299 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
300 layout.menu("VIEW3D_MT_Select_Edit_Surface", icon='RESTRICT_SELECT_OFF')
301 UseSeparator(self,context)
302 layout.menu("INFO_MT_surface_add", text="Add Surface",
303 icon='OUTLINER_OB_SURFACE')
304 layout.menu("VIEW3D_MT_TransformMenu", icon='MANIPUL')
305 layout.menu("VIEW3D_MT_MirrorMenu", icon='MOD_MIRROR')
306 layout.menu("VIEW3D_MT_CursorMenu", icon='CURSOR')
307 UseSeparator(self,context)
308 layout.prop_menu_enum(settings, "proportional_edit",
309 icon="PROP_CON")
310 layout.prop_menu_enum(settings, "proportional_edit_falloff",
311 icon="SMOOTHCURVE")
312 layout.menu("VIEW3D_MT_EditCurveSpecials",
313 icon='SOLO_OFF')
314 UseSeparator(self,context)
315 layout.operator("curve.delete", text="Delete Object",
316 icon='CANCEL')
317 UseSeparator(self,context)
318 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
319 layout.operator("object.editmode_toggle", text="Enter Object Mode",
320 icon='OBJECT_DATA')
321 UseSeparator(self,context)
322 layout.operator("view3d.toolshelf", icon='MENU_PANEL')
323 layout.operator("view3d.properties", icon='MENU_PANEL')
325 ### Metaball Object Mode ###
326 if obj and obj.type == 'META' and obj.mode in {'OBJECT'}:
328 layout.operator_context = 'INVOKE_REGION_WIN'
329 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
330 UseSeparator(self,context)
331 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
332 layout.menu("VIEW3D_MT_Select_Object", icon='RESTRICT_SELECT_OFF')
333 UseSeparator(self,context)
334 layout.menu("VIEW3D_MT_AddMenu", icon='OBJECT_DATAMODE')
335 layout.menu("VIEW3D_MT_Object", icon='VIEW3D')
336 UseSeparator(self,context)
337 layout.menu("VIEW3D_MT_TransformMenu", icon='MANIPUL')
338 layout.menu("VIEW3D_MT_MirrorMenu", icon='MOD_MIRROR')
339 layout.menu("VIEW3D_MT_CursorMenu", icon='CURSOR')
340 UseSeparator(self,context)
341 layout.menu("VIEW3D_MT_ParentMenu", icon='ROTACTIVE')
342 layout.menu("VIEW3D_MT_GroupMenu", icon='GROUP')
343 UseSeparator(self,context)
344 layout.menu("VIEW3D_MT_object_specials", text = "Specials", icon='SOLO_OFF')
345 layout.menu("VIEW3D_MT_Camera_Options", icon='OUTLINER_OB_CAMERA')
346 UseSeparator(self,context)
347 layout.operator("object.delete", text="Delete Object", icon='X_VEC')
348 UseSeparator(self,context)
349 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
350 layout.operator("object.editmode_toggle", text="Enter Edit Mode",
351 icon='OBJECT_DATA')
352 UseSeparator(self,context)
353 layout.operator("view3d.toolshelf", icon='MENU_PANEL')
354 layout.operator("view3d.properties", icon='MENU_PANEL')
356 ## Edit Metaball ##
357 if obj and obj.type == 'META' and obj.mode in {'EDIT'}:
359 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
360 UseSeparator(self,context)
361 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
362 layout.menu("VIEW3D_MT_SelectMetaball", icon='RESTRICT_SELECT_OFF')
363 UseSeparator(self,context)
364 layout.operator_menu_enum("object.metaball_add", "type",
365 text="Add Metaball",
366 icon='OUTLINER_OB_META')
367 layout.menu("VIEW3D_MT_TransformMenu", icon='MANIPUL')
368 layout.menu("VIEW3D_MT_MirrorMenu", icon='MOD_MIRROR')
369 layout.menu("VIEW3D_MT_CursorMenu", icon='CURSOR')
370 UseSeparator(self,context)
371 layout.prop_menu_enum(settings, "proportional_edit",
372 icon="PROP_CON")
373 layout.prop_menu_enum(settings, "proportional_edit_falloff",
374 icon="SMOOTHCURVE")
375 UseSeparator(self,context)
376 layout.operator("mball.delete_metaelems", text="Delete Object",
377 icon='CANCEL')
378 UseSeparator(self,context)
379 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
380 layout.operator("object.editmode_toggle", text="Enter Object Mode",
381 icon='OBJECT_DATA')
382 UseSeparator(self,context)
383 layout.operator("view3d.toolshelf", icon='MENU_PANEL')
384 layout.operator("view3d.properties", icon='MENU_PANEL')
386 ### Text Object Mode ###
387 if obj and obj.type == 'FONT' and obj.mode in {'OBJECT'}:
389 layout.operator_context = 'INVOKE_REGION_WIN'
390 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
391 UseSeparator(self,context)
392 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
393 layout.menu("VIEW3D_MT_Select_Object", icon='RESTRICT_SELECT_OFF')
394 UseSeparator(self,context)
395 layout.menu("VIEW3D_MT_AddMenu", icon='OBJECT_DATAMODE')
396 layout.menu("VIEW3D_MT_Object", icon='VIEW3D')
397 UseSeparator(self,context)
398 layout.menu("VIEW3D_MT_TransformMenu", icon='MANIPUL')
399 layout.menu("VIEW3D_MT_MirrorMenu", icon='MOD_MIRROR')
400 layout.menu("VIEW3D_MT_CursorMenu", icon='CURSOR')
401 UseSeparator(self,context)
402 layout.menu("VIEW3D_MT_ParentMenu", icon='ROTACTIVE')
403 layout.menu("VIEW3D_MT_GroupMenu", icon='GROUP')
404 UseSeparator(self,context)
405 layout.menu("VIEW3D_MT_object_specials", text = "Specials", icon='SOLO_OFF')
406 layout.menu("VIEW3D_MT_Camera_Options", icon='OUTLINER_OB_CAMERA')
407 UseSeparator(self,context)
408 layout.operator("object.delete", text="Delete Object", icon='X_VEC')
409 UseSeparator(self,context)
410 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
411 # New Entry For Switching to Editmode
412 layout.operator("view3d.interactive_mode_text", icon='VIEW3D')
413 UseSeparator(self,context)
414 layout.operator("view3d.toolshelf", icon='MENU_PANEL')
415 layout.operator("view3d.properties", icon='MENU_PANEL')
417 ### Text Edit Mode ###
418 # To Do: Space is already reserved for the typing tool
419 if obj and obj.type == 'FONT' and obj.mode in {'EDIT'}:
421 layout.operator_context = 'INVOKE_REGION_WIN'
422 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
423 UseSeparator(self,context)
424 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
425 layout.menu("VIEW3D_MT_select_edit_text", icon='VIEW3D')
426 layout.menu("VIEW3D_MT_edit_font", icon='RESTRICT_SELECT_OFF')
427 UseSeparator(self,context)
428 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
429 layout.operator("object.editmode_toggle", text="Enter Object Mode",
430 icon='OBJECT_DATA')
431 UseSeparator(self,context)
432 layout.operator("view3d.toolshelf", icon='MENU_PANEL')
433 layout.operator("view3d.properties", icon='MENU_PANEL')
435 ### Camera Object Mode ###
436 if obj and obj.type == 'CAMERA' and obj.mode in {'OBJECT'}:
438 layout.operator_context = 'INVOKE_REGION_WIN'
439 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
440 UseSeparator(self,context)
441 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
442 layout.menu("VIEW3D_MT_Select_Object", icon='RESTRICT_SELECT_OFF')
443 UseSeparator(self,context)
444 layout.menu("VIEW3D_MT_AddMenu", icon='OBJECT_DATAMODE')
445 layout.menu("VIEW3D_MT_Object", icon='VIEW3D')
446 UseSeparator(self,context)
447 layout.menu("VIEW3D_MT_TransformMenu", icon='MANIPUL')
448 layout.menu("VIEW3D_MT_CursorMenuLite", icon='CURSOR')
449 UseSeparator(self,context)
450 layout.menu("VIEW3D_MT_ParentMenu", icon='ROTACTIVE')
451 layout.menu("VIEW3D_MT_GroupMenu", icon='GROUP')
452 UseSeparator(self,context)
453 layout.menu("VIEW3D_MT_object_specials", text = "Specials", icon='SOLO_OFF')
454 layout.menu("VIEW3D_MT_Camera_Options", icon='OUTLINER_OB_CAMERA')
455 UseSeparator(self,context)
456 layout.operator("object.delete", text="Delete Object", icon='X_VEC')
457 UseSeparator(self,context)
458 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
459 UseSeparator(self,context)
460 layout.operator("view3d.toolshelf", icon='MENU_PANEL')
461 layout.operator("view3d.properties", icon='MENU_PANEL')
463 ### Lamp Object Mode ###
464 if obj and obj.type == 'LAMP' and obj.mode in {'OBJECT'}:
466 layout.operator_context = 'INVOKE_REGION_WIN'
467 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
468 UseSeparator(self,context)
469 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
470 layout.menu("VIEW3D_MT_Select_Object", icon='RESTRICT_SELECT_OFF')
471 UseSeparator(self,context)
472 layout.menu("VIEW3D_MT_AddMenu", icon='OBJECT_DATAMODE')
473 layout.menu("VIEW3D_MT_Object", icon='VIEW3D')
474 UseSeparator(self,context)
475 layout.menu("VIEW3D_MT_TransformMenuLite", icon='MANIPUL')
476 layout.menu("VIEW3D_MT_CursorMenuLite", icon='CURSOR')
477 UseSeparator(self,context)
478 layout.menu("VIEW3D_MT_ParentMenu", icon='ROTACTIVE')
479 layout.menu("VIEW3D_MT_GroupMenu", icon='GROUP')
480 UseSeparator(self,context)
481 layout.menu("VIEW3D_MT_object_specials", text = "Specials", icon='SOLO_OFF')
482 layout.menu("VIEW3D_MT_Camera_Options", icon='OUTLINER_OB_CAMERA')
483 UseSeparator(self,context)
484 layout.operator("object.delete", text="Delete Object", icon='X_VEC')
485 UseSeparator(self,context)
486 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
487 UseSeparator(self,context)
488 layout.operator("view3d.toolshelf", icon='MENU_PANEL')
489 layout.operator("view3d.properties", icon='MENU_PANEL')
491 ### Armature Object Mode ###
492 if obj and obj.type == 'ARMATURE' and obj.mode in {'OBJECT'}:
494 layout.operator_context = 'INVOKE_REGION_WIN'
495 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
496 UseSeparator(self,context)
497 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
498 layout.menu("VIEW3D_MT_Select_Object", icon='RESTRICT_SELECT_OFF')
499 UseSeparator(self,context)
500 layout.menu("VIEW3D_MT_AddMenu", icon='OBJECT_DATAMODE')
501 layout.menu("VIEW3D_MT_Object", icon='VIEW3D')
502 UseSeparator(self,context)
503 layout.menu("VIEW3D_MT_TransformMenuArmature", icon='MANIPUL')
504 layout.menu("VIEW3D_MT_MirrorMenu", icon='MOD_MIRROR')
505 layout.menu("VIEW3D_MT_CursorMenuLite", icon='CURSOR')
506 UseSeparator(self,context)
507 layout.menu("VIEW3D_MT_ParentMenu", icon='ROTACTIVE')
508 layout.menu("VIEW3D_MT_GroupMenu", icon='GROUP')
509 UseSeparator(self,context)
510 layout.menu("VIEW3D_MT_object_specials", text = "Specials", icon='SOLO_OFF')
511 layout.menu("VIEW3D_MT_Camera_Options", icon='OUTLINER_OB_CAMERA')
512 UseSeparator(self,context)
513 layout.operator("object.delete", text="Delete Object", icon='X_VEC')
514 UseSeparator(self,context)
515 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
516 layout.menu("VIEW3D_MT_Object_Interactive_Armature", icon='VIEW3D')
517 UseSeparator(self,context)
518 layout.operator("view3d.toolshelf", icon='MENU_PANEL')
519 layout.operator("view3d.properties", icon='MENU_PANEL')
521 ## Armature Edit ##
522 if obj and obj.type == 'ARMATURE' and obj.mode in {'EDIT'}:
524 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
525 UseSeparator(self,context)
526 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
527 layout.menu("VIEW3D_MT_Select_Edit_Armature",
528 icon='RESTRICT_SELECT_OFF')
529 UseSeparator(self,context)
530 layout.menu("INFO_MT_armature_add", text="Add Armature",
531 icon='OUTLINER_OB_ARMATURE')
532 layout.menu("VIEW3D_MT_Edit_Armature", text="Armature",
533 icon='OUTLINER_DATA_ARMATURE')
534 layout.menu("VIEW3D_MT_EditArmatureTK",
535 icon='ARMATURE_DATA')
536 UseSeparator(self,context)
537 layout.menu("VIEW3D_MT_TransformMenuArmatureEdit", icon='MANIPUL')
538 layout.menu("VIEW3D_MT_MirrorMenu", icon='MOD_MIRROR')
539 layout.menu("VIEW3D_MT_CursorMenuLite", icon='CURSOR')
540 layout.menu("VIEW3D_MT_ParentMenu", icon='ROTACTIVE')
541 layout.menu("VIEW3D_MT_armature_specials", icon='SOLO_OFF')
542 layout.menu("VIEW3D_MT_edit_armature_roll",
543 icon='BONE_DATA')
544 UseSeparator(self,context)
545 layout.operator("armature.delete", text="Delete Object",
546 icon='X_VEC')
547 UseSeparator(self,context)
548 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
549 layout.menu("VIEW3D_MT_Object_Interactive_Armature", icon='VIEW3D')
550 UseSeparator(self,context)
551 layout.operator("view3d.toolshelf", icon='MENU_PANEL')
552 layout.operator("view3d.properties", icon='MENU_PANEL')
554 ## Armature Pose ##
555 if obj and obj.type == 'ARMATURE' and obj.mode in {'POSE'}:
557 arm = context.active_object.data
559 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
560 UseSeparator(self,context)
561 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
562 layout.menu("VIEW3D_MT_Select_Pose", icon='RESTRICT_SELECT_OFF')
563 UseSeparator(self,context)
564 layout.menu("VIEW3D_MT_Pose", icon='OUTLINER_DATA_POSE')
565 layout.menu("VIEW3D_MT_TransformMenuArmaturePose", icon='MANIPUL')
566 layout.menu("VIEW3D_MT_pose_transform", icon='EMPTY_DATA')
567 UseSeparator(self,context)
568 layout.menu("VIEW3D_MT_CursorMenuLite", icon='CURSOR')
569 layout.menu("VIEW3D_MT_PoseCopy", icon='FILE')
571 if arm.draw_type in {'BBONE', 'ENVELOPE'}:
572 layout.operator("transform.transform",
573 text="Scale Envelope Distance").mode = 'BONE_SIZE'
575 layout.menu("VIEW3D_MT_pose_apply", icon='AUTO')
576 layout.operator("pose.relax", icon= 'ARMATURE_DATA')
577 layout.menu("VIEW3D_MT_KeyframeMenu", icon='KEY_HLT')
578 layout.menu("VIEW3D_MT_pose_specials", icon='SOLO_OFF')
579 layout.menu("VIEW3D_MT_pose_group", icon= 'GROUP_BONE')
580 UseSeparator(self,context)
581 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
582 layout.menu("VIEW3D_MT_Object_Interactive_Armature", icon='VIEW3D')
583 UseSeparator(self,context)
584 layout.operator("view3d.toolshelf", icon='MENU_PANEL')
585 layout.operator("view3d.properties", icon='MENU_PANEL')
587 ### Lattice Object Mode ###
588 if obj and obj.type == 'LATTICE' and obj.mode in {'OBJECT'}:
590 layout.operator_context = 'INVOKE_REGION_WIN'
591 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
592 UseSeparator(self,context)
593 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
594 layout.menu("VIEW3D_MT_Select_Object", icon='RESTRICT_SELECT_OFF')
595 UseSeparator(self,context)
596 layout.menu("VIEW3D_MT_AddMenu", icon='OBJECT_DATAMODE')
597 layout.menu("VIEW3D_MT_Object", icon='VIEW3D')
598 UseSeparator(self,context)
599 layout.menu("VIEW3D_MT_TransformMenu", icon='MANIPUL')
600 layout.menu("VIEW3D_MT_MirrorMenu", icon='MOD_MIRROR')
601 layout.menu("VIEW3D_MT_CursorMenu", icon='CURSOR')
602 UseSeparator(self,context)
603 layout.menu("VIEW3D_MT_ParentMenu", icon='ROTACTIVE')
604 layout.menu("VIEW3D_MT_GroupMenu", icon='GROUP')
605 UseSeparator(self,context)
606 layout.menu("VIEW3D_MT_object_specials", text = "Specials", icon='SOLO_OFF')
607 layout.menu("VIEW3D_MT_Camera_Options", icon='OUTLINER_OB_CAMERA')
608 layout.operator_menu_enum("object.modifier_add", "type", icon='MODIFIER')
609 UseSeparator(self,context)
610 layout.operator("object.delete", text="Delete Object", icon='X_VEC')
611 UseSeparator(self,context)
612 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
613 layout.operator("object.editmode_toggle", text="Enter Edit Mode",
614 icon='OBJECT_DATA')
615 UseSeparator(self,context)
616 layout.operator("view3d.toolshelf", icon='MENU_PANEL')
617 layout.operator("view3d.properties", icon='MENU_PANEL')
619 ## Edit Lattice ##
620 if obj and obj.type == 'LATTICE' and obj.mode in {'EDIT'}:
622 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
623 UseSeparator(self,context)
624 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
625 layout.menu("VIEW3D_MT_Select_Edit_Lattice",
626 icon='RESTRICT_SELECT_OFF')
627 UseSeparator(self,context)
628 layout.menu("VIEW3D_MT_TransformMenu", icon='MANIPUL')
629 layout.menu("VIEW3D_MT_MirrorMenu", icon='MOD_MIRROR')
630 layout.menu("VIEW3D_MT_CursorMenu", icon='CURSOR')
631 UseSeparator(self,context)
632 layout.prop_menu_enum(settings, "proportional_edit",
633 icon= "PROP_CON")
634 layout.prop_menu_enum(settings, "proportional_edit_falloff",
635 icon= "SMOOTHCURVE")
636 UseSeparator(self,context)
637 layout.operator("lattice.make_regular")
638 UseSeparator(self,context)
639 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
640 layout.operator("object.editmode_toggle", text="Enter Object Mode",
641 icon='OBJECT_DATA')
642 UseSeparator(self,context)
643 layout.operator("view3d.toolshelf", icon='MENU_PANEL')
644 layout.operator("view3d.properties", icon='MENU_PANEL')
646 ### Empty Object Mode ###
647 if obj and obj.type == 'EMPTY' and obj.mode in {'OBJECT'}:
649 layout.operator_context = 'INVOKE_REGION_WIN'
650 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
651 UseSeparator(self,context)
652 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
653 layout.menu("VIEW3D_MT_Select_Object", icon='RESTRICT_SELECT_OFF')
654 UseSeparator(self,context)
655 layout.menu("VIEW3D_MT_AddMenu", icon='OBJECT_DATAMODE')
656 layout.menu("VIEW3D_MT_Object", icon='VIEW3D')
657 UseSeparator(self,context)
658 layout.menu("VIEW3D_MT_TransformMenuLite", icon='MANIPUL')
659 layout.menu("VIEW3D_MT_MirrorMenu", icon='MOD_MIRROR')
660 layout.menu("VIEW3D_MT_CursorMenuLite", icon='CURSOR')
661 UseSeparator(self,context)
662 layout.menu("VIEW3D_MT_ParentMenu", icon='ROTACTIVE')
663 layout.menu("VIEW3D_MT_GroupMenu", icon='GROUP')
664 UseSeparator(self,context)
665 layout.menu("VIEW3D_MT_object_specials", text = "Specials", icon='SOLO_OFF')
666 layout.menu("VIEW3D_MT_Camera_Options", icon='OUTLINER_OB_CAMERA')
667 UseSeparator(self,context)
668 layout.operator("object.delete", text="Delete Object", icon='X_VEC')
669 UseSeparator(self,context)
670 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
671 UseSeparator(self,context)
672 layout.operator("view3d.toolshelf", icon='MENU_PANEL')
673 layout.operator("view3d.properties", icon='MENU_PANEL')
675 ### Speaker Object Mode ###
676 if obj and obj.type == 'SPEAKER' and obj.mode in {'OBJECT'}:
678 layout.operator_context = 'INVOKE_REGION_WIN'
679 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
680 UseSeparator(self,context)
681 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
682 layout.menu("VIEW3D_MT_Select_Object", icon='RESTRICT_SELECT_OFF')
683 UseSeparator(self,context)
684 layout.menu("VIEW3D_MT_AddMenu", icon='OBJECT_DATAMODE')
685 layout.menu("VIEW3D_MT_Object", icon='VIEW3D')
686 UseSeparator(self,context)
687 layout.menu("VIEW3D_MT_TransformMenuLite", icon='MANIPUL')
688 layout.menu("VIEW3D_MT_CursorMenuLite", icon='CURSOR')
689 UseSeparator(self,context)
690 layout.menu("VIEW3D_MT_ParentMenu", icon='ROTACTIVE')
691 layout.menu("VIEW3D_MT_GroupMenu", icon='GROUP')
692 UseSeparator(self,context)
693 layout.operator("object.delete", text="Delete Object", icon='X_VEC')
694 UseSeparator(self,context)
695 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
696 UseSeparator(self,context)
697 layout.operator("view3d.toolshelf", icon='MENU_PANEL')
698 layout.operator("view3d.properties", icon='MENU_PANEL')
700 ## Particle Menu ##
701 if obj and context.mode == 'PARTICLE':
703 layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
704 UseSeparator(self,context)
705 layout.menu("VIEW3D_MT_View_Menu", icon='ZOOM_ALL')
706 layout.menu("VIEW3D_MT_Select_Particle",
707 icon='RESTRICT_SELECT_OFF')
708 layout.menu("VIEW3D_MT_Selection_Mode_Particle",
709 text="Select and Display Mode", icon='PARTICLE_PATH')
710 UseSeparator(self,context)
711 layout.menu("VIEW3D_MT_TransformMenu", icon='MANIPUL')
712 layout.menu("VIEW3D_MT_MirrorMenu", icon='MOD_MIRROR')
713 layout.menu("VIEW3D_MT_CursorMenuLite", icon='CURSOR')
714 UseSeparator(self,context)
715 layout.prop_menu_enum(settings, "proportional_edit",
716 icon= "PROP_CON")
717 layout.prop_menu_enum(settings, "proportional_edit_falloff",
718 icon= "SMOOTHCURVE")
719 UseSeparator(self,context)
720 layout.menu("VIEW3D_MT_particle", icon='PARTICLEMODE')
721 layout.menu("VIEW3D_MT_particle_specials", text="Hair Specials", icon='HAIR')
722 UseSeparator(self,context)
723 layout.operator("object.delete", text="Delete Object", icon='X_VEC')
724 UseSeparator(self,context)
725 layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
726 layout.menu("VIEW3D_MT_Object_Interactive_Mode", icon='VIEW3D')
727 UseSeparator(self,context)
728 layout.operator("view3d.toolshelf", icon='MENU_PANEL')
729 layout.operator("view3d.properties", icon='MENU_PANEL')
731 ############ Object Menus #########
733 # ********** Object Menu **********
734 class VIEW3D_MT_Object(bpy.types.Menu):
735 bl_context = "objectmode"
736 bl_label = "Object"
738 def draw(self, context):
739 layout = self.layout
740 view = context.space_data
741 is_local_view = (view.local_view is not None)
743 layout.operator("object.delete", text="Delete...").use_global = False
744 UseSeparator(self,context)
745 layout.menu("VIEW3D_MT_object_parent")
746 layout.menu("VIEW3D_MT_Duplicate")
747 layout.operator("object.join")
749 if is_local_view:
750 layout.operator_context = 'EXEC_REGION_WIN'
751 layout.operator("object.move_to_layer", text="Move out of Local View")
752 layout.operator_context = 'INVOKE_REGION_WIN'
753 else:
754 layout.operator("object.move_to_layer", text="Move to Layer...")
756 layout.menu("VIEW3D_MT_make_links", text="Make Links...")
757 layout.menu("VIEW3D_MT_Object_Data_Link")
758 UseSeparator(self,context)
759 layout.menu("VIEW3D_MT_AutoSmooth", icon='ALIASED')
760 UseSeparator(self,context)
761 layout.menu("VIEW3D_MT_object_constraints")
762 layout.menu("VIEW3D_MT_object_track")
763 layout.menu("VIEW3D_MT_object_animation")
764 UseSeparator(self,context)
765 layout.menu("VIEW3D_MT_object_game")
766 layout.menu("VIEW3D_MT_object_showhide")
767 UseSeparator(self,context)
768 layout.operator_menu_enum("object.convert", "target")
770 # ********** Object Add **********
771 class VIEW3D_MT_AddMenu(bpy.types.Menu):
772 bl_label = "Add Object"
774 def draw(self, context):
775 layout = self.layout
776 layout.operator_context = 'INVOKE_REGION_WIN'
778 layout.menu("INFO_MT_mesh_add", text="Add Mesh",
779 icon='OUTLINER_OB_MESH')
780 layout.menu("INFO_MT_curve_add", text="Add Curve",
781 icon='OUTLINER_OB_CURVE')
782 layout.menu("INFO_MT_surface_add", text="Add Surface",
783 icon='OUTLINER_OB_SURFACE')
784 layout.operator_menu_enum("object.metaball_add", "type",
785 icon='OUTLINER_OB_META')
786 layout.operator("object.text_add", text="Add Text",
787 icon='OUTLINER_OB_FONT')
788 UseSeparator(self,context)
789 layout.menu("INFO_MT_armature_add", text="Add Armature",
790 icon='OUTLINER_OB_ARMATURE')
791 layout.operator("object.add", text="Lattice",
792 icon='OUTLINER_OB_LATTICE').type = 'LATTICE'
793 layout.operator_menu_enum("object.empty_add", "type", text="Empty", icon='OUTLINER_OB_EMPTY')
794 UseSeparator(self,context)
795 layout.operator("object.speaker_add", text="Speaker", icon='OUTLINER_OB_SPEAKER')
796 UseSeparator(self,context)
797 layout.operator("object.camera_add", text="Camera",
798 icon='OUTLINER_OB_CAMERA')
799 layout.operator_menu_enum("object.lamp_add", "type",
800 icon="OUTLINER_OB_LAMP")
801 UseSeparator(self,context)
802 layout.operator_menu_enum("object.effector_add", "type",
803 text="Force Field",
804 icon='FORCE_FORCE')
805 layout.menu("VIEW3D_MT_object_quick_effects", text="Quick Effects", icon='PARTICLES')
806 UseSeparator(self,context)
807 layout.operator_menu_enum("object.group_instance_add", "group",
808 text="Group Instance",
809 icon='GROUP_VERTEX')
811 # ********** Object Manipulator **********
812 class VIEW3D_MT_ManipulatorMenu1(bpy.types.Menu):
813 bl_label = "Manipulator"
815 def draw(self, context):
816 layout = self.layout
817 layout.operator_context = 'INVOKE_REGION_WIN'
818 props = layout.operator("view3d.enable_manipulator",text ='Translate', icon='MAN_TRANS')
819 props.translate = True
820 props = layout.operator("view3d.enable_manipulator",text ='Rotate', icon='MAN_ROT')
821 props.rotate = True
822 props = layout.operator("view3d.enable_manipulator",text ='Scale', icon='MAN_SCALE')
823 props.scale = True
824 UseSeparator(self,context)
825 props = layout.operator("view3d.enable_manipulator",text ='Combo', icon='MAN_SCALE')
826 props.scale = True
827 props.rotate = True
828 props.translate = True
829 props = layout.operator("view3d.enable_manipulator",text ='Hide', icon='MAN_SCALE')
830 props.scale = False
831 props.rotate = False
832 props.translate = False
834 # ********** Object Mirror **********
835 class VIEW3D_MT_MirrorMenu(bpy.types.Menu):
836 bl_label = "Mirror"
838 def draw(self, context):
839 layout = self.layout
840 layout.operator("transform.mirror", text="Interactive Mirror")
841 UseSeparator(self,context)
842 layout.operator_context = 'INVOKE_REGION_WIN'
843 props = layout.operator("transform.mirror", text="X Global")
844 props.constraint_axis = (True, False, False)
845 props.constraint_orientation = 'GLOBAL'
846 props = layout.operator("transform.mirror", text="Y Global")
847 props.constraint_axis = (False, True, False)
848 props.constraint_orientation = 'GLOBAL'
849 props = layout.operator("transform.mirror", text="Z Global")
850 props.constraint_axis = (False, False, True)
851 props.constraint_orientation = 'GLOBAL'
853 if context.edit_object:
855 UseSeparator(self,context)
856 props = layout.operator("transform.mirror", text="X Local")
857 props.constraint_axis = (True, False, False)
858 props.constraint_orientation = 'LOCAL'
859 props = layout.operator("transform.mirror", text="Y Local")
860 props.constraint_axis = (False, True, False)
861 props.constraint_orientation = 'LOCAL'
862 props = layout.operator("transform.mirror", text="Z Local")
863 props.constraint_axis = (False, False, True)
864 props.constraint_orientation = 'LOCAL'
865 UseSeparator(self,context)
866 layout.operator("object.vertex_group_mirror")
868 # ********** Object Snap Cursor **********
869 class VIEW3D_MT_Pivot(bpy.types.Menu):
870 bl_label = "Pivot"
872 def draw(self, context):
873 layout = self.layout
874 layout.prop(context.space_data, "pivot_point", expand=True)
875 if context.active_object.mode == 'OBJECT':
876 UseSeparator(self,context)
877 layout.prop(context.space_data, "use_pivot_point_align", text="Center Points")
879 class VIEW3D_Snap_Context(bpy.types.Menu):
880 bl_label = "Snapping"
882 def draw(self, context):
883 layout = self.layout
884 toolsettings = context.tool_settings
885 layout.prop(toolsettings, "snap_element", expand=True)
886 layout.prop(toolsettings, "use_snap")
888 class VIEW3D_Snap_Origin(bpy.types.Menu):
889 bl_label = "Snap "
891 def draw(self, context):
892 layout = self.layout
893 layout.operator_context = 'EXEC_AREA'
894 layout.operator("object.origin_set",
895 text="Geometry to Origin").type = 'GEOMETRY_ORIGIN'
896 UseSeparator(self,context)
897 layout.operator("object.origin_set",
898 text="Origin to Geometry").type = 'ORIGIN_GEOMETRY'
899 layout.operator("object.origin_set",
900 text="Origin to 3D Cursor").type = 'ORIGIN_CURSOR'
901 layout.operator("object.origin_set",
902 text="Origin to Center of Mass").type = 'ORIGIN_CENTER_OF_MASS'
904 class VIEW3D_MT_CursorMenu(bpy.types.Menu):
905 bl_label = "Snap Cursor"
907 def draw(self, context):
908 layout = self.layout
909 layout.operator_context = 'INVOKE_REGION_WIN'
910 layout.menu("VIEW3D_Snap_Origin")
911 layout.menu("VIEW3D_Snap_Context")
912 UseSeparator(self,context)
913 layout.operator("view3d.snap_cursor_to_selected",
914 text="Cursor to Selected")
915 layout.operator("view3d.snap_cursor_to_center",
916 text="Cursor to Center")
917 layout.operator("view3d.snap_cursor_to_grid",
918 text="Cursor to Grid")
919 layout.operator("view3d.snap_cursor_to_active",
920 text="Cursor to Active")
921 UseSeparator(self,context)
922 layout.operator("view3d.snap_selected_to_cursor", text="Selection to Cursor").use_offset = False
923 layout.operator("view3d.snap_selected_to_cursor", text="Selection to Cursor (Offset)").use_offset = True
924 layout.operator("view3d.snap_selected_to_grid",
925 text="Selection to Grid")
926 layout.operator("view3d.snap_cursor_selected_to_center",
927 text="Selection and Cursor to Center")
928 UseSeparator(self,context)
929 layout.menu("VIEW3D_MT_Pivot")
930 layout.operator("view3d.pivot_cursor",
931 text="Set Cursor as Pivot Point")
932 layout.operator("view3d.revert_pivot",
933 text="Revert Pivot Point")
935 class VIEW3D_MT_CursorMenuLite(bpy.types.Menu):
936 bl_label = "Snap Cursor"
938 def draw(self, context):
939 layout = self.layout
940 layout.operator_context = 'INVOKE_REGION_WIN'
941 layout.menu("VIEW3D_Snap_Origin")
942 UseSeparator(self,context)
943 layout.operator("view3d.snap_cursor_to_selected",
944 text="Cursor to Selected")
945 layout.operator("view3d.snap_cursor_to_center",
946 text="Cursor to Center")
947 layout.operator("view3d.snap_cursor_to_grid",
948 text="Cursor to Grid")
949 layout.operator("view3d.snap_cursor_to_active",
950 text="Cursor to Active")
951 UseSeparator(self,context)
952 layout.operator("view3d.snap_selected_to_cursor", text="Selection to Cursor").use_offset = False
953 layout.operator("view3d.snap_selected_to_cursor", text="Selection to Cursor (Offset)").use_offset = True
954 layout.operator("view3d.snap_selected_to_grid",
955 text="Selection to Grid")
956 layout.operator("view3d.snap_cursor_selected_to_center",
957 text="Selection and Cursor to Center")
958 UseSeparator(self,context)
959 layout.menu("VIEW3D_MT_Pivot")
960 layout.operator("view3d.pivot_cursor",
961 text="Set Cursor as Pivot Point")
962 layout.operator("view3d.revert_pivot",
963 text="Revert Pivot Point")
965 # ********** Object Interactive Mode **********
966 class InteractiveMode(bpy.types.Menu):
967 bl_idname = "VIEW3D_MT_Object_Interactive_Mode"
968 bl_label = "Interactive Mode"
969 bl_description = "Menu of objects interactive modes (Window Types)"
971 def draw(self, context):
972 self.layout.operator(SetObjectMode.bl_idname, text="Object", icon="OBJECT_DATAMODE").mode = "OBJECT"
973 self.layout.operator(SetObjectMode.bl_idname, text="Edit", icon="EDITMODE_HLT").mode = "EDIT"
974 self.layout.operator(SetObjectMode.bl_idname, text="Sculpt", icon="SCULPTMODE_HLT").mode = "SCULPT"
975 self.layout.operator(SetObjectMode.bl_idname, text="Vertex Paint", icon="VPAINT_HLT").mode = "VERTEX_PAINT"
976 self.layout.operator(SetObjectMode.bl_idname, text="Weight Paint", icon="WPAINT_HLT").mode = "WEIGHT_PAINT"
977 self.layout.operator(SetObjectMode.bl_idname, text="Texture Paint", icon="TPAINT_HLT").mode = "TEXTURE_PAINT"
978 self.layout.operator(SetObjectMode.bl_idname, text="Particle Edit", icon="PARTICLEMODE").mode = "PARTICLE_EDIT"
980 # ********** Object Armature Interactive Mode **********
981 class InteractiveModeArmature(bpy.types.Menu):
982 bl_idname = "VIEW3D_MT_Object_Interactive_Armature"
983 bl_label = "Interactive Mode"
984 bl_description = "Menu of objects interactive mode"
986 def draw(self, context):
987 self.layout.operator(SetObjectMode.bl_idname, text="Object", icon="OBJECT_DATAMODE").mode = "OBJECT"
988 self.layout.operator(SetObjectMode.bl_idname, text="Edit", icon="EDITMODE_HLT").mode = "EDIT"
989 self.layout.operator(SetObjectMode.bl_idname, text="Pose", icon="POSE_HLT").mode = "POSE"
991 # ********** Text Interactive Mode **********
992 class VIEW3D_OT_Interactive_Mode_Text(bpy.types.Operator):
993 """Toggle object's editmode"""
994 bl_idname = "view3d.interactive_mode_text"
995 bl_label = "Enter Edit Mode"
997 @classmethod
998 def poll(cls, context):
999 return (context.active_object is not None)
1001 def execute(self, context):
1002 bpy.ops.object.editmode_toggle()
1003 self.report({'INFO'}, "Spacebar shortcut won't work in the Text Edit mode")
1004 return {'FINISHED'}
1007 # ********** Object Parent **********
1008 class VIEW3D_MT_ParentMenu(bpy.types.Menu):
1009 bl_label = "Parent"
1011 def draw(self, context):
1012 layout = self.layout
1014 layout.operator("object.parent_set", text="Set")
1015 layout.operator("object.parent_clear", text="Clear")
1017 # ********** Object Group **********
1018 class VIEW3D_MT_GroupMenu(bpy.types.Menu):
1019 bl_label = "Group"
1021 def draw(self, context):
1022 layout = self.layout
1023 layout.operator("group.create")
1024 layout.operator("group.objects_add_active")
1025 UseSeparator(self,context)
1026 layout.operator("group.objects_remove")
1027 layout.operator("group.objects_remove_all")
1028 layout.operator("group.objects_remove_active")
1030 # ********** Object Camera Options **********
1031 class VIEW3D_MT_Camera_Options(bpy.types.Menu):
1032 bl_label = "Camera"
1034 def draw(self, context):
1035 layout = self.layout
1036 layout.operator_context = 'EXEC_REGION_WIN'
1037 layout.operator("object.camera_add", text="Add Camera", icon='OUTLINER_OB_CAMERA')
1038 self.layout.operator("view3d.object_as_camera", text="Object As Camera", icon='OUTLINER_OB_CAMERA')
1039 self.layout.operator("view3d.viewnumpad", text="View Active Camera" , icon='OUTLINER_OB_CAMERA').type = 'CAMERA'
1042 class VIEW3D_MT_Object_Data_Link(Menu):
1043 bl_label = "Object Data"
1045 def draw(self, context):
1046 layout = self.layout
1048 layout.operator_menu_enum("object.make_local", "type", text="Make Local...")
1049 layout.menu("VIEW3D_MT_make_single_user")
1050 layout.operator("object.proxy_make", text="Make Proxy...")
1051 layout.operator("object.make_dupli_face")
1052 UseSeparator(self,context)
1053 layout.operator("object.data_transfer")
1054 layout.operator("object.datalayout_transfer")
1056 class VIEW3D_MT_Duplicate(Menu):
1057 bl_label = "Duplicate"
1059 def draw(self, context):
1060 layout = self.layout
1062 layout.operator("object.duplicate_move")
1063 layout.operator("object.duplicate_move_linked")
1065 class VIEW3D_MT_KeyframeMenu(bpy.types.Menu):
1066 bl_label = "Keyframe"
1068 def draw(self, context):
1069 layout = self.layout
1070 layout.operator("anim.keyframe_insert_menu",
1071 text="Insert Keyframe...")
1072 layout.operator("anim.keyframe_delete_v3d",
1073 text="Delete Keyframe...")
1074 layout.operator("anim.keying_set_active_set",
1075 text="Change Keying Set...")
1077 class VIEW3D_MT_UndoS(bpy.types.Menu):
1078 bl_label = "Undo/Redo"
1080 def draw(self, context):
1081 layout = self.layout
1083 layout.operator("ed.undo")
1084 layout.operator("ed.redo")
1085 UseSeparator(self,context)
1086 layout.operator("ed.undo_history")
1088 # ********** Normals / Auto Smooth Menu **********
1089 # Thanks to marvin.k.breuer for the Autosmooth part of the menu
1090 class VIEW3D_MT_AutoSmooth(bpy.types.Menu):
1091 bl_label = "Normals / Auto Smooth"
1093 def draw(self, context):
1094 layout = self.layout
1095 obj = context.object
1096 obj_data = context.active_object.data
1098 # moved the VIEW3D_MT_edit_mesh_normals contents here under an Edit mode check
1099 if obj and obj.type == 'MESH' and obj.mode in {'EDIT'}:
1100 layout.operator("mesh.normals_make_consistent",
1101 text="Recalculate Outside").inside = False
1102 layout.operator("mesh.normals_make_consistent",
1103 text="Recalculate Inside").inside = True
1104 layout.operator("mesh.flip_normals")
1105 UseSeparator(self,context)
1107 layout.prop(obj_data, "show_double_sided", text = "Normals: Double Sided")
1108 UseSeparator(self,context)
1109 layout.prop(obj_data, "use_auto_smooth", text = "Normals: Auto Smooth")
1111 # Auto Smooth Angle has two tab spaces to align it with the rest of the menu
1112 layout.prop(obj_data, "auto_smooth_angle",
1113 text=" Auto Smooth Angle")
1116 ############ Edit Mode Menu's #########
1118 # ********** Edit Mesh **********
1119 class VIEW3D_MT_Edit_Mesh(Menu):
1120 bl_label = "Mesh"
1122 def draw(self, context):
1123 layout = self.layout
1124 toolsettings = context.tool_settings
1125 view = context.space_data
1127 layout.menu("VIEW3D_MT_edit_mesh_vertices", icon='VERTEXSEL')
1128 layout.menu("VIEW3D_MT_edit_mesh_edges", icon='EDGESEL')
1129 layout.menu("VIEW3D_MT_edit_mesh_faces", icon='FACESEL')
1130 UseSeparator(self,context)
1131 layout.operator("mesh.duplicate_move")
1132 UseSeparator(self,context)
1133 layout.menu("VIEW3D_MT_edit_mesh_clean", icon='AUTO')
1134 layout.prop(view, "use_occlude_geometry")
1135 UseSeparator(self,context)
1136 layout.menu("VIEW3D_MT_AutoSmooth", icon='META_DATA')
1137 layout.operator("mesh.loopcut_slide",
1138 text="Loopcut", icon='EDIT_VEC')
1139 UseSeparator(self,context)
1140 layout.operator("mesh.symmetrize")
1141 layout.operator("mesh.symmetry_snap")
1142 UseSeparator(self,context)
1143 layout.operator("mesh.bisect")
1144 layout.operator_menu_enum("mesh.sort_elements", "type", text="Sort Elements...")
1145 UseSeparator(self,context)
1146 layout.prop_menu_enum(toolsettings, "proportional_edit")
1147 layout.prop_menu_enum(toolsettings, "proportional_edit_falloff")
1148 UseSeparator(self,context)
1150 layout.prop(toolsettings, "use_mesh_automerge")
1151 #text = Double Threshold has two tab spaces to align it with the rest of the menu
1152 layout.prop(toolsettings, "double_threshold", text=" Double Threshold")
1154 UseSeparator(self,context)
1155 layout.menu("VIEW3D_MT_edit_mesh_showhide")
1157 # ********** Edit Multiselect **********
1158 class VIEW3D_MT_Edit_Multi(bpy.types.Menu):
1159 bl_label = "Multi Select"
1161 def draw(self, context):
1162 layout = self.layout
1163 layout.operator_context = 'INVOKE_REGION_WIN'
1165 prop = layout.operator("wm.context_set_value", text="Vertex Select",
1166 icon='VERTEXSEL')
1167 prop.value = "(True, False, False)"
1168 prop.data_path = "tool_settings.mesh_select_mode"
1170 prop = layout.operator("wm.context_set_value", text="Edge Select",
1171 icon='EDGESEL')
1172 prop.value = "(False, True, False)"
1173 prop.data_path = "tool_settings.mesh_select_mode"
1175 prop = layout.operator("wm.context_set_value", text="Face Select",
1176 icon='FACESEL')
1177 prop.value = "(False, False, True)"
1178 prop.data_path = "tool_settings.mesh_select_mode"
1179 UseSeparator(self,context)
1181 prop = layout.operator("wm.context_set_value",
1182 text="Vertex & Edge Select",
1183 icon='EDITMODE_HLT')
1184 prop.value = "(True, True, False)"
1185 prop.data_path = "tool_settings.mesh_select_mode"
1187 prop = layout.operator("wm.context_set_value",
1188 text="Vertex & Face Select",
1189 icon='ORTHO')
1190 prop.value = "(True, False, True)"
1191 prop.data_path = "tool_settings.mesh_select_mode"
1193 prop = layout.operator("wm.context_set_value",
1194 text="Edge & Face Select",
1195 icon='SNAP_FACE')
1196 prop.value = "(False, True, True)"
1197 prop.data_path = "tool_settings.mesh_select_mode"
1198 UseSeparator(self,context)
1200 prop = layout.operator("wm.context_set_value",
1201 text="Vertex & Edge & Face Select",
1202 icon='SNAP_VOLUME')
1203 prop.value = "(True, True, True)"
1204 prop.data_path = "tool_settings.mesh_select_mode"
1206 # ********** Edit Mesh Edge **********
1207 class VIEW3D_MT_EditM_Edge(bpy.types.Menu):
1208 bl_label = "Edges"
1210 def draw(self, context):
1211 layout = self.layout
1212 layout.operator_context = 'INVOKE_REGION_WIN'
1214 layout.operator("mesh.mark_seam")
1215 layout.operator("mesh.mark_seam", text="Clear Seam").clear = True
1216 UseSeparator(self,context)
1218 layout.operator("mesh.mark_sharp")
1219 layout.operator("mesh.mark_sharp", text="Clear Sharp").clear = True
1220 layout.operator("mesh.extrude_move_along_normals", text="Extrude")
1221 UseSeparator(self,context)
1223 layout.operator("mesh.edge_rotate",
1224 text="Rotate Edge CW").direction = 'CW'
1225 layout.operator("mesh.edge_rotate",
1226 text="Rotate Edge CCW").direction = 'CCW'
1227 UseSeparator(self,context)
1229 layout.operator("TFM_OT_edge_slide", text="Edge Slide")
1230 layout.operator("mesh.loop_multi_select", text="Edge Loop")
1231 layout.operator("mesh.loop_multi_select", text="Edge Ring").ring = True
1232 layout.operator("mesh.loop_to_region")
1233 layout.operator("mesh.region_to_loop")
1236 # ********** Edit Mesh Cursor **********
1237 class VIEW3D_MT_EditCursorMenu(bpy.types.Menu):
1238 bl_label = "Snap Cursor"
1240 def draw(self, context):
1241 layout = self.layout
1242 layout.operator_context = 'INVOKE_REGION_WIN'
1243 layout.operator("object.setorigintoselected",
1244 text="Origin to Selected V/F/E")
1245 UseSeparator(self,context)
1246 layout.menu("VIEW3D_Snap_Origin")
1247 layout.menu("VIEW3D_Snap_Context")
1248 UseSeparator(self,context)
1249 layout.operator("view3d.snap_cursor_to_selected",
1250 text="Cursor to Selected")
1251 layout.operator("view3d.snap_cursor_to_center",
1252 text="Cursor to Center")
1253 layout.operator("view3d.snap_cursor_to_grid",
1254 text="Cursor to Grid")
1255 layout.operator("view3d.snap_cursor_to_active",
1256 text="Cursor to Active")
1257 layout.operator("view3d.snap_cursor_to_edge_intersection",
1258 text="Cursor to Edge Intersection")
1259 UseSeparator(self,context)
1260 layout.operator("view3d.snap_selected_to_cursor", text="Selection to Cursor").use_offset = False
1261 layout.operator("view3d.snap_selected_to_cursor", text="Selection to Cursor (Offset)").use_offset = True
1262 layout.operator("view3d.snap_selected_to_grid",
1263 text="Selection to Grid")
1264 UseSeparator(self,context)
1265 layout.menu("VIEW3D_MT_Pivot")
1266 layout.operator("view3d.pivot_cursor",
1267 text="Set Cursor as Pivot Point")
1268 layout.operator("view3d.revert_pivot",
1269 text="Revert Pivot Point")
1271 # ********** Edit Mesh UV **********
1272 class VIEW3D_MT_UV_Map(bpy.types.Menu):
1273 bl_label = "UV Mapping"
1275 def draw(self, context):
1276 layout = self.layout
1277 layout.operator("uv.unwrap")
1278 UseSeparator(self,context)
1279 layout.operator_context = 'INVOKE_DEFAULT'
1280 layout.operator("uv.smart_project")
1281 layout.operator("uv.lightmap_pack")
1282 layout.operator("uv.follow_active_quads")
1283 layout.operator_context = 'EXEC_REGION_WIN'
1284 layout.operator("uv.cube_project")
1285 layout.operator("uv.cylinder_project")
1286 layout.operator("uv.sphere_project")
1287 layout.operator_context = 'INVOKE_REGION_WIN'
1288 UseSeparator(self,context)
1289 layout.operator("uv.project_from_view").scale_to_bounds = False
1290 layout.operator("uv.project_from_view", text="Project from View (Bounds)").scale_to_bounds = True
1291 UseSeparator(self,context)
1292 layout.operator("uv.reset")
1295 # ********** Edit Curve **********
1296 class VIEW3D_MT_Edit_Curve(bpy.types.Menu):
1297 bl_label = "Curve"
1299 def draw(self, context):
1300 layout = self.layout
1302 toolsettings = context.tool_settings
1304 layout.operator("curve.extrude_move")
1305 layout.operator("curve.spin")
1306 layout.operator("curve.duplicate_move")
1307 layout.operator("curve.split")
1308 layout.operator("curve.separate")
1309 layout.operator("curve.make_segment")
1310 layout.operator("curve.cyclic_toggle")
1311 UseSeparator(self,context)
1312 layout.operator("curve.delete", text="Delete...")
1313 UseSeparator(self,context)
1314 layout.menu("VIEW3D_MT_edit_curve_segments")
1315 layout.prop_menu_enum(settings, "proportional_edit",
1316 icon="PROP_CON")
1317 layout.prop_menu_enum(settings, "proportional_edit_falloff",
1318 icon="SMOOTHCURVE")
1319 layout.menu("VIEW3D_MT_edit_curve_showhide")
1321 class VIEW3D_MT_EditCurveCtrlpoints(bpy.types.Menu):
1322 bl_label = "Control Points"
1324 def draw(self, context):
1325 layout = self.layout
1327 edit_object = context.edit_object
1329 if edit_object.type == 'CURVE':
1330 layout.operator("transform.transform").mode = 'TILT'
1331 layout.operator("curve.tilt_clear")
1332 layout.operator("curve.separate")
1333 layout.operator_menu_enum("curve.handle_type_set", "type")
1334 layout.menu("VIEW3D_MT_hook")
1336 class VIEW3D_MT_EditCurveSegments(bpy.types.Menu):
1337 bl_label = "Curve Segments"
1339 def draw(self, context):
1340 layout = self.layout
1341 layout.operator("curve.subdivide")
1342 layout.operator("curve.switch_direction")
1344 class VIEW3D_MT_EditCurveSpecials(bpy.types.Menu):
1345 bl_label = "Specials"
1347 def draw(self, context):
1348 layout = self.layout
1349 layout.operator("curve.subdivide")
1350 UseSeparator(self,context)
1351 layout.operator("curve.switch_direction")
1352 layout.operator("curve.spline_weight_set")
1353 layout.operator("curve.radius_set")
1354 UseSeparator(self,context)
1355 layout.operator("curve.smooth")
1356 layout.operator("curve.smooth_weight")
1357 layout.operator("curve.smooth_radius")
1358 layout.operator("curve.smooth_tilt")
1360 ############ Brushes Menu's ########
1361 # Thanks to CoDEmanX for the code
1362 class VIEW3D_MT_Brush_Selection(bpy.types.Menu):
1363 bl_label = "Brush Tool"
1365 def draw(self, context):
1366 layout = self.layout
1367 settings = UnifiedPaintPanel.paint_settings(context)
1369 #check if brush exists (for instance, in paint mode before adding a slot)
1370 if hasattr(settings, 'brush'):
1371 brush = settings.brush
1372 else:
1373 brush = None
1375 if not brush: return
1377 if not context.particle_edit_object:
1378 if UseBrushesLists():
1379 col = layout.row()
1380 flow = layout.column_flow(columns=3)
1382 for brsh in bpy.data.brushes:
1383 if (context.sculpt_object and brsh.use_paint_sculpt):
1384 props = flow.operator("wm.context_set_id", text=brsh.name,
1385 icon_value=layout.icon(brsh))
1386 props.data_path = "tool_settings.sculpt.brush"
1387 props.value = brsh.name
1388 elif (context.image_paint_object and brsh.use_paint_image):
1389 props = flow.operator("wm.context_set_id", text=brsh.name,
1390 icon_value=layout.icon(brsh))
1391 props.data_path = "tool_settings.image_paint.brush"
1392 props.value = brsh.name
1393 elif (context.vertex_paint_object and brsh.use_paint_vertex):
1394 props = flow.operator("wm.context_set_id", text=brsh.name,
1395 icon_value=layout.icon(brsh))
1396 props.data_path = "tool_settings.vertex_paint.brush"
1397 props.value = brsh.name
1398 elif (context.weight_paint_object and brsh.use_paint_weight):
1399 props = flow.operator("wm.context_set_id", text=brsh.name,
1400 icon_value=layout.icon(brsh))
1401 props.data_path = "tool_settings.weight_paint.brush"
1402 props.value = brsh.name
1403 else:
1404 layout.template_ID_preview(settings, "brush", new="brush.add", rows=3, cols=8)
1406 class VIEW3D_MT_Brush_Settings(bpy.types.Menu):
1407 bl_label = "Brush Settings"
1409 def draw(self, context):
1410 layout = self.layout
1411 settings = UnifiedPaintPanel.paint_settings(context)
1412 brush = settings.brush
1414 ups = context.tool_settings.unified_paint_settings
1415 layout.prop(ups, "use_unified_size", text="Unified Size")
1416 layout.prop(ups, "use_unified_strength", text="Unified Strength")
1417 if context.image_paint_object or context.vertex_paint_object:
1418 layout.prop(ups, "use_unified_color", text="Unified Color")
1419 UseSeparator(self,context)
1421 layout.menu("VIEW3D_MT_brush_paint_modes")
1423 if not brush:
1424 return
1426 if context.sculpt_object:
1427 sculpt_tool = brush.sculpt_tool
1429 UseSeparator(self,context)
1430 layout.operator_menu_enum("brush.curve_preset", "shape", text="Curve Preset")
1431 UseSeparator(self,context)
1433 if sculpt_tool != 'GRAB':
1434 layout.prop_menu_enum(brush, "stroke_method")
1436 if sculpt_tool in {'DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'}:
1437 layout.prop_menu_enum(brush, "direction")
1439 if sculpt_tool == 'LAYER':
1440 layout.prop(brush, "use_persistent")
1441 layout.operator("sculpt.set_persistent_base")
1444 ############ Sculpt Menu's #########
1445 class VIEW3D_MT_Sculpts(Menu):
1446 bl_label = "Sculpt"
1448 def draw(self, context):
1449 layout = self.layout
1450 toolsettings = context.tool_settings
1451 sculpt = toolsettings.sculpt
1453 layout.prop(sculpt, "use_symmetry_x")
1454 layout.prop(sculpt, "use_symmetry_y")
1455 layout.prop(sculpt, "use_symmetry_z")
1457 UseSeparator(self,context)
1458 layout.prop(sculpt, "lock_x")
1459 layout.prop(sculpt, "lock_y")
1460 layout.prop(sculpt, "lock_z")
1462 UseSeparator(self,context)
1463 layout.prop(sculpt, "use_threaded", text="Threaded Sculpt")
1464 layout.prop(sculpt, "show_low_resolution")
1465 layout.prop(sculpt, "use_deform_only")
1467 UseSeparator(self,context)
1468 layout.prop(sculpt, "show_brush")
1469 layout.prop(sculpt, "show_diffuse_color")
1471 class VIEW3D_MT_Hide_Masks(Menu):
1472 bl_label = "Hide/Mask"
1474 def draw(self, context):
1475 layout = self.layout
1477 props = layout.operator("paint.mask_lasso_gesture", text="Lasso Mask")
1478 UseSeparator(self,context)
1479 props = layout.operator("view3d.select_border", text="Box Mask", icon="BORDER_RECT")
1480 props = layout.operator("paint.hide_show", text="Box Hide")
1481 props.action = 'HIDE'
1482 props.area = 'INSIDE'
1484 props = layout.operator("paint.hide_show", text="Box Show")
1485 props.action = 'SHOW'
1486 props.area = 'INSIDE'
1487 UseSeparator(self,context)
1489 props = layout.operator("paint.mask_flood_fill", text="Fill Mask", icon="BORDER_RECT")
1490 props.mode = 'VALUE'
1491 props.value = 1
1493 props = layout.operator("paint.mask_flood_fill", text="Clear Mask")
1494 props.mode = 'VALUE'
1495 props.value = 0
1497 layout.operator("paint.mask_flood_fill", text="Invert Mask").mode = 'INVERT'
1498 UseSeparator(self,context)
1500 props = layout.operator("paint.hide_show", text="Show All", icon="RESTRICT_VIEW_OFF")
1501 props.action = 'SHOW'
1502 props.area = 'ALL'
1504 props = layout.operator("paint.hide_show", text="Hide Masked", icon="RESTRICT_VIEW_ON")
1505 props.area = 'MASKED'
1506 props.action = 'HIDE'
1508 ## Dyntopo Menu (Thanks to marvin.k.breuer) ##
1509 class VIEW3D_MT_Sculpt_Dyntopo(bpy.types.Menu):
1510 bl_label = "Dyntopo Set"
1511 bl_idname = "view3d.set_brush_dyntopo"
1513 def draw(self, context):
1514 layout = self.layout
1515 settings = context.tool_settings
1517 layout.prop(settings.sculpt, "detail_refine_method", text="")
1518 layout.prop(settings.sculpt, "detail_type_method", text="")
1519 UseSeparator(self,context)
1520 layout.prop(settings.sculpt, "use_smooth_shading", "Smooth")
1522 ## Sculpt Specials Menu (Thanks to marvin.k.breuer) ##
1523 class VIEW3D_MT_Sculpt_Specials(bpy.types.Menu):
1524 bl_label = "Sculpt Specials"
1526 def draw(self, context):
1527 layout = self.layout
1528 settings = context.tool_settings
1530 if context.sculpt_object.use_dynamic_topology_sculpting:
1531 layout.operator("sculpt.dynamic_topology_toggle", icon='X', text="Disable Dyntopo")
1532 UseSeparator(self,context)
1533 if (settings.sculpt.detail_type_method == 'CONSTANT'):
1534 layout.prop(settings.sculpt, "constant_detail", text="Const.")
1535 layout.operator("sculpt.sample_detail_size", text="", icon='EYEDROPPER')
1536 else:
1537 layout.prop(settings.sculpt, "detail_size", text="Detail")
1539 UseSeparator(self,context)
1540 layout.operator("sculpt.symmetrize", icon='ARROW_LEFTRIGHT')
1541 layout.prop(settings.sculpt, "symmetrize_direction", "")
1542 UseSeparator(self,context)
1543 layout.operator("sculpt.optimize")
1544 if (settings.sculpt.detail_type_method == 'CONSTANT'):
1545 layout.operator("sculpt.detail_flood_fill")
1547 layout.menu("view3d.set_brush_dyntopo")
1549 else:
1550 layout.operator("sculpt.dynamic_topology_toggle", icon='SCULPT_DYNTOPO', text="Enable Dyntopo")
1552 ## Display Wire (Thanks to marvin.k.breuer) ##
1553 class VIEW3D_OT_Display_Wire_All(bpy.types.Operator):
1554 """Display Wire on All Objects"""
1555 bl_label = "Wire on All Objects"
1556 bl_idname = "view3d.display_wire_all"
1558 @classmethod
1559 def poll(cls, context):
1560 return context.active_object is not None
1562 def execute(self, context):
1564 for obj in bpy.data.objects:
1565 if obj.show_wire:
1566 obj.show_all_edges = False
1567 obj.show_wire = False
1568 else:
1569 obj.show_all_edges = True
1570 obj.show_wire = True
1572 return {'FINISHED'}
1574 ## Vertex Color Menu ##
1575 class VIEW3D_MT_Vertex_Colors(Menu):
1576 bl_label = "Vertex Colors"
1578 def draw(self, context):
1579 layout = self.layout
1580 layout.operator("paint.vertex_color_set")
1581 UseSeparator(self,context)
1582 layout.operator("paint.vertex_color_smooth")
1583 layout.operator("paint.vertex_color_dirt")
1585 ## Weight Paint Menu ##
1586 class VIEW3D_MT_Paint_Weights(Menu):
1587 bl_label = "Weights"
1589 def draw(self, context):
1590 layout = self.layout
1592 layout.operator("paint.weight_from_bones", text="Assign Automatic From Bones").type = 'AUTOMATIC'
1593 layout.operator("paint.weight_from_bones", text="Assign From Bone Envelopes").type = 'ENVELOPES'
1594 UseSeparator(self,context)
1596 layout.operator("object.vertex_group_normalize_all", text="Normalize All")
1597 layout.operator("object.vertex_group_normalize", text="Normalize")
1598 UseSeparator(self,context)
1600 layout.operator("object.vertex_group_mirror", text="Mirror")
1601 layout.operator("object.vertex_group_invert", text="Invert")
1602 UseSeparator(self,context)
1603 layout.operator("object.vertex_group_clean", text="Clean")
1604 layout.operator("object.vertex_group_quantize", text="Quantize")
1605 UseSeparator(self,context)
1606 layout.operator("object.vertex_group_levels", text="Levels")
1607 layout.operator("object.vertex_group_smooth", text="Smooth")
1608 UseSeparator(self,context)
1609 props = layout.operator("object.data_transfer", text="Transfer Weights")
1610 props.use_reverse_transfer = True
1611 props.data_type = 'VGROUP_WEIGHTS'
1612 UseSeparator(self,context)
1613 layout.operator("object.vertex_group_limit_total", text="Limit Total")
1614 layout.operator("object.vertex_group_fix", text="Fix Deforms")
1616 UseSeparator(self,context)
1618 layout.operator("paint.weight_set")
1619 ############ Armature Menu's #########
1621 class VIEW3D_MT_Edit_Armature(bpy.types.Menu):
1622 bl_label = "Armature"
1624 def draw(self, context):
1625 layout = self.layout
1627 edit_object = context.edit_object
1628 arm = edit_object.data
1629 toolsettings = context.tool_settings
1631 layout.prop_menu_enum(toolsettings, "proportional_edit", icon="PROP_CON")
1632 layout.prop_menu_enum(toolsettings, "proportional_edit_falloff", icon="SMOOTHCURVE")
1633 UseSeparator(self,context)
1634 layout.menu("VIEW3D_MT_bone_options_toggle", text="Bone Settings")
1635 layout.operator("armature.merge")
1636 layout.operator("armature.fill")
1637 layout.operator("armature.split")
1638 layout.operator("armature.separate")
1639 layout.operator("armature.switch_direction", text="Switch Direction")
1640 layout.operator_context = 'EXEC_AREA'
1641 layout.operator("armature.symmetrize")
1642 UseSeparator(self,context)
1643 layout.operator("armature.delete")
1644 UseSeparator(self,context)
1645 layout.operator_context = 'INVOKE_DEFAULT'
1646 layout.operator("armature.armature_layers")
1647 layout.operator("armature.bone_layers")
1649 class VIEW3D_MT_EditArmatureTK(bpy.types.Menu):
1650 bl_label = "Armature Tools"
1652 def draw(self, context):
1653 layout = self.layout
1654 layout.operator("armature.subdivide", text="Subdivide")
1655 layout.operator("armature.extrude_move")
1656 layout.operator("armature.extrude_forked")
1657 layout.operator("armature.duplicate_move")
1658 UseSeparator(self,context)
1659 layout.menu("VIEW3D_MT_edit_armature_delete")
1660 UseSeparator(self,context)
1661 layout.operator("transform.transform",
1662 text="Scale Envelope Distance").mode = 'BONE_SIZE'
1663 layout.operator("transform.transform",
1664 text="Scale B-Bone Width").mode = 'BONE_SIZE'
1666 ############ Armature Pose Menu's #########
1668 class VIEW3D_MT_Pose(bpy.types.Menu):
1669 bl_label = "Pose"
1671 def draw(self, context):
1672 layout = self.layout
1674 layout.menu("VIEW3D_MT_object_animation")
1675 layout.menu("VIEW3D_MT_pose_slide")
1676 layout.menu("VIEW3D_MT_pose_propagate")
1677 layout.menu("VIEW3D_MT_pose_library")
1678 layout.menu("VIEW3D_MT_pose_motion")
1679 UseSeparator(self,context)
1680 layout.menu("VIEW3D_MT_pose_group")
1681 layout.menu("VIEW3D_MT_object_parent")
1682 UseSeparator(self,context)
1683 layout.menu("VIEW3D_MT_pose_ik")
1684 layout.menu("VIEW3D_MT_pose_constraints")
1685 layout.menu("VIEW3D_MT_PoseNames")
1686 layout.operator("pose.quaternions_flip")
1687 layout.operator_context = 'INVOKE_AREA'
1688 UseSeparator(self,context)
1689 layout.operator("armature.armature_layers", text="Change Armature Layers...")
1690 layout.operator("pose.bone_layers", text="Change Bone Layers...")
1691 UseSeparator(self,context)
1692 layout.menu("VIEW3D_MT_pose_showhide")
1693 layout.menu("VIEW3D_MT_bone_options_toggle", text="Bone Settings")
1695 ############ Transform Menu's #########
1697 class VIEW3D_MT_TransformMenu(bpy.types.Menu):
1698 bl_label = "Transform"
1700 def draw(self, context):
1701 layout = self.layout
1702 layout.menu("VIEW3D_MT_ManipulatorMenu1")
1703 UseSeparator(self,context)
1704 layout.operator("transform.translate", text="Grab/Move")
1705 layout.operator("transform.rotate", text="Rotate")
1706 layout.operator("transform.resize", text="Scale")
1707 UseSeparator(self,context)
1708 layout.menu("VIEW3D_MT_object_clear")
1709 layout.menu("VIEW3D_MT_object_apply")
1710 UseSeparator(self,context)
1711 layout.operator("transform.translate", text="Move Texture Space").texture_space = True
1712 layout.operator("transform.resize", text="Scale Texture Space").texture_space = True
1713 UseSeparator(self,context)
1714 layout.operator("object.randomize_transform")
1715 layout.operator("transform.tosphere", text="To Sphere")
1716 layout.operator("transform.shear", text="Shear")
1717 layout.operator("transform.bend", text="Bend")
1718 layout.operator("transform.push_pull", text="Push/Pull")
1719 UseSeparator(self,context)
1720 layout.operator("object.align")
1721 layout.operator_context = 'EXEC_REGION_WIN'
1722 layout.operator("transform.transform",
1723 text="Align to Transform Orientation").mode = 'ALIGN'
1725 # ********** Edit Mesh Transform **********
1726 class VIEW3D_MT_TransformMenuEdit(bpy.types.Menu):
1727 bl_label = "Transform"
1729 def draw(self, context):
1730 layout = self.layout
1731 layout.menu("VIEW3D_MT_ManipulatorMenu1")
1732 UseSeparator(self,context)
1733 layout.operator("transform.translate", text="Grab/Move")
1734 layout.operator("transform.rotate", text="Rotate")
1735 layout.operator("transform.resize", text="Scale")
1736 UseSeparator(self,context)
1737 layout.operator("transform.tosphere", text="To Sphere")
1738 layout.operator("transform.shear", text="Shear")
1739 layout.operator("transform.bend", text="Bend")
1740 layout.operator("transform.push_pull", text="Push/Pull")
1741 layout.operator("transform.vertex_warp", text="Warp")
1742 layout.operator("transform.vertex_random", text="Randomize")
1743 UseSeparator(self,context)
1744 layout.operator("transform.translate", text="Move Texture Space").texture_space = True
1745 layout.operator("transform.resize", text="Scale Texture Space").texture_space = True
1746 UseSeparator(self,context)
1747 layout.operator_context = 'EXEC_REGION_WIN'
1748 layout.operator("transform.transform",
1749 text="Align to Transform Orientation").mode = 'ALIGN'
1750 layout.operator_context = 'EXEC_AREA'
1751 layout.operator("object.origin_set",
1752 text="Geometry to Origin").type = 'GEOMETRY_ORIGIN'
1754 # ********** Transform Lite/Short **********
1755 class VIEW3D_MT_TransformMenuLite(bpy.types.Menu):
1756 bl_label = "Transform"
1758 def draw(self, context):
1759 layout = self.layout
1760 layout.menu("VIEW3D_MT_ManipulatorMenu1")
1761 UseSeparator(self,context)
1762 layout.operator("transform.translate", text="Grab/Move")
1763 layout.operator("transform.rotate", text="Rotate")
1764 layout.operator("transform.resize", text="Scale")
1765 UseSeparator(self,context)
1766 layout.menu("VIEW3D_MT_object_clear")
1767 layout.menu("VIEW3D_MT_object_apply")
1768 UseSeparator(self,context)
1769 layout.operator("transform.transform",
1770 text="Align to Transform Orientation").mode = 'ALIGN'
1772 # ********** Transform Camera **********
1773 class VIEW3D_MT_TransformMenuCamera(bpy.types.Menu):
1774 bl_label = "Transform"
1776 def draw(self, context):
1777 layout.menu("VIEW3D_MT_ManipulatorMenu1")
1778 layout.menu("VIEW3D_MT_object_clear")
1779 layout.menu("VIEW3D_MT_object_apply")
1780 layout.operator("transform.translate", text="Grab/Move")
1781 layout.operator("transform.rotate", text="Rotate")
1782 layout.operator("transform.resize", text="Scale")
1783 layout.operator("object.align")
1784 layout.operator_context = 'EXEC_REGION_WIN'
1785 UseSeparator(self,context)
1786 layout.operator("transform.transform",
1787 text="Align to Transform Orientation").mode = 'ALIGN'
1789 # ********** Transform Armature **********
1790 class VIEW3D_MT_TransformMenuArmature(bpy.types.Menu):
1791 bl_label = "Transform"
1793 def draw(self, context):
1794 layout = self.layout
1795 layout.menu("VIEW3D_MT_ManipulatorMenu1")
1796 UseSeparator(self,context)
1797 layout.operator("transform.translate", text="Grab/Move")
1798 layout.operator("transform.rotate", text="Rotate")
1799 layout.operator("transform.resize", text="Scale")
1800 UseSeparator(self,context)
1801 layout.operator("armature.align")
1802 layout.operator("object.align")
1803 layout.operator_context = 'EXEC_AREA'
1804 UseSeparator(self,context)
1805 layout.operator("object.origin_set",
1806 text="Geometry to Origin").type = 'GEOMETRY_ORIGIN'
1807 layout.operator("object.origin_set",
1808 text="Origin to Geometry").type = 'ORIGIN_GEOMETRY'
1809 layout.operator("object.origin_set",
1810 text="Origin to 3D Cursor").type = 'ORIGIN_CURSOR'
1811 layout.operator("object.origin_set",
1812 text="Origin to Center of Mass").type = 'ORIGIN_CENTER_OF_MASS'
1814 # ********** Transform Armature Edit **********
1815 class VIEW3D_MT_TransformMenuArmatureEdit(bpy.types.Menu):
1816 bl_label = "Transform"
1818 def draw(self, context):
1819 layout = self.layout
1820 layout.menu("VIEW3D_MT_ManipulatorMenu1")
1821 UseSeparator(self,context)
1822 layout.operator("transform.translate", text="Grab/Move")
1823 layout.operator("transform.rotate", text="Rotate")
1824 layout.operator("transform.resize", text="Scale")
1825 UseSeparator(self,context)
1826 layout.operator("transform.tosphere", text="To Sphere")
1827 layout.operator("transform.shear", text="Shear")
1828 layout.operator("transform.bend", text="Bend")
1829 layout.operator("transform.push_pull", text="Push/Pull")
1830 layout.operator("transform.vertex_warp", text="Warp")
1831 UseSeparator(self,context)
1832 layout.operator("transform.vertex_random", text="Randomize")
1833 layout.operator("armature.align")
1834 layout.operator_context = 'EXEC_AREA'
1836 # ********** Transform Armature Pose **********
1837 class VIEW3D_MT_TransformMenuArmaturePose(bpy.types.Menu):
1838 bl_label = "Transform"
1840 def draw(self, context):
1841 layout = self.layout
1842 layout.menu("VIEW3D_MT_ManipulatorMenu1")
1843 layout.operator("transform.translate", text="Grab/Move")
1844 layout.operator("transform.rotate", text="Rotate")
1845 layout.operator("transform.resize", text="Scale")
1846 UseSeparator(self,context)
1847 layout.operator("pose.transforms_clear", text="Clear All")
1848 layout.operator("pose.loc_clear", text="Location")
1849 layout.operator("pose.rot_clear", text="Rotation")
1850 layout.operator("pose.scale_clear", text="Scale")
1852 UseSeparator(self,context)
1854 layout.operator("pose.user_transforms_clear", text="Reset unkeyed")
1855 obj = context.object
1856 if obj.type == 'ARMATURE' and obj.mode in {'EDIT', 'POSE'}:
1857 if obj.data.draw_type == 'BBONE':
1858 layout.operator("transform.transform", text="Scale BBone").mode = 'BONE_SIZE'
1859 elif obj.data.draw_type == 'ENVELOPE':
1860 layout.operator("transform.transform", text="Scale Envelope Distance").mode = 'BONE_SIZE'
1861 layout.operator("transform.transform", text="Scale Radius").mode = 'BONE_ENVELOPE'
1863 ############ View Menu's #########
1865 class VIEW3D_MT_View_Directions(bpy.types.Menu):
1866 bl_label = "Directions"
1868 def draw(self, context):
1869 layout = self.layout
1870 layout.operator("view3d.viewnumpad", text="Camera").type = 'CAMERA'
1871 UseSeparator(self,context)
1872 layout.operator("view3d.viewnumpad", text="Top").type = 'TOP'
1873 layout.operator("view3d.viewnumpad", text="Bottom").type = 'BOTTOM'
1874 UseSeparator(self,context)
1875 layout.operator("view3d.viewnumpad", text="Front").type = 'FRONT'
1876 layout.operator("view3d.viewnumpad", text="Back").type = 'BACK'
1877 UseSeparator(self,context)
1878 layout.operator("view3d.viewnumpad", text="Right").type = 'RIGHT'
1879 layout.operator("view3d.viewnumpad", text="Left").type = 'LEFT'
1882 class VIEW3D_MT_View_Border(bpy.types.Menu):
1883 bl_label = "Set Border"
1885 def draw(self, context):
1886 layout = self.layout
1887 layout.operator_context = 'INVOKE_REGION_WIN'
1888 layout.operator("view3d.clip_border", text="Clipping Border...")
1889 layout.operator("view3d.zoom_border", text="Zoom Border...")
1890 layout.operator("view3d.render_border", text="Render Border...").camera_only = False
1892 class VIEW3D_MT_View_Toggle(bpy.types.Menu):
1893 bl_label = "View Toggle"
1895 def draw(self, context):
1896 layout = self.layout
1897 layout.operator_context = 'INVOKE_REGION_WIN'
1898 layout.operator("screen.area_dupli")
1899 UseSeparator(self,context)
1900 layout.operator("screen.region_quadview")
1901 layout.operator("screen.screen_full_area", text="Toggle Maximize Area")
1902 layout.operator("screen.screen_full_area").use_hide_panels = True
1905 class VIEW3D_MT_View_Menu(bpy.types.Menu):
1906 bl_label = "View"
1908 def draw(self, context):
1909 layout = self.layout
1910 layout.menu("VIEW3D_MT_Shade")
1911 UseSeparator(self,context)
1912 layout.menu("VIEW3D_MT_view_cameras", text="Cameras")
1913 layout.menu("VIEW3D_MT_View_Directions")
1914 layout.menu("VIEW3D_MT_View_Navigation")
1915 UseSeparator(self,context)
1916 layout.menu("VIEW3D_MT_View_Align")
1917 layout.menu("VIEW3D_MT_View_Toggle")
1918 layout.operator("view3d.view_persportho")
1919 layout.operator("view3d.localview", text="View Global/Local")
1920 layout.operator("view3d.view_selected").use_all_regions = False
1921 layout.operator("view3d.view_all").center = False
1922 UseSeparator(self,context)
1923 layout.menu("VIEW3D_MT_View_Border")
1924 layout.operator("view3d.layers", text="Show All Layers").nr = 0
1925 UseSeparator(self,context)
1926 # New menu entry for Animation player
1927 layout.menu("VIEW3D_MT_Animation_Player",
1928 text="Playback Animation", icon='PLAY')
1930 class VIEW3D_MT_View_Navigation(bpy.types.Menu):
1931 bl_label = "Navigation"
1933 def draw(self, context):
1934 from math import pi
1935 layout = self.layout
1936 layout.operator_enum("view3d.view_orbit", "type")
1937 props = layout.operator("view3d.view_orbit", "Orbit Opposite")
1938 props.type = 'ORBITRIGHT'
1939 props.angle = pi
1941 UseSeparator(self,context)
1942 layout.operator("view3d.view_roll", text="Roll Left").type = 'LEFT'
1943 layout.operator("view3d.view_roll", text="Roll Right").type = 'RIGHT'
1944 UseSeparator(self,context)
1945 layout.operator_enum("view3d.view_pan", "type")
1946 UseSeparator(self,context)
1947 layout.operator("view3d.zoom", text="Zoom In").delta = 1
1948 layout.operator("view3d.zoom", text="Zoom Out").delta = -1
1949 UseSeparator(self,context)
1950 layout.operator("view3d.zoom_camera_1_to_1", text="Zoom Camera 1:1")
1951 UseSeparator(self,context)
1952 layout.operator("view3d.fly")
1953 layout.operator("view3d.walk")
1955 class VIEW3D_MT_View_Align(bpy.types.Menu):
1956 bl_label = "Align View"
1958 def draw(self, context):
1959 layout = self.layout
1960 layout.operator("view3d.view_all", text="Center Cursor and View All").center = True
1961 layout.operator("view3d.view_center_cursor")
1962 UseSeparator(self,context)
1963 layout.operator("view3d.camera_to_view", text="Align Active Camera to View")
1964 layout.operator("view3d.camera_to_view_selected", text="Align Active Camera to Selected")
1965 UseSeparator(self,context)
1966 layout.operator("view3d.view_selected")
1967 layout.operator("view3d.view_lock_to_active")
1968 layout.operator("view3d.view_lock_clear")
1970 class VIEW3D_MT_View_Align_Selected(bpy.types.Menu):
1971 bl_label = "Align View to Active"
1973 def draw(self, context):
1974 layout = self.layout
1975 props = layout.operator("view3d.viewnumpad", text="Top")
1976 props.align_active = True
1977 props.type = 'TOP'
1978 props = layout.operator("view3d.viewnumpad", text="Bottom")
1979 props.align_active = True
1980 props.type = 'BOTTOM'
1981 props = layout.operator("view3d.viewnumpad", text="Front")
1982 props.align_active = True
1983 props.type = 'FRONT'
1984 props = layout.operator("view3d.viewnumpad", text="Back")
1985 props.align_active = True
1986 props.type = 'BACK'
1987 props = layout.operator("view3d.viewnumpad", text="Right")
1988 props.align_active = True
1989 props.type = 'RIGHT'
1990 props = layout.operator("view3d.viewnumpad", text="Left")
1991 props.align_active = True
1992 props.type = 'LEFT'
1994 class VIEW3D_MT_View_Cameras(bpy.types.Menu):
1995 bl_label = "Cameras"
1997 def draw(self, context):
1998 layout = self.layout
1999 layout.operator("view3d.object_as_camera")
2000 layout.operator("view3d.viewnumpad", text="Active Camera").type = 'CAMERA'
2002 # Matcap and AO, Wire all and X-Ray entries thanks to marvin.k.breuer
2003 class VIEW3D_MT_Shade(Menu):
2004 bl_label = "Shade"
2006 def draw(self, context):
2007 layout = self.layout
2009 layout.prop(context.space_data, "viewport_shade", expand=True)
2010 UseSeparator(self,context)
2012 if context.active_object:
2013 if(context.mode == 'EDIT_MESH'):
2014 layout.operator("MESH_OT_faces_shade_smooth")
2015 layout.operator("MESH_OT_faces_shade_flat")
2016 else:
2017 layout.operator("OBJECT_OT_shade_smooth")
2018 layout.operator("OBJECT_OT_shade_flat")
2020 UseSeparator(self,context)
2021 layout.operator("view3d.display_wire_all", text="Wire all", icon='WIRE')
2022 layout.prop(context.object, "show_x_ray", text="X-Ray", icon="META_CUBE")
2024 UseSeparator(self,context)
2025 layout.prop(context.space_data.fx_settings, "use_ssao",
2026 text="Ambient Occlusion", icon="GROUP")
2027 layout.prop(context.space_data, "use_matcap", icon="MATCAP_01")
2029 if context.space_data.use_matcap:
2030 row = layout.column(1)
2031 row.scale_y = 0.3
2032 row.scale_x = 0.5
2033 row.template_icon_view(context.space_data, "matcap_icon")
2036 ## Animation Player (Thanks to marvin.k.breuer) ##
2037 class VIEW3D_MT_Animation_Player(bpy.types.Menu):
2038 bl_label = "Animation Player"
2040 def draw(self, context):
2041 layout = self.layout
2043 scene = context.scene
2044 toolsettings = context.tool_settings
2045 screen = context.screen
2047 layout.operator("screen.frame_jump", text="Jump REW", icon='REW').end = False
2048 layout.operator("screen.keyframe_jump", text="Previous FR", icon='PREV_KEYFRAME').next = False
2050 UseSeparator(self,context)
2051 layout.operator("screen.animation_play", text="Reverse", icon='PLAY_REVERSE').reverse = True
2052 layout.operator("screen.animation_play", text="PLAY", icon='PLAY')
2053 layout.operator("screen.animation_play", text="Stop", icon='PAUSE')
2054 UseSeparator(self,context)
2056 layout.operator("screen.keyframe_jump", text="Next FR", icon='NEXT_KEYFRAME').next = True
2057 layout.operator("screen.frame_jump", text="Jump FF", icon='FF').end = True
2060 ############ Select Menu's #########
2062 ## Object Select ##
2063 class VIEW3D_MT_Select_Object(bpy.types.Menu):
2064 bl_label = "Select"
2066 def draw(self, context):
2067 layout = self.layout
2068 layout.operator_context = 'INVOKE_REGION_WIN'
2069 layout.operator("view3d.select_border")
2070 layout.operator("view3d.select_circle")
2071 UseSeparator(self,context)
2072 layout.operator("object.select_all").action = 'TOGGLE'
2073 layout.operator("object.select_all", text="Inverse").action = 'INVERT'
2074 layout.operator("object.select_random", text="Random")
2075 layout.operator("object.select_mirror", text="Mirror")
2076 UseSeparator(self,context)
2077 layout.operator("object.select_by_layer", text="Select All by Layer")
2078 layout.operator_menu_enum("object.select_by_type", "type",
2079 text="Select All by Type...")
2080 layout.operator_menu_enum("object.select_grouped", "type",
2081 text="Grouped")
2082 layout.operator_menu_enum("object.select_linked", "type",
2083 text="Linked")
2084 layout.operator("object.select_camera", text="Select Camera")
2085 UseSeparator(self,context)
2086 layout.menu("VIEW3D_MT_Select_Object_More_Less", text="More/Less")
2087 layout.operator("object.select_pattern", text="Select Pattern...")
2089 class VIEW3D_MT_Select_Object_More_Less(bpy.types.Menu):
2090 bl_label = "Select More/Less"
2092 def draw(self, context):
2093 layout = self.layout
2094 layout.operator("object.select_more", text="More")
2095 layout.operator("object.select_less", text="Less")
2096 UseSeparator(self,context)
2097 props = layout.operator("object.select_hierarchy", text="Parent")
2098 props.extend = False
2099 props.direction = 'PARENT'
2100 props = layout.operator("object.select_hierarchy", text="Child")
2101 props.extend = False
2102 props.direction = 'CHILD'
2103 UseSeparator(self,context)
2104 props = layout.operator("object.select_hierarchy", text="Extend Parent")
2105 props.extend = True
2106 props.direction = 'PARENT'
2107 props = layout.operator("object.select_hierarchy", text="Extend Child")
2108 props.extend = True
2109 props.direction = 'CHILD'
2111 ## Edit Select ##
2112 class VIEW3D_MT_Select_Edit_Mesh(bpy.types.Menu):
2113 bl_label = "Select"
2115 def draw(self, context):
2116 layout = self.layout
2117 layout.operator("view3d.select_border")
2118 layout.operator("view3d.select_circle")
2119 UseSeparator(self,context)
2120 layout.operator("mesh.select_all").action = 'TOGGLE'
2121 layout.operator("mesh.select_all", text="Inverse").action = 'INVERT'
2122 layout.operator("mesh.select_linked", text="Linked")
2123 layout.operator("mesh.faces_select_linked_flat",
2124 text="Linked Flat Faces")
2125 layout.operator("mesh.select_random", text="Random")
2126 layout.operator("mesh.select_nth", text="Every N Number of Verts")
2127 UseSeparator(self,context)
2128 layout.menu("VIEW3D_MT_Edit_Mesh_Select_Trait")
2129 layout.menu("VIEW3D_MT_Edit_Mesh_Select_Similar")
2130 layout.menu("VIEW3D_MT_Edit_Mesh_Select_More_Less")
2131 UseSeparator(self,context)
2132 layout.operator("mesh.select_mirror", text="Mirror")
2133 layout.operator("mesh.edges_select_sharp", text="Sharp Edges")
2134 layout.operator("mesh.select_axis", text="Side of Active")
2135 layout.operator("mesh.shortest_path_select", text="Shortest Path")
2136 UseSeparator(self,context)
2137 layout.operator("mesh.loop_multi_select", text="Edge Loops").ring = False
2138 layout.operator("mesh.loop_multi_select", text="Edge Rings").ring = True
2139 layout.operator("mesh.loop_to_region")
2140 layout.operator("mesh.region_to_loop")
2142 class VIEW3D_MT_Edit_Mesh_Select_Similar(bpy.types.Menu):
2143 bl_label = "Select Similar"
2145 def draw(self, context):
2146 layout = self.layout
2147 layout.operator_enum("mesh.select_similar", "type")
2148 layout.operator("mesh.select_similar_region", text="Face Regions")
2150 class VIEW3D_MT_Edit_Mesh_Select_Trait(bpy.types.Menu):
2151 bl_label = "Select All by Trait"
2153 def draw(self, context):
2154 layout = self.layout
2155 if context.scene.tool_settings.mesh_select_mode[2] is False:
2156 layout.operator("mesh.select_non_manifold", text="Non Manifold")
2157 layout.operator("mesh.select_loose", text="Loose Geometry")
2158 layout.operator("mesh.select_interior_faces", text="Interior Faces")
2159 layout.operator("mesh.select_face_by_sides", text="By Number of Verts")
2160 layout.operator("mesh.select_ungrouped", text="Ungrouped Verts")
2162 class VIEW3D_MT_Edit_Mesh_Select_More_Less(bpy.types.Menu):
2163 bl_label = "Select More/Less"
2165 def draw(self, context):
2166 layout = self.layout
2167 layout.operator("mesh.select_more", text="More")
2168 layout.operator("mesh.select_less", text="Less")
2169 UseSeparator(self,context)
2170 layout.operator("mesh.select_next_item", text="Next Active")
2171 layout.operator("mesh.select_prev_item", text="Previous Active")
2173 ## Edit Curve Select ##
2174 class VIEW3D_MT_Select_Edit_Curve(bpy.types.Menu):
2175 bl_label = "Select"
2177 def draw(self, context):
2178 layout = self.layout
2179 layout.operator("view3d.select_border")
2180 layout.operator("view3d.select_circle")
2181 UseSeparator(self,context)
2182 layout.operator("curve.select_all").action = 'TOGGLE'
2183 layout.operator("curve.select_all", text="Inverse").action = 'INVERT'
2184 layout.operator("curve.select_nth")
2185 UseSeparator(self,context)
2186 layout.operator("curve.select_random")
2187 layout.operator("curve.select_linked", text="Select Linked")
2188 layout.operator("curve.select_similar", text="Select Similar")
2189 layout.operator("curve.de_select_first")
2190 layout.operator("curve.de_select_last")
2191 layout.operator("curve.select_next")
2192 layout.operator("curve.select_previous")
2193 UseSeparator(self,context)
2194 layout.operator("curve.select_more")
2195 layout.operator("curve.select_less")
2197 ## Armature Select ##
2198 class VIEW3D_MT_SelectArmatureMenu(bpy.types.Menu):
2199 bl_label = "Select"
2201 def draw(self, context):
2202 layout = self.layout
2203 layout.operator("view3d.select_border")
2204 layout.operator("armature.select_all")
2205 layout.operator("armature.select_inverse", text="Inverse")
2206 layout.operator("armature.select_hierarchy",
2207 text="Parent").direction = 'PARENT'
2208 layout.operator("armature.select_hierarchy",
2209 text="Child").direction = 'CHILD'
2210 props = layout.operator("armature.select_hierarchy",
2211 text="Extend Parent")
2212 props.extend = True
2213 props.direction = 'PARENT'
2214 props = layout.operator("armature.select_hierarchy",
2215 text="Extend Child")
2216 props.extend = True
2217 props.direction = 'CHILD'
2218 layout.operator("object.select_pattern", text="Select Pattern...")
2220 class VIEW3D_MT_Select_Edit_Armature(bpy.types.Menu):
2221 bl_label = "Select"
2223 def draw(self, context):
2224 layout = self.layout
2226 layout.operator("view3d.select_border")
2227 layout.operator("view3d.select_circle")
2229 UseSeparator(self,context)
2231 layout.operator("armature.select_all").action = 'TOGGLE'
2232 layout.operator("armature.select_all", text="Inverse").action = 'INVERT'
2233 layout.operator("armature.select_mirror", text="Mirror").extend = False
2235 UseSeparator(self,context)
2237 layout.operator("armature.select_more", text="More")
2238 layout.operator("armature.select_less", text="Less")
2240 UseSeparator(self,context)
2242 props = layout.operator("armature.select_hierarchy", text="Parent")
2243 props.extend = False
2244 props.direction = 'PARENT'
2246 props = layout.operator("armature.select_hierarchy", text="Child")
2247 props.extend = False
2248 props.direction = 'CHILD'
2250 UseSeparator(self,context)
2252 props = layout.operator("armature.select_hierarchy", text="Extend Parent")
2253 props.extend = True
2254 props.direction = 'PARENT'
2256 props = layout.operator("armature.select_hierarchy", text="Extend Child")
2257 props.extend = True
2258 props.direction = 'CHILD'
2260 layout.operator_menu_enum("armature.select_similar", "type", text="Similar")
2261 layout.operator("object.select_pattern", text="Select Pattern...")
2263 class VIEW3D_MT_Select_Pose(bpy.types.Menu):
2264 bl_label = "Select"
2266 def draw(self, context):
2267 layout = self.layout
2268 layout.operator("view3d.select_border")
2269 layout.operator("view3d.select_circle")
2270 UseSeparator(self,context)
2271 layout.operator("pose.select_all").action = 'TOGGLE'
2272 layout.operator("pose.select_all", text="Inverse").action = 'INVERT'
2273 layout.operator("pose.select_mirror", text="Flip Active")
2274 layout.operator("pose.select_constraint_target",
2275 text="Constraint Target")
2276 UseSeparator(self,context)
2277 layout.operator("pose.select_linked", text="Linked")
2278 layout.operator("pose.select_hierarchy",
2279 text="Parent").direction = 'PARENT'
2280 layout.operator("pose.select_hierarchy",
2281 text="Child").direction = 'CHILD'
2282 props = layout.operator("pose.select_hierarchy", text="Extend Parent")
2283 props.extend = True
2284 props.direction = 'PARENT'
2285 props = layout.operator("pose.select_hierarchy", text="Extend Child")
2286 props.extend = True
2287 props.direction = 'CHILD'
2288 layout.operator_menu_enum("pose.select_grouped", "type",
2289 text="Grouped")
2290 UseSeparator(self,context)
2291 layout.operator("object.select_pattern", text="Select Pattern...")
2292 layout.menu("VIEW3D_MT_select_pose_more_less")
2294 class VIEW3D_MT_Select_Pose_More_Less(bpy.types.Menu):
2295 bl_label = "Select More/Less"
2297 def draw(self, context):
2298 layout = self.layout
2299 props = layout.operator("pose.select_hierarchy", text="Parent")
2300 props.extend = False
2301 props.direction = 'PARENT'
2303 props = layout.operator("pose.select_hierarchy", text="Child")
2304 props.extend = False
2305 props.direction = 'CHILD'
2307 props = layout.operator("pose.select_hierarchy", text="Extend Parent")
2308 props.extend = True
2309 props.direction = 'PARENT'
2311 props = layout.operator("pose.select_hierarchy", text="Extend Child")
2312 props.extend = True
2313 props.direction = 'CHILD'
2315 class VIEW3D_MT_PoseCopy(bpy.types.Menu):
2316 bl_label = "Pose Copy"
2318 def draw(self, context):
2319 layout = self.layout
2320 layout.operator("pose.copy")
2321 layout.operator("pose.paste")
2322 layout.operator("pose.paste",
2323 text="Paste X-Flipped Pose").flipped = True
2325 class VIEW3D_MT_PoseNames(bpy.types.Menu):
2326 bl_label = "Pose Names"
2328 def draw(self, context):
2329 layout = self.layout
2330 layout.operator_context = 'EXEC_AREA'
2331 layout.operator("pose.autoside_names",
2332 text="AutoName Left/Right").axis = 'XAXIS'
2333 layout.operator("pose.autoside_names",
2334 text="AutoName Front/Back").axis = 'YAXIS'
2335 layout.operator("pose.autoside_names",
2336 text="AutoName Top/Bottom").axis = 'ZAXIS'
2337 layout.operator("pose.flip_names")
2339 ## Surface Select ##
2340 class VIEW3D_MT_Select_Edit_Surface(bpy.types.Menu):
2341 bl_label = "Select"
2343 def draw(self, context):
2344 layout = self.layout
2345 layout.operator("view3d.select_border")
2346 layout.operator("view3d.select_circle")
2347 UseSeparator(self,context)
2348 layout.operator("curve.select_all").action = 'TOGGLE'
2349 layout.operator("curve.select_all", text="Inverse").action = 'INVERT'
2350 layout.operator("curve.select_random")
2351 layout.operator("curve.select_nth")
2352 layout.operator("curve.select_linked", text="Select Linked")
2353 layout.operator("curve.select_similar", text="Select Similar")
2354 layout.operator("curve.select_row")
2355 UseSeparator(self,context)
2356 layout.operator("curve.select_more")
2357 layout.operator("curve.select_less")
2359 ## Metaball Select ##
2360 class VIEW3D_MT_SelectMetaball(bpy.types.Menu):
2361 bl_label = "Select"
2363 def draw(self, context):
2364 layout = self.layout
2365 layout.operator("view3d.select_border")
2366 layout.operator("view3d.select_circle")
2367 UseSeparator(self,context)
2368 layout.operator("mball.select_all").action = 'TOGGLE'
2369 layout.operator("mball.select_all").action = 'INVERT'
2370 layout.operator("mball.select_random_metaelems")
2372 class VIEW3D_MT_Select_Edit_Metaball(bpy.types.Menu):
2373 bl_label = "Select"
2375 def draw(self, context):
2376 layout = self.layout
2377 layout.operator("view3d.select_border")
2378 layout.operator("view3d.select_circle")
2379 layout.operator("mball.select_all").action = 'TOGGLE'
2380 layout.operator("mball.select_all", text="Inverse").action = 'INVERT'
2381 layout.operator("mball.select_random_metaelems")
2382 layout.operator_menu_enum("mball.select_similar", "type", text="Similar")
2384 ## Particle Select ##
2385 class VIEW3D_MT_Selection_Mode_Particle(bpy.types.Menu):
2386 bl_label = "Particle Select and Display Mode"
2388 def draw(self, context):
2389 layout = self.layout
2390 toolsettings = context.tool_settings
2392 layout.prop(toolsettings.particle_edit, "select_mode", expand=True)
2395 class VIEW3D_MT_Select_Particle(bpy.types.Menu):
2396 bl_label = "Select"
2398 def draw(self, context):
2399 layout = self.layout
2400 toolsettings = context.tool_settings
2402 layout.operator("view3d.select_border")
2403 layout.operator("view3d.select_circle")
2404 UseSeparator(self,context)
2406 layout.operator("particle.select_all").action = 'TOGGLE'
2407 layout.operator("particle.select_linked")
2408 layout.operator("particle.select_all", text="Inverse").action = 'INVERT'
2410 UseSeparator(self,context)
2411 layout.operator("particle.select_more")
2412 layout.operator("particle.select_less")
2414 UseSeparator(self,context)
2415 layout.operator("particle.select_random")
2417 UseSeparator(self,context)
2418 layout.operator("particle.select_roots", text="Roots")
2419 layout.operator("particle.select_tips", text="Tips")
2421 ## Lattice Edit Select ##
2422 class VIEW3D_MT_Select_Edit_Lattice(bpy.types.Menu):
2423 bl_label = "Select"
2425 def draw(self, context):
2426 layout = self.layout
2428 layout.operator("view3d.select_border")
2429 layout.operator("view3d.select_circle")
2430 UseSeparator(self,context)
2431 layout.operator("lattice.select_mirror")
2432 layout.operator("lattice.select_random")
2433 layout.operator("lattice.select_all").action = 'TOGGLE'
2434 layout.operator("lattice.select_all", text="Inverse").action = 'INVERT'
2435 UseSeparator(self,context)
2436 layout.operator("lattice.select_ungrouped", text="Ungrouped Verts")
2438 ## Grease Pencil Select ##
2439 class VIEW3D_MT_Select_Gpencil(bpy.types.Menu):
2440 # To Do: used in 3dview header might work if mapped to mouse
2441 # Not in Class List yet
2442 bl_label = "Select"
2444 def draw(self, context):
2445 layout = self.layout
2447 layout.operator("gpencil.select_border")
2448 layout.operator("gpencil.select_circle")
2450 UseSeparator(self,context)
2452 layout.operator("gpencil.select_all", text="(De)select All").action = 'TOGGLE'
2453 layout.operator("gpencil.select_all", text="Inverse").action = 'INVERT'
2454 layout.operator("gpencil.select_linked", text="Linked")
2455 #layout.operator_menu_enum("gpencil.select_grouped", "type", text="Grouped")
2456 layout.operator("gpencil.select_grouped", text="Grouped")
2458 UseSeparator(self,context)
2460 layout.operator("gpencil.select_more")
2461 layout.operator("gpencil.select_less")
2463 ## Text Select ##
2464 class VIEW3D_MT_Select_Edit_Text(bpy.types.Menu):
2465 # To Do: used in 3dview header might work if mapped to mouse
2466 # Not in Class List yet
2467 bl_label = "Edit"
2469 def draw(self, context):
2470 layout = self.layout
2471 layout.operator("font.text_copy", text="Copy")
2472 layout.operator("font.text_cut", text="Cut")
2473 layout.operator("font.text_paste", text="Paste")
2474 layout.operator("font.text_paste_from_file")
2475 layout.operator("font.select_all")
2477 ## Paint Mode Menus ##
2478 class VIEW3D_MT_Select_Paint_Mask(bpy.types.Menu):
2479 bl_label = "Select"
2481 def draw(self, context):
2482 layout = self.layout
2483 layout.operator("view3d.select_border")
2484 layout.operator("view3d.select_circle")
2485 layout.operator("paint.face_select_all").action = 'TOGGLE'
2486 layout.operator("paint.face_select_all", text="Inverse").action = 'INVERT'
2487 layout.operator("paint.face_select_linked", text="Linked")
2490 class VIEW3D_MT_Select_Paint_Mask_Vertex(bpy.types.Menu):
2491 bl_label = "Select"
2493 def draw(self, context):
2494 layout = self.layout
2495 layout.operator("view3d.select_border")
2496 layout.operator("view3d.select_circle")
2497 layout.operator("paint.vert_select_all").action = 'TOGGLE'
2498 layout.operator("paint.vert_select_all", text="Inverse").action = 'INVERT'
2499 layout.operator("paint.vert_select_ungrouped", text="Ungrouped Verts")
2502 class VIEW3D_MT_Angle_Control(bpy.types.Menu):
2503 bl_label = "Angle Control"
2505 @classmethod
2506 def poll(cls, context):
2507 settings = UnifiedPaintPanel.paint_settings(context)
2508 if not settings:
2509 return False
2511 brush = settings.brush
2512 tex_slot = brush.texture_slot
2514 return tex_slot.has_texture_angle and tex_slot.has_texture_angle_source
2516 def draw(self, context):
2517 layout = self.layout
2519 settings = UnifiedPaintPanel.paint_settings(context)
2520 brush = settings.brush
2522 sculpt = (context.sculpt_object is not None)
2524 tex_slot = brush.texture_slot
2526 layout.prop(tex_slot, "use_rake", text="Rake")
2528 if brush.brush_capabilities.has_random_texture_angle and tex_slot.has_random_texture_angle:
2529 if sculpt:
2530 if brush.sculpt_capabilities.has_random_texture_angle:
2531 layout.prop(tex_slot, "use_random", text="Random")
2532 else:
2533 layout.prop(tex_slot, "use_random", text="Random")
2535 ## Cursor Menu Operators ##
2536 class VIEW3D_OT_Pivot_Cursor(bpy.types.Operator):
2537 "Cursor as Pivot Point"
2538 bl_idname = "view3d.pivot_cursor"
2539 bl_label = "Cursor as Pivot Point"
2541 @classmethod
2542 def poll(cls, context):
2543 return bpy.context.space_data.pivot_point != 'CURSOR'
2545 def execute(self, context):
2546 bpy.context.space_data.pivot_point = 'CURSOR'
2547 return {'FINISHED'}
2549 class VIEW3D_OT_Revert_Pivot(bpy.types.Operator):
2550 "Revert Pivot Point"
2551 bl_idname = "view3d.revert_pivot"
2552 bl_label = "Reverts Pivot Point to median"
2554 @classmethod
2555 def poll(cls, context):
2556 return bpy.context.space_data.pivot_point != 'MEDIAN_POINT'
2558 def execute(self, context):
2559 bpy.context.space_data.pivot_point = 'MEDIAN_POINT'
2560 return{'FINISHED'}
2562 ## Cursor Edge Intersection Defs ##
2564 def abs(val):
2565 if val > 0:
2566 return val
2567 return -val
2569 def edgeIntersect(context, operator):
2570 from mathutils.geometry import intersect_line_line
2572 obj = context.active_object
2574 if (obj.type != "MESH"):
2575 operator.report({'ERROR'}, "Object must be a mesh")
2576 return None
2578 edges = []
2579 mesh = obj.data
2580 verts = mesh.vertices
2582 is_editmode = (obj.mode == 'EDIT')
2583 if is_editmode:
2584 bpy.ops.object.mode_set(mode='OBJECT')
2586 for e in mesh.edges:
2587 if e.select:
2588 edges.append(e)
2590 if len(edges) > 2:
2591 break
2593 if is_editmode:
2594 bpy.ops.object.mode_set(mode='EDIT')
2596 if len(edges) != 2:
2597 operator.report({'ERROR'},
2598 "Operator requires exactly 2 edges to be selected")
2599 return
2601 line = intersect_line_line(verts[edges[0].vertices[0]].co,
2602 verts[edges[0].vertices[1]].co,
2603 verts[edges[1].vertices[0]].co,
2604 verts[edges[1].vertices[1]].co)
2606 if line is None:
2607 operator.report({'ERROR'}, "Selected edges do not intersect")
2608 return
2610 point = line[0].lerp(line[1], 0.5)
2611 context.scene.cursor_location = obj.matrix_world * point
2614 ## Cursor Edge Intersection Operator ##
2615 class VIEW3D_OT_CursorToEdgeIntersection(bpy.types.Operator):
2616 "Finds the mid-point of the shortest distance between two edges"
2618 bl_idname = "view3d.snap_cursor_to_edge_intersection"
2619 bl_label = "Cursor to Edge Intersection"
2621 @classmethod
2622 def poll(cls, context):
2623 obj = context.active_object
2624 return obj != None and obj.type == 'MESH'
2626 def execute(self, context):
2627 edgeIntersect(context, self)
2628 return {'FINISHED'}
2631 ### Set Mode Operator ###
2632 class SetObjectMode(bpy.types.Operator):
2633 bl_idname = "object.set_object_mode"
2634 bl_label = "Set the object interactive mode"
2635 bl_description = "I set the interactive mode of object"
2636 bl_options = {'REGISTER'}
2638 mode = bpy.props.StringProperty(name="Interactive mode", default="OBJECT")
2640 def execute(self, context):
2641 if (context.active_object):
2642 try:
2643 bpy.ops.object.mode_set(mode=self.mode)
2644 except TypeError:
2645 self.report(type={"WARNING"}, message=context.active_object.name+" It is not possible to enter into the interactive mode")
2646 else:
2647 self.report(type={"WARNING"}, message="There is no active object")
2648 return {'FINISHED'}
2651 ## Origin To Selected Edit Mode ##
2652 def vfeOrigin(context):
2653 cursorPositionX = bpy.context.scene.cursor_location[0]
2654 cursorPositionY = bpy.context.scene.cursor_location[1]
2655 cursorPositionZ = bpy.context.scene.cursor_location[2]
2656 bpy.ops.view3d.snap_cursor_to_selected()
2657 bpy.ops.object.mode_set()
2658 bpy.ops.object.origin_set(type='ORIGIN_CURSOR', center='MEDIAN')
2659 bpy.ops.object.mode_set(mode='EDIT')
2660 bpy.context.scene.cursor_location[0] = cursorPositionX
2661 bpy.context.scene.cursor_location[1] = cursorPositionY
2662 bpy.context.scene.cursor_location[2] = cursorPositionZ
2665 class SetOriginToSelected(bpy.types.Operator):
2666 '''Tooltip'''
2667 bl_idname = "object.setorigintoselected"
2668 bl_label = "Set Origin to Selected"
2670 @classmethod
2671 def poll(cls, context):
2672 return context.active_object is not None
2674 def execute(self, context):
2675 vfeOrigin(context)
2676 return {'FINISHED'}
2678 # Code thanks to Isaac Weaver (wisaac) D1963
2679 class SnapCursSelToCenter(bpy.types.Operator):
2680 """Snap 3D cursor and selected objects to the center \n"""\
2681 """Works only in Object Mode"""
2682 bl_idname = "view3d.snap_cursor_selected_to_center"
2683 bl_label = "Snap Cursor & Selection to Center"
2685 @classmethod
2686 def poll(cls, context):
2687 return (context.mode == "OBJECT")
2689 def execute(self, context):
2690 context.space_data.cursor_location = (0, 0, 0)
2691 for obj in context.selected_objects:
2692 obj.location = (0, 0, 0)
2693 return {'FINISHED'}
2695 ## Draw Separator ##
2696 def UseSeparator(operator, context):
2697 #pass the preferences use_separators bool to enable/disable them
2698 useSep = bpy.context.user_preferences.addons[__name__].preferences.use_separators
2699 if useSep:
2700 operator.layout.separator()
2702 ## Use compact brushes menus ##
2703 def UseBrushesLists():
2704 #pass the prefrences use_brushes_lists bool to enable/disable them
2705 #separate function just for more convience
2706 useLists = bpy.context.user_preferences.addons[__name__].preferences.use_brushes_lists
2707 if useLists: return True
2708 return False
2710 ### Addon Preferences ###
2711 class VIEW3D_MT_Space_Dynamic_Menu_Pref(bpy.types.AddonPreferences):
2712 bl_idname = __name__
2714 use_separators = bpy.props.BoolProperty(
2715 name="Use Separators in the menus",
2716 default=True,
2717 description="Use separators in the menus, a trade-off between \n"\
2718 "readability vs. using more space for displaying items"
2721 use_brushes_lists = bpy.props.BoolProperty(
2722 name="Use compact menus for brushes",
2723 default=False,
2724 description="Use more compact menus instead \n"\
2725 "of thumbnails for displaying brushes"
2728 def draw(self, context):
2729 layout = self.layout
2730 row = layout.row()
2731 row.prop(self, "use_separators")
2732 row.prop(self, "use_brushes_lists")
2735 ### List The Classes ###
2737 classes = [
2738 VIEW3D_MT_Space_Dynamic_Menu,
2739 VIEW3D_MT_AddMenu,
2740 VIEW3D_MT_Object,
2741 VIEW3D_MT_Edit_Mesh,
2742 VIEW3D_MT_TransformMenu,
2743 VIEW3D_MT_TransformMenuEdit,
2744 VIEW3D_MT_TransformMenuArmature,
2745 VIEW3D_MT_TransformMenuArmatureEdit,
2746 VIEW3D_MT_TransformMenuArmaturePose,
2747 VIEW3D_MT_TransformMenuLite,
2748 VIEW3D_MT_TransformMenuCamera,
2749 VIEW3D_MT_MirrorMenu,
2750 VIEW3D_MT_ParentMenu,
2751 VIEW3D_MT_GroupMenu,
2752 VIEW3D_MT_Select_Object,
2753 VIEW3D_MT_Select_Object_More_Less,
2754 VIEW3D_MT_Select_Edit_Mesh,
2755 VIEW3D_MT_Edit_Mesh_Select_Similar,
2756 VIEW3D_MT_Edit_Mesh_Select_Trait,
2757 VIEW3D_MT_Edit_Mesh_Select_More_Less,
2758 VIEW3D_MT_Select_Edit_Curve,
2759 VIEW3D_MT_SelectArmatureMenu,
2760 VIEW3D_MT_Select_Pose,
2761 VIEW3D_MT_Select_Pose_More_Less,
2762 VIEW3D_MT_Pose,
2763 VIEW3D_MT_PoseCopy,
2764 VIEW3D_MT_PoseNames,
2765 VIEW3D_MT_Select_Edit_Surface,
2766 VIEW3D_MT_SelectMetaball,
2767 VIEW3D_MT_Select_Edit_Metaball,
2768 VIEW3D_MT_Select_Particle,
2769 VIEW3D_MT_Select_Edit_Lattice,
2770 VIEW3D_MT_Select_Edit_Armature,
2771 VIEW3D_MT_Select_Paint_Mask,
2772 VIEW3D_MT_Select_Paint_Mask_Vertex,
2773 VIEW3D_MT_Angle_Control,
2774 VIEW3D_MT_Edit_Multi,
2775 VIEW3D_MT_EditM_Edge,
2776 VIEW3D_MT_Edit_Curve,
2777 VIEW3D_MT_EditCurveCtrlpoints,
2778 VIEW3D_MT_EditCurveSegments,
2779 VIEW3D_MT_EditCurveSpecials,
2780 VIEW3D_MT_Edit_Armature,
2781 VIEW3D_MT_EditArmatureTK,
2782 VIEW3D_MT_KeyframeMenu,
2783 VIEW3D_OT_Pivot_Cursor,
2784 VIEW3D_OT_Revert_Pivot,
2785 VIEW3D_MT_CursorMenu,
2786 VIEW3D_MT_CursorMenuLite,
2787 VIEW3D_MT_EditCursorMenu,
2788 VIEW3D_OT_CursorToEdgeIntersection,
2789 VIEW3D_MT_UndoS,
2790 VIEW3D_MT_Camera_Options,
2791 InteractiveMode,
2792 InteractiveModeArmature,
2793 SetObjectMode,
2794 VIEW3D_MT_View_Directions,
2795 VIEW3D_MT_View_Border,
2796 VIEW3D_MT_View_Toggle,
2797 VIEW3D_MT_View_Menu,
2798 VIEW3D_MT_View_Navigation,
2799 VIEW3D_MT_View_Align,
2800 VIEW3D_MT_View_Align_Selected,
2801 VIEW3D_MT_View_Cameras,
2802 VIEW3D_MT_UV_Map,
2803 VIEW3D_MT_Pivot,
2804 VIEW3D_Snap_Context,
2805 VIEW3D_Snap_Origin,
2806 VIEW3D_MT_Shade,
2807 VIEW3D_MT_ManipulatorMenu1,
2808 SetOriginToSelected,
2809 VIEW3D_MT_Object_Data_Link,
2810 VIEW3D_MT_Duplicate,
2811 VIEW3D_MT_Space_Dynamic_Menu_Pref,
2812 VIEW3D_MT_Selection_Mode_Particle,
2813 VIEW3D_MT_AutoSmooth,
2814 VIEW3D_MT_Animation_Player,
2815 VIEW3D_OT_Interactive_Mode_Text,
2816 SnapCursSelToCenter,
2817 VIEW3D_MT_Sculpt_Specials,
2818 VIEW3D_MT_Sculpt_Dyntopo,
2819 VIEW3D_MT_Brush_Settings,
2820 VIEW3D_MT_Brush_Selection,
2821 VIEW3D_MT_Sculpts,
2822 VIEW3D_MT_Hide_Masks,
2823 VIEW3D_OT_Display_Wire_All,
2824 VIEW3D_MT_Vertex_Colors,
2825 VIEW3D_MT_Paint_Weights
2828 ## Register Classes ^ & Hotkeys ##
2830 def register():
2831 for cls in classes:
2832 bpy.utils.register_class(cls)
2834 wm = bpy.context.window_manager
2835 kc = wm.keyconfigs.addon
2836 if kc:
2837 km = kc.keymaps.new(name='3D View', space_type='VIEW_3D')
2838 kmi = km.keymap_items.new('wm.call_menu', 'SPACE', 'PRESS')
2839 kmi.properties.name = "VIEW3D_MT_Space_Dynamic_Menu"
2842 ## Unegister Classes & Hotkeys ##
2844 def unregister():
2845 for cls in classes:
2846 bpy.utils.unregister_class(cls)
2848 wm = bpy.context.window_manager
2849 kc = wm.keyconfigs.addon
2850 if kc:
2851 km = kc.keymaps['3D View']
2852 for kmi in km.keymap_items:
2853 if kmi.idname == 'wm.call_menu':
2854 if kmi.properties.name == "VIEW3D_MT_Space_Dynamic_Menu":
2855 km.keymap_items.remove(kmi)
2856 break
2858 if __name__ == "__main__":
2859 register()