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 #
21 "name": "Dynamic Context Menu",
22 "author": "meta-androcto",
24 "blender": (2, 77, 0),
25 "location": "View3D > Spacebar",
26 "description": "Object Mode Context Sensitive Spacebar Menu",
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",
35 from bpy
.types
import Operator
, Menu
37 ### Dynamic Context Sensitive Menu ###
38 ### Main Menu based on Object Type & 3d View Editor Mode ###
40 class VIEW3D_MT_Space_Dynamic_Menu(bpy
.types
.Menu
):
41 bl_label
= "Dynamic Context Menu"
43 def draw(self
, context
):
45 settings
= context
.tool_settings
46 layout
.operator_context
= 'INVOKE_REGION_WIN'
50 ### No Object Selected ###
51 if not context
.active_object
:
52 layout
.operator_context
= 'INVOKE_REGION_WIN'
53 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
55 layout
.menu("VIEW3D_MT_AddMenu", icon
='OBJECT_DATAMODE')
56 layout
.menu("VIEW3D_MT_View_Directions", icon
='ZOOM_ALL')
57 layout
.menu("VIEW3D_MT_View_Navigation", icon
='ROTATE')
58 layout
.menu("VIEW3D_MT_View_Toggle", icon
='SPLITSCREEN')
59 layout
.operator("view3d.snap_cursor_to_center",
60 text
="Cursor to Center")
61 layout
.operator("view3d.snap_cursor_to_grid",
62 text
="Cursor to Grid")
63 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
64 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
65 layout
.operator("view3d.properties", icon
='MENU_PANEL')
67 ### Mesh Object Mode ###
68 if obj
and obj
.type == 'MESH' and obj
.mode
in {'OBJECT'}:
69 layout
.operator_context
= 'INVOKE_REGION_WIN'
70 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
72 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
73 layout
.menu("VIEW3D_MT_Select_Object", icon
='RESTRICT_SELECT_OFF')
74 layout
.menu("VIEW3D_MT_AddMenu", icon
='OBJECT_DATAMODE')
75 layout
.menu("VIEW3D_MT_Object", icon
='VIEW3D')
76 layout
.menu("VIEW3D_MT_TransformMenu", icon
='MANIPUL')
77 layout
.menu("VIEW3D_MT_MirrorMenu", icon
='MOD_MIRROR')
78 layout
.menu("VIEW3D_MT_CursorMenu", icon
='CURSOR')
79 layout
.menu("VIEW3D_MT_ParentMenu", icon
='ROTACTIVE')
80 layout
.menu("VIEW3D_MT_GroupMenu", icon
='GROUP')
81 layout
.menu("VIEW3D_MT_object_specials", text
= "Specials", icon
='SOLO_OFF')
82 layout
.menu("VIEW3D_MT_Camera_Options", icon
='OUTLINER_OB_CAMERA')
83 layout
.operator_menu_enum("object.modifier_add", "type", icon
='MODIFIER')
84 layout
.operator("object.delete", text
="Delete Object", icon
='X_VEC')
85 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
86 layout
.menu("VIEW3D_MT_Object_Interactive_Mode", icon
='EDIT')
87 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
88 layout
.operator("view3d.properties", icon
='MENU_PANEL')
91 if obj
and obj
.type == 'MESH' and obj
.mode
in {'EDIT'}:
92 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
94 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
95 layout
.menu("VIEW3D_MT_Select_Edit_Mesh", icon
='RESTRICT_SELECT_OFF')
96 layout
.menu("INFO_MT_mesh_add", text
="Add Mesh", icon
='OUTLINER_OB_MESH')
97 layout
.menu("VIEW3D_MT_Edit_Mesh", text
="Mesh", icon
='MESH_DATA')
98 layout
.menu("VIEW3D_MT_TransformMenuEdit", icon
='MANIPUL')
99 layout
.menu("VIEW3D_MT_MirrorMenu", icon
='MOD_MIRROR')
100 layout
.menu("VIEW3D_MT_EditCursorMenu", icon
='CURSOR')
101 layout
.menu("VIEW3D_MT_UV_Map", icon
='MOD_UVPROJECT')
102 layout
.menu("VIEW3D_MT_edit_mesh_specials", icon
='SOLO_OFF')
103 layout
.menu("VIEW3D_MT_edit_mesh_extrude", icon
='ORTHO')
104 layout
.menu("VIEW3D_MT_Edit_Multi", icon
='VERTEXSEL')
105 layout
.menu("VIEW3D_MT_edit_mesh_delete", icon
='X_VEC')
106 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
107 layout
.menu("VIEW3D_MT_Object_Interactive_Mode", icon
='EDIT')
108 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
109 layout
.operator("view3d.properties", icon
='MENU_PANEL')
112 if obj
and obj
.type == 'MESH' and obj
.mode
in {'SCULPT'}:
114 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
116 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
117 layout
.menu("VIEW3D_MT_sculpt", icon
='SCULPTMODE_HLT')
118 layout
.menu("VIEW3D_MT_brush", icon
='ZOOM_ALL')
119 layout
.menu("VIEW3D_MT_hide_mask", icon
='SCULPTMODE_HLT')
120 layout
.menu("VIEW3D_MT_TransformMenu", icon
='MANIPUL')
121 layout
.menu("VIEW3D_MT_MirrorMenu", icon
='MOD_MIRROR')
122 layout
.menu("VIEW3D_MT_CursorMenu", icon
='CURSOR')
123 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
124 layout
.menu("VIEW3D_MT_Object_Interactive_Mode", icon
='EDIT')
125 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
126 layout
.operator("view3d.properties", icon
='MENU_PANEL')
129 if obj
and obj
.type == 'MESH' and obj
.mode
in {'VERTEX_PAINT'}:
131 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
133 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
134 layout
.menu("VIEW3D_MT_paint_vertex", icon
='VPAINT_HLT')
135 layout
.menu("VIEW3D_MT_brush", icon
='BRUSH_DATA')
136 layout
.operator("paint.vertex_color_set", icon
='GROUP_VCOL')
137 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
138 layout
.menu("VIEW3D_MT_Object_Interactive_Mode", icon
='EDIT')
139 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
140 layout
.operator("view3d.properties", icon
='MENU_PANEL')
142 ## Weight Paint Menu ##
143 if obj
and obj
.type == 'MESH' and obj
.mode
in {'WEIGHT_PAINT'}:
145 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
147 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
148 layout
.menu("VIEW3D_MT_paint_weight", icon
='WPAINT_HLT')
149 layout
.menu("VIEW3D_MT_brush", icon
='BRUSH_DATA')
150 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
151 layout
.menu("VIEW3D_MT_Object_Interactive_Mode", icon
='EDIT')
152 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
153 layout
.operator("view3d.properties", icon
='MENU_PANEL')
156 if obj
and obj
.type == 'MESH' and obj
.mode
in {'TEXTURE_PAINT'}:
158 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
160 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
161 layout
.menu("VIEW3D_MT_brush", icon
='BRUSH_DATA')
162 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
163 layout
.menu("VIEW3D_MT_Object_Interactive_Mode", icon
='EDIT')
164 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
165 layout
.operator("view3d.properties", icon
='MENU_PANEL')
167 ### Curve Object Mode ###
168 if obj
and obj
.type == 'CURVE' and obj
.mode
in {'OBJECT'}:
170 layout
.operator_context
= 'INVOKE_REGION_WIN'
171 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
173 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
174 layout
.menu("VIEW3D_MT_Select_Object", icon
='RESTRICT_SELECT_OFF')
175 layout
.menu("VIEW3D_MT_AddMenu", icon
='OBJECT_DATAMODE')
176 layout
.menu("VIEW3D_MT_Object", icon
='VIEW3D')
177 layout
.menu("VIEW3D_MT_TransformMenu", icon
='MANIPUL')
178 layout
.menu("VIEW3D_MT_MirrorMenu", icon
='MOD_MIRROR')
179 layout
.menu("VIEW3D_MT_CursorMenu", icon
='CURSOR')
180 layout
.menu("VIEW3D_MT_ParentMenu", icon
='ROTACTIVE')
181 layout
.menu("VIEW3D_MT_GroupMenu", icon
='GROUP')
182 layout
.menu("VIEW3D_MT_object_specials", text
= "Specials", icon
='SOLO_OFF')
183 layout
.menu("VIEW3D_MT_Camera_Options", icon
='OUTLINER_OB_CAMERA')
184 layout
.operator_menu_enum("object.modifier_add", "type", icon
='MODIFIER')
185 layout
.operator("object.delete", text
="Delete Object", icon
='X_VEC')
186 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
187 layout
.operator("object.editmode_toggle", text
="Enter Edit Mode",
189 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
190 layout
.operator("view3d.properties", icon
='MENU_PANEL')
193 if obj
and obj
.type == 'CURVE' and obj
.mode
in {'EDIT'}:
195 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
197 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
198 layout
.menu("VIEW3D_MT_Select_Edit_Curve",
199 icon
='RESTRICT_SELECT_OFF')
200 layout
.menu("INFO_MT_curve_add", text
="Add Curve",
201 icon
='OUTLINER_OB_CURVE')
202 layout
.menu("VIEW3D_MT_Edit_Curve", icon
='CURVE_DATA')
203 layout
.menu("VIEW3D_MT_TransformMenu", icon
='MANIPUL')
204 layout
.menu("VIEW3D_MT_MirrorMenu", icon
='MOD_MIRROR')
205 layout
.menu("VIEW3D_MT_CursorMenu", icon
='CURSOR')
206 layout
.menu("VIEW3D_MT_EditCurveCtrlpoints",
207 icon
='CURVE_BEZCURVE')
208 layout
.menu("VIEW3D_MT_EditCurveSpecials",
210 layout
.operator("curve.delete", text
="Delete Object",
212 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
213 layout
.operator("object.editmode_toggle", text
="Enter Object Mode",
215 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
216 layout
.operator("view3d.properties", icon
='MENU_PANEL')
218 ### Surface Object Mode ###
219 if obj
and obj
.type == 'SURFACE' and obj
.mode
in {'OBJECT'}:
221 layout
.operator_context
= 'INVOKE_REGION_WIN'
222 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
224 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
225 layout
.menu("VIEW3D_MT_Select_Object", icon
='RESTRICT_SELECT_OFF')
226 layout
.menu("VIEW3D_MT_AddMenu", icon
='OBJECT_DATAMODE')
227 layout
.menu("VIEW3D_MT_Object", icon
='VIEW3D')
228 layout
.menu("VIEW3D_MT_TransformMenu", icon
='MANIPUL')
229 layout
.menu("VIEW3D_MT_MirrorMenu", icon
='MOD_MIRROR')
230 layout
.menu("VIEW3D_MT_CursorMenu", icon
='CURSOR')
231 layout
.menu("VIEW3D_MT_ParentMenu", icon
='ROTACTIVE')
232 layout
.menu("VIEW3D_MT_GroupMenu", icon
='GROUP')
233 layout
.menu("VIEW3D_MT_object_specials", text
= "Specials", icon
='SOLO_OFF')
234 layout
.menu("VIEW3D_MT_Camera_Options", icon
='OUTLINER_OB_CAMERA')
235 layout
.operator_menu_enum("object.modifier_add", "type", icon
='MODIFIER')
236 layout
.operator("object.delete", text
="Delete Object", icon
='X_VEC')
237 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
238 layout
.operator("object.editmode_toggle", text
="Enter Edit Mode",
240 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
241 layout
.operator("view3d.properties", icon
='MENU_PANEL')
244 if obj
and obj
.type == 'SURFACE' and obj
.mode
in {'EDIT'}:
246 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
248 layout
.menu("INFO_MT_surface_add", text
="Add Surface",
249 icon
='OUTLINER_OB_SURFACE')
250 layout
.menu("VIEW3D_MT_TransformMenu", icon
='MANIPUL')
251 layout
.menu("VIEW3D_MT_MirrorMenu", icon
='MOD_MIRROR')
252 layout
.menu("VIEW3D_MT_CursorMenu", icon
='CURSOR')
253 layout
.prop_menu_enum(settings
, "proportional_edit",
255 layout
.prop_menu_enum(settings
, "proportional_edit_falloff",
257 layout
.menu("VIEW3D_MT_EditCurveSpecials",
259 layout
.menu("VIEW3D_MT_Select_Edit_Surface", icon
='RESTRICT_SELECT_OFF')
260 layout
.operator("curve.delete", text
="Delete Object",
262 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
263 layout
.operator("object.editmode_toggle", text
="Enter Object Mode",
265 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
266 layout
.operator("view3d.properties", icon
='MENU_PANEL')
268 ### Metaball Object Mode ###
269 if obj
and obj
.type == 'META' and obj
.mode
in {'OBJECT'}:
271 layout
.operator_context
= 'INVOKE_REGION_WIN'
272 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
274 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
275 layout
.menu("VIEW3D_MT_Select_Object", icon
='RESTRICT_SELECT_OFF')
276 layout
.menu("VIEW3D_MT_AddMenu", icon
='OBJECT_DATAMODE')
277 layout
.menu("VIEW3D_MT_Object", icon
='VIEW3D')
278 layout
.menu("VIEW3D_MT_TransformMenu", icon
='MANIPUL')
279 layout
.menu("VIEW3D_MT_MirrorMenu", icon
='MOD_MIRROR')
280 layout
.menu("VIEW3D_MT_CursorMenu", icon
='CURSOR')
281 layout
.menu("VIEW3D_MT_ParentMenu", icon
='ROTACTIVE')
282 layout
.menu("VIEW3D_MT_GroupMenu", icon
='GROUP')
283 layout
.menu("VIEW3D_MT_object_specials", text
= "Specials", icon
='SOLO_OFF')
284 layout
.menu("VIEW3D_MT_Camera_Options", icon
='OUTLINER_OB_CAMERA')
285 layout
.operator_menu_enum("object.modifier_add", "type", icon
='MODIFIER')
286 layout
.operator("object.delete", text
="Delete Object", icon
='X_VEC')
287 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
288 layout
.operator("object.editmode_toggle", text
="Enter Edit Mode",
290 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
291 layout
.operator("view3d.properties", icon
='MENU_PANEL')
294 if obj
and obj
.type == 'META' and obj
.mode
in {'EDIT'}:
296 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
298 layout
.operator_menu_enum("object.metaball_add", "type",
300 icon
='OUTLINER_OB_META')
301 layout
.menu("VIEW3D_MT_TransformMenu", icon
='MANIPUL')
302 layout
.menu("VIEW3D_MT_MirrorMenu", icon
='MOD_MIRROR')
303 layout
.menu("VIEW3D_MT_CursorMenu", icon
='CURSOR')
304 layout
.prop_menu_enum(settings
, "proportional_edit",
306 layout
.prop_menu_enum(settings
, "proportional_edit_falloff",
308 layout
.menu("VIEW3D_MT_SelectMetaball", icon
='RESTRICT_SELECT_OFF')
309 layout
.operator("mball.delete_metaelems", text
="Delete Object",
311 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
312 layout
.operator("object.editmode_toggle", text
="Enter Object Mode",
314 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
315 layout
.operator("view3d.properties", icon
='MENU_PANEL')
317 ### Text Object Mode ###
318 if obj
and obj
.type == 'FONT' and obj
.mode
in {'OBJECT'}:
320 layout
.operator_context
= 'INVOKE_REGION_WIN'
321 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
323 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
324 layout
.menu("VIEW3D_MT_Select_Object", icon
='RESTRICT_SELECT_OFF')
325 layout
.menu("VIEW3D_MT_AddMenu", icon
='OBJECT_DATAMODE')
326 layout
.menu("VIEW3D_MT_Object", icon
='VIEW3D')
327 layout
.menu("VIEW3D_MT_TransformMenu", icon
='MANIPUL')
328 layout
.menu("VIEW3D_MT_MirrorMenu", icon
='MOD_MIRROR')
329 layout
.menu("VIEW3D_MT_CursorMenu", icon
='CURSOR')
330 layout
.menu("VIEW3D_MT_ParentMenu", icon
='ROTACTIVE')
331 layout
.menu("VIEW3D_MT_GroupMenu", icon
='GROUP')
332 layout
.menu("VIEW3D_MT_object_specials", text
= "Specials", icon
='SOLO_OFF')
333 layout
.menu("VIEW3D_MT_Camera_Options", icon
='OUTLINER_OB_CAMERA')
334 layout
.operator("object.delete", text
="Delete Object", icon
='X_VEC')
335 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
336 layout
.operator("object.editmode_toggle", text
="Enter Edit Mode",
338 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
339 layout
.operator("view3d.properties", icon
='MENU_PANEL')
341 ### Text Edit Mode ###
342 if obj
and obj
.type == 'FONT' and obj
.mode
in {'EDIT'}:
344 layout
.operator_context
= 'INVOKE_REGION_WIN'
345 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
347 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
348 layout
.menu("VIEW3D_MT_select_edit_text", icon
='VIEW3D')
349 layout
.menu("VIEW3D_MT_edit_font", icon
='RESTRICT_SELECT_OFF')
350 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
351 layout
.operator("object.editmode_toggle", text
="Enter Object Mode",
353 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
354 layout
.operator("view3d.properties", icon
='MENU_PANEL')
356 ### Camera Object Mode ###
357 if obj
and obj
.type == 'CAMERA' and obj
.mode
in {'OBJECT'}:
359 layout
.operator_context
= 'INVOKE_REGION_WIN'
360 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
362 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
363 layout
.menu("VIEW3D_MT_Select_Object", icon
='RESTRICT_SELECT_OFF')
364 layout
.menu("VIEW3D_MT_AddMenu", icon
='OBJECT_DATAMODE')
365 layout
.menu("VIEW3D_MT_Object", icon
='VIEW3D')
366 layout
.menu("VIEW3D_MT_TransformMenu", icon
='MANIPUL')
367 layout
.menu("VIEW3D_MT_CursorMenuLite", icon
='CURSOR')
368 layout
.menu("VIEW3D_MT_ParentMenu", icon
='ROTACTIVE')
369 layout
.menu("VIEW3D_MT_GroupMenu", icon
='GROUP')
370 layout
.menu("VIEW3D_MT_object_specials", text
= "Specials", icon
='SOLO_OFF')
371 layout
.menu("VIEW3D_MT_Camera_Options", icon
='OUTLINER_OB_CAMERA')
372 layout
.operator("object.delete", text
="Delete Object", icon
='X_VEC')
373 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
374 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
375 layout
.operator("view3d.properties", icon
='MENU_PANEL')
377 ### Lamp Object Mode ###
378 if obj
and obj
.type == 'LAMP' and obj
.mode
in {'OBJECT'}:
380 layout
.operator_context
= 'INVOKE_REGION_WIN'
381 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
383 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
384 layout
.menu("VIEW3D_MT_Select_Object", icon
='RESTRICT_SELECT_OFF')
385 layout
.menu("VIEW3D_MT_AddMenu", icon
='OBJECT_DATAMODE')
386 layout
.menu("VIEW3D_MT_Object", icon
='VIEW3D')
387 layout
.menu("VIEW3D_MT_TransformMenuLite", icon
='MANIPUL')
388 layout
.menu("VIEW3D_MT_CursorMenuLite", icon
='CURSOR')
389 layout
.menu("VIEW3D_MT_ParentMenu", icon
='ROTACTIVE')
390 layout
.menu("VIEW3D_MT_GroupMenu", icon
='GROUP')
391 layout
.menu("VIEW3D_MT_object_specials", text
= "Specials", icon
='SOLO_OFF')
392 layout
.menu("VIEW3D_MT_Camera_Options", icon
='OUTLINER_OB_CAMERA')
393 layout
.operator("object.delete", text
="Delete Object", icon
='X_VEC')
394 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
395 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
396 layout
.operator("view3d.properties", icon
='MENU_PANEL')
398 ### Armature Object Mode ###
399 if obj
and obj
.type == 'ARMATURE' and obj
.mode
in {'OBJECT'}:
401 layout
.operator_context
= 'INVOKE_REGION_WIN'
402 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
404 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
405 layout
.menu("VIEW3D_MT_Select_Object", icon
='RESTRICT_SELECT_OFF')
406 layout
.menu("VIEW3D_MT_AddMenu", icon
='OBJECT_DATAMODE')
407 layout
.menu("VIEW3D_MT_Object", icon
='VIEW3D')
408 layout
.menu("VIEW3D_MT_TransformMenuArmature", icon
='MANIPUL')
409 layout
.menu("VIEW3D_MT_MirrorMenu", icon
='MOD_MIRROR')
410 layout
.menu("VIEW3D_MT_CursorMenuLite", icon
='CURSOR')
411 layout
.menu("VIEW3D_MT_ParentMenu", icon
='ROTACTIVE')
412 layout
.menu("VIEW3D_MT_GroupMenu", icon
='GROUP')
413 layout
.menu("VIEW3D_MT_object_specials", text
= "Specials", icon
='SOLO_OFF')
414 layout
.menu("VIEW3D_MT_Camera_Options", icon
='OUTLINER_OB_CAMERA')
415 layout
.operator("object.delete", text
="Delete Object", icon
='X_VEC')
416 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
417 layout
.menu("VIEW3D_MT_Object_Interactive_Armature", icon
='VIEW3D')
418 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
419 layout
.operator("view3d.properties", icon
='MENU_PANEL')
422 if obj
and obj
.type == 'ARMATURE' and obj
.mode
in {'EDIT'}:
424 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
426 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
427 layout
.menu("VIEW3D_MT_Select_Edit_Armature",
428 icon
='RESTRICT_SELECT_OFF')
429 layout
.menu("INFO_MT_armature_add", text
="Add Armature",
430 icon
='OUTLINER_OB_ARMATURE')
431 layout
.menu("VIEW3D_MT_Edit_Armature", text
="Armature",
432 icon
='OUTLINER_DATA_ARMATURE')
433 layout
.menu("VIEW3D_MT_EditArmatureTK",
434 icon
='ARMATURE_DATA')
435 layout
.menu("VIEW3D_MT_TransformMenuArmatureEdit", icon
='MANIPUL')
436 layout
.menu("VIEW3D_MT_MirrorMenu", icon
='MOD_MIRROR')
437 layout
.menu("VIEW3D_MT_CursorMenuLite", icon
='CURSOR')
438 layout
.menu("VIEW3D_MT_ParentMenu", icon
='ROTACTIVE')
439 layout
.menu("VIEW3D_MT_armature_specials", icon
='SOLO_OFF')
440 layout
.menu("VIEW3D_MT_edit_armature_roll",
442 layout
.operator("armature.delete", text
="Delete Object",
444 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
445 layout
.menu("VIEW3D_MT_Object_Interactive_Armature", icon
='VIEW3D')
446 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
447 layout
.operator("view3d.properties", icon
='MENU_PANEL')
450 if obj
and obj
.type == 'ARMATURE' and obj
.mode
in {'POSE'}:
452 arm
= context
.active_object
.data
454 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
456 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
457 layout
.menu("VIEW3D_MT_Select_Pose", icon
='RESTRICT_SELECT_OFF')
458 layout
.menu("VIEW3D_MT_Pose", icon
='OUTLINER_DATA_POSE')
459 layout
.menu("VIEW3D_MT_TransformMenuArmaturePose", icon
='MANIPUL')
460 layout
.menu("VIEW3D_MT_pose_transform", icon
='EMPTY_DATA')
461 layout
.menu("VIEW3D_MT_CursorMenuLite", icon
='CURSOR')
462 layout
.menu("VIEW3D_MT_PoseCopy", icon
='FILE')
464 if arm
.draw_type
in {'BBONE', 'ENVELOPE'}:
465 layout
.operator("transform.transform",
466 text
="Scale Envelope Distance").mode
= 'BONE_SIZE'
468 layout
.menu("VIEW3D_MT_pose_apply", icon
='AUTO')
469 layout
.operator("pose.relax", icon
= 'ARMATURE_DATA')
470 layout
.menu("VIEW3D_MT_KeyframeMenu", icon
='KEY_HLT')
471 layout
.menu("VIEW3D_MT_pose_specials", icon
='SOLO_OFF')
472 layout
.menu("VIEW3D_MT_pose_group", icon
= 'GROUP_BONE')
473 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
474 layout
.menu("VIEW3D_MT_Object_Interactive_Armature", icon
='VIEW3D')
475 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
476 layout
.operator("view3d.properties", icon
='MENU_PANEL')
478 ### Lattice Object Mode ###
479 if obj
and obj
.type == 'LATTICE' and obj
.mode
in {'OBJECT'}:
481 layout
.operator_context
= 'INVOKE_REGION_WIN'
482 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
484 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
485 layout
.menu("VIEW3D_MT_Select_Object", icon
='RESTRICT_SELECT_OFF')
486 layout
.menu("VIEW3D_MT_AddMenu", icon
='OBJECT_DATAMODE')
487 layout
.menu("VIEW3D_MT_Object", icon
='VIEW3D')
488 layout
.menu("VIEW3D_MT_TransformMenu", icon
='MANIPUL')
489 layout
.menu("VIEW3D_MT_MirrorMenu", icon
='MOD_MIRROR')
490 layout
.menu("VIEW3D_MT_CursorMenu", icon
='CURSOR')
491 layout
.menu("VIEW3D_MT_ParentMenu", icon
='ROTACTIVE')
492 layout
.menu("VIEW3D_MT_GroupMenu", icon
='GROUP')
493 layout
.menu("VIEW3D_MT_object_specials", text
= "Specials", icon
='SOLO_OFF')
494 layout
.menu("VIEW3D_MT_Camera_Options", icon
='OUTLINER_OB_CAMERA')
495 layout
.operator_menu_enum("object.modifier_add", "type", icon
='MODIFIER')
496 layout
.operator("object.delete", text
="Delete Object", icon
='X_VEC')
497 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
498 layout
.operator("object.editmode_toggle", text
="Enter Edit Mode",
500 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
501 layout
.operator("view3d.properties", icon
='MENU_PANEL')
504 if obj
and obj
.type == 'LATTICE' and obj
.mode
in {'EDIT'}:
506 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
508 layout
.menu("VIEW3D_MT_TransformMenu", icon
='MANIPUL')
509 layout
.menu("VIEW3D_MT_MirrorMenu", icon
='MOD_MIRROR')
510 layout
.menu("VIEW3D_MT_CursorMenu", icon
='CURSOR')
511 layout
.prop_menu_enum(settings
, "proportional_edit",
513 layout
.prop_menu_enum(settings
, "proportional_edit_falloff",
515 layout
.operator("lattice.make_regular")
516 layout
.menu("VIEW3D_MT_Select_Edit_Lattice",
517 icon
='RESTRICT_SELECT_OFF')
518 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
519 layout
.operator("object.editmode_toggle", text
="Enter Object Mode",
521 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
522 layout
.operator("view3d.properties", icon
='MENU_PANEL')
524 ### Empty Object Mode ###
525 if obj
and obj
.type == 'EMPTY' and obj
.mode
in {'OBJECT'}:
527 layout
.operator_context
= 'INVOKE_REGION_WIN'
528 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
530 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
531 layout
.menu("VIEW3D_MT_Select_Object", icon
='RESTRICT_SELECT_OFF')
532 layout
.menu("VIEW3D_MT_AddMenu", icon
='OBJECT_DATAMODE')
533 layout
.menu("VIEW3D_MT_Object", icon
='VIEW3D')
534 layout
.menu("VIEW3D_MT_TransformMenuLite", icon
='MANIPUL')
535 layout
.menu("VIEW3D_MT_MirrorMenu", icon
='MOD_MIRROR')
536 layout
.menu("VIEW3D_MT_CursorMenuLite", icon
='CURSOR')
537 layout
.menu("VIEW3D_MT_ParentMenu", icon
='ROTACTIVE')
538 layout
.menu("VIEW3D_MT_GroupMenu", icon
='GROUP')
539 layout
.menu("VIEW3D_MT_object_specials", text
= "Specials", icon
='SOLO_OFF')
540 layout
.menu("VIEW3D_MT_Camera_Options", icon
='OUTLINER_OB_CAMERA')
541 layout
.operator("object.delete", text
="Delete Object", icon
='X_VEC')
542 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
543 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
544 layout
.operator("view3d.properties", icon
='MENU_PANEL')
546 ### Speaker Object Mode ###
547 if obj
and obj
.type == 'SPEAKER' and obj
.mode
in {'OBJECT'}:
549 layout
.operator_context
= 'INVOKE_REGION_WIN'
550 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
552 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
553 layout
.menu("VIEW3D_MT_Select_Object", icon
='RESTRICT_SELECT_OFF')
554 layout
.menu("VIEW3D_MT_AddMenu", icon
='OBJECT_DATAMODE')
555 layout
.menu("VIEW3D_MT_Object", icon
='VIEW3D')
556 layout
.menu("VIEW3D_MT_TransformMenuLite", icon
='MANIPUL')
557 layout
.menu("VIEW3D_MT_CursorMenuLite", icon
='CURSOR')
558 layout
.menu("VIEW3D_MT_ParentMenu", icon
='ROTACTIVE')
559 layout
.menu("VIEW3D_MT_GroupMenu", icon
='GROUP')
560 layout
.operator("object.delete", text
="Delete Object", icon
='X_VEC')
561 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
562 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
563 layout
.operator("view3d.properties", icon
='MENU_PANEL')
566 if obj
and context
.mode
== 'PARTICLE':
568 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
570 layout
.menu("VIEW3D_MT_TransformMenu", icon
='MANIPUL')
571 layout
.menu("VIEW3D_MT_MirrorMenu", icon
='MOD_MIRROR')
572 layout
.menu("VIEW3D_MT_CursorMenuLite", icon
='CURSOR')
573 layout
.prop_menu_enum(settings
, "proportional_edit",
575 layout
.prop_menu_enum(settings
, "proportional_edit_falloff",
577 layout
.menu("VIEW3D_MT_particle", icon
='PARTICLEMODE')
578 layout
.menu("VIEW3D_MT_particle_specials", text
="Hair Specials", icon
='HAIR')
579 layout
.menu("VIEW3D_MT_Select_Particle",
580 icon
='RESTRICT_SELECT_OFF')
581 layout
.operator("object.delete", text
="Delete Object", icon
='X_VEC')
582 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
583 layout
.menu("VIEW3D_MT_Object_Interactive_Mode", icon
='VIEW3D')
584 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
585 layout
.operator("view3d.properties", icon
='MENU_PANEL')
587 ############ Object Menus #########
589 # ********** Object Menu **********
590 class VIEW3D_MT_Object(bpy
.types
.Menu
):
591 bl_context
= "objectmode"
594 def draw(self
, context
):
596 view
= context
.space_data
597 is_local_view
= (view
.local_view
is not None)
599 layout
.operator("object.delete", text
="Delete...").use_global
= False
600 layout
.menu("VIEW3D_MT_object_parent")
601 layout
.menu("VIEW3D_MT_Duplicate")
602 layout
.operator("object.join")
605 layout
.operator_context
= 'EXEC_REGION_WIN'
606 layout
.operator("object.move_to_layer", text
="Move out of Local View")
607 layout
.operator_context
= 'INVOKE_REGION_WIN'
609 layout
.operator("object.move_to_layer", text
="Move to Layer...")
611 layout
.menu("VIEW3D_MT_make_links", text
="Make Links...")
612 layout
.menu("VIEW3D_MT_Object_Data_Link")
613 layout
.menu("VIEW3D_MT_object_constraints")
614 layout
.menu("VIEW3D_MT_object_track")
615 layout
.menu("VIEW3D_MT_object_animation")
616 layout
.menu("VIEW3D_MT_object_game")
617 layout
.menu("VIEW3D_MT_object_showhide")
618 layout
.operator_menu_enum("object.convert", "target")
620 # ********** Object Add **********
621 class VIEW3D_MT_AddMenu(bpy
.types
.Menu
):
622 bl_label
= "Add Object"
624 def draw(self
, context
):
626 layout
.operator_context
= 'INVOKE_REGION_WIN'
628 layout
.menu("INFO_MT_mesh_add", text
="Add Mesh",
629 icon
='OUTLINER_OB_MESH')
630 layout
.menu("INFO_MT_curve_add", text
="Add Curve",
631 icon
='OUTLINER_OB_CURVE')
632 layout
.menu("INFO_MT_surface_add", text
="Add Surface",
633 icon
='OUTLINER_OB_SURFACE')
634 layout
.operator_menu_enum("object.metaball_add", "type",
635 icon
='OUTLINER_OB_META')
636 layout
.operator("object.text_add", text
="Add Text",
637 icon
='OUTLINER_OB_FONT')
638 layout
.menu("INFO_MT_armature_add", text
="Add Armature",
639 icon
='OUTLINER_OB_ARMATURE')
640 layout
.operator("object.add", text
="Lattice",
641 icon
='OUTLINER_OB_LATTICE').type = 'LATTICE'
642 layout
.operator_menu_enum("object.empty_add", "type", text
="Empty", icon
='OUTLINER_OB_EMPTY')
643 layout
.operator("object.speaker_add", text
="Speaker", icon
='OUTLINER_OB_SPEAKER')
644 layout
.operator("object.camera_add", text
="Camera",
645 icon
='OUTLINER_OB_CAMERA')
646 layout
.operator_menu_enum("object.lamp_add", "type",
647 icon
="OUTLINER_OB_LAMP")
648 layout
.operator_menu_enum("object.effector_add", "type",
651 layout
.menu("VIEW3D_MT_object_quick_effects", text
="Quick Effects", icon
='PARTICLES')
652 layout
.operator_menu_enum("object.group_instance_add", "group",
653 text
="Group Instance",
656 # ********** Object Manipulator **********
657 class VIEW3D_MT_ManipulatorMenu1(bpy
.types
.Menu
):
658 bl_label
= "Manipulator"
660 def draw(self
, context
):
662 layout
.operator_context
= 'INVOKE_REGION_WIN'
663 props
= layout
.operator("view3d.enable_manipulator",text
='Translate', icon
='MAN_TRANS')
664 props
.translate
= True
665 props
= layout
.operator("view3d.enable_manipulator",text
='Rotate', icon
='MAN_ROT')
667 props
= layout
.operator("view3d.enable_manipulator",text
='Scale', icon
='MAN_SCALE')
669 props
= layout
.operator("view3d.enable_manipulator",text
='Combo', icon
='MAN_SCALE')
672 props
.translate
= True
673 props
= layout
.operator("view3d.enable_manipulator",text
='Hide', icon
='MAN_SCALE')
676 props
.translate
= False
678 # ********** Object Mirror **********
679 class VIEW3D_MT_MirrorMenu(bpy
.types
.Menu
):
682 def draw(self
, context
):
684 layout
.operator("transform.mirror", text
="Interactive Mirror")
685 layout
.operator_context
= 'INVOKE_REGION_WIN'
686 props
= layout
.operator("transform.mirror", text
="X Global")
687 props
.constraint_axis
= (True, False, False)
688 props
.constraint_orientation
= 'GLOBAL'
689 props
= layout
.operator("transform.mirror", text
="Y Global")
690 props
.constraint_axis
= (False, True, False)
691 props
.constraint_orientation
= 'GLOBAL'
692 props
= layout
.operator("transform.mirror", text
="Z Global")
693 props
.constraint_axis
= (False, False, True)
694 props
.constraint_orientation
= 'GLOBAL'
696 if context
.edit_object
:
698 props
= layout
.operator("transform.mirror", text
="X Local")
699 props
.constraint_axis
= (True, False, False)
700 props
.constraint_orientation
= 'LOCAL'
701 props
= layout
.operator("transform.mirror", text
="Y Local")
702 props
.constraint_axis
= (False, True, False)
703 props
.constraint_orientation
= 'LOCAL'
704 props
= layout
.operator("transform.mirror", text
="Z Local")
705 props
.constraint_axis
= (False, False, True)
706 props
.constraint_orientation
= 'LOCAL'
707 layout
.operator("object.vertex_group_mirror")
709 # ********** Object Snap Cursor **********
710 class VIEW3D_MT_Pivot(bpy
.types
.Menu
):
713 def draw(self
, context
):
715 layout
.prop(context
.space_data
, "pivot_point", expand
=True)
716 if context
.active_object
.mode
== 'OBJECT':
717 layout
.prop(context
.space_data
, "use_pivot_point_align", text
="Center Points")
719 class VIEW3D_Snap_Context(bpy
.types
.Menu
):
720 bl_label
= "Snapping"
722 def draw(self
, context
):
724 toolsettings
= context
.tool_settings
725 layout
.prop(toolsettings
, "snap_element", expand
=True)
726 layout
.prop(toolsettings
, "use_snap")
728 class VIEW3D_Snap_Origin(bpy
.types
.Menu
):
729 bl_label
= "Snap Origin"
731 def draw(self
, context
):
733 layout
.operator_context
= 'EXEC_AREA'
734 layout
.operator("object.origin_set",
735 text
="Geometry to Origin").type = 'GEOMETRY_ORIGIN'
736 layout
.operator("object.origin_set",
737 text
="Origin to Geometry").type = 'ORIGIN_GEOMETRY'
738 layout
.operator("object.origin_set",
739 text
="Origin to 3D Cursor").type = 'ORIGIN_CURSOR'
740 layout
.operator("object.origin_set",
741 text
="Origin to Center of Mass").type = 'ORIGIN_CENTER_OF_MASS'
743 class VIEW3D_MT_CursorMenu(bpy
.types
.Menu
):
744 bl_label
= "Snap Cursor"
746 def draw(self
, context
):
748 layout
.operator_context
= 'INVOKE_REGION_WIN'
749 layout
.menu("VIEW3D_Snap_Origin")
750 layout
.menu("VIEW3D_Snap_Context")
751 layout
.operator("view3d.snap_cursor_to_selected",
752 text
="Cursor to Selected")
753 layout
.operator("view3d.snap_cursor_to_center",
754 text
="Cursor to Center")
755 layout
.operator("view3d.snap_cursor_to_grid",
756 text
="Cursor to Grid")
757 layout
.operator("view3d.snap_cursor_to_active",
758 text
="Cursor to Active")
759 layout
.operator("view3d.snap_selected_to_cursor", text
="Selection to Cursor").use_offset
= False
760 layout
.operator("view3d.snap_selected_to_cursor", text
="Selection to Cursor (Offset)").use_offset
= True
761 layout
.operator("view3d.snap_selected_to_grid",
762 text
="Selection to Grid")
763 layout
.menu("VIEW3D_MT_Pivot")
764 layout
.operator("view3d.pivot_cursor",
765 text
="Set Cursor as Pivot Point")
766 layout
.operator("view3d.revert_pivot",
767 text
="Revert Pivot Point")
769 class VIEW3D_MT_CursorMenuLite(bpy
.types
.Menu
):
770 bl_label
= "Snap Cursor"
772 def draw(self
, context
):
774 layout
.operator_context
= 'INVOKE_REGION_WIN'
775 layout
.menu("VIEW3D_Snap_Origin")
776 layout
.operator("view3d.snap_cursor_to_selected",
777 text
="Cursor to Selected")
778 layout
.operator("view3d.snap_cursor_to_center",
779 text
="Cursor to Center")
780 layout
.operator("view3d.snap_cursor_to_grid",
781 text
="Cursor to Grid")
782 layout
.operator("view3d.snap_cursor_to_active",
783 text
="Cursor to Active")
784 layout
.operator("view3d.snap_selected_to_cursor", text
="Selection to Cursor").use_offset
= False
785 layout
.operator("view3d.snap_selected_to_cursor", text
="Selection to Cursor (Offset)").use_offset
= True
786 layout
.operator("view3d.snap_selected_to_grid",
787 text
="Selection to Grid")
788 layout
.menu("VIEW3D_MT_Pivot")
789 layout
.operator("view3d.pivot_cursor",
790 text
="Set Cursor as Pivot Point")
791 layout
.operator("view3d.revert_pivot",
792 text
="Revert Pivot Point")
794 # ********** Object Interactive Mode **********
795 class InteractiveMode(bpy
.types
.Menu
):
796 bl_idname
= "VIEW3D_MT_Object_Interactive_Mode"
797 bl_label
= "Interactive Mode"
798 bl_description
= "Menu of objects interactive modes (Window Types)"
800 def draw(self
, context
):
801 self
.layout
.operator(SetObjectMode
.bl_idname
, text
="Object", icon
="OBJECT_DATAMODE").mode
= "OBJECT"
802 self
.layout
.operator(SetObjectMode
.bl_idname
, text
="Edit", icon
="EDITMODE_HLT").mode
= "EDIT"
803 self
.layout
.operator(SetObjectMode
.bl_idname
, text
="Sculpt", icon
="SCULPTMODE_HLT").mode
= "SCULPT"
804 self
.layout
.operator(SetObjectMode
.bl_idname
, text
="Vertex Paint", icon
="VPAINT_HLT").mode
= "VERTEX_PAINT"
805 self
.layout
.operator(SetObjectMode
.bl_idname
, text
="Weight Paint", icon
="WPAINT_HLT").mode
= "WEIGHT_PAINT"
806 self
.layout
.operator(SetObjectMode
.bl_idname
, text
="Texture Paint", icon
="TPAINT_HLT").mode
= "TEXTURE_PAINT"
807 self
.layout
.operator(SetObjectMode
.bl_idname
, text
="Particle Edit", icon
="PARTICLEMODE").mode
= "PARTICLE_EDIT"
809 # ********** Object Armature Interactive Mode **********
810 class InteractiveModeArmature(bpy
.types
.Menu
):
811 bl_idname
= "VIEW3D_MT_Object_Interactive_Armature"
812 bl_label
= "Interactive Mode"
813 bl_description
= "Menu of objects interactive mode"
815 def draw(self
, context
):
816 self
.layout
.operator(SetObjectMode
.bl_idname
, text
="Object", icon
="OBJECT_DATAMODE").mode
= "OBJECT"
817 self
.layout
.operator(SetObjectMode
.bl_idname
, text
="Edit", icon
="EDITMODE_HLT").mode
= "EDIT"
818 self
.layout
.operator(SetObjectMode
.bl_idname
, text
="Pose", icon
="POSE_HLT").mode
= "POSE"
820 # ********** Object Parent **********
821 class VIEW3D_MT_ParentMenu(bpy
.types
.Menu
):
824 def draw(self
, context
):
827 layout
.operator("object.parent_set", text
="Set")
828 layout
.operator("object.parent_clear", text
="Clear")
830 # ********** Object Group **********
831 class VIEW3D_MT_GroupMenu(bpy
.types
.Menu
):
834 def draw(self
, context
):
836 layout
.operator("group.create")
837 layout
.operator("group.objects_remove")
838 layout
.operator("group.objects_remove_all")
839 layout
.operator("group.objects_add_active")
840 layout
.operator("group.objects_remove_active")
842 # ********** Object Camera Options **********
843 class VIEW3D_MT_Camera_Options(bpy
.types
.Menu
):
846 def draw(self
, context
):
848 layout
.operator_context
= 'EXEC_REGION_WIN'
849 layout
.operator("object.camera_add", text
="Add Camera", icon
='OUTLINER_OB_CAMERA')
850 self
.layout
.operator("view3d.object_as_camera", text
="Object As Camera", icon
='OUTLINER_OB_CAMERA')
851 self
.layout
.operator("view3d.viewnumpad", text
="View Active Camera" , icon
='OUTLINER_OB_CAMERA').type = 'CAMERA'
854 class VIEW3D_MT_Object_Data_Link(Menu
):
855 bl_label
= "Object Data"
857 def draw(self
, context
):
860 layout
.operator_menu_enum("object.make_local", "type", text
="Make Local...")
861 layout
.menu("VIEW3D_MT_make_single_user")
862 layout
.operator("object.proxy_make", text
="Make Proxy...")
863 layout
.operator("object.make_dupli_face")
864 layout
.operator("object.data_transfer")
865 layout
.operator("object.datalayout_transfer")
867 class VIEW3D_MT_Duplicate(Menu
):
868 bl_label
= "Duplicate"
870 def draw(self
, context
):
873 layout
.operator("object.duplicate_move")
874 layout
.operator("object.duplicate_move_linked")
877 class VIEW3D_MT_KeyframeMenu(bpy
.types
.Menu
):
878 bl_label
= "Keyframe"
880 def draw(self
, context
):
882 layout
.operator("anim.keyframe_insert_menu",
883 text
="Insert Keyframe...")
884 layout
.operator("anim.keyframe_delete_v3d",
885 text
="Delete Keyframe...")
886 layout
.operator("anim.keying_set_active_set",
887 text
="Change Keying Set...")
889 class VIEW3D_MT_UndoS(bpy
.types
.Menu
):
890 bl_label
= "Undo/Redo"
892 def draw(self
, context
):
895 layout
.operator("ed.undo")
896 layout
.operator("ed.redo")
897 layout
.operator("ed.undo_history")
899 ############ Edit Mode Menu's #########
901 # ********** Edit Mesh **********
902 class VIEW3D_MT_Edit_Mesh(Menu
):
905 def draw(self
, context
):
907 toolsettings
= context
.tool_settings
909 layout
.menu("VIEW3D_MT_edit_mesh_vertices", icon
='VERTEXSEL')
910 layout
.menu("VIEW3D_MT_edit_mesh_edges", icon
='EDGESEL')
911 layout
.menu("VIEW3D_MT_edit_mesh_faces", icon
='FACESEL')
912 layout
.operator("mesh.duplicate_move")
913 layout
.menu("VIEW3D_MT_edit_mesh_clean", icon
='AUTO')
914 layout
.menu("VIEW3D_MT_edit_mesh_normals", icon
='META_DATA')
915 layout
.operator("mesh.loopcut_slide",
916 text
="Loopcut", icon
='EDIT_VEC')
917 layout
.operator("mesh.symmetrize")
918 layout
.operator("mesh.symmetry_snap")
919 layout
.operator("mesh.bisect")
920 layout
.operator_menu_enum("mesh.sort_elements", "type", text
="Sort Elements...")
921 layout
.prop(toolsettings
, "use_mesh_automerge")
922 layout
.prop_menu_enum(toolsettings
, "proportional_edit")
923 layout
.prop_menu_enum(toolsettings
, "proportional_edit_falloff")
924 layout
.menu("VIEW3D_MT_edit_mesh_showhide")
926 # ********** Edit Multiselect **********
927 class VIEW3D_MT_Edit_Multi(bpy
.types
.Menu
):
928 bl_label
= "Multi Select"
930 def draw(self
, context
):
932 layout
.operator_context
= 'INVOKE_REGION_WIN'
935 prop
= layout
.operator("wm.context_set_value", text
="Vertex Select",
937 prop
.value
= "(True, False, False)"
938 prop
.data_path
= "tool_settings.mesh_select_mode"
940 prop
= layout
.operator("wm.context_set_value", text
="Edge Select",
942 prop
.value
= "(False, True, False)"
943 prop
.data_path
= "tool_settings.mesh_select_mode"
945 prop
= layout
.operator("wm.context_set_value", text
="Face Select",
947 prop
.value
= "(False, False, True)"
948 prop
.data_path
= "tool_settings.mesh_select_mode"
951 prop
= layout
.operator("wm.context_set_value",
952 text
="Vertex & Edge Select",
954 prop
.value
= "(True, True, False)"
955 prop
.data_path
= "tool_settings.mesh_select_mode"
957 prop
= layout
.operator("wm.context_set_value",
958 text
="Vertex & Face Select",
960 prop
.value
= "(True, False, True)"
961 prop
.data_path
= "tool_settings.mesh_select_mode"
963 prop
= layout
.operator("wm.context_set_value",
964 text
="Edge & Face Select",
966 prop
.value
= "(False, True, True)"
967 prop
.data_path
= "tool_settings.mesh_select_mode"
970 prop
= layout
.operator("wm.context_set_value",
971 text
="Vertex & Edge & Face Select",
973 prop
.value
= "(True, True, True)"
974 prop
.data_path
= "tool_settings.mesh_select_mode"
976 # ********** Edit Mesh Edge **********
977 class VIEW3D_MT_EditM_Edge(bpy
.types
.Menu
):
980 def draw(self
, context
):
982 layout
.operator_context
= 'INVOKE_REGION_WIN'
984 layout
.operator("mesh.mark_seam")
985 layout
.operator("mesh.mark_seam", text
="Clear Seam").clear
= True
988 layout
.operator("mesh.mark_sharp")
989 layout
.operator("mesh.mark_sharp", text
="Clear Sharp").clear
= True
990 layout
.operator("mesh.extrude_move_along_normals", text
="Extrude")
993 layout
.operator("mesh.edge_rotate",
994 text
="Rotate Edge CW").direction
= 'CW'
995 layout
.operator("mesh.edge_rotate",
996 text
="Rotate Edge CCW").direction
= 'CCW'
999 layout
.operator("TFM_OT_edge_slide", text
="Edge Slide")
1000 layout
.operator("mesh.loop_multi_select", text
="Edge Loop")
1001 layout
.operator("mesh.loop_multi_select", text
="Edge Ring").ring
= True
1002 layout
.operator("mesh.loop_to_region")
1003 layout
.operator("mesh.region_to_loop")
1006 # ********** Edit Mesh Cursor **********
1007 class VIEW3D_MT_EditCursorMenu(bpy
.types
.Menu
):
1008 bl_label
= "Snap Cursor"
1010 def draw(self
, context
):
1011 layout
= self
.layout
1012 layout
.operator_context
= 'INVOKE_REGION_WIN'
1013 layout
.operator("object.setorigintoselected",
1014 text
="Origin to Selected V/F/E")
1015 layout
.menu("VIEW3D_Snap_Origin")
1016 layout
.menu("VIEW3D_Snap_Context")
1017 layout
.operator("view3d.snap_cursor_to_selected",
1018 text
="Cursor to Selected")
1019 layout
.operator("view3d.snap_cursor_to_center",
1020 text
="Cursor to Center")
1021 layout
.operator("view3d.snap_cursor_to_grid",
1022 text
="Cursor to Grid")
1023 layout
.operator("view3d.snap_cursor_to_active",
1024 text
="Cursor to Active")
1025 layout
.operator("view3d.snap_selected_to_cursor", text
="Selection to Cursor").use_offset
= False
1026 layout
.operator("view3d.snap_selected_to_cursor", text
="Selection to Cursor (Offset)").use_offset
= True
1027 layout
.operator("view3d.snap_selected_to_grid",
1028 text
="Selection to Grid")
1029 layout
.menu("VIEW3D_MT_Pivot")
1030 layout
.operator("view3d.pivot_cursor",
1031 text
="Set Cursor as Pivot Point")
1032 layout
.operator("view3d.revert_pivot",
1033 text
="Revert Pivot Point")
1034 layout
.operator("view3d.snap_cursor_to_edge_intersection",
1035 text
="Cursor to Edge Intersection")
1037 # ********** Edit Mesh UV **********
1038 class VIEW3D_MT_UV_Map(bpy
.types
.Menu
):
1039 bl_label
= "UV Mapping"
1041 def draw(self
, context
):
1042 layout
= self
.layout
1043 layout
.operator("uv.unwrap")
1044 layout
.operator_context
= 'INVOKE_DEFAULT'
1045 layout
.operator("uv.smart_project")
1046 layout
.operator("uv.lightmap_pack")
1047 layout
.operator("uv.follow_active_quads")
1048 layout
.operator_context
= 'EXEC_REGION_WIN'
1049 layout
.operator("uv.cube_project")
1050 layout
.operator("uv.cylinder_project")
1051 layout
.operator("uv.sphere_project")
1052 layout
.operator_context
= 'INVOKE_REGION_WIN'
1053 layout
.operator("uv.project_from_view").scale_to_bounds
= False
1054 layout
.operator("uv.project_from_view", text
="Project from View (Bounds)").scale_to_bounds
= True
1055 layout
.operator("uv.reset")
1058 # ********** Edit Curve **********
1059 class VIEW3D_MT_Edit_Curve(bpy
.types
.Menu
):
1062 def draw(self
, context
):
1063 layout
= self
.layout
1065 toolsettings
= context
.tool_settings
1067 layout
.operator("curve.extrude_move")
1068 layout
.operator("curve.spin")
1069 layout
.operator("curve.duplicate_move")
1070 layout
.operator("curve.split")
1071 layout
.operator("curve.separate")
1072 layout
.operator("curve.make_segment")
1073 layout
.operator("curve.cyclic_toggle")
1074 layout
.operator("curve.delete", text
="Delete...")
1075 layout
.menu("VIEW3D_MT_edit_curve_segments")
1076 layout
.prop_menu_enum(settings
, "proportional_edit",
1078 layout
.prop_menu_enum(settings
, "proportional_edit_falloff",
1080 layout
.menu("VIEW3D_MT_edit_curve_showhide")
1082 class VIEW3D_MT_EditCurveCtrlpoints(bpy
.types
.Menu
):
1083 bl_label
= "Control Points"
1085 def draw(self
, context
):
1086 layout
= self
.layout
1088 edit_object
= context
.edit_object
1090 if edit_object
.type == 'CURVE':
1091 layout
.operator("transform.transform").mode
= 'TILT'
1092 layout
.operator("curve.tilt_clear")
1093 layout
.operator("curve.separate")
1094 layout
.operator_menu_enum("curve.handle_type_set", "type")
1095 layout
.menu("VIEW3D_MT_hook")
1097 class VIEW3D_MT_EditCurveSegments(bpy
.types
.Menu
):
1098 bl_label
= "Curve Segments"
1100 def draw(self
, context
):
1101 layout
= self
.layout
1102 layout
.operator("curve.subdivide")
1103 layout
.operator("curve.switch_direction")
1105 class VIEW3D_MT_EditCurveSpecials(bpy
.types
.Menu
):
1106 bl_label
= "Specials"
1108 def draw(self
, context
):
1109 layout
= self
.layout
1110 layout
.operator("curve.subdivide")
1111 layout
.operator("curve.switch_direction")
1112 layout
.operator("curve.spline_weight_set")
1113 layout
.operator("curve.radius_set")
1114 layout
.operator("curve.smooth")
1115 layout
.operator("curve.smooth_weight")
1116 layout
.operator("curve.smooth_radius")
1117 layout
.operator("curve.smooth_tilt")
1119 ############ Armature Menu's #########
1122 class VIEW3D_MT_Edit_Armature(bpy
.types
.Menu
):
1123 bl_label
= "Armature"
1125 def draw(self
, context
):
1126 layout
= self
.layout
1128 edit_object
= context
.edit_object
1129 arm
= edit_object
.data
1130 toolsettings
= context
.tool_settings
1132 layout
.prop_menu_enum(toolsettings
, "proportional_edit", icon
="PROP_CON")
1133 layout
.prop_menu_enum(toolsettings
, "proportional_edit_falloff", icon
="SMOOTHCURVE")
1134 layout
.menu("VIEW3D_MT_bone_options_toggle", text
="Bone Settings")
1135 layout
.operator("armature.merge")
1136 layout
.operator("armature.fill")
1137 layout
.operator("armature.split")
1138 layout
.operator("armature.separate")
1139 layout
.operator("armature.switch_direction", text
="Switch Direction")
1140 layout
.operator_context
= 'EXEC_AREA'
1141 layout
.operator("armature.symmetrize")
1142 layout
.operator("armature.delete")
1143 layout
.operator_context
= 'INVOKE_DEFAULT'
1144 layout
.operator("armature.armature_layers")
1145 layout
.operator("armature.bone_layers")
1147 class VIEW3D_MT_EditArmatureTK(bpy
.types
.Menu
):
1148 bl_label
= "Armature Tools"
1150 def draw(self
, context
):
1151 layout
= self
.layout
1152 layout
.operator("armature.subdivide", text
="Subdivide")
1153 layout
.operator("armature.extrude_move")
1154 layout
.operator("armature.extrude_forked")
1155 layout
.operator("armature.duplicate_move")
1156 layout
.menu("VIEW3D_MT_edit_armature_delete")
1157 layout
.operator("transform.transform",
1158 text
="Scale Envelope Distance").mode
= 'BONE_SIZE'
1159 layout
.operator("transform.transform",
1160 text
="Scale B-Bone Width").mode
= 'BONE_SIZE'
1162 ############ Armature Pose Menu's #########
1164 class VIEW3D_MT_Pose(bpy
.types
.Menu
):
1167 def draw(self
, context
):
1168 layout
= self
.layout
1170 layout
.menu("VIEW3D_MT_object_animation")
1171 layout
.menu("VIEW3D_MT_pose_slide")
1172 layout
.menu("VIEW3D_MT_pose_propagate")
1173 layout
.menu("VIEW3D_MT_pose_library")
1174 layout
.menu("VIEW3D_MT_pose_motion")
1175 layout
.menu("VIEW3D_MT_pose_group")
1176 layout
.menu("VIEW3D_MT_object_parent")
1177 layout
.menu("VIEW3D_MT_pose_ik")
1178 layout
.menu("VIEW3D_MT_pose_constraints")
1179 layout
.menu("VIEW3D_MT_PoseNames")
1180 layout
.operator("pose.quaternions_flip")
1181 layout
.operator_context
= 'INVOKE_AREA'
1182 layout
.operator("armature.armature_layers", text
="Change Armature Layers...")
1183 layout
.operator("pose.bone_layers", text
="Change Bone Layers...")
1184 layout
.menu("VIEW3D_MT_pose_showhide")
1185 layout
.menu("VIEW3D_MT_bone_options_toggle", text
="Bone Settings")
1187 ############ Transform Menu's #########
1189 class VIEW3D_MT_TransformMenu(bpy
.types
.Menu
):
1190 bl_label
= "Transform"
1192 def draw(self
, context
):
1193 layout
= self
.layout
1194 layout
.menu("VIEW3D_MT_ManipulatorMenu1")
1195 layout
.menu("VIEW3D_MT_object_clear")
1196 layout
.menu("VIEW3D_MT_object_apply")
1197 layout
.operator("transform.translate", text
="Grab/Move")
1198 layout
.operator("transform.rotate", text
="Rotate")
1199 layout
.operator("transform.resize", text
="Scale")
1200 layout
.operator("transform.translate", text
="Move Texture Space").texture_space
= True
1201 layout
.operator("transform.resize", text
="Scale Texture Space").texture_space
= True
1202 layout
.operator("object.randomize_transform")
1203 layout
.operator("transform.tosphere", text
="To Sphere")
1204 layout
.operator("transform.shear", text
="Shear")
1205 layout
.operator("transform.bend", text
="Bend")
1206 layout
.operator("transform.push_pull", text
="Push/Pull")
1207 layout
.operator("object.align")
1208 layout
.operator_context
= 'EXEC_REGION_WIN'
1209 layout
.operator("transform.transform",
1210 text
="Align to Transform Orientation").mode
= 'ALIGN'
1212 # ********** Edit Mesh Transform **********
1213 class VIEW3D_MT_TransformMenuEdit(bpy
.types
.Menu
):
1214 bl_label
= "Transform"
1216 def draw(self
, context
):
1217 layout
= self
.layout
1218 layout
.menu("VIEW3D_MT_ManipulatorMenu1")
1219 layout
.operator("transform.translate", text
="Grab/Move")
1220 layout
.operator("transform.rotate", text
="Rotate")
1221 layout
.operator("transform.resize", text
="Scale")
1222 layout
.operator("transform.tosphere", text
="To Sphere")
1223 layout
.operator("transform.shear", text
="Shear")
1224 layout
.operator("transform.bend", text
="Bend")
1225 layout
.operator("transform.push_pull", text
="Push/Pull")
1226 layout
.operator("transform.vertex_warp", text
="Warp")
1227 layout
.operator("transform.vertex_random", text
="Randomize")
1228 layout
.operator("transform.translate", text
="Move Texture Space").texture_space
= True
1229 layout
.operator("transform.resize", text
="Scale Texture Space").texture_space
= True
1230 layout
.operator_context
= 'EXEC_REGION_WIN'
1231 layout
.operator("transform.transform",
1232 text
="Align to Transform Orientation").mode
= 'ALIGN'
1233 layout
.operator_context
= 'EXEC_AREA'
1234 layout
.operator("object.origin_set",
1235 text
="Geometry to Origin").type = 'GEOMETRY_ORIGIN'
1237 # ********** Transform Lite/Short **********
1238 class VIEW3D_MT_TransformMenuLite(bpy
.types
.Menu
):
1239 bl_label
= "Transform"
1241 def draw(self
, context
):
1242 layout
= self
.layout
1243 layout
.menu("VIEW3D_MT_ManipulatorMenu1")
1244 layout
.menu("VIEW3D_MT_object_clear")
1245 layout
.menu("VIEW3D_MT_object_apply")
1246 layout
.operator("transform.translate", text
="Grab/Move")
1247 layout
.operator("transform.rotate", text
="Rotate")
1248 layout
.operator("transform.resize", text
="Scale")
1249 layout
.operator("transform.transform",
1250 text
="Align to Transform Orientation").mode
= 'ALIGN'
1252 # ********** Transform Camera **********
1253 class VIEW3D_MT_TransformMenuCamera(bpy
.types
.Menu
):
1254 bl_label
= "Transform"
1256 def draw(self
, context
):
1257 layout
.menu("VIEW3D_MT_ManipulatorMenu1")
1258 layout
.menu("VIEW3D_MT_object_clear")
1259 layout
.menu("VIEW3D_MT_object_apply")
1260 layout
.operator("transform.translate", text
="Grab/Move")
1261 layout
.operator("transform.rotate", text
="Rotate")
1262 layout
.operator("transform.resize", text
="Scale")
1263 layout
.operator("object.align")
1264 layout
.operator_context
= 'EXEC_REGION_WIN'
1265 layout
.operator("transform.transform",
1266 text
="Align to Transform Orientation").mode
= 'ALIGN'
1268 # ********** Transform Armature **********
1269 class VIEW3D_MT_TransformMenuArmature(bpy
.types
.Menu
):
1270 bl_label
= "Transform"
1272 def draw(self
, context
):
1273 layout
= self
.layout
1274 layout
.menu("VIEW3D_MT_ManipulatorMenu1")
1275 layout
.operator("transform.translate", text
="Grab/Move")
1276 layout
.operator("transform.rotate", text
="Rotate")
1277 layout
.operator("transform.resize", text
="Scale")
1278 layout
.operator("armature.align")
1279 layout
.operator("object.align")
1280 layout
.operator_context
= 'EXEC_AREA'
1281 layout
.operator("object.origin_set",
1282 text
="Geometry to Origin").type = 'GEOMETRY_ORIGIN'
1283 layout
.operator("object.origin_set",
1284 text
="Origin to Geometry").type = 'ORIGIN_GEOMETRY'
1285 layout
.operator("object.origin_set",
1286 text
="Origin to 3D Cursor").type = 'ORIGIN_CURSOR'
1287 layout
.operator("object.origin_set",
1288 text
="Origin to Center of Mass").type = 'ORIGIN_CENTER_OF_MASS'
1290 # ********** Transform Armature Edit **********
1291 class VIEW3D_MT_TransformMenuArmatureEdit(bpy
.types
.Menu
):
1292 bl_label
= "Transform"
1294 def draw(self
, context
):
1295 layout
= self
.layout
1296 layout
.menu("VIEW3D_MT_ManipulatorMenu1")
1297 layout
.operator("transform.translate", text
="Grab/Move")
1298 layout
.operator("transform.rotate", text
="Rotate")
1299 layout
.operator("transform.resize", text
="Scale")
1300 layout
.operator("transform.tosphere", text
="To Sphere")
1301 layout
.operator("transform.shear", text
="Shear")
1302 layout
.operator("transform.bend", text
="Bend")
1303 layout
.operator("transform.push_pull", text
="Push/Pull")
1304 layout
.operator("transform.vertex_warp", text
="Warp")
1305 layout
.operator("transform.vertex_random", text
="Randomize")
1306 layout
.operator("armature.align")
1307 layout
.operator_context
= 'EXEC_AREA'
1309 # ********** Transform Armature Pose **********
1310 class VIEW3D_MT_TransformMenuArmaturePose(bpy
.types
.Menu
):
1311 bl_label
= "Transform"
1313 def draw(self
, context
):
1314 layout
= self
.layout
1315 layout
.menu("VIEW3D_MT_ManipulatorMenu1")
1316 layout
.operator("transform.translate", text
="Grab/Move")
1317 layout
.operator("transform.rotate", text
="Rotate")
1318 layout
.operator("transform.resize", text
="Scale")
1320 layout
.operator("pose.transforms_clear", text
="Clear All")
1321 layout
.operator("pose.loc_clear", text
="Location")
1322 layout
.operator("pose.rot_clear", text
="Rotation")
1323 layout
.operator("pose.scale_clear", text
="Scale")
1327 layout
.operator("pose.user_transforms_clear", text
="Reset unkeyed")
1328 obj
= context
.object
1329 if obj
.type == 'ARMATURE' and obj
.mode
in {'EDIT', 'POSE'}:
1330 if obj
.data
.draw_type
== 'BBONE':
1331 layout
.operator("transform.transform", text
="Scale BBone").mode
= 'BONE_SIZE'
1332 elif obj
.data
.draw_type
== 'ENVELOPE':
1333 layout
.operator("transform.transform", text
="Scale Envelope Distance").mode
= 'BONE_SIZE'
1334 layout
.operator("transform.transform", text
="Scale Radius").mode
= 'BONE_ENVELOPE'
1336 ############ View Menu's #########
1338 class VIEW3D_MT_View_Directions(bpy
.types
.Menu
):
1339 bl_label
= "Directions"
1341 def draw(self
, context
):
1342 layout
= self
.layout
1343 layout
.operator("view3d.viewnumpad", text
="Camera").type = 'CAMERA'
1344 layout
.operator("view3d.viewnumpad", text
="Top").type = 'TOP'
1345 layout
.operator("view3d.viewnumpad", text
="Bottom").type = 'BOTTOM'
1346 layout
.operator("view3d.viewnumpad", text
="Front").type = 'FRONT'
1347 layout
.operator("view3d.viewnumpad", text
="Back").type = 'BACK'
1348 layout
.operator("view3d.viewnumpad", text
="Right").type = 'RIGHT'
1349 layout
.operator("view3d.viewnumpad", text
="Left").type = 'LEFT'
1351 class VIEW3D_MT_View_Border(bpy
.types
.Menu
):
1352 bl_label
= "Set Border"
1354 def draw(self
, context
):
1355 layout
= self
.layout
1356 layout
.operator_context
= 'INVOKE_REGION_WIN'
1357 layout
.operator("view3d.clip_border", text
="Clipping Border...")
1358 layout
.operator("view3d.zoom_border", text
="Zoom Border...")
1359 layout
.operator("view3d.render_border", text
="Render Border...").camera_only
= False
1361 class VIEW3D_MT_View_Toggle(bpy
.types
.Menu
):
1362 bl_label
= "View Toggle"
1364 def draw(self
, context
):
1365 layout
= self
.layout
1366 layout
.operator_context
= 'INVOKE_REGION_WIN'
1367 layout
.operator("screen.area_dupli")
1368 layout
.operator("screen.region_quadview")
1369 layout
.operator("screen.screen_full_area", text
="Toggle Maximize Area")
1370 layout
.operator("screen.screen_full_area").use_hide_panels
= True
1373 class VIEW3D_MT_View_Menu(bpy
.types
.Menu
):
1376 def draw(self
, context
):
1377 layout
= self
.layout
1378 layout
.menu("VIEW3D_MT_view_cameras", text
="Cameras")
1379 layout
.menu("VIEW3D_MT_View_Directions")
1380 layout
.menu("VIEW3D_MT_View_Navigation")
1381 layout
.menu("VIEW3D_MT_Shade")
1382 layout
.menu("VIEW3D_MT_View_Align")
1383 layout
.menu("VIEW3D_MT_View_Toggle")
1384 layout
.operator("view3d.view_persportho")
1385 layout
.operator("view3d.localview", text
="View Global/Local")
1386 layout
.operator("view3d.view_selected").use_all_regions
= False
1387 layout
.operator("view3d.view_all").center
= False
1388 layout
.menu("VIEW3D_MT_View_Border")
1389 layout
.operator("screen.area_dupli")
1390 layout
.operator("view3d.layers", text
="Show All Layers").nr
= 0
1391 layout
.operator("screen.animation_play", text
="Playback Animation")
1393 class VIEW3D_MT_View_Navigation(bpy
.types
.Menu
):
1394 bl_label
= "Navigation"
1396 def draw(self
, context
):
1398 layout
= self
.layout
1399 layout
.operator_enum("view3d.view_orbit", "type")
1400 props
= layout
.operator("view3d.view_orbit", "Orbit Opposite")
1401 props
.type = 'ORBITRIGHT'
1404 layout
.operator("view3d.view_roll", text
="Roll Left").type = 'LEFT'
1405 layout
.operator("view3d.view_roll", text
="Roll Right").type = 'RIGHT'
1406 layout
.operator_enum("view3d.view_pan", "type")
1407 layout
.operator("view3d.zoom", text
="Zoom In").delta
= 1
1408 layout
.operator("view3d.zoom", text
="Zoom Out").delta
= -1
1409 layout
.operator("view3d.zoom_camera_1_to_1", text
="Zoom Camera 1:1")
1410 layout
.operator("view3d.fly")
1411 layout
.operator("view3d.walk")
1413 class VIEW3D_MT_View_Align(bpy
.types
.Menu
):
1414 bl_label
= "Align View"
1416 def draw(self
, context
):
1417 layout
= self
.layout
1418 layout
.operator("view3d.view_all", text
="Center Cursor and View All").center
= True
1419 layout
.operator("view3d.camera_to_view", text
="Align Active Camera to View")
1420 layout
.operator("view3d.camera_to_view_selected", text
="Align Active Camera to Selected")
1421 layout
.operator("view3d.view_selected")
1422 layout
.operator("view3d.view_center_cursor")
1423 layout
.operator("view3d.view_lock_to_active")
1424 layout
.operator("view3d.view_lock_clear")
1426 class VIEW3D_MT_View_Align_Selected(bpy
.types
.Menu
):
1427 bl_label
= "Align View to Active"
1429 def draw(self
, context
):
1430 layout
= self
.layout
1431 props
= layout
.operator("view3d.viewnumpad", text
="Top")
1432 props
.align_active
= True
1434 props
= layout
.operator("view3d.viewnumpad", text
="Bottom")
1435 props
.align_active
= True
1436 props
.type = 'BOTTOM'
1437 props
= layout
.operator("view3d.viewnumpad", text
="Front")
1438 props
.align_active
= True
1439 props
.type = 'FRONT'
1440 props
= layout
.operator("view3d.viewnumpad", text
="Back")
1441 props
.align_active
= True
1443 props
= layout
.operator("view3d.viewnumpad", text
="Right")
1444 props
.align_active
= True
1445 props
.type = 'RIGHT'
1446 props
= layout
.operator("view3d.viewnumpad", text
="Left")
1447 props
.align_active
= True
1450 class VIEW3D_MT_View_Cameras(bpy
.types
.Menu
):
1451 bl_label
= "Cameras"
1453 def draw(self
, context
):
1454 layout
= self
.layout
1455 layout
.operator("view3d.object_as_camera")
1456 layout
.operator("view3d.viewnumpad", text
="Active Camera").type = 'CAMERA'
1458 class VIEW3D_MT_Shade(Menu
):
1461 def draw(self
, context
):
1462 layout
= self
.layout
1464 layout
.prop(context
.space_data
, "viewport_shade", expand
=True)
1466 if context
.active_object
:
1467 if(context
.mode
== 'EDIT_MESH'):
1468 layout
.operator("MESH_OT_faces_shade_smooth")
1469 layout
.operator("MESH_OT_faces_shade_flat")
1471 layout
.operator("OBJECT_OT_shade_smooth")
1472 layout
.operator("OBJECT_OT_shade_flat")
1474 ############ Select Menu's #########
1477 class VIEW3D_MT_Select_Object(bpy
.types
.Menu
):
1480 def draw(self
, context
):
1481 layout
= self
.layout
1482 layout
.operator_context
= 'INVOKE_REGION_WIN'
1483 layout
.operator("view3d.select_border")
1484 layout
.operator("view3d.select_circle")
1485 layout
.operator("object.select_all").action
= 'TOGGLE'
1486 layout
.operator("object.select_all", text
="Inverse").action
= 'INVERT'
1487 layout
.operator("object.select_random", text
="Random")
1488 layout
.operator("object.select_mirror", text
="Mirror")
1489 layout
.operator("object.select_by_layer", text
="Select All by Layer")
1490 layout
.operator_menu_enum("object.select_by_type", "type",
1491 text
="Select All by Type...")
1492 layout
.operator("object.select_camera", text
="Select Camera")
1493 layout
.operator_menu_enum("object.select_grouped", "type",
1495 layout
.operator_menu_enum("object.select_linked", "type",
1497 layout
.operator("object.select_pattern", text
="Select Pattern...")
1498 layout
.menu("VIEW3D_MT_Select_Object_More_Less", text
="More/Less")
1500 class VIEW3D_MT_Select_Object_More_Less(bpy
.types
.Menu
):
1501 bl_label
= "Select More/Less"
1503 def draw(self
, context
):
1504 layout
= self
.layout
1505 layout
.operator("object.select_more", text
="More")
1506 layout
.operator("object.select_less", text
="Less")
1507 props
= layout
.operator("object.select_hierarchy", text
="Parent")
1508 props
.extend
= False
1509 props
.direction
= 'PARENT'
1510 props
= layout
.operator("object.select_hierarchy", text
="Child")
1511 props
.extend
= False
1512 props
.direction
= 'CHILD'
1513 props
= layout
.operator("object.select_hierarchy", text
="Extend Parent")
1515 props
.direction
= 'PARENT'
1516 props
= layout
.operator("object.select_hierarchy", text
="Extend Child")
1518 props
.direction
= 'CHILD'
1521 class VIEW3D_MT_Select_Edit_Mesh(bpy
.types
.Menu
):
1524 def draw(self
, context
):
1525 layout
= self
.layout
1526 layout
.operator("view3d.select_border")
1527 layout
.operator("view3d.select_circle")
1528 layout
.operator("mesh.select_all").action
= 'TOGGLE'
1529 layout
.operator("mesh.select_all", text
="Inverse").action
= 'INVERT'
1530 layout
.operator("mesh.select_linked", text
="Linked")
1531 layout
.operator("mesh.faces_select_linked_flat",
1532 text
="Linked Flat Faces")
1533 layout
.operator("mesh.select_random", text
="Random")
1534 layout
.operator("mesh.select_nth", text
="Every N Number of Verts")
1535 layout
.menu("VIEW3D_MT_Edit_Mesh_Select_Trait")
1536 layout
.menu("VIEW3D_MT_Edit_Mesh_Select_Similar")
1537 layout
.menu("VIEW3D_MT_Edit_Mesh_Select_More_Less")
1538 layout
.operator("mesh.select_mirror", text
="Mirror")
1539 layout
.operator("mesh.edges_select_sharp", text
="Sharp Edges")
1540 layout
.operator("mesh.select_axis", text
="Side of Active")
1541 layout
.operator("mesh.shortest_path_select", text
="Shortest Path")
1542 layout
.operator("mesh.loop_multi_select", text
="Edge Loops").ring
= False
1543 layout
.operator("mesh.loop_multi_select", text
="Edge Rings").ring
= True
1544 layout
.operator("mesh.loop_to_region")
1545 layout
.operator("mesh.region_to_loop")
1547 class VIEW3D_MT_Edit_Mesh_Select_Similar(bpy
.types
.Menu
):
1548 bl_label
= "Select Similar"
1550 def draw(self
, context
):
1551 layout
= self
.layout
1552 layout
.operator_enum("mesh.select_similar", "type")
1553 layout
.operator("mesh.select_similar_region", text
="Face Regions")
1555 class VIEW3D_MT_Edit_Mesh_Select_Trait(bpy
.types
.Menu
):
1556 bl_label
= "Select All by Trait"
1558 def draw(self
, context
):
1559 layout
= self
.layout
1560 if context
.scene
.tool_settings
.mesh_select_mode
[2] is False:
1561 layout
.operator("mesh.select_non_manifold", text
="Non Manifold")
1562 layout
.operator("mesh.select_loose", text
="Loose Geometry")
1563 layout
.operator("mesh.select_interior_faces", text
="Interior Faces")
1564 layout
.operator("mesh.select_face_by_sides", text
="By Number of Verts")
1565 layout
.operator("mesh.select_ungrouped", text
="Ungrouped Verts")
1567 class VIEW3D_MT_Edit_Mesh_Select_More_Less(bpy
.types
.Menu
):
1568 bl_label
= "Select More/Less"
1570 def draw(self
, context
):
1571 layout
= self
.layout
1572 layout
.operator("mesh.select_more", text
="More")
1573 layout
.operator("mesh.select_less", text
="Less")
1574 layout
.operator("mesh.select_next_item", text
="Next Active")
1575 layout
.operator("mesh.select_prev_item", text
="Previous Active")
1577 ## Edit Curve Select ##
1578 class VIEW3D_MT_Select_Edit_Curve(bpy
.types
.Menu
):
1581 def draw(self
, context
):
1582 layout
= self
.layout
1583 layout
.operator("view3d.select_border")
1584 layout
.operator("view3d.select_circle")
1585 layout
.operator("curve.select_all").action
= 'TOGGLE'
1586 layout
.operator("curve.select_all", text
="Inverse").action
= 'INVERT'
1587 layout
.operator("curve.select_random")
1588 layout
.operator("curve.select_nth")
1589 layout
.operator("curve.select_linked", text
="Select Linked")
1590 layout
.operator("curve.select_similar", text
="Select Similar")
1591 layout
.operator("curve.de_select_first")
1592 layout
.operator("curve.de_select_last")
1593 layout
.operator("curve.select_next")
1594 layout
.operator("curve.select_previous")
1595 layout
.operator("curve.select_more")
1596 layout
.operator("curve.select_less")
1598 ## Armature Select ##
1599 class VIEW3D_MT_SelectArmatureMenu(bpy
.types
.Menu
):
1602 def draw(self
, context
):
1603 layout
= self
.layout
1604 layout
.operator("view3d.select_border")
1605 layout
.operator("armature.select_all")
1606 layout
.operator("armature.select_inverse", text
="Inverse")
1607 layout
.operator("armature.select_hierarchy",
1608 text
="Parent").direction
= 'PARENT'
1609 layout
.operator("armature.select_hierarchy",
1610 text
="Child").direction
= 'CHILD'
1611 props
= layout
.operator("armature.select_hierarchy",
1612 text
="Extend Parent")
1614 props
.direction
= 'PARENT'
1615 props
= layout
.operator("armature.select_hierarchy",
1616 text
="Extend Child")
1618 props
.direction
= 'CHILD'
1619 layout
.operator("object.select_pattern", text
="Select Pattern...")
1621 class VIEW3D_MT_Select_Edit_Armature(bpy
.types
.Menu
):
1624 def draw(self
, context
):
1625 layout
= self
.layout
1627 layout
.operator("view3d.select_border")
1628 layout
.operator("view3d.select_circle")
1632 layout
.operator("armature.select_all").action
= 'TOGGLE'
1633 layout
.operator("armature.select_all", text
="Inverse").action
= 'INVERT'
1634 layout
.operator("armature.select_mirror", text
="Mirror").extend
= False
1638 layout
.operator("armature.select_more", text
="More")
1639 layout
.operator("armature.select_less", text
="Less")
1643 props
= layout
.operator("armature.select_hierarchy", text
="Parent")
1644 props
.extend
= False
1645 props
.direction
= 'PARENT'
1647 props
= layout
.operator("armature.select_hierarchy", text
="Child")
1648 props
.extend
= False
1649 props
.direction
= 'CHILD'
1653 props
= layout
.operator("armature.select_hierarchy", text
="Extend Parent")
1655 props
.direction
= 'PARENT'
1657 props
= layout
.operator("armature.select_hierarchy", text
="Extend Child")
1659 props
.direction
= 'CHILD'
1661 layout
.operator_menu_enum("armature.select_similar", "type", text
="Similar")
1662 layout
.operator("object.select_pattern", text
="Select Pattern...")
1664 class VIEW3D_MT_Select_Pose(bpy
.types
.Menu
):
1667 def draw(self
, context
):
1668 layout
= self
.layout
1669 layout
.operator("view3d.select_border")
1670 layout
.operator("view3d.select_circle")
1671 layout
.operator("pose.select_all").action
= 'TOGGLE'
1672 layout
.operator("pose.select_all", text
="Inverse").action
= 'INVERT'
1673 layout
.operator("pose.select_mirror", text
="Flip Active")
1674 layout
.operator("pose.select_constraint_target",
1675 text
="Constraint Target")
1676 layout
.operator("pose.select_linked", text
="Linked")
1677 layout
.operator("pose.select_hierarchy",
1678 text
="Parent").direction
= 'PARENT'
1679 layout
.operator("pose.select_hierarchy",
1680 text
="Child").direction
= 'CHILD'
1681 props
= layout
.operator("pose.select_hierarchy", text
="Extend Parent")
1683 props
.direction
= 'PARENT'
1684 props
= layout
.operator("pose.select_hierarchy", text
="Extend Child")
1686 props
.direction
= 'CHILD'
1687 layout
.operator_menu_enum("pose.select_grouped", "type",
1689 layout
.operator("object.select_pattern", text
="Select Pattern...")
1690 layout
.menu("VIEW3D_MT_select_pose_more_less")
1692 class VIEW3D_MT_Select_Pose_More_Less(bpy
.types
.Menu
):
1693 bl_label
= "Select More/Less"
1695 def draw(self
, context
):
1696 layout
= self
.layout
1697 props
= layout
.operator("pose.select_hierarchy", text
="Parent")
1698 props
.extend
= False
1699 props
.direction
= 'PARENT'
1701 props
= layout
.operator("pose.select_hierarchy", text
="Child")
1702 props
.extend
= False
1703 props
.direction
= 'CHILD'
1705 props
= layout
.operator("pose.select_hierarchy", text
="Extend Parent")
1707 props
.direction
= 'PARENT'
1709 props
= layout
.operator("pose.select_hierarchy", text
="Extend Child")
1711 props
.direction
= 'CHILD'
1713 class VIEW3D_MT_PoseCopy(bpy
.types
.Menu
):
1714 bl_label
= "Pose Copy"
1716 def draw(self
, context
):
1717 layout
= self
.layout
1718 layout
.operator("pose.copy")
1719 layout
.operator("pose.paste")
1720 layout
.operator("pose.paste",
1721 text
="Paste X-Flipped Pose").flipped
= True
1723 class VIEW3D_MT_PoseNames(bpy
.types
.Menu
):
1724 bl_label
= "Pose Names"
1726 def draw(self
, context
):
1727 layout
= self
.layout
1728 layout
.operator_context
= 'EXEC_AREA'
1729 layout
.operator("pose.autoside_names",
1730 text
="AutoName Left/Right").axis
= 'XAXIS'
1731 layout
.operator("pose.autoside_names",
1732 text
="AutoName Front/Back").axis
= 'YAXIS'
1733 layout
.operator("pose.autoside_names",
1734 text
="AutoName Top/Bottom").axis
= 'ZAXIS'
1735 layout
.operator("pose.flip_names")
1737 ## Surface Select ##
1738 class VIEW3D_MT_Select_Edit_Surface(bpy
.types
.Menu
):
1741 def draw(self
, context
):
1742 layout
= self
.layout
1743 layout
.operator("view3d.select_border")
1744 layout
.operator("view3d.select_circle")
1745 layout
.operator("curve.select_all").action
= 'TOGGLE'
1746 layout
.operator("curve.select_all", text
="Inverse").action
= 'INVERT'
1747 layout
.operator("curve.select_random")
1748 layout
.operator("curve.select_nth")
1749 layout
.operator("curve.select_linked", text
="Select Linked")
1750 layout
.operator("curve.select_similar", text
="Select Similar")
1751 layout
.operator("curve.select_row")
1752 layout
.operator("curve.select_more")
1753 layout
.operator("curve.select_less")
1755 ## Metaball Select ##
1756 class VIEW3D_MT_SelectMetaball(bpy
.types
.Menu
):
1759 def draw(self
, context
):
1760 layout
= self
.layout
1761 layout
.operator("view3d.select_border")
1762 layout
.operator("mball.select_all").action
= 'TOGGLE'
1763 layout
.operator("mball.select_all").action
= 'INVERT'
1764 layout
.operator("mball.select_random_metaelems")
1766 class VIEW3D_MT_Select_Edit_Metaball(bpy
.types
.Menu
):
1769 def draw(self
, context
):
1770 layout
= self
.layout
1771 layout
.operator("view3d.select_border")
1772 layout
.operator("view3d.select_circle")
1773 layout
.operator("mball.select_all").action
= 'TOGGLE'
1774 layout
.operator("mball.select_all", text
="Inverse").action
= 'INVERT'
1775 layout
.operator("mball.select_random_metaelems")
1776 layout
.operator_menu_enum("mball.select_similar", "type", text
="Similar")
1778 ## Particle Select ##
1779 class VIEW3D_MT_Select_Particle(bpy
.types
.Menu
):
1782 def draw(self
, context
):
1783 layout
= self
.layout
1785 layout
.operator("view3d.select_border")
1789 layout
.operator("particle.select_all").action
= 'TOGGLE'
1790 layout
.operator("particle.select_linked")
1791 layout
.operator("particle.select_all", text
="Inverse").action
= 'INVERT'
1795 layout
.operator("particle.select_more")
1796 layout
.operator("particle.select_less")
1800 layout
.operator("particle.select_random")
1804 layout
.operator("particle.select_roots", text
="Roots")
1805 layout
.operator("particle.select_tips", text
="Tips")
1807 ## Lattice Edit Select ##
1808 class VIEW3D_MT_Select_Edit_Lattice(bpy
.types
.Menu
):
1811 def draw(self
, context
):
1812 layout
= self
.layout
1814 layout
.operator("view3d.select_border")
1815 layout
.operator("view3d.select_circle")
1816 layout
.operator("lattice.select_mirror")
1817 layout
.operator("lattice.select_random")
1818 layout
.operator("lattice.select_all").action
= 'TOGGLE'
1819 layout
.operator("lattice.select_all", text
="Inverse").action
= 'INVERT'
1820 layout
.operator("lattice.select_ungrouped", text
="Ungrouped Verts")
1822 ## Grease Pencil Select ##
1823 class VIEW3D_MT_Select_Gpencil(bpy
.types
.Menu
):
1824 # To Do: used in 3dview header might work if mapped to mouse
1825 # Not in Class List yet
1828 def draw(self
, context
):
1829 layout
= self
.layout
1831 layout
.operator("gpencil.select_border")
1832 layout
.operator("gpencil.select_circle")
1836 layout
.operator("gpencil.select_all", text
="(De)select All").action
= 'TOGGLE'
1837 layout
.operator("gpencil.select_all", text
="Inverse").action
= 'INVERT'
1838 layout
.operator("gpencil.select_linked", text
="Linked")
1839 #layout.operator_menu_enum("gpencil.select_grouped", "type", text="Grouped")
1840 layout
.operator("gpencil.select_grouped", text
="Grouped")
1844 layout
.operator("gpencil.select_more")
1845 layout
.operator("gpencil.select_less")
1848 class VIEW3D_MT_Select_Edit_Text(bpy
.types
.Menu
):
1849 # To Do: used in 3dview header might work if mapped to mouse
1850 # Not in Class List yet
1853 def draw(self
, context
):
1854 layout
= self
.layout
1855 layout
.operator("font.text_copy", text
="Copy")
1856 layout
.operator("font.text_cut", text
="Cut")
1857 layout
.operator("font.text_paste", text
="Paste")
1858 layout
.operator("font.text_paste_from_file")
1859 layout
.operator("font.select_all")
1861 ## Paint Mode Menus ##
1862 class VIEW3D_MT_Select_Paint_Mask(bpy
.types
.Menu
):
1865 def draw(self
, context
):
1866 layout
= self
.layout
1867 layout
.operator("view3d.select_border")
1868 layout
.operator("view3d.select_circle")
1869 layout
.operator("paint.face_select_all").action
= 'TOGGLE'
1870 layout
.operator("paint.face_select_all", text
="Inverse").action
= 'INVERT'
1871 layout
.operator("paint.face_select_linked", text
="Linked")
1874 class VIEW3D_MT_Select_Paint_Mask_Vertex(bpy
.types
.Menu
):
1877 def draw(self
, context
):
1878 layout
= self
.layout
1879 layout
.operator("view3d.select_border")
1880 layout
.operator("view3d.select_circle")
1881 layout
.operator("paint.vert_select_all").action
= 'TOGGLE'
1882 layout
.operator("paint.vert_select_all", text
="Inverse").action
= 'INVERT'
1883 layout
.operator("paint.vert_select_ungrouped", text
="Ungrouped Verts")
1886 class VIEW3D_MT_Angle_Control(bpy
.types
.Menu
):
1887 bl_label
= "Angle Control"
1890 def poll(cls
, context
):
1891 settings
= UnifiedPaintPanel
.paint_settings(context
)
1895 brush
= settings
.brush
1896 tex_slot
= brush
.texture_slot
1898 return tex_slot
.has_texture_angle
and tex_slot
.has_texture_angle_source
1900 def draw(self
, context
):
1901 layout
= self
.layout
1903 settings
= UnifiedPaintPanel
.paint_settings(context
)
1904 brush
= settings
.brush
1906 sculpt
= (context
.sculpt_object
is not None)
1908 tex_slot
= brush
.texture_slot
1910 layout
.prop(tex_slot
, "use_rake", text
="Rake")
1912 if brush
.brush_capabilities
.has_random_texture_angle
and tex_slot
.has_random_texture_angle
:
1914 if brush
.sculpt_capabilities
.has_random_texture_angle
:
1915 layout
.prop(tex_slot
, "use_random", text
="Random")
1917 layout
.prop(tex_slot
, "use_random", text
="Random")
1920 ## Cursor Menu Operators ##
1921 class VIEW3D_OT_Pivot_Cursor(bpy
.types
.Operator
):
1922 "Cursor as Pivot Point"
1923 bl_idname
= "view3d.pivot_cursor"
1924 bl_label
= "Cursor as Pivot Point"
1927 def poll(cls
, context
):
1928 return bpy
.context
.space_data
.pivot_point
!= 'CURSOR'
1930 def execute(self
, context
):
1931 bpy
.context
.space_data
.pivot_point
= 'CURSOR'
1934 class VIEW3D_OT_Revert_Pivot(bpy
.types
.Operator
):
1935 "Revert Pivot Point"
1936 bl_idname
= "view3d.revert_pivot"
1937 bl_label
= "Reverts Pivot Point to median"
1940 def poll(cls
, context
):
1941 return bpy
.context
.space_data
.pivot_point
!= 'MEDIAN_POINT'
1943 def execute(self
, context
):
1944 bpy
.context
.space_data
.pivot_point
= 'MEDIAN_POINT'
1947 ## Cursor Edge Intersection Defs ##
1954 def edgeIntersect(context
, operator
):
1955 from mathutils
.geometry
import intersect_line_line
1957 obj
= context
.active_object
1959 if (obj
.type != "MESH"):
1960 operator
.report({'ERROR'}, "Object must be a mesh")
1965 verts
= mesh
.vertices
1967 is_editmode
= (obj
.mode
== 'EDIT')
1969 bpy
.ops
.object.mode_set(mode
='OBJECT')
1971 for e
in mesh
.edges
:
1979 bpy
.ops
.object.mode_set(mode
='EDIT')
1982 operator
.report({'ERROR'},
1983 "Operator requires exactly 2 edges to be selected")
1986 line
= intersect_line_line(verts
[edges
[0].vertices
[0]].co
,
1987 verts
[edges
[0].vertices
[1]].co
,
1988 verts
[edges
[1].vertices
[0]].co
,
1989 verts
[edges
[1].vertices
[1]].co
)
1992 operator
.report({'ERROR'}, "Selected edges do not intersect")
1995 point
= line
[0].lerp(line
[1], 0.5)
1996 context
.scene
.cursor_location
= obj
.matrix_world
* point
1998 ## Cursor Edge Intersection Operator ##
1999 class VIEW3D_OT_CursorToEdgeIntersection(bpy
.types
.Operator
):
2000 "Finds the mid-point of the shortest distance between two edges"
2002 bl_idname
= "view3d.snap_cursor_to_edge_intersection"
2003 bl_label
= "Cursor to Edge Intersection"
2006 def poll(cls
, context
):
2007 obj
= context
.active_object
2008 return obj
!= None and obj
.type == 'MESH'
2010 def execute(self
, context
):
2011 edgeIntersect(context
, self
)
2014 ### Set Mode Operator ###
2016 class SetObjectMode(bpy
.types
.Operator
):
2017 bl_idname
= "object.set_object_mode"
2018 bl_label
= "Set the object interactive mode"
2019 bl_description
= "I set the interactive mode of object"
2020 bl_options
= {'REGISTER'}
2022 mode
= bpy
.props
.StringProperty(name
="Interactive mode", default
="OBJECT")
2024 def execute(self
, context
):
2025 if (context
.active_object
):
2027 bpy
.ops
.object.mode_set(mode
=self
.mode
)
2029 self
.report(type={"WARNING"}, message
=context
.active_object
.name
+" It is not possible to enter into the interactive mode")
2031 self
.report(type={"WARNING"}, message
="There is no active object")
2034 ## Origin To Selected Edit Mode ##
2035 def vfeOrigin(context
):
2036 cursorPositionX
= bpy
.context
.scene
.cursor_location
[0]
2037 cursorPositionY
= bpy
.context
.scene
.cursor_location
[1]
2038 cursorPositionZ
= bpy
.context
.scene
.cursor_location
[2]
2039 bpy
.ops
.view3d
.snap_cursor_to_selected()
2040 bpy
.ops
.object.mode_set()
2041 bpy
.ops
.object.origin_set(type='ORIGIN_CURSOR', center
='MEDIAN')
2042 bpy
.ops
.object.mode_set(mode
='EDIT')
2043 bpy
.context
.scene
.cursor_location
[0] = cursorPositionX
2044 bpy
.context
.scene
.cursor_location
[1] = cursorPositionY
2045 bpy
.context
.scene
.cursor_location
[2] = cursorPositionZ
2047 class SetOriginToSelected(bpy
.types
.Operator
):
2049 bl_idname
= "object.setorigintoselected"
2050 bl_label
= "Set Origin to Selected"
2053 def poll(cls
, context
):
2054 return context
.active_object
is not None
2056 def execute(self
, context
):
2060 ### List The Classes ###
2063 VIEW3D_MT_Space_Dynamic_Menu
,
2066 VIEW3D_MT_Edit_Mesh
,
2067 VIEW3D_MT_TransformMenu
,
2068 VIEW3D_MT_TransformMenuEdit
,
2069 VIEW3D_MT_TransformMenuArmature
,
2070 VIEW3D_MT_TransformMenuArmatureEdit
,
2071 VIEW3D_MT_TransformMenuArmaturePose
,
2072 VIEW3D_MT_TransformMenuLite
,
2073 VIEW3D_MT_TransformMenuCamera
,
2074 VIEW3D_MT_MirrorMenu
,
2075 VIEW3D_MT_ParentMenu
,
2076 VIEW3D_MT_GroupMenu
,
2077 VIEW3D_MT_Select_Object
,
2078 VIEW3D_MT_Select_Object_More_Less
,
2079 VIEW3D_MT_Select_Edit_Mesh
,
2080 VIEW3D_MT_Edit_Mesh_Select_Similar
,
2081 VIEW3D_MT_Edit_Mesh_Select_Trait
,
2082 VIEW3D_MT_Edit_Mesh_Select_More_Less
,
2083 VIEW3D_MT_Select_Edit_Curve
,
2084 VIEW3D_MT_SelectArmatureMenu
,
2085 VIEW3D_MT_Select_Pose
,
2086 VIEW3D_MT_Select_Pose_More_Less
,
2089 VIEW3D_MT_PoseNames
,
2090 VIEW3D_MT_Select_Edit_Surface
,
2091 VIEW3D_MT_SelectMetaball
,
2092 VIEW3D_MT_Select_Edit_Metaball
,
2093 VIEW3D_MT_Select_Particle
,
2094 VIEW3D_MT_Select_Edit_Lattice
,
2095 VIEW3D_MT_Select_Edit_Armature
,
2096 VIEW3D_MT_Select_Paint_Mask
,
2097 VIEW3D_MT_Select_Paint_Mask_Vertex
,
2098 VIEW3D_MT_Angle_Control
,
2099 VIEW3D_MT_Edit_Multi
,
2100 VIEW3D_MT_EditM_Edge
,
2101 VIEW3D_MT_Edit_Curve
,
2102 VIEW3D_MT_EditCurveCtrlpoints
,
2103 VIEW3D_MT_EditCurveSegments
,
2104 VIEW3D_MT_EditCurveSpecials
,
2105 VIEW3D_MT_Edit_Armature
,
2106 VIEW3D_MT_EditArmatureTK
,
2107 VIEW3D_MT_KeyframeMenu
,
2108 VIEW3D_OT_Pivot_Cursor
,
2109 VIEW3D_OT_Revert_Pivot
,
2110 VIEW3D_MT_CursorMenu
,
2111 VIEW3D_MT_CursorMenuLite
,
2112 VIEW3D_MT_EditCursorMenu
,
2113 VIEW3D_OT_CursorToEdgeIntersection
,
2115 VIEW3D_MT_Camera_Options
,
2117 InteractiveModeArmature
,
2119 VIEW3D_MT_View_Directions
,
2120 VIEW3D_MT_View_Border
,
2121 VIEW3D_MT_View_Toggle
,
2122 VIEW3D_MT_View_Menu
,
2123 VIEW3D_MT_View_Navigation
,
2124 VIEW3D_MT_View_Align
,
2125 VIEW3D_MT_View_Align_Selected
,
2126 VIEW3D_MT_View_Cameras
,
2129 VIEW3D_Snap_Context
,
2132 VIEW3D_MT_ManipulatorMenu1
,
2133 SetOriginToSelected
,
2134 VIEW3D_MT_Object_Data_Link
,
2135 VIEW3D_MT_Duplicate
,
2138 ## Register Classes ^ & Hotkeys ##
2142 bpy
.utils
.register_class(cls
)
2144 wm
= bpy
.context
.window_manager
2145 kc
= wm
.keyconfigs
.addon
2147 km
= kc
.keymaps
.new(name
='3D View', space_type
='VIEW_3D')
2148 kmi
= km
.keymap_items
.new('wm.call_menu', 'SPACE', 'PRESS')
2149 kmi
.properties
.name
= "VIEW3D_MT_Space_Dynamic_Menu"
2151 ## Unegister Classes & Hotkeys ##
2155 bpy
.utils
.unregister_class(cls
)
2157 wm
= bpy
.context
.window_manager
2158 kc
= wm
.keyconfigs
.addon
2160 km
= kc
.keymaps
['3D View']
2161 for kmi
in km
.keymap_items
:
2162 if kmi
.idname
== 'wm.call_menu':
2163 if kmi
.properties
.name
== "VIEW3D_MT_Space_Dynamic_Menu":
2164 km
.keymap_items
.remove(kmi
)
2167 if __name__
== "__main__":