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 #
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": "https://wiki.blender.org/index.php/Extensions:2.6/Py/"
29 "Scripts/3D_interaction/Dynamic_Spacebar_Menu",
30 "category": "3D View",
34 from bpy
.types
import (
39 from bpy
.props
import (
44 from bl_ui
.properties_paint_common
import UnifiedPaintPanel
47 # Dynamic Context Sensitive Menu #
48 # Main Menu based on Object Type & 3d View Editor Mode #
50 class VIEW3D_MT_Space_Dynamic_Menu(Menu
):
51 bl_label
= "Dynamic Context Menu"
53 def draw(self
, context
):
55 settings
= context
.tool_settings
56 layout
.operator_context
= 'INVOKE_REGION_WIN'
57 obj
= context
.active_object
59 # No Object Selected #
62 layout
.operator_context
= 'INVOKE_REGION_WIN'
63 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
64 UseSeparator(self
, context
)
65 layout
.menu("VIEW3D_MT_AddMenu", icon
='OBJECT_DATAMODE')
66 layout
.menu("VIEW3D_MT_View_Directions", icon
='ZOOM_ALL')
67 layout
.menu("VIEW3D_MT_View_Navigation", icon
='ROTATE')
68 layout
.menu("VIEW3D_MT_View_Toggle", icon
='SPLITSCREEN')
69 layout
.operator("view3d.snap_cursor_to_center",
70 text
="Cursor to Center")
71 layout
.operator("view3d.snap_cursor_to_grid",
72 text
="Cursor to Grid")
73 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
74 UseSeparator(self
, context
)
75 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
76 layout
.operator("view3d.properties", icon
='MENU_PANEL')
77 if context
.gpencil_data
and context
.gpencil_data
.use_stroke_edit_mode
:
78 layout
.menu("VIEW3D_MT_Edit_Gpencil", icon
='GREASEPENCIL')
81 if obj
and obj
.type == 'MESH' and obj
.mode
in {'OBJECT'}:
83 layout
.operator_context
= 'INVOKE_REGION_WIN'
84 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
85 UseSeparator(self
, context
)
86 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
87 layout
.menu("VIEW3D_MT_Select_Object", icon
='RESTRICT_SELECT_OFF')
88 UseSeparator(self
, context
)
89 layout
.menu("VIEW3D_MT_AddMenu", icon
='OBJECT_DATAMODE')
90 layout
.menu("VIEW3D_MT_Object", icon
='VIEW3D')
91 UseSeparator(self
, context
)
92 layout
.menu("VIEW3D_MT_TransformMenu", icon
='MANIPUL')
93 layout
.menu("VIEW3D_MT_MirrorMenu", icon
='MOD_MIRROR')
94 layout
.menu("VIEW3D_MT_CursorMenu", icon
='CURSOR')
95 UseSeparator(self
, context
)
96 layout
.menu("VIEW3D_MT_ParentMenu", icon
='ROTACTIVE')
97 layout
.menu("VIEW3D_MT_GroupMenu", icon
='GROUP')
98 UseSeparator(self
, context
)
99 layout
.menu("VIEW3D_MT_object_specials", text
="Specials", icon
='SOLO_OFF')
100 if context
.gpencil_data
and context
.gpencil_data
.use_stroke_edit_mode
:
101 layout
.menu("VIEW3D_MT_Edit_Gpencil", icon
='GREASEPENCIL')
102 layout
.menu("VIEW3D_MT_Camera_Options", icon
='OUTLINER_OB_CAMERA')
103 layout
.operator_menu_enum("object.modifier_add", "type", icon
='MODIFIER')
104 layout
.operator_menu_enum("object.constraint_add",
105 "type", text
="Add Constraint", icon
='CONSTRAINT')
106 UseSeparator(self
, context
)
107 layout
.operator("object.delete", text
="Delete Object", icon
='X')
108 UseSeparator(self
, context
)
109 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
110 layout
.menu("VIEW3D_MT_Object_Interactive_Mode", icon
='EDIT')
111 UseSeparator(self
, context
)
112 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
113 layout
.operator("view3d.properties", icon
='MENU_PANEL')
116 if obj
and obj
.type == 'MESH' and obj
.mode
in {'EDIT'}:
118 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
119 UseSeparator(self
, context
)
120 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
121 layout
.menu("VIEW3D_MT_Select_Edit_Mesh", icon
='RESTRICT_SELECT_OFF')
122 layout
.menu("VIEW3D_MT_Edit_Multi", icon
='VERTEXSEL')
123 UseSeparator(self
, context
)
124 layout
.menu("INFO_MT_mesh_add", text
="Add Mesh", icon
='OUTLINER_OB_MESH')
125 layout
.menu("VIEW3D_MT_Edit_Mesh", text
="Mesh", icon
='MESH_DATA')
126 UseSeparator(self
, context
)
127 layout
.menu("VIEW3D_MT_TransformMenuEdit", icon
='MANIPUL')
128 layout
.menu("VIEW3D_MT_MirrorMenu", icon
='MOD_MIRROR')
129 layout
.menu("VIEW3D_MT_EditCursorMenu", icon
='CURSOR')
130 UseSeparator(self
, context
)
131 layout
.menu("VIEW3D_MT_UV_Map", icon
='MOD_UVPROJECT')
132 layout
.menu("VIEW3D_MT_edit_mesh_specials", icon
='SOLO_OFF')
133 layout
.menu("VIEW3D_MT_edit_mesh_extrude", icon
='ORTHO')
134 UseSeparator(self
, context
)
135 layout
.operator_menu_enum("object.modifier_add", "type", icon
='MODIFIER')
136 layout
.operator_menu_enum("object.constraint_add",
137 "type", text
="Add Constraint", icon
='CONSTRAINT')
138 UseSeparator(self
, context
)
139 layout
.menu("VIEW3D_MT_edit_mesh_delete", icon
='X')
140 UseSeparator(self
, context
)
141 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
142 layout
.menu("VIEW3D_MT_Object_Interactive_Mode", icon
='EDIT')
143 UseSeparator(self
, context
)
144 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
145 layout
.operator("view3d.properties", icon
='MENU_PANEL')
148 if obj
and obj
.type == 'MESH' and obj
.mode
in {'SCULPT'}:
150 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
151 UseSeparator(self
, context
)
152 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
153 UseSeparator(self
, context
)
154 layout
.menu("VIEW3D_MT_Sculpts", icon
='SCULPTMODE_HLT')
155 layout
.menu("VIEW3D_MT_Brush_Selection", text
="Sculpt Tool", icon
='BRUSH_SCULPT_DRAW')
156 layout
.menu("VIEW3D_MT_Brush_Settings", icon
='BRUSH_DATA')
157 layout
.menu("VIEW3D_MT_Hide_Masks", icon
='RESTRICT_VIEW_OFF')
158 UseSeparator(self
, context
)
159 layout
.menu("VIEW3D_MT_Sculpt_Specials", icon
='SOLO_OFF')
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')
168 if obj
and obj
.type == 'MESH' and obj
.mode
in {'VERTEX_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_Brush_Settings", icon
='BRUSH_DATA')
175 layout
.menu("VIEW3D_MT_Brush_Selection",
176 text
="Vertex Paint Tool", icon
='BRUSH_VERTEXDRAW')
177 layout
.menu("VIEW3D_MT_Vertex_Colors", icon
='GROUP_VCOL')
178 UseSeparator(self
, context
)
179 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
180 layout
.menu("VIEW3D_MT_Object_Interactive_Mode", icon
='EDIT')
181 UseSeparator(self
, context
)
182 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
183 layout
.operator("view3d.properties", icon
='MENU_PANEL')
185 # Weight Paint Menu #
186 if obj
and obj
.type == 'MESH' and obj
.mode
in {'WEIGHT_PAINT'}:
188 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
189 UseSeparator(self
, context
)
190 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
191 UseSeparator(self
, context
)
192 layout
.menu("VIEW3D_MT_Paint_Weights", icon
='WPAINT_HLT')
193 layout
.menu("VIEW3D_MT_Brush_Settings", icon
='BRUSH_DATA')
194 layout
.menu("VIEW3D_MT_Brush_Selection",
195 text
="Weight Paint Tool", icon
='BRUSH_TEXMASK')
196 UseSeparator(self
, context
)
197 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
198 layout
.menu("VIEW3D_MT_Object_Interactive_Mode", icon
='EDIT')
199 UseSeparator(self
, context
)
200 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
201 layout
.operator("view3d.properties", icon
='MENU_PANEL')
204 if obj
and obj
.type == 'MESH' and obj
.mode
in {'TEXTURE_PAINT'}:
206 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
207 UseSeparator(self
, context
)
208 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
209 layout
.menu("VIEW3D_MT_Brush_Settings", icon
='BRUSH_DATA')
210 layout
.menu("VIEW3D_MT_Brush_Selection",
211 text
="Texture Paint Tool", icon
='SCULPTMODE_HLT')
212 UseSeparator(self
, context
)
213 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
214 layout
.menu("VIEW3D_MT_Object_Interactive_Mode", icon
='EDIT')
215 UseSeparator(self
, context
)
216 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
217 layout
.operator("view3d.properties", icon
='MENU_PANEL')
219 # Curve Object Mode #
220 if obj
and obj
.type == 'CURVE' and obj
.mode
in {'OBJECT'}:
222 layout
.operator_context
= 'INVOKE_REGION_WIN'
223 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
224 UseSeparator(self
, context
)
225 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
226 layout
.menu("VIEW3D_MT_Select_Object", icon
='RESTRICT_SELECT_OFF')
227 UseSeparator(self
, context
)
228 layout
.menu("VIEW3D_MT_AddMenu", icon
='OBJECT_DATAMODE')
229 layout
.menu("VIEW3D_MT_Object", icon
='VIEW3D')
230 UseSeparator(self
, context
)
231 layout
.menu("VIEW3D_MT_TransformMenu", icon
='MANIPUL')
232 layout
.menu("VIEW3D_MT_MirrorMenu", icon
='MOD_MIRROR')
233 layout
.menu("VIEW3D_MT_CursorMenu", icon
='CURSOR')
234 UseSeparator(self
, context
)
235 layout
.menu("VIEW3D_MT_ParentMenu", icon
='ROTACTIVE')
236 layout
.menu("VIEW3D_MT_GroupMenu", icon
='GROUP')
237 UseSeparator(self
, context
)
238 layout
.menu("VIEW3D_MT_object_specials", text
="Specials", icon
='SOLO_OFF')
239 layout
.menu("VIEW3D_MT_Camera_Options", icon
='OUTLINER_OB_CAMERA')
240 UseSeparator(self
, context
)
241 layout
.operator_menu_enum("object.modifier_add", "type", icon
='MODIFIER')
242 layout
.operator_menu_enum("object.constraint_add",
243 "type", text
="Add Constraint", icon
='CONSTRAINT')
244 UseSeparator(self
, context
)
245 layout
.operator("object.delete", text
="Delete Object", icon
='X')
246 UseSeparator(self
, context
)
247 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
248 layout
.menu("VIEW3D_MT_Object_Interactive_Other", icon
='OBJECT_DATA')
249 UseSeparator(self
, context
)
250 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
251 layout
.operator("view3d.properties", icon
='MENU_PANEL')
254 if obj
and obj
.type == 'CURVE' and obj
.mode
in {'EDIT'}:
256 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
257 UseSeparator(self
, context
)
258 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
259 layout
.menu("VIEW3D_MT_Select_Edit_Curve",
260 icon
='RESTRICT_SELECT_OFF')
261 UseSeparator(self
, context
)
262 layout
.menu("INFO_MT_curve_add", text
="Add Curve",
263 icon
='OUTLINER_OB_CURVE')
264 layout
.menu("VIEW3D_MT_Edit_Curve", icon
='CURVE_DATA')
265 UseSeparator(self
, context
)
266 layout
.menu("VIEW3D_MT_TransformMenu", icon
='MANIPUL')
267 layout
.menu("VIEW3D_MT_MirrorMenu", icon
='MOD_MIRROR')
268 layout
.menu("VIEW3D_MT_CursorMenu", icon
='CURSOR')
269 layout
.menu("VIEW3D_MT_EditCurveCtrlpoints",
270 icon
='CURVE_BEZCURVE')
271 layout
.menu("VIEW3D_MT_EditCurveSpecials",
273 UseSeparator(self
, context
)
274 layout
.operator("curve.delete", text
="Delete Object",
276 UseSeparator(self
, context
)
277 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
278 layout
.menu("VIEW3D_MT_Object_Interactive_Other", icon
='OBJECT_DATA')
279 UseSeparator(self
, context
)
280 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
281 layout
.operator("view3d.properties", icon
='MENU_PANEL')
283 # Surface Object Mode #
284 if obj
and obj
.type == 'SURFACE' and obj
.mode
in {'OBJECT'}:
286 layout
.operator_context
= 'INVOKE_REGION_WIN'
287 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
288 UseSeparator(self
, context
)
289 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
290 layout
.menu("VIEW3D_MT_Select_Object", icon
='RESTRICT_SELECT_OFF')
291 UseSeparator(self
, context
)
292 layout
.menu("VIEW3D_MT_AddMenu", icon
='OBJECT_DATAMODE')
293 layout
.menu("VIEW3D_MT_Object", icon
='VIEW3D')
294 UseSeparator(self
, context
)
295 layout
.menu("VIEW3D_MT_TransformMenu", icon
='MANIPUL')
296 layout
.menu("VIEW3D_MT_MirrorMenu", icon
='MOD_MIRROR')
297 layout
.menu("VIEW3D_MT_CursorMenu", icon
='CURSOR')
298 UseSeparator(self
, context
)
299 layout
.menu("VIEW3D_MT_ParentMenu", icon
='ROTACTIVE')
300 layout
.menu("VIEW3D_MT_GroupMenu", icon
='GROUP')
301 UseSeparator(self
, context
)
302 layout
.menu("VIEW3D_MT_object_specials", text
="Specials", icon
='SOLO_OFF')
303 layout
.menu("VIEW3D_MT_Camera_Options", icon
='OUTLINER_OB_CAMERA')
304 layout
.operator_menu_enum("object.modifier_add", "type", icon
='MODIFIER')
305 layout
.operator_menu_enum("object.constraint_add",
306 "type", text
="Add Constraint", icon
='CONSTRAINT')
307 UseSeparator(self
, context
)
308 layout
.operator("object.delete", text
="Delete Object", icon
='X')
309 UseSeparator(self
, context
)
310 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
311 layout
.menu("VIEW3D_MT_Object_Interactive_Other", icon
='OBJECT_DATA')
312 UseSeparator(self
, context
)
313 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
314 layout
.operator("view3d.properties", icon
='MENU_PANEL')
317 if obj
and obj
.type == 'SURFACE' and obj
.mode
in {'EDIT'}:
319 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
320 UseSeparator(self
, context
)
321 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
322 layout
.menu("VIEW3D_MT_Select_Edit_Surface", icon
='RESTRICT_SELECT_OFF')
323 UseSeparator(self
, context
)
324 layout
.menu("INFO_MT_surface_add", text
="Add Surface",
325 icon
='OUTLINER_OB_SURFACE')
326 layout
.menu("VIEW3D_MT_TransformMenu", icon
='MANIPUL')
327 layout
.menu("VIEW3D_MT_MirrorMenu", icon
='MOD_MIRROR')
328 layout
.menu("VIEW3D_MT_CursorMenu", icon
='CURSOR')
329 UseSeparator(self
, context
)
330 layout
.prop_menu_enum(settings
, "proportional_edit",
332 layout
.prop_menu_enum(settings
, "proportional_edit_falloff",
334 layout
.menu("VIEW3D_MT_EditCurveSpecials",
336 UseSeparator(self
, context
)
337 layout
.operator("curve.delete", text
="Delete Object",
339 UseSeparator(self
, context
)
340 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
341 layout
.menu("VIEW3D_MT_Object_Interactive_Other", icon
='OBJECT_DATA')
342 UseSeparator(self
, context
)
343 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
344 layout
.operator("view3d.properties", icon
='MENU_PANEL')
346 # Metaball Object Mode #
347 if obj
and obj
.type == 'META' and obj
.mode
in {'OBJECT'}:
349 layout
.operator_context
= 'INVOKE_REGION_WIN'
350 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
351 UseSeparator(self
, context
)
352 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
353 layout
.menu("VIEW3D_MT_Select_Object", icon
='RESTRICT_SELECT_OFF')
354 UseSeparator(self
, context
)
355 layout
.menu("VIEW3D_MT_AddMenu", icon
='OBJECT_DATAMODE')
356 layout
.menu("VIEW3D_MT_Object", icon
='VIEW3D')
357 UseSeparator(self
, context
)
358 layout
.menu("VIEW3D_MT_TransformMenu", icon
='MANIPUL')
359 layout
.menu("VIEW3D_MT_MirrorMenu", icon
='MOD_MIRROR')
360 layout
.menu("VIEW3D_MT_CursorMenu", icon
='CURSOR')
361 UseSeparator(self
, context
)
362 layout
.menu("VIEW3D_MT_ParentMenu", icon
='ROTACTIVE')
363 layout
.menu("VIEW3D_MT_GroupMenu", icon
='GROUP')
364 UseSeparator(self
, context
)
365 layout
.menu("VIEW3D_MT_object_specials", text
="Specials", icon
='SOLO_OFF')
366 layout
.menu("VIEW3D_MT_Camera_Options", icon
='OUTLINER_OB_CAMERA')
367 UseSeparator(self
, context
)
368 layout
.operator_menu_enum("object.constraint_add",
369 "type", text
="Add Constraint", icon
='CONSTRAINT')
370 layout
.operator("object.delete", text
="Delete Object", icon
='X')
371 UseSeparator(self
, context
)
372 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
373 layout
.menu("VIEW3D_MT_Object_Interactive_Other", icon
='OBJECT_DATA')
374 UseSeparator(self
, context
)
375 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
376 layout
.operator("view3d.properties", icon
='MENU_PANEL')
379 if obj
and obj
.type == 'META' and obj
.mode
in {'EDIT'}:
381 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
382 UseSeparator(self
, context
)
383 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
384 layout
.menu("VIEW3D_MT_SelectMetaball", icon
='RESTRICT_SELECT_OFF')
385 UseSeparator(self
, context
)
386 layout
.operator_menu_enum("object.metaball_add", "type",
388 icon
='OUTLINER_OB_META')
389 layout
.menu("VIEW3D_MT_TransformMenu", icon
='MANIPUL')
390 layout
.menu("VIEW3D_MT_MirrorMenu", icon
='MOD_MIRROR')
391 layout
.menu("VIEW3D_MT_CursorMenu", icon
='CURSOR')
392 UseSeparator(self
, context
)
393 layout
.prop_menu_enum(settings
, "proportional_edit",
395 layout
.prop_menu_enum(settings
, "proportional_edit_falloff",
397 UseSeparator(self
, context
)
398 layout
.operator("mball.delete_metaelems", text
="Delete Object",
400 UseSeparator(self
, context
)
401 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
402 layout
.menu("VIEW3D_MT_Object_Interactive_Other", icon
='OBJECT_DATA')
403 UseSeparator(self
, context
)
404 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
405 layout
.operator("view3d.properties", icon
='MENU_PANEL')
408 if obj
and obj
.type == 'FONT' and obj
.mode
in {'OBJECT'}:
410 layout
.operator_context
= 'INVOKE_REGION_WIN'
411 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
412 UseSeparator(self
, context
)
413 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
414 layout
.menu("VIEW3D_MT_Select_Object", icon
='RESTRICT_SELECT_OFF')
415 UseSeparator(self
, context
)
416 layout
.menu("VIEW3D_MT_AddMenu", icon
='OBJECT_DATAMODE')
417 layout
.menu("VIEW3D_MT_Object", icon
='VIEW3D')
418 UseSeparator(self
, context
)
419 layout
.menu("VIEW3D_MT_TransformMenu", icon
='MANIPUL')
420 layout
.menu("VIEW3D_MT_MirrorMenu", icon
='MOD_MIRROR')
421 layout
.menu("VIEW3D_MT_CursorMenu", icon
='CURSOR')
422 UseSeparator(self
, context
)
423 layout
.menu("VIEW3D_MT_ParentMenu", icon
='ROTACTIVE')
424 layout
.menu("VIEW3D_MT_GroupMenu", icon
='GROUP')
425 UseSeparator(self
, context
)
426 layout
.menu("VIEW3D_MT_object_specials", text
="Specials", icon
='SOLO_OFF')
427 layout
.menu("VIEW3D_MT_Camera_Options", icon
='OUTLINER_OB_CAMERA')
428 UseSeparator(self
, context
)
429 layout
.operator_menu_enum("object.modifier_add", "type", icon
='MODIFIER')
430 layout
.operator_menu_enum("object.constraint_add",
431 "type", text
="Add Constraint", icon
='CONSTRAINT')
432 UseSeparator(self
, context
)
433 layout
.operator("object.delete", text
="Delete Object", icon
='X')
434 UseSeparator(self
, context
)
435 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
436 # New Entry For Switching to Editmode
437 layout
.operator("view3d.interactive_mode_text", icon
='VIEW3D')
438 UseSeparator(self
, context
)
439 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
440 layout
.operator("view3d.properties", icon
='MENU_PANEL')
443 # To Do: Space is already reserved for the typing tool
444 if obj
and obj
.type == 'FONT' and obj
.mode
in {'EDIT'}:
446 layout
.operator_context
= 'INVOKE_REGION_WIN'
447 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
448 UseSeparator(self
, context
)
449 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
450 layout
.menu("VIEW3D_MT_select_edit_text", icon
='VIEW3D')
451 layout
.menu("VIEW3D_MT_edit_font", icon
='RESTRICT_SELECT_OFF')
452 UseSeparator(self
, context
)
453 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
454 layout
.operator("object.editmode_toggle", text
="Enter Object Mode",
456 UseSeparator(self
, context
)
457 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
458 layout
.operator("view3d.properties", icon
='MENU_PANEL')
460 # Camera Object Mode #
461 if obj
and obj
.type == 'CAMERA' and obj
.mode
in {'OBJECT'}:
463 layout
.operator_context
= 'INVOKE_REGION_WIN'
464 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
465 UseSeparator(self
, context
)
466 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
467 layout
.menu("VIEW3D_MT_Select_Object", icon
='RESTRICT_SELECT_OFF')
468 UseSeparator(self
, context
)
469 layout
.menu("VIEW3D_MT_AddMenu", icon
='OBJECT_DATAMODE')
470 layout
.menu("VIEW3D_MT_Object", icon
='VIEW3D')
471 UseSeparator(self
, context
)
472 layout
.menu("VIEW3D_MT_TransformMenu", icon
='MANIPUL')
473 layout
.menu("VIEW3D_MT_CursorMenuLite", icon
='CURSOR')
474 UseSeparator(self
, context
)
475 layout
.menu("VIEW3D_MT_ParentMenu", icon
='ROTACTIVE')
476 layout
.menu("VIEW3D_MT_GroupMenu", icon
='GROUP')
477 UseSeparator(self
, context
)
478 layout
.menu("VIEW3D_MT_object_specials", text
="Specials", icon
='SOLO_OFF')
479 layout
.menu("VIEW3D_MT_Camera_Options", icon
='OUTLINER_OB_CAMERA')
480 UseSeparator(self
, context
)
481 layout
.operator_menu_enum("object.constraint_add",
482 "type", text
="Add Constraint", icon
='CONSTRAINT')
483 UseSeparator(self
, context
)
484 layout
.operator("object.delete", text
="Delete Object", icon
='X')
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')
492 if obj
and obj
.type == 'LIGHT' 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_TransformMenuLite", icon
='MANIPUL')
504 layout
.menu("VIEW3D_MT_CursorMenuLite", icon
='CURSOR')
505 UseSeparator(self
, context
)
506 layout
.menu("VIEW3D_MT_ParentMenu", icon
='ROTACTIVE')
507 layout
.menu("VIEW3D_MT_GroupMenu", icon
='GROUP')
508 UseSeparator(self
, context
)
509 layout
.menu("VIEW3D_MT_object_specials", text
="Specials", icon
='SOLO_OFF')
510 layout
.menu("VIEW3D_MT_Camera_Options", icon
='OUTLINER_OB_CAMERA')
511 UseSeparator(self
, context
)
512 layout
.operator_menu_enum("object.constraint_add",
513 "type", text
="Add Constraint", icon
='CONSTRAINT')
514 UseSeparator(self
, context
)
515 layout
.operator("object.delete", text
="Delete Object", icon
='X')
516 UseSeparator(self
, context
)
517 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
518 UseSeparator(self
, context
)
519 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
520 layout
.operator("view3d.properties", icon
='MENU_PANEL')
522 # Armature Object Mode #
523 if obj
and obj
.type == 'ARMATURE' and obj
.mode
in {'OBJECT'}:
525 layout
.operator_context
= 'INVOKE_REGION_WIN'
526 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
527 UseSeparator(self
, context
)
528 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
529 layout
.menu("VIEW3D_MT_Select_Object", icon
='RESTRICT_SELECT_OFF')
530 UseSeparator(self
, context
)
531 layout
.menu("VIEW3D_MT_AddMenu", icon
='OBJECT_DATAMODE')
532 layout
.menu("VIEW3D_MT_Object", icon
='VIEW3D')
533 UseSeparator(self
, context
)
534 layout
.menu("VIEW3D_MT_TransformMenuArmature", icon
='MANIPUL')
535 layout
.menu("VIEW3D_MT_MirrorMenu", icon
='MOD_MIRROR')
536 layout
.menu("VIEW3D_MT_CursorMenuLite", icon
='CURSOR')
537 UseSeparator(self
, context
)
538 layout
.menu("VIEW3D_MT_ParentMenu", icon
='ROTACTIVE')
539 layout
.menu("VIEW3D_MT_GroupMenu", icon
='GROUP')
540 UseSeparator(self
, context
)
541 layout
.menu("VIEW3D_MT_object_specials", text
="Specials", icon
='SOLO_OFF')
542 layout
.menu("VIEW3D_MT_Camera_Options", icon
='OUTLINER_OB_CAMERA')
543 UseSeparator(self
, context
)
544 layout
.operator_menu_enum("object.constraint_add",
545 "type", text
="Add Constraint", icon
='CONSTRAINT')
546 UseSeparator(self
, context
)
547 layout
.operator("object.delete", text
="Delete Object", icon
='X')
548 UseSeparator(self
, context
)
549 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
550 layout
.menu("VIEW3D_MT_Object_Interactive_Armature", icon
='VIEW3D')
551 UseSeparator(self
, context
)
552 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
553 layout
.operator("view3d.properties", icon
='MENU_PANEL')
556 if obj
and obj
.type == 'ARMATURE' and obj
.mode
in {'EDIT'}:
558 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
559 UseSeparator(self
, context
)
560 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
561 layout
.menu("VIEW3D_MT_Select_Edit_Armature",
562 icon
='RESTRICT_SELECT_OFF')
563 UseSeparator(self
, context
)
564 layout
.menu("INFO_MT_armature_add", text
="Add Armature",
565 icon
='OUTLINER_OB_ARMATURE')
566 layout
.menu("VIEW3D_MT_Edit_Armature", text
="Armature",
567 icon
='OUTLINER_DATA_ARMATURE')
568 layout
.menu("VIEW3D_MT_EditArmatureTK",
569 icon
='ARMATURE_DATA')
570 UseSeparator(self
, context
)
571 layout
.menu("VIEW3D_MT_TransformMenuArmatureEdit", icon
='MANIPUL')
572 layout
.menu("VIEW3D_MT_MirrorMenu", icon
='MOD_MIRROR')
573 layout
.menu("VIEW3D_MT_CursorMenuLite", icon
='CURSOR')
574 layout
.menu("VIEW3D_MT_ParentMenu", icon
='ROTACTIVE')
575 layout
.menu("VIEW3D_MT_armature_specials", icon
='SOLO_OFF')
576 layout
.menu("VIEW3D_MT_edit_armature_roll",
578 UseSeparator(self
, context
)
579 layout
.operator("armature.delete", text
="Delete Object",
581 UseSeparator(self
, context
)
582 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
583 layout
.menu("VIEW3D_MT_Object_Interactive_Armature", icon
='VIEW3D')
584 UseSeparator(self
, context
)
585 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
586 layout
.operator("view3d.properties", icon
='MENU_PANEL')
589 if obj
and obj
.type == 'ARMATURE' and obj
.mode
in {'POSE'}:
591 arm
= context
.active_object
.data
593 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
594 UseSeparator(self
, context
)
595 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
596 layout
.menu("VIEW3D_MT_Select_Pose", icon
='RESTRICT_SELECT_OFF')
597 UseSeparator(self
, context
)
598 layout
.menu("VIEW3D_MT_Pose", icon
='OUTLINER_DATA_POSE')
599 layout
.menu("VIEW3D_MT_TransformMenuArmaturePose", icon
='MANIPUL')
600 layout
.menu("VIEW3D_MT_pose_transform", icon
='EMPTY_DATA')
601 UseSeparator(self
, context
)
602 layout
.menu("VIEW3D_MT_CursorMenuLite", icon
='CURSOR')
603 layout
.menu("VIEW3D_MT_PoseCopy", icon
='FILE')
605 if arm
.draw_type
in {'BBONE', 'ENVELOPE'}:
606 layout
.operator("transform.transform",
607 text
="Scale Envelope Distance").mode
= 'BONE_SIZE'
609 layout
.menu("VIEW3D_MT_pose_apply", icon
='AUTO')
610 layout
.operator("pose.relax", icon
='ARMATURE_DATA')
611 layout
.menu("VIEW3D_MT_KeyframeMenu", icon
='KEY_HLT')
612 layout
.menu("VIEW3D_MT_pose_specials", icon
='SOLO_OFF')
613 layout
.menu("VIEW3D_MT_pose_group", icon
='GROUP_BONE')
614 UseSeparator(self
, context
)
615 layout
.operator_menu_enum("pose.constraint_add",
616 "type", text
="Add Constraint", icon
='CONSTRAINT_BONE')
617 UseSeparator(self
, context
)
618 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
619 layout
.menu("VIEW3D_MT_Object_Interactive_Armature", icon
='VIEW3D')
620 UseSeparator(self
, context
)
621 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
622 layout
.operator("view3d.properties", icon
='MENU_PANEL')
624 # Lattice Object Mode #
625 if obj
and obj
.type == 'LATTICE' and obj
.mode
in {'OBJECT'}:
627 layout
.operator_context
= 'INVOKE_REGION_WIN'
628 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
629 UseSeparator(self
, context
)
630 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
631 layout
.menu("VIEW3D_MT_Select_Object", icon
='RESTRICT_SELECT_OFF')
632 UseSeparator(self
, context
)
633 layout
.menu("VIEW3D_MT_AddMenu", icon
='OBJECT_DATAMODE')
634 layout
.menu("VIEW3D_MT_Object", icon
='VIEW3D')
635 UseSeparator(self
, context
)
636 layout
.menu("VIEW3D_MT_TransformMenu", icon
='MANIPUL')
637 layout
.menu("VIEW3D_MT_MirrorMenu", icon
='MOD_MIRROR')
638 layout
.menu("VIEW3D_MT_CursorMenu", icon
='CURSOR')
639 UseSeparator(self
, context
)
640 layout
.menu("VIEW3D_MT_ParentMenu", icon
='ROTACTIVE')
641 layout
.menu("VIEW3D_MT_GroupMenu", icon
='GROUP')
642 UseSeparator(self
, context
)
643 layout
.menu("VIEW3D_MT_object_specials", text
="Specials", icon
='SOLO_OFF')
644 layout
.menu("VIEW3D_MT_Camera_Options", icon
='OUTLINER_OB_CAMERA')
645 UseSeparator(self
, context
)
646 layout
.operator_menu_enum("object.modifier_add", "type", icon
='MODIFIER')
647 layout
.operator_menu_enum("object.constraint_add",
648 "type", text
="Add Constraint", icon
='CONSTRAINT')
649 UseSeparator(self
, context
)
650 layout
.operator("object.delete", text
="Delete Object", icon
='X')
651 UseSeparator(self
, context
)
652 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
653 layout
.menu("VIEW3D_MT_Object_Interactive_Other", icon
='OBJECT_DATA')
654 UseSeparator(self
, context
)
655 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
656 layout
.operator("view3d.properties", icon
='MENU_PANEL')
659 if obj
and obj
.type == 'LATTICE' and obj
.mode
in {'EDIT'}:
661 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
662 UseSeparator(self
, context
)
663 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
664 layout
.menu("VIEW3D_MT_Select_Edit_Lattice",
665 icon
='RESTRICT_SELECT_OFF')
666 UseSeparator(self
, context
)
667 layout
.menu("VIEW3D_MT_TransformMenu", icon
='MANIPUL')
668 layout
.menu("VIEW3D_MT_MirrorMenu", icon
='MOD_MIRROR')
669 layout
.menu("VIEW3D_MT_CursorMenu", icon
='CURSOR')
670 UseSeparator(self
, context
)
671 layout
.prop_menu_enum(settings
, "proportional_edit",
673 layout
.prop_menu_enum(settings
, "proportional_edit_falloff",
675 UseSeparator(self
, context
)
676 layout
.operator("lattice.make_regular")
677 UseSeparator(self
, context
)
678 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
679 layout
.menu("VIEW3D_MT_Object_Interactive_Other", icon
='OBJECT_DATA')
680 UseSeparator(self
, context
)
681 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
682 layout
.operator("view3d.properties", icon
='MENU_PANEL')
684 # Empty Object Mode #
685 if obj
and obj
.type == 'EMPTY' and obj
.mode
in {'OBJECT'}:
687 layout
.operator_context
= 'INVOKE_REGION_WIN'
688 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
689 UseSeparator(self
, context
)
690 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
691 layout
.menu("VIEW3D_MT_Select_Object", icon
='RESTRICT_SELECT_OFF')
692 UseSeparator(self
, context
)
693 layout
.menu("VIEW3D_MT_AddMenu", icon
='OBJECT_DATAMODE')
694 layout
.menu("VIEW3D_MT_Object", icon
='VIEW3D')
695 UseSeparator(self
, context
)
696 layout
.menu("VIEW3D_MT_TransformMenuLite", icon
='MANIPUL')
697 layout
.menu("VIEW3D_MT_MirrorMenu", icon
='MOD_MIRROR')
698 layout
.menu("VIEW3D_MT_CursorMenuLite", icon
='CURSOR')
699 UseSeparator(self
, context
)
700 layout
.menu("VIEW3D_MT_ParentMenu", icon
='ROTACTIVE')
701 layout
.menu("VIEW3D_MT_GroupMenu", icon
='GROUP')
702 UseSeparator(self
, context
)
703 layout
.menu("VIEW3D_MT_object_specials", text
="Specials", icon
='SOLO_OFF')
704 layout
.menu("VIEW3D_MT_Camera_Options", icon
='OUTLINER_OB_CAMERA')
705 UseSeparator(self
, context
)
706 layout
.operator_menu_enum("object.constraint_add",
707 "type", text
="Add Constraint", icon
='CONSTRAINT')
708 UseSeparator(self
, context
)
709 layout
.operator("object.delete", text
="Delete Object", icon
='X')
710 UseSeparator(self
, context
)
711 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
712 UseSeparator(self
, context
)
713 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
714 layout
.operator("view3d.properties", icon
='MENU_PANEL')
716 # Speaker Object Mode #
717 if obj
and obj
.type == 'SPEAKER' and obj
.mode
in {'OBJECT'}:
719 layout
.operator_context
= 'INVOKE_REGION_WIN'
720 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
721 UseSeparator(self
, context
)
722 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
723 layout
.menu("VIEW3D_MT_Select_Object", icon
='RESTRICT_SELECT_OFF')
724 UseSeparator(self
, context
)
725 layout
.menu("VIEW3D_MT_AddMenu", icon
='OBJECT_DATAMODE')
726 layout
.menu("VIEW3D_MT_Object", icon
='VIEW3D')
727 UseSeparator(self
, context
)
728 layout
.menu("VIEW3D_MT_TransformMenuLite", icon
='MANIPUL')
729 layout
.menu("VIEW3D_MT_CursorMenuLite", icon
='CURSOR')
730 UseSeparator(self
, context
)
731 layout
.menu("VIEW3D_MT_ParentMenu", icon
='ROTACTIVE')
732 layout
.menu("VIEW3D_MT_GroupMenu", icon
='GROUP')
733 UseSeparator(self
, context
)
734 layout
.operator_menu_enum("object.constraint_add",
735 "type", text
="Add Constraint", icon
='CONSTRAINT')
736 UseSeparator(self
, context
)
737 layout
.operator("object.delete", text
="Delete Object", icon
='X')
738 UseSeparator(self
, context
)
739 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
740 UseSeparator(self
, context
)
741 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
742 layout
.operator("view3d.properties", icon
='MENU_PANEL')
745 if obj
and context
.mode
== 'PARTICLE':
747 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
748 UseSeparator(self
, context
)
749 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
750 layout
.menu("VIEW3D_MT_Select_Particle",
751 icon
='RESTRICT_SELECT_OFF')
752 layout
.menu("VIEW3D_MT_Selection_Mode_Particle",
753 text
="Select and Display Mode", icon
='PARTICLE_PATH')
754 UseSeparator(self
, context
)
755 layout
.menu("VIEW3D_MT_TransformMenu", icon
='MANIPUL')
756 layout
.menu("VIEW3D_MT_MirrorMenu", icon
='MOD_MIRROR')
757 layout
.menu("VIEW3D_MT_CursorMenuLite", icon
='CURSOR')
758 UseSeparator(self
, context
)
759 layout
.prop_menu_enum(settings
, "proportional_edit",
761 layout
.prop_menu_enum(settings
, "proportional_edit_falloff",
763 UseSeparator(self
, context
)
764 layout
.menu("VIEW3D_MT_particle", icon
='PARTICLEMODE')
765 layout
.menu("VIEW3D_MT_particle_specials", text
="Hair Specials", icon
='HAIR')
766 UseSeparator(self
, context
)
767 layout
.operator("object.delete", text
="Delete Object", icon
='X')
768 UseSeparator(self
, context
)
769 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
770 layout
.menu("VIEW3D_MT_Object_Interactive_Mode", icon
='VIEW3D')
771 UseSeparator(self
, context
)
772 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
773 layout
.operator("view3d.properties", icon
='MENU_PANEL')
778 # ********** Object Menu **********
779 class VIEW3D_MT_Object(Menu
):
780 bl_context
= "objectmode"
783 def draw(self
, context
):
785 view
= context
.space_data
786 is_local_view
= (view
.local_view
is not None)
788 layout
.operator("object.delete", text
="Delete...").use_global
= False
789 UseSeparator(self
, context
)
790 layout
.menu("VIEW3D_MT_object_parent")
791 layout
.menu("VIEW3D_MT_Duplicate")
792 layout
.operator("object.join")
795 layout
.operator_context
= 'EXEC_REGION_WIN'
796 layout
.operator("object.move_to_layer", text
="Move out of Local View")
797 layout
.operator_context
= 'INVOKE_REGION_WIN'
799 layout
.operator("object.move_to_layer", text
="Move to Layer...")
801 layout
.menu("VIEW3D_MT_make_links", text
="Make Links...")
802 layout
.menu("VIEW3D_MT_Object_Data_Link")
803 UseSeparator(self
, context
)
804 layout
.menu("VIEW3D_MT_AutoSmooth", icon
='ALIASED')
805 UseSeparator(self
, context
)
806 layout
.menu("VIEW3D_MT_object_constraints")
807 layout
.menu("VIEW3D_MT_object_track")
808 layout
.menu("VIEW3D_MT_object_animation")
809 UseSeparator(self
, context
)
810 layout
.menu("VIEW3D_MT_object_showhide")
811 UseSeparator(self
, context
)
812 layout
.operator_menu_enum("object.convert", "target")
815 # ********** Object Add **********
816 class VIEW3D_MT_AddMenu(Menu
):
817 bl_label
= "Add Object"
819 def draw(self
, context
):
821 layout
.operator_context
= 'INVOKE_REGION_WIN'
823 layout
.menu("INFO_MT_mesh_add", text
="Add Mesh",
824 icon
='OUTLINER_OB_MESH')
825 layout
.menu("INFO_MT_curve_add", text
="Add Curve",
826 icon
='OUTLINER_OB_CURVE')
827 layout
.menu("INFO_MT_surface_add", text
="Add Surface",
828 icon
='OUTLINER_OB_SURFACE')
829 layout
.operator_menu_enum("object.metaball_add", "type",
830 icon
='OUTLINER_OB_META')
831 layout
.operator("object.text_add", text
="Add Text",
832 icon
='OUTLINER_OB_FONT')
833 UseSeparator(self
, context
)
834 layout
.menu("INFO_MT_armature_add", text
="Add Armature",
835 icon
='OUTLINER_OB_ARMATURE')
836 layout
.operator("object.add", text
="Lattice",
837 icon
='OUTLINER_OB_LATTICE').type = 'LATTICE'
838 layout
.operator_menu_enum("object.empty_add", "type", text
="Empty", icon
='OUTLINER_OB_EMPTY')
839 UseSeparator(self
, context
)
840 layout
.operator("object.speaker_add", text
="Speaker", icon
='OUTLINER_OB_SPEAKER')
841 UseSeparator(self
, context
)
842 layout
.operator("object.camera_add", text
="Camera",
843 icon
='OUTLINER_OB_CAMERA')
844 layout
.operator_menu_enum("object.light_add", "type",
845 icon
="OUTLINER_OB_LIGHT")
846 UseSeparator(self
, context
)
847 layout
.operator_menu_enum("object.effector_add", "type",
850 layout
.menu("VIEW3D_MT_object_quick_effects", text
="Quick Effects", icon
='PARTICLES')
851 UseSeparator(self
, context
)
853 has_groups
= (len(bpy
.data
.groups
) > 0)
854 col_group
= layout
.column()
855 col_group
.enabled
= has_groups
857 if not has_groups
or len(bpy
.data
.groups
) > 10:
858 col_group
.operator_context
= 'INVOKE_REGION_WIN'
859 col_group
.operator("object.group_instance_add",
860 text
="Group Instance..." if has_groups
else "No Groups in Data",
863 col_group
.operator_menu_enum("object.group_instance_add", "group",
864 text
="Group Instance", icon
='GROUP_VERTEX')
867 # ********** Object Manipulator **********
868 class VIEW3D_MT_ManipulatorMenu1(Menu
):
869 bl_label
= "Manipulator"
871 def draw(self
, context
):
873 layout
.operator_context
= 'INVOKE_REGION_WIN'
874 props
= layout
.operator("view3d.enable_manipulator", text
='Translate', icon
='MAN_TRANS')
875 props
.translate
= True
876 props
= layout
.operator("view3d.enable_manipulator", text
='Rotate', icon
='MAN_ROT')
878 props
= layout
.operator("view3d.enable_manipulator", text
='Scale', icon
='MAN_SCALE')
880 UseSeparator(self
, context
)
881 props
= layout
.operator("view3d.enable_manipulator", text
='Combo', icon
='MAN_SCALE')
884 props
.translate
= True
885 props
= layout
.operator("view3d.enable_manipulator", text
='Hide', icon
='MAN_SCALE')
888 props
.translate
= False
891 # ********** Object Mirror **********
892 class VIEW3D_MT_MirrorMenu(Menu
):
895 def draw(self
, context
):
897 layout
.operator("transform.mirror", text
="Interactive Mirror")
898 UseSeparator(self
, context
)
899 layout
.operator_context
= 'INVOKE_REGION_WIN'
900 props
= layout
.operator("transform.mirror", text
="X Global")
901 props
.constraint_axis
= (True, False, False)
902 props
.constraint_orientation
= 'GLOBAL'
903 props
= layout
.operator("transform.mirror", text
="Y Global")
904 props
.constraint_axis
= (False, True, False)
905 props
.constraint_orientation
= 'GLOBAL'
906 props
= layout
.operator("transform.mirror", text
="Z Global")
907 props
.constraint_axis
= (False, False, True)
908 props
.constraint_orientation
= 'GLOBAL'
910 if context
.edit_object
:
912 UseSeparator(self
, context
)
913 props
= layout
.operator("transform.mirror", text
="X Local")
914 props
.constraint_axis
= (True, False, False)
915 props
.constraint_orientation
= 'LOCAL'
916 props
= layout
.operator("transform.mirror", text
="Y Local")
917 props
.constraint_axis
= (False, True, False)
918 props
.constraint_orientation
= 'LOCAL'
919 props
= layout
.operator("transform.mirror", text
="Z Local")
920 props
.constraint_axis
= (False, False, True)
921 props
.constraint_orientation
= 'LOCAL'
922 UseSeparator(self
, context
)
923 layout
.operator("object.vertex_group_mirror")
926 # ********** Object Snap Cursor **********
927 class VIEW3D_MT_Pivot(Menu
):
930 def draw(self
, context
):
932 layout
.prop(context
.space_data
, "pivot_point", expand
=True)
933 if context
.active_object
.mode
== 'OBJECT':
934 UseSeparator(self
, context
)
935 layout
.prop(context
.space_data
, "use_pivot_point_align", text
="Center Points")
938 class VIEW3D_Snap_Context(Menu
):
939 bl_label
= "Snapping"
941 def draw(self
, context
):
943 toolsettings
= context
.tool_settings
944 layout
.prop(toolsettings
, "snap_element", expand
=True)
945 layout
.prop(toolsettings
, "use_snap")
948 class VIEW3D_Snap_Origin(Menu
):
951 def draw(self
, context
):
953 layout
.operator_context
= 'EXEC_AREA'
954 layout
.operator("object.origin_set",
955 text
="Geometry to Origin").type = 'GEOMETRY_ORIGIN'
956 UseSeparator(self
, context
)
957 layout
.operator("object.origin_set",
958 text
="Origin to Geometry").type = 'ORIGIN_GEOMETRY'
959 layout
.operator("object.origin_set",
960 text
="Origin to 3D Cursor").type = 'ORIGIN_CURSOR'
961 layout
.operator("object.origin_set",
962 text
="Origin to Center of Mass").type = 'ORIGIN_CENTER_OF_MASS'
965 class VIEW3D_MT_CursorMenu(Menu
):
966 bl_label
= "Snap Cursor"
968 def draw(self
, context
):
970 layout
.operator_context
= 'INVOKE_REGION_WIN'
971 layout
.menu("VIEW3D_Snap_Origin")
972 layout
.menu("VIEW3D_Snap_Context")
973 UseSeparator(self
, context
)
974 layout
.operator("view3d.snap_cursor_to_selected",
975 text
="Cursor to Selected")
976 layout
.operator("view3d.snap_cursor_to_center",
977 text
="Cursor to Center")
978 layout
.operator("view3d.snap_cursor_to_grid",
979 text
="Cursor to Grid")
980 layout
.operator("view3d.snap_cursor_to_active",
981 text
="Cursor to Active")
982 UseSeparator(self
, context
)
983 layout
.operator("view3d.snap_selected_to_cursor",
984 text
="Selection to Cursor").use_offset
= False
985 layout
.operator("view3d.snap_selected_to_cursor",
986 text
="Selection to Cursor (Keep Offset)").use_offset
= True
987 layout
.operator("view3d.snap_selected_to_grid",
988 text
="Selection to Grid")
989 layout
.operator("view3d.snap_cursor_selected_to_center",
990 text
="Selection and Cursor to Center")
991 UseSeparator(self
, context
)
992 layout
.menu("VIEW3D_MT_Pivot")
993 layout
.operator("view3d.pivot_cursor",
994 text
="Set Cursor as Pivot Point")
995 layout
.operator("view3d.revert_pivot",
996 text
="Revert Pivot Point")
999 class VIEW3D_MT_CursorMenuLite(Menu
):
1000 bl_label
= "Snap Cursor"
1002 def draw(self
, context
):
1003 layout
= self
.layout
1004 layout
.operator_context
= 'INVOKE_REGION_WIN'
1005 layout
.menu("VIEW3D_Snap_Origin")
1006 UseSeparator(self
, context
)
1007 layout
.operator("view3d.snap_cursor_to_selected",
1008 text
="Cursor to Selected")
1009 layout
.operator("view3d.snap_cursor_to_center",
1010 text
="Cursor to Center")
1011 layout
.operator("view3d.snap_cursor_to_grid",
1012 text
="Cursor to Grid")
1013 layout
.operator("view3d.snap_cursor_to_active",
1014 text
="Cursor to Active")
1015 UseSeparator(self
, context
)
1016 layout
.operator("view3d.snap_selected_to_cursor",
1017 text
="Selection to Cursor").use_offset
= False
1018 layout
.operator("view3d.snap_selected_to_cursor",
1019 text
="Selection to Cursor (Keep Offset)").use_offset
= True
1020 layout
.operator("view3d.snap_selected_to_grid",
1021 text
="Selection to Grid")
1022 layout
.operator("view3d.snap_cursor_selected_to_center",
1023 text
="Selection and Cursor to Center")
1024 UseSeparator(self
, context
)
1025 layout
.menu("VIEW3D_MT_Pivot")
1026 layout
.operator("view3d.pivot_cursor",
1027 text
="Set Cursor as Pivot Point")
1028 layout
.operator("view3d.revert_pivot",
1029 text
="Revert Pivot Point")
1032 # ********** Object Interactive Mode **********
1033 class InteractiveMode(Menu
):
1034 bl_idname
= "VIEW3D_MT_Object_Interactive_Mode"
1035 bl_label
= "Interactive Mode"
1036 bl_description
= "Menu of objects' interactive modes (Window Types)"
1038 def draw(self
, context
):
1039 layout
= self
.layout
1040 obj
= context
.active_object
1041 psys
= hasattr(obj
, "particle_systems")
1042 psys_items
= len(obj
.particle_systems
.items()) > 0 if psys
else False
1044 layout
.operator(SetObjectMode
.bl_idname
, text
="Object", icon
="OBJECT_DATAMODE").mode
= "OBJECT"
1045 layout
.operator(SetObjectMode
.bl_idname
, text
="Edit", icon
="EDITMODE_HLT").mode
= "EDIT"
1046 layout
.operator(SetObjectMode
.bl_idname
, text
="Sculpt", icon
="SCULPTMODE_HLT").mode
= "SCULPT"
1047 layout
.operator(SetObjectMode
.bl_idname
, text
="Vertex Paint", icon
="VPAINT_HLT").mode
= "VERTEX_PAINT"
1048 layout
.operator(SetObjectMode
.bl_idname
, text
="Weight Paint", icon
="WPAINT_HLT").mode
= "WEIGHT_PAINT"
1049 layout
.operator(SetObjectMode
.bl_idname
, text
="Texture Paint", icon
="TPAINT_HLT").mode
= "TEXTURE_PAINT"
1050 if obj
and psys_items
:
1051 layout
.operator(SetObjectMode
.bl_idname
, text
="Particle Edit",
1052 icon
="PARTICLEMODE").mode
= "PARTICLE_EDIT"
1053 if context
.gpencil_data
:
1054 layout
.operator("view3d.interactive_mode_grease_pencil", icon
="GREASEPENCIL")
1057 # ********** Object Armature Interactive Mode **********
1058 class InteractiveModeArmature(Menu
):
1059 bl_idname
= "VIEW3D_MT_Object_Interactive_Armature"
1060 bl_label
= "Interactive Mode"
1061 bl_description
= "Menu of objects interactive mode"
1063 def draw(self
, context
):
1064 layout
= self
.layout
1066 layout
.operator(SetObjectMode
.bl_idname
, text
="Object", icon
="OBJECT_DATAMODE").mode
= "OBJECT"
1067 layout
.operator(SetObjectMode
.bl_idname
, text
="Edit", icon
="EDITMODE_HLT").mode
= "EDIT"
1068 layout
.operator(SetObjectMode
.bl_idname
, text
="Pose", icon
="POSE_HLT").mode
= "POSE"
1069 if context
.gpencil_data
:
1070 layout
.operator("view3d.interactive_mode_grease_pencil", icon
="GREASEPENCIL")
1073 # ********** Interactive Mode Other **********
1074 class InteractiveModeOther(Menu
):
1075 bl_idname
= "VIEW3D_MT_Object_Interactive_Other"
1076 bl_label
= "Interactive Mode"
1077 bl_description
= "Menu of objects interactive mode"
1079 def draw(self
, context
):
1080 layout
= self
.layout
1081 layout
.operator("object.editmode_toggle", text
="Edit/Object Toggle",
1083 if context
.gpencil_data
:
1084 layout
.operator("view3d.interactive_mode_grease_pencil", icon
="GREASEPENCIL")
1087 # ********** Grease Pencil Interactive Mode **********
1088 class VIEW3D_OT_Interactive_Mode_Grease_Pencil(Operator
):
1089 bl_idname
= "view3d.interactive_mode_grease_pencil"
1090 bl_label
= "Edit Strokes"
1091 bl_description
= "Toggle Edit Strokes for Grease Pencil"
1094 def poll(cls
, context
):
1095 return (context
.gpencil_data
is not None)
1097 def execute(self
, context
):
1099 bpy
.ops
.gpencil
.editmode_toggle()
1101 self
.report({'WARNING'}, "It is not possible to enter into the interactive mode")
1105 class VIEW3D_MT_Edit_Gpencil(Menu
):
1106 bl_label
= "GPencil"
1108 def draw(self
, context
):
1109 toolsettings
= context
.tool_settings
1110 layout
= self
.layout
1112 layout
.operator("gpencil.brush_paint", text
="Sculpt Strokes").wait_for_input
= True
1113 layout
.prop_menu_enum(toolsettings
.gpencil_sculpt
, "tool", text
="Sculpt Brush")
1114 UseSeparator(self
, context
)
1116 layout
.menu("VIEW3D_MT_edit_gpencil_transform")
1117 layout
.operator("transform.mirror", text
="Mirror")
1118 layout
.menu("GPENCIL_MT_snap")
1119 UseSeparator(self
, context
)
1121 layout
.menu("VIEW3D_MT_object_animation") # NOTE: provides keyingset access...
1122 UseSeparator(self
, context
)
1124 layout
.menu("VIEW3D_MT_edit_gpencil_delete")
1125 layout
.operator("gpencil.duplicate_move", text
="Duplicate")
1126 UseSeparator(self
, context
)
1128 layout
.menu("VIEW3D_MT_select_gpencil")
1129 UseSeparator(self
, context
)
1131 layout
.operator("gpencil.copy", text
="Copy")
1132 layout
.operator("gpencil.paste", text
="Paste")
1133 UseSeparator(self
, context
)
1135 layout
.prop_menu_enum(toolsettings
, "proportional_edit")
1136 layout
.prop_menu_enum(toolsettings
, "proportional_edit_falloff")
1137 UseSeparator(self
, context
)
1139 layout
.operator("gpencil.reveal")
1140 layout
.operator("gpencil.hide", text
="Show Active Layer Only").unselected
= True
1141 layout
.operator("gpencil.hide", text
="Hide Active Layer").unselected
= False
1142 UseSeparator(self
, context
)
1144 layout
.operator_menu_enum("gpencil.move_to_layer", "layer", text
="Move to Layer")
1145 layout
.operator_menu_enum("gpencil.convert", "type", text
="Convert to Geometry...")
1148 # ********** Text Interactive Mode **********
1149 class VIEW3D_OT_Interactive_Mode_Text(Operator
):
1150 bl_idname
= "view3d.interactive_mode_text"
1151 bl_label
= "Enter Edit Mode"
1152 bl_description
= "Toggle object's editmode"
1155 def poll(cls
, context
):
1156 return (context
.active_object
is not None)
1158 def execute(self
, context
):
1159 bpy
.ops
.object.editmode_toggle()
1160 self
.report({'INFO'}, "Spacebar shortcut won't work in the Text Edit mode")
1164 # ********** Object Parent **********
1165 class VIEW3D_MT_ParentMenu(Menu
):
1168 def draw(self
, context
):
1169 layout
= self
.layout
1171 layout
.operator("object.parent_set", text
="Set")
1172 layout
.operator("object.parent_clear", text
="Clear")
1175 # ********** Object Group **********
1176 class VIEW3D_MT_GroupMenu(Menu
):
1179 def draw(self
, context
):
1180 layout
= self
.layout
1181 layout
.operator("group.create")
1182 layout
.operator("group.objects_add_active")
1183 UseSeparator(self
, context
)
1184 layout
.operator("group.objects_remove")
1185 layout
.operator("group.objects_remove_all")
1186 layout
.operator("group.objects_remove_active")
1189 # ********** Object Camera Options **********
1190 class VIEW3D_MT_Camera_Options(Menu
):
1193 def draw(self
, context
):
1194 layout
= self
.layout
1195 layout
.operator_context
= 'EXEC_REGION_WIN'
1196 layout
.operator("object.camera_add", text
="Add Camera", icon
='OUTLINER_OB_CAMERA')
1197 self
.layout
.operator("view3d.object_as_camera", text
="Object As Camera", icon
='OUTLINER_OB_CAMERA')
1198 self
.layout
.operator("view3d.viewnumpad", text
="View Active Camera",
1199 icon
='OUTLINER_OB_CAMERA').type = 'CAMERA'
1202 class VIEW3D_MT_Object_Data_Link(Menu
):
1203 bl_label
= "Object Data"
1205 def draw(self
, context
):
1206 layout
= self
.layout
1208 layout
.operator_menu_enum("object.make_local", "type", text
="Make Local...")
1209 layout
.menu("VIEW3D_MT_make_single_user")
1210 layout
.operator("object.proxy_make", text
="Make Proxy...")
1211 layout
.operator("object.make_dupli_face")
1212 UseSeparator(self
, context
)
1213 layout
.operator("object.data_transfer")
1214 layout
.operator("object.datalayout_transfer")
1217 class VIEW3D_MT_Duplicate(Menu
):
1218 bl_label
= "Duplicate"
1220 def draw(self
, context
):
1221 layout
= self
.layout
1223 layout
.operator("object.duplicate_move")
1224 layout
.operator("object.duplicate_move_linked")
1227 class VIEW3D_MT_KeyframeMenu(Menu
):
1228 bl_label
= "Keyframe"
1230 def draw(self
, context
):
1231 layout
= self
.layout
1232 layout
.operator("anim.keyframe_insert_menu",
1233 text
="Insert Keyframe...")
1234 layout
.operator("anim.keyframe_delete_v3d",
1235 text
="Delete Keyframe...")
1236 layout
.operator("anim.keying_set_active_set",
1237 text
="Change Keying Set...")
1240 class VIEW3D_MT_UndoS(Menu
):
1241 bl_label
= "Undo/Redo"
1243 def draw(self
, context
):
1244 layout
= self
.layout
1246 layout
.operator("ed.undo")
1247 layout
.operator("ed.redo")
1248 UseSeparator(self
, context
)
1249 layout
.operator("ed.undo_history")
1252 # ********** Normals / Auto Smooth Menu **********
1253 # Thanks to marvin.k.breuer for the Autosmooth part of the menu
1254 class VIEW3D_MT_AutoSmooth(Menu
):
1255 bl_label
= "Normals / Auto Smooth"
1257 def draw(self
, context
):
1258 layout
= self
.layout
1259 obj
= context
.object
1260 obj_data
= context
.active_object
.data
1262 # moved the VIEW3D_MT_edit_mesh_normals contents here under an Edit mode check
1263 if obj
and obj
.type == 'MESH' and obj
.mode
in {'EDIT'}:
1264 layout
.operator("mesh.normals_make_consistent",
1265 text
="Recalculate Outside").inside
= False
1266 layout
.operator("mesh.normals_make_consistent",
1267 text
="Recalculate Inside").inside
= True
1268 layout
.operator("mesh.flip_normals")
1269 UseSeparator(self
, context
)
1271 layout
.prop(obj_data
, "show_double_sided", text
="Normals: Double Sided")
1272 UseSeparator(self
, context
)
1273 layout
.prop(obj_data
, "use_auto_smooth", text
="Normals: Auto Smooth")
1275 # Auto Smooth Angle - two tab spaces to align it with the rest of the menu
1276 layout
.prop(obj_data
, "auto_smooth_angle",
1277 text
=" Auto Smooth Angle")
1280 # Edit Mode Menu's #
1282 # ********** Edit Mesh **********
1283 class VIEW3D_MT_Edit_Mesh(Menu
):
1286 def draw(self
, context
):
1287 layout
= self
.layout
1288 toolsettings
= context
.tool_settings
1289 view
= context
.space_data
1291 layout
.menu("VIEW3D_MT_edit_mesh_vertices", icon
='VERTEXSEL')
1292 layout
.menu("VIEW3D_MT_edit_mesh_edges", icon
='EDGESEL')
1293 layout
.menu("VIEW3D_MT_edit_mesh_faces", icon
='FACESEL')
1294 UseSeparator(self
, context
)
1295 layout
.operator("mesh.duplicate_move")
1296 UseSeparator(self
, context
)
1297 layout
.menu("VIEW3D_MT_edit_mesh_clean", icon
='AUTO')
1298 layout
.prop(view
, "use_occlude_geometry")
1299 UseSeparator(self
, context
)
1300 layout
.menu("VIEW3D_MT_AutoSmooth", icon
='META_DATA')
1301 layout
.operator("mesh.loopcut_slide",
1302 text
="Loopcut", icon
='UV_EDGESEL')
1303 UseSeparator(self
, context
)
1304 layout
.operator("mesh.symmetrize")
1305 layout
.operator("mesh.symmetry_snap")
1306 UseSeparator(self
, context
)
1307 layout
.operator("mesh.bisect")
1308 layout
.operator_menu_enum("mesh.sort_elements", "type", text
="Sort Elements...")
1309 UseSeparator(self
, context
)
1310 layout
.prop_menu_enum(toolsettings
, "proportional_edit")
1311 layout
.prop_menu_enum(toolsettings
, "proportional_edit_falloff")
1312 UseSeparator(self
, context
)
1314 layout
.prop(toolsettings
, "use_mesh_automerge")
1315 # Double Threshold - two tab spaces to align it with the rest of the menu
1316 layout
.prop(toolsettings
, "double_threshold", text
=" Double Threshold")
1318 UseSeparator(self
, context
)
1319 layout
.menu("VIEW3D_MT_edit_mesh_showhide")
1322 # ********** Edit Multiselect **********
1323 class VIEW3D_MT_Edit_Multi(Menu
):
1324 bl_label
= "Multi Select"
1326 def draw(self
, context
):
1327 layout
= self
.layout
1328 layout
.operator_context
= 'INVOKE_REGION_WIN'
1330 prop
= layout
.operator("wm.context_set_value", text
="Vertex Select",
1332 prop
.value
= "(True, False, False)"
1333 prop
.data_path
= "tool_settings.mesh_select_mode"
1335 prop
= layout
.operator("wm.context_set_value", text
="Edge Select",
1337 prop
.value
= "(False, True, False)"
1338 prop
.data_path
= "tool_settings.mesh_select_mode"
1340 prop
= layout
.operator("wm.context_set_value", text
="Face Select",
1342 prop
.value
= "(False, False, True)"
1343 prop
.data_path
= "tool_settings.mesh_select_mode"
1344 UseSeparator(self
, context
)
1346 prop
= layout
.operator("wm.context_set_value",
1347 text
="Vertex & Edge Select",
1348 icon
='EDITMODE_HLT')
1349 prop
.value
= "(True, True, False)"
1350 prop
.data_path
= "tool_settings.mesh_select_mode"
1352 prop
= layout
.operator("wm.context_set_value",
1353 text
="Vertex & Face Select",
1355 prop
.value
= "(True, False, True)"
1356 prop
.data_path
= "tool_settings.mesh_select_mode"
1358 prop
= layout
.operator("wm.context_set_value",
1359 text
="Edge & Face Select",
1361 prop
.value
= "(False, True, True)"
1362 prop
.data_path
= "tool_settings.mesh_select_mode"
1363 UseSeparator(self
, context
)
1365 prop
= layout
.operator("wm.context_set_value",
1366 text
="Vertex & Edge & Face Select",
1368 prop
.value
= "(True, True, True)"
1369 prop
.data_path
= "tool_settings.mesh_select_mode"
1372 # ********** Edit Mesh Edge **********
1373 class VIEW3D_MT_EditM_Edge(Menu
):
1376 def draw(self
, context
):
1377 layout
= self
.layout
1378 layout
.operator_context
= 'INVOKE_REGION_WIN'
1380 layout
.operator("mesh.mark_seam")
1381 layout
.operator("mesh.mark_seam", text
="Clear Seam").clear
= True
1382 UseSeparator(self
, context
)
1384 layout
.operator("mesh.mark_sharp")
1385 layout
.operator("mesh.mark_sharp", text
="Clear Sharp").clear
= True
1386 layout
.operator("mesh.extrude_move_along_normals", text
="Extrude")
1387 UseSeparator(self
, context
)
1389 layout
.operator("mesh.edge_rotate",
1390 text
="Rotate Edge CW").direction
= 'CW'
1391 layout
.operator("mesh.edge_rotate",
1392 text
="Rotate Edge CCW").direction
= 'CCW'
1393 UseSeparator(self
, context
)
1395 layout
.operator("TFM_OT_edge_slide", text
="Edge Slide")
1396 layout
.operator("mesh.loop_multi_select", text
="Edge Loop")
1397 layout
.operator("mesh.loop_multi_select", text
="Edge Ring").ring
= True
1398 layout
.operator("mesh.loop_to_region")
1399 layout
.operator("mesh.region_to_loop")
1402 # ********** Edit Mesh Cursor **********
1403 class VIEW3D_MT_EditCursorMenu(Menu
):
1404 bl_label
= "Snap Cursor"
1406 def draw(self
, context
):
1407 layout
= self
.layout
1408 layout
.operator_context
= 'INVOKE_REGION_WIN'
1409 layout
.operator("object.setorigintoselected",
1410 text
="Origin to Selected V/F/E")
1411 UseSeparator(self
, context
)
1412 layout
.menu("VIEW3D_Snap_Origin")
1413 layout
.menu("VIEW3D_Snap_Context")
1414 UseSeparator(self
, context
)
1415 layout
.operator("view3d.snap_cursor_to_selected",
1416 text
="Cursor to Selected")
1417 layout
.operator("view3d.snap_cursor_to_center",
1418 text
="Cursor to Center")
1419 layout
.operator("view3d.snap_cursor_to_grid",
1420 text
="Cursor to Grid")
1421 layout
.operator("view3d.snap_cursor_to_active",
1422 text
="Cursor to Active")
1423 layout
.operator("view3d.snap_cursor_to_edge_intersection",
1424 text
="Cursor to Edge Intersection")
1425 UseSeparator(self
, context
)
1426 layout
.operator("view3d.snap_selected_to_cursor",
1427 text
="Selection to Cursor").use_offset
= False
1428 layout
.operator("view3d.snap_selected_to_cursor",
1429 text
="Selection to Cursor (Keep Offset)").use_offset
= True
1430 layout
.operator("view3d.snap_selected_to_grid",
1431 text
="Selection to Grid")
1432 UseSeparator(self
, context
)
1433 layout
.menu("VIEW3D_MT_Pivot")
1434 layout
.operator("view3d.pivot_cursor",
1435 text
="Set Cursor as Pivot Point")
1436 layout
.operator("view3d.revert_pivot",
1437 text
="Revert Pivot Point")
1440 # ********** Edit Mesh UV **********
1441 class VIEW3D_MT_UV_Map(Menu
):
1442 bl_label
= "UV Mapping"
1444 def draw(self
, context
):
1445 layout
= self
.layout
1446 layout
.operator("uv.unwrap")
1447 UseSeparator(self
, context
)
1448 layout
.operator_context
= 'INVOKE_DEFAULT'
1449 layout
.operator("uv.smart_project")
1450 layout
.operator("uv.lightmap_pack")
1451 layout
.operator("uv.follow_active_quads")
1452 layout
.operator_context
= 'EXEC_REGION_WIN'
1453 layout
.operator("uv.cube_project")
1454 layout
.operator("uv.cylinder_project")
1455 layout
.operator("uv.sphere_project")
1456 layout
.operator_context
= 'INVOKE_REGION_WIN'
1457 UseSeparator(self
, context
)
1458 layout
.operator("uv.project_from_view").scale_to_bounds
= False
1459 layout
.operator("uv.project_from_view", text
="Project from View (Bounds)").scale_to_bounds
= True
1460 UseSeparator(self
, context
)
1461 layout
.operator("uv.reset")
1464 # ********** Edit Curve **********
1465 class VIEW3D_MT_Edit_Curve(Menu
):
1468 def draw(self
, context
):
1469 layout
= self
.layout
1471 toolsettings
= context
.tool_settings
1473 layout
.operator("curve.extrude_move")
1474 layout
.operator("curve.spin")
1475 layout
.operator("curve.duplicate_move")
1476 layout
.operator("curve.split")
1477 layout
.operator("curve.separate")
1478 layout
.operator("curve.make_segment")
1479 layout
.operator("curve.cyclic_toggle")
1480 UseSeparator(self
, context
)
1481 layout
.operator("curve.delete", text
="Delete...")
1482 UseSeparator(self
, context
)
1483 layout
.menu("VIEW3D_MT_edit_curve_segments")
1484 layout
.prop_menu_enum(toolsettings
, "proportional_edit",
1486 layout
.prop_menu_enum(toolsettings
, "proportional_edit_falloff",
1488 layout
.menu("VIEW3D_MT_edit_curve_showhide")
1491 class VIEW3D_MT_EditCurveCtrlpoints(Menu
):
1492 bl_label
= "Control Points"
1494 def draw(self
, context
):
1495 layout
= self
.layout
1497 edit_object
= context
.edit_object
1499 if edit_object
.type == 'CURVE':
1500 layout
.operator("transform.transform").mode
= 'TILT'
1501 layout
.operator("curve.tilt_clear")
1502 layout
.operator("curve.separate")
1503 layout
.operator_menu_enum("curve.handle_type_set", "type")
1504 layout
.menu("VIEW3D_MT_hook")
1507 class VIEW3D_MT_EditCurveSegments(Menu
):
1508 bl_label
= "Curve Segments"
1510 def draw(self
, context
):
1511 layout
= self
.layout
1512 layout
.operator("curve.subdivide")
1513 layout
.operator("curve.switch_direction")
1516 class VIEW3D_MT_EditCurveSpecials(Menu
):
1517 bl_label
= "Specials"
1519 def draw(self
, context
):
1520 layout
= self
.layout
1521 layout
.operator("curve.subdivide")
1522 UseSeparator(self
, context
)
1523 layout
.operator("curve.switch_direction")
1524 layout
.operator("curve.spline_weight_set")
1525 layout
.operator("curve.radius_set")
1526 UseSeparator(self
, context
)
1527 layout
.operator("curve.smooth")
1528 layout
.operator("curve.smooth_weight")
1529 layout
.operator("curve.smooth_radius")
1530 layout
.operator("curve.smooth_tilt")
1534 # Thanks to CoDEmanX for the code
1535 class VIEW3D_MT_Brush_Selection(Menu
):
1536 bl_label
= "Brush Tool"
1538 def draw(self
, context
):
1539 layout
= self
.layout
1540 settings
= UnifiedPaintPanel
.paint_settings(context
)
1542 # check if brush exists (for instance, in paint mode before adding a slot)
1543 if hasattr(settings
, 'brush'):
1544 brush
= settings
.brush
1549 layout
.label(text
="No Brushes currently available", icon
="INFO")
1552 if not context
.particle_edit_object
:
1553 if UseBrushesLists():
1554 flow
= layout
.column_flow(columns
=3)
1556 for brsh
in bpy
.data
.brushes
:
1557 if (context
.sculpt_object
and brsh
.use_paint_sculpt
):
1558 props
= flow
.operator("wm.context_set_id", text
=brsh
.name
,
1559 icon_value
=layout
.icon(brsh
))
1560 props
.data_path
= "tool_settings.sculpt.brush"
1561 props
.value
= brsh
.name
1562 elif (context
.image_paint_object
and brsh
.use_paint_image
):
1563 props
= flow
.operator("wm.context_set_id", text
=brsh
.name
,
1564 icon_value
=layout
.icon(brsh
))
1565 props
.data_path
= "tool_settings.image_paint.brush"
1566 props
.value
= brsh
.name
1567 elif (context
.vertex_paint_object
and brsh
.use_paint_vertex
):
1568 props
= flow
.operator("wm.context_set_id", text
=brsh
.name
,
1569 icon_value
=layout
.icon(brsh
))
1570 props
.data_path
= "tool_settings.vertex_paint.brush"
1571 props
.value
= brsh
.name
1572 elif (context
.weight_paint_object
and brsh
.use_paint_weight
):
1573 props
= flow
.operator("wm.context_set_id", text
=brsh
.name
,
1574 icon_value
=layout
.icon(brsh
))
1575 props
.data_path
= "tool_settings.weight_paint.brush"
1576 props
.value
= brsh
.name
1578 layout
.template_ID_preview(settings
, "brush", new
="brush.add", rows
=3, cols
=8)
1581 class VIEW3D_MT_Brush_Settings(Menu
):
1582 bl_label
= "Brush Settings"
1584 def draw(self
, context
):
1585 layout
= self
.layout
1586 settings
= UnifiedPaintPanel
.paint_settings(context
)
1587 brush
= getattr(settings
, "brush", None)
1589 ups
= context
.tool_settings
.unified_paint_settings
1590 layout
.prop(ups
, "use_unified_size", text
="Unified Size")
1591 layout
.prop(ups
, "use_unified_strength", text
="Unified Strength")
1592 if context
.image_paint_object
or context
.vertex_paint_object
:
1593 layout
.prop(ups
, "use_unified_color", text
="Unified Color")
1594 UseSeparator(self
, context
)
1597 layout
.label(text
="No Brushes currently available", icon
="INFO")
1600 layout
.menu("VIEW3D_MT_brush_paint_modes")
1602 if context
.sculpt_object
:
1603 sculpt_tool
= brush
.sculpt_tool
1605 UseSeparator(self
, context
)
1606 layout
.operator_menu_enum("brush.curve_preset", "shape", text
="Curve Preset")
1607 UseSeparator(self
, context
)
1609 if sculpt_tool
!= 'GRAB':
1610 layout
.prop_menu_enum(brush
, "stroke_method")
1612 if sculpt_tool
in {'DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'}:
1613 layout
.prop_menu_enum(brush
, "direction")
1615 if sculpt_tool
== 'LAYER':
1616 layout
.prop(brush
, "use_persistent")
1617 layout
.operator("sculpt.set_persistent_base")
1621 class VIEW3D_MT_Sculpts(Menu
):
1624 def draw(self
, context
):
1625 layout
= self
.layout
1626 toolsettings
= context
.tool_settings
1627 sculpt
= toolsettings
.sculpt
1629 layout
.prop(sculpt
, "use_symmetry_x")
1630 layout
.prop(sculpt
, "use_symmetry_y")
1631 layout
.prop(sculpt
, "use_symmetry_z")
1633 UseSeparator(self
, context
)
1634 layout
.prop(sculpt
, "lock_x")
1635 layout
.prop(sculpt
, "lock_y")
1636 layout
.prop(sculpt
, "lock_z")
1638 UseSeparator(self
, context
)
1639 layout
.prop(sculpt
, "use_threaded", text
="Threaded Sculpt")
1640 layout
.prop(sculpt
, "show_low_resolution")
1641 layout
.prop(sculpt
, "use_deform_only")
1643 UseSeparator(self
, context
)
1644 layout
.prop(sculpt
, "show_brush")
1645 layout
.prop(sculpt
, "show_diffuse_color")
1648 class VIEW3D_MT_Hide_Masks(Menu
):
1649 bl_label
= "Hide/Mask"
1651 def draw(self
, context
):
1652 layout
= self
.layout
1654 props
= layout
.operator("paint.mask_lasso_gesture", text
="Lasso Mask")
1655 UseSeparator(self
, context
)
1656 props
= layout
.operator("view3d.select_border", text
="Box Mask", icon
="BORDER_RECT")
1657 props
= layout
.operator("paint.hide_show", text
="Box Hide")
1658 props
.action
= 'HIDE'
1659 props
.area
= 'INSIDE'
1661 props
= layout
.operator("paint.hide_show", text
="Box Show")
1662 props
.action
= 'SHOW'
1663 props
.area
= 'INSIDE'
1664 UseSeparator(self
, context
)
1666 props
= layout
.operator("paint.mask_flood_fill", text
="Fill Mask", icon
="BORDER_RECT")
1667 props
.mode
= 'VALUE'
1670 props
= layout
.operator("paint.mask_flood_fill", text
="Clear Mask")
1671 props
.mode
= 'VALUE'
1674 layout
.operator("paint.mask_flood_fill", text
="Invert Mask").mode
= 'INVERT'
1675 UseSeparator(self
, context
)
1677 props
= layout
.operator("paint.hide_show", text
="Show All", icon
="RESTRICT_VIEW_OFF")
1678 props
.action
= 'SHOW'
1681 props
= layout
.operator("paint.hide_show", text
="Hide Masked", icon
="RESTRICT_VIEW_ON")
1682 props
.area
= 'MASKED'
1683 props
.action
= 'HIDE'
1686 # Sculpt Specials Menu (Thanks to marvin.k.breuer) #
1687 class VIEW3D_MT_Sculpt_Specials(Menu
):
1688 bl_label
= "Sculpt Specials"
1690 def draw(self
, context
):
1691 layout
= self
.layout
1692 settings
= context
.tool_settings
1694 if context
.sculpt_object
.use_dynamic_topology_sculpting
:
1695 layout
.operator("sculpt.dynamic_topology_toggle",
1696 icon
='X', text
="Disable Dyntopo")
1697 UseSeparator(self
, context
)
1699 if (settings
.sculpt
.detail_type_method
== 'CONSTANT'):
1700 layout
.prop(settings
.sculpt
, "constant_detail", text
="Const.")
1701 layout
.operator("sculpt.sample_detail_size", text
="", icon
='EYEDROPPER')
1703 layout
.prop(settings
.sculpt
, "detail_size", text
="Detail")
1704 UseSeparator(self
, context
)
1706 layout
.operator("sculpt.symmetrize", icon
='ARROW_LEFTRIGHT')
1707 layout
.prop(settings
.sculpt
, "symmetrize_direction", "")
1708 UseSeparator(self
, context
)
1710 layout
.operator("sculpt.optimize")
1711 if (settings
.sculpt
.detail_type_method
== 'CONSTANT'):
1712 layout
.operator("sculpt.detail_flood_fill")
1713 UseSeparator(self
, context
)
1715 layout
.prop(settings
.sculpt
, "detail_refine_method", text
="")
1716 layout
.prop(settings
.sculpt
, "detail_type_method", text
="")
1717 UseSeparator(self
, context
)
1718 layout
.prop(settings
.sculpt
, "use_smooth_shading", "Smooth")
1720 layout
.operator("sculpt.dynamic_topology_toggle",
1721 icon
='SCULPT_DYNTOPO', text
="Enable Dyntopo")
1724 # Display Wire (Thanks to marvin.k.breuer) #
1725 class VIEW3D_OT_Display_Wire_All(Operator
):
1726 bl_label
= "Wire on All Objects"
1727 bl_idname
= "view3d.display_wire_all"
1728 bl_description
= "Enable/Disable Display Wire on All Objects"
1731 def poll(cls
, context
):
1732 return context
.active_object
is not None
1734 def execute(self
, context
):
1736 for obj
in bpy
.data
.objects
:
1739 obj
.show_all_edges
= False
1740 obj
.show_wire
= False
1742 obj
.show_all_edges
= True
1743 obj
.show_wire
= True
1749 self
.report({'WARNING'},
1750 "Wire on All Objects could not be completed for some objects")
1755 # Vertex Color Menu #
1756 class VIEW3D_MT_Vertex_Colors(Menu
):
1757 bl_label
= "Vertex Colors"
1759 def draw(self
, context
):
1760 layout
= self
.layout
1761 layout
.operator("paint.vertex_color_set")
1762 UseSeparator(self
, context
)
1764 layout
.operator("paint.vertex_color_smooth")
1765 layout
.operator("paint.vertex_color_dirt")
1768 # Weight Paint Menu #
1769 class VIEW3D_MT_Paint_Weights(Menu
):
1770 bl_label
= "Weights"
1772 def draw(self
, context
):
1773 layout
= self
.layout
1775 layout
.operator("paint.weight_from_bones",
1776 text
="Assign Automatic From Bones").type = 'AUTOMATIC'
1777 layout
.operator("paint.weight_from_bones",
1778 text
="Assign From Bone Envelopes").type = 'ENVELOPES'
1779 UseSeparator(self
, context
)
1781 layout
.operator("object.vertex_group_normalize_all", text
="Normalize All")
1782 layout
.operator("object.vertex_group_normalize", text
="Normalize")
1783 UseSeparator(self
, context
)
1785 layout
.operator("object.vertex_group_mirror", text
="Mirror")
1786 layout
.operator("object.vertex_group_invert", text
="Invert")
1787 UseSeparator(self
, context
)
1789 layout
.operator("object.vertex_group_clean", text
="Clean")
1790 layout
.operator("object.vertex_group_quantize", text
="Quantize")
1791 UseSeparator(self
, context
)
1793 layout
.operator("object.vertex_group_levels", text
="Levels")
1794 layout
.operator("object.vertex_group_smooth", text
="Smooth")
1795 UseSeparator(self
, context
)
1797 props
= layout
.operator("object.data_transfer", text
="Transfer Weights")
1798 props
.use_reverse_transfer
= True
1799 props
.data_type
= 'VGROUP_WEIGHTS'
1800 UseSeparator(self
, context
)
1802 layout
.operator("object.vertex_group_limit_total", text
="Limit Total")
1803 layout
.operator("object.vertex_group_fix", text
="Fix Deforms")
1804 UseSeparator(self
, context
)
1806 layout
.operator("paint.weight_set")
1811 class VIEW3D_MT_Edit_Armature(Menu
):
1812 bl_label
= "Armature"
1814 def draw(self
, context
):
1815 layout
= self
.layout
1816 toolsettings
= context
.tool_settings
1818 layout
.prop_menu_enum(toolsettings
, "proportional_edit", icon
="PROP_CON")
1819 layout
.prop_menu_enum(toolsettings
, "proportional_edit_falloff", icon
="SMOOTHCURVE")
1820 UseSeparator(self
, context
)
1822 layout
.menu("VIEW3D_MT_bone_options_toggle", text
="Bone Settings")
1823 layout
.operator("armature.merge")
1824 layout
.operator("armature.fill")
1825 layout
.operator("armature.split")
1826 layout
.operator("armature.separate")
1827 layout
.operator("armature.switch_direction", text
="Switch Direction")
1829 layout
.operator_context
= 'EXEC_AREA'
1830 layout
.operator("armature.symmetrize")
1831 UseSeparator(self
, context
)
1833 layout
.operator("armature.delete")
1834 UseSeparator(self
, context
)
1836 layout
.operator_context
= 'INVOKE_DEFAULT'
1837 layout
.operator("armature.armature_layers")
1838 layout
.operator("armature.bone_layers")
1841 class VIEW3D_MT_EditArmatureTK(Menu
):
1842 bl_label
= "Armature Tools"
1844 def draw(self
, context
):
1845 layout
= self
.layout
1846 layout
.operator("armature.subdivide", text
="Subdivide")
1847 layout
.operator("armature.extrude_move")
1848 layout
.operator("armature.extrude_forked")
1849 layout
.operator("armature.duplicate_move")
1850 UseSeparator(self
, context
)
1851 layout
.menu("VIEW3D_MT_edit_armature_delete")
1852 UseSeparator(self
, context
)
1853 layout
.operator("transform.transform",
1854 text
="Scale Envelope Distance").mode
= 'BONE_SIZE'
1855 layout
.operator("transform.transform",
1856 text
="Scale B-Bone Width").mode
= 'BONE_SIZE'
1859 # Armature Pose Menu's #
1861 class VIEW3D_MT_Pose(Menu
):
1864 def draw(self
, context
):
1865 layout
= self
.layout
1867 layout
.menu("VIEW3D_MT_object_animation")
1868 layout
.menu("VIEW3D_MT_pose_slide")
1869 layout
.menu("VIEW3D_MT_pose_propagate")
1870 layout
.menu("VIEW3D_MT_pose_library")
1871 layout
.menu("VIEW3D_MT_pose_motion")
1872 UseSeparator(self
, context
)
1873 layout
.menu("VIEW3D_MT_pose_group")
1874 layout
.menu("VIEW3D_MT_object_parent")
1875 UseSeparator(self
, context
)
1876 layout
.menu("VIEW3D_MT_pose_ik")
1877 layout
.menu("VIEW3D_MT_pose_constraints")
1878 layout
.menu("VIEW3D_MT_PoseNames")
1879 layout
.operator("pose.quaternions_flip")
1880 layout
.operator_context
= 'INVOKE_AREA'
1881 UseSeparator(self
, context
)
1882 layout
.operator("armature.armature_layers", text
="Change Armature Layers...")
1883 layout
.operator("pose.bone_layers", text
="Change Bone Layers...")
1884 UseSeparator(self
, context
)
1885 layout
.menu("VIEW3D_MT_pose_showhide")
1886 layout
.menu("VIEW3D_MT_bone_options_toggle", text
="Bone Settings")
1889 # Transform Menu's #
1891 class VIEW3D_MT_TransformMenu(Menu
):
1892 bl_label
= "Transform"
1894 def draw(self
, context
):
1895 layout
= self
.layout
1896 layout
.menu("VIEW3D_MT_ManipulatorMenu1")
1897 UseSeparator(self
, context
)
1898 layout
.operator("transform.translate", text
="Grab/Move")
1899 layout
.operator("transform.rotate", text
="Rotate")
1900 layout
.operator("transform.resize", text
="Scale")
1901 UseSeparator(self
, context
)
1902 layout
.menu("VIEW3D_MT_object_clear")
1903 layout
.menu("VIEW3D_MT_object_apply")
1904 UseSeparator(self
, context
)
1905 layout
.operator("transform.translate", text
="Move Texture Space").texture_space
= True
1906 layout
.operator("transform.resize", text
="Scale Texture Space").texture_space
= True
1907 UseSeparator(self
, context
)
1908 layout
.operator("object.randomize_transform")
1909 layout
.operator("transform.tosphere", text
="To Sphere")
1910 layout
.operator("transform.shear", text
="Shear")
1911 layout
.operator("transform.bend", text
="Bend")
1912 layout
.operator("transform.push_pull", text
="Push/Pull")
1913 UseSeparator(self
, context
)
1914 layout
.operator("object.align")
1915 layout
.operator_context
= 'EXEC_REGION_WIN'
1916 layout
.operator("transform.transform",
1917 text
="Align to Transform Orientation").mode
= 'ALIGN'
1920 # ********** Edit Mesh Transform **********
1921 class VIEW3D_MT_TransformMenuEdit(Menu
):
1922 bl_label
= "Transform"
1924 def draw(self
, context
):
1925 layout
= self
.layout
1926 layout
.menu("VIEW3D_MT_ManipulatorMenu1")
1927 UseSeparator(self
, context
)
1928 layout
.operator("transform.translate", text
="Grab/Move")
1929 layout
.operator("transform.rotate", text
="Rotate")
1930 layout
.operator("transform.resize", text
="Scale")
1931 UseSeparator(self
, context
)
1932 layout
.operator("transform.tosphere", text
="To Sphere")
1933 layout
.operator("transform.shear", text
="Shear")
1934 layout
.operator("transform.bend", text
="Bend")
1935 layout
.operator("transform.push_pull", text
="Push/Pull")
1936 layout
.operator("transform.vertex_warp", text
="Warp")
1937 layout
.operator("transform.vertex_random", text
="Randomize")
1938 UseSeparator(self
, context
)
1939 layout
.operator("transform.translate", text
="Move Texture Space").texture_space
= True
1940 layout
.operator("transform.resize", text
="Scale Texture Space").texture_space
= True
1941 UseSeparator(self
, context
)
1942 layout
.operator_context
= 'EXEC_REGION_WIN'
1943 layout
.operator("transform.transform",
1944 text
="Align to Transform Orientation").mode
= 'ALIGN'
1945 layout
.operator_context
= 'EXEC_AREA'
1946 layout
.operator("object.origin_set",
1947 text
="Geometry to Origin").type = 'GEOMETRY_ORIGIN'
1950 # ********** Transform Lite/Short **********
1951 class VIEW3D_MT_TransformMenuLite(Menu
):
1952 bl_label
= "Transform"
1954 def draw(self
, context
):
1955 layout
= self
.layout
1956 layout
.menu("VIEW3D_MT_ManipulatorMenu1")
1957 UseSeparator(self
, context
)
1958 layout
.operator("transform.translate", text
="Grab/Move")
1959 layout
.operator("transform.rotate", text
="Rotate")
1960 layout
.operator("transform.resize", text
="Scale")
1961 UseSeparator(self
, context
)
1962 layout
.menu("VIEW3D_MT_object_clear")
1963 layout
.menu("VIEW3D_MT_object_apply")
1964 UseSeparator(self
, context
)
1965 layout
.operator("transform.transform",
1966 text
="Align to Transform Orientation").mode
= 'ALIGN'
1969 # ********** Transform Camera **********
1970 class VIEW3D_MT_TransformMenuCamera(Menu
):
1971 bl_label
= "Transform"
1973 def draw(self
, context
):
1974 layout
= self
.layout
1976 layout
.menu("VIEW3D_MT_ManipulatorMenu1")
1977 layout
.menu("VIEW3D_MT_object_clear")
1978 layout
.menu("VIEW3D_MT_object_apply")
1979 layout
.operator("transform.translate", text
="Grab/Move")
1980 layout
.operator("transform.rotate", text
="Rotate")
1981 layout
.operator("transform.resize", text
="Scale")
1982 layout
.operator("object.align")
1983 layout
.operator_context
= 'EXEC_REGION_WIN'
1984 UseSeparator(self
, context
)
1985 layout
.operator("transform.transform",
1986 text
="Align to Transform Orientation").mode
= 'ALIGN'
1989 # ********** Transform Armature **********
1990 class VIEW3D_MT_TransformMenuArmature(Menu
):
1991 bl_label
= "Transform"
1993 def draw(self
, context
):
1994 layout
= self
.layout
1996 layout
.menu("VIEW3D_MT_ManipulatorMenu1")
1997 UseSeparator(self
, context
)
1998 layout
.operator("transform.translate", text
="Grab/Move")
1999 layout
.operator("transform.rotate", text
="Rotate")
2000 layout
.operator("transform.resize", text
="Scale")
2001 UseSeparator(self
, context
)
2002 layout
.operator("armature.align")
2003 layout
.operator("object.align")
2004 layout
.operator_context
= 'EXEC_AREA'
2005 UseSeparator(self
, context
)
2006 layout
.operator("object.origin_set",
2007 text
="Geometry to Origin").type = 'GEOMETRY_ORIGIN'
2008 layout
.operator("object.origin_set",
2009 text
="Origin to Geometry").type = 'ORIGIN_GEOMETRY'
2010 layout
.operator("object.origin_set",
2011 text
="Origin to 3D Cursor").type = 'ORIGIN_CURSOR'
2012 layout
.operator("object.origin_set",
2013 text
="Origin to Center of Mass").type = 'ORIGIN_CENTER_OF_MASS'
2016 # ********** Transform Armature Edit **********
2017 class VIEW3D_MT_TransformMenuArmatureEdit(Menu
):
2018 bl_label
= "Transform"
2020 def draw(self
, context
):
2021 layout
= self
.layout
2022 layout
.menu("VIEW3D_MT_ManipulatorMenu1")
2023 UseSeparator(self
, context
)
2024 layout
.operator("transform.translate", text
="Grab/Move")
2025 layout
.operator("transform.rotate", text
="Rotate")
2026 layout
.operator("transform.resize", text
="Scale")
2027 UseSeparator(self
, context
)
2028 layout
.operator("transform.tosphere", text
="To Sphere")
2029 layout
.operator("transform.shear", text
="Shear")
2030 layout
.operator("transform.bend", text
="Bend")
2031 layout
.operator("transform.push_pull", text
="Push/Pull")
2032 layout
.operator("transform.vertex_warp", text
="Warp")
2033 UseSeparator(self
, context
)
2034 layout
.operator("transform.vertex_random", text
="Randomize")
2035 layout
.operator("armature.align")
2036 layout
.operator_context
= 'EXEC_AREA'
2039 # ********** Transform Armature Pose **********
2040 class VIEW3D_MT_TransformMenuArmaturePose(Menu
):
2041 bl_label
= "Transform"
2043 def draw(self
, context
):
2044 layout
= self
.layout
2045 layout
.menu("VIEW3D_MT_ManipulatorMenu1")
2046 layout
.operator("transform.translate", text
="Grab/Move")
2047 layout
.operator("transform.rotate", text
="Rotate")
2048 layout
.operator("transform.resize", text
="Scale")
2049 UseSeparator(self
, context
)
2050 layout
.operator("pose.transforms_clear", text
="Clear All")
2051 layout
.operator("pose.loc_clear", text
="Location")
2052 layout
.operator("pose.rot_clear", text
="Rotation")
2053 layout
.operator("pose.scale_clear", text
="Scale")
2055 UseSeparator(self
, context
)
2057 layout
.operator("pose.user_transforms_clear", text
="Reset unkeyed")
2058 obj
= context
.object
2059 if obj
.type == 'ARMATURE' and obj
.mode
in {'EDIT', 'POSE'}:
2060 if obj
.data
.draw_type
== 'BBONE':
2061 layout
.operator("transform.transform", text
="Scale BBone").mode
= 'BONE_SIZE'
2062 elif obj
.data
.draw_type
== 'ENVELOPE':
2063 layout
.operator("transform.transform", text
="Scale Envelope Distance").mode
= 'BONE_SIZE'
2064 layout
.operator("transform.transform", text
="Scale Radius").mode
= 'BONE_ENVELOPE'
2069 class VIEW3D_MT_View_Directions(Menu
):
2070 bl_label
= "Directions"
2072 def draw(self
, context
):
2073 layout
= self
.layout
2074 layout
.operator("view3d.viewnumpad", text
="Camera").type = 'CAMERA'
2075 UseSeparator(self
, context
)
2076 layout
.operator("view3d.viewnumpad", text
="Top").type = 'TOP'
2077 layout
.operator("view3d.viewnumpad", text
="Bottom").type = 'BOTTOM'
2078 UseSeparator(self
, context
)
2079 layout
.operator("view3d.viewnumpad", text
="Front").type = 'FRONT'
2080 layout
.operator("view3d.viewnumpad", text
="Back").type = 'BACK'
2081 UseSeparator(self
, context
)
2082 layout
.operator("view3d.viewnumpad", text
="Right").type = 'RIGHT'
2083 layout
.operator("view3d.viewnumpad", text
="Left").type = 'LEFT'
2086 class VIEW3D_MT_View_Border(Menu
):
2087 bl_label
= "Set Border"
2089 def draw(self
, context
):
2090 layout
= self
.layout
2091 layout
.operator_context
= 'INVOKE_REGION_WIN'
2092 layout
.operator("view3d.clip_border", text
="Clipping Border...")
2093 layout
.operator("view3d.zoom_border", text
="Zoom Border...")
2094 layout
.operator("view3d.render_border", text
="Render Border...")
2097 class VIEW3D_MT_View_Toggle(Menu
):
2098 bl_label
= "View Toggle"
2100 def draw(self
, context
):
2101 layout
= self
.layout
2102 layout
.operator_context
= 'INVOKE_REGION_WIN'
2103 layout
.operator("screen.area_dupli")
2104 UseSeparator(self
, context
)
2105 layout
.operator("screen.region_quadview")
2106 layout
.operator("screen.screen_full_area", text
="Toggle Maximize Area")
2107 layout
.operator("screen.screen_full_area").use_hide_panels
= True
2110 class VIEW3D_MT_View_Menu(Menu
):
2113 def draw(self
, context
):
2114 layout
= self
.layout
2115 layout
.menu("VIEW3D_MT_Shade")
2116 UseSeparator(self
, context
)
2117 layout
.menu("VIEW3D_MT_view_cameras", text
="Cameras")
2118 layout
.menu("VIEW3D_MT_View_Directions")
2119 layout
.menu("VIEW3D_MT_View_Navigation")
2120 UseSeparator(self
, context
)
2121 layout
.menu("VIEW3D_MT_View_Align")
2122 layout
.menu("VIEW3D_MT_View_Toggle")
2123 layout
.operator("view3d.view_persportho")
2124 layout
.operator("view3d.localview", text
="View Global/Local")
2125 layout
.operator("view3d.view_selected").use_all_regions
= False
2126 layout
.operator("view3d.view_all").center
= False
2127 UseSeparator(self
, context
)
2128 layout
.menu("VIEW3D_MT_View_Border")
2129 layout
.operator("view3d.layers", text
="Show All Layers").nr
= 0
2130 UseSeparator(self
, context
)
2131 # New menu entry for Animation player
2132 layout
.menu("VIEW3D_MT_Animation_Player",
2133 text
="Playback Animation", icon
='PLAY')
2136 class VIEW3D_MT_View_Navigation(Menu
):
2137 bl_label
= "Navigation"
2139 def draw(self
, context
):
2141 layout
= self
.layout
2142 layout
.operator_enum("view3d.view_orbit", "type")
2143 props
= layout
.operator("view3d.view_orbit", "Orbit Opposite")
2144 props
.type = 'ORBITRIGHT'
2147 UseSeparator(self
, context
)
2148 layout
.operator("view3d.view_roll", text
="Roll Left").type = 'LEFT'
2149 layout
.operator("view3d.view_roll", text
="Roll Right").type = 'RIGHT'
2150 UseSeparator(self
, context
)
2151 layout
.operator_enum("view3d.view_pan", "type")
2152 UseSeparator(self
, context
)
2153 layout
.operator("view3d.zoom", text
="Zoom In").delta
= 1
2154 layout
.operator("view3d.zoom", text
="Zoom Out").delta
= -1
2155 UseSeparator(self
, context
)
2156 layout
.operator("view3d.zoom_camera_1_to_1", text
="Zoom Camera 1:1")
2157 UseSeparator(self
, context
)
2158 layout
.operator("view3d.fly")
2159 layout
.operator("view3d.walk")
2162 class VIEW3D_MT_View_Align(Menu
):
2163 bl_label
= "Align View"
2165 def draw(self
, context
):
2166 layout
= self
.layout
2167 layout
.operator("view3d.view_all", text
="Center Cursor and View All").center
= True
2168 layout
.operator("view3d.view_center_cursor")
2169 UseSeparator(self
, context
)
2170 layout
.operator("view3d.camera_to_view", text
="Align Active Camera to View")
2171 layout
.operator("view3d.camera_to_view_selected", text
="Align Active Camera to Selected")
2172 UseSeparator(self
, context
)
2173 layout
.operator("view3d.view_selected")
2174 layout
.operator("view3d.view_lock_to_active")
2175 layout
.operator("view3d.view_lock_clear")
2178 class VIEW3D_MT_View_Align_Selected(Menu
):
2179 bl_label
= "Align View to Active"
2181 def draw(self
, context
):
2182 layout
= self
.layout
2183 props
= layout
.operator("view3d.viewnumpad", text
="Top")
2184 props
.align_active
= True
2186 props
= layout
.operator("view3d.viewnumpad", text
="Bottom")
2187 props
.align_active
= True
2188 props
.type = 'BOTTOM'
2189 props
= layout
.operator("view3d.viewnumpad", text
="Front")
2190 props
.align_active
= True
2191 props
.type = 'FRONT'
2192 props
= layout
.operator("view3d.viewnumpad", text
="Back")
2193 props
.align_active
= True
2195 props
= layout
.operator("view3d.viewnumpad", text
="Right")
2196 props
.align_active
= True
2197 props
.type = 'RIGHT'
2198 props
= layout
.operator("view3d.viewnumpad", text
="Left")
2199 props
.align_active
= True
2203 class VIEW3D_MT_View_Cameras(Menu
):
2204 bl_label
= "Cameras"
2206 def draw(self
, context
):
2207 layout
= self
.layout
2208 layout
.operator("view3d.object_as_camera")
2209 layout
.operator("view3d.viewnumpad", text
="Active Camera").type = 'CAMERA'
2212 # Matcap and AO, Wire all and X-Ray entries thanks to marvin.k.breuer
2213 class VIEW3D_MT_Shade(Menu
):
2216 def draw(self
, context
):
2217 layout
= self
.layout
2219 layout
.prop(context
.space_data
, "viewport_shade", expand
=True)
2220 UseSeparator(self
, context
)
2222 if context
.active_object
:
2223 if(context
.mode
== 'EDIT_MESH'):
2224 layout
.operator("MESH_OT_faces_shade_smooth")
2225 layout
.operator("MESH_OT_faces_shade_flat")
2227 layout
.operator("OBJECT_OT_shade_smooth")
2228 layout
.operator("OBJECT_OT_shade_flat")
2230 UseSeparator(self
, context
)
2231 layout
.operator("view3d.display_wire_all", text
="Wire all", icon
='WIRE')
2232 layout
.prop(context
.object, "show_x_ray", text
="X-Ray", icon
="META_CUBE")
2234 UseSeparator(self
, context
)
2235 layout
.prop(context
.space_data
.fx_settings
, "use_ssao",
2236 text
="Ambient Occlusion", icon
="GROUP")
2237 layout
.prop(context
.space_data
, "use_matcap", icon
="MATCAP_01")
2239 if context
.space_data
.use_matcap
:
2240 row
= layout
.column(1)
2243 row
.template_icon_view(context
.space_data
, "matcap_icon")
2246 # Animation Player (Thanks to marvin.k.breuer) #
2247 class VIEW3D_MT_Animation_Player(Menu
):
2248 bl_label
= "Animation Player"
2250 def draw(self
, context
):
2251 layout
= self
.layout
2253 layout
.operator("screen.frame_jump", text
="Jump REW", icon
='REW').end
= False
2254 layout
.operator("screen.keyframe_jump", text
="Previous FR", icon
='PREV_KEYFRAME').next
= False
2256 UseSeparator(self
, context
)
2257 layout
.operator("screen.animation_play", text
="Reverse", icon
='PLAY_REVERSE').reverse
= True
2258 layout
.operator("screen.animation_play", text
="PLAY", icon
='PLAY')
2259 layout
.operator("screen.animation_play", text
="Stop", icon
='PAUSE')
2260 UseSeparator(self
, context
)
2262 layout
.operator("screen.keyframe_jump", text
="Next FR", icon
='NEXT_KEYFRAME').next
= True
2263 layout
.operator("screen.frame_jump", text
="Jump FF", icon
='FF').end
= True
2269 class VIEW3D_MT_Select_Object(Menu
):
2272 def draw(self
, context
):
2273 layout
= self
.layout
2274 layout
.operator_context
= 'INVOKE_REGION_WIN'
2275 layout
.operator("view3d.select_border")
2276 layout
.operator("view3d.select_circle")
2277 UseSeparator(self
, context
)
2278 layout
.operator("object.select_all").action
= 'TOGGLE'
2279 layout
.operator("object.select_all", text
="Inverse").action
= 'INVERT'
2280 layout
.operator("object.select_random", text
="Random")
2281 layout
.operator("object.select_mirror", text
="Mirror")
2282 UseSeparator(self
, context
)
2283 layout
.operator("object.select_by_layer", text
="Select All by Layer")
2284 layout
.operator_menu_enum("object.select_by_type", "type",
2285 text
="Select All by Type...")
2286 layout
.operator_menu_enum("object.select_grouped", "type",
2288 layout
.operator_menu_enum("object.select_linked", "type",
2290 layout
.operator("object.select_camera", text
="Select Camera")
2291 UseSeparator(self
, context
)
2292 layout
.menu("VIEW3D_MT_Select_Object_More_Less", text
="More/Less")
2293 layout
.operator("object.select_pattern", text
="Select Pattern...")
2296 class VIEW3D_MT_Select_Object_More_Less(Menu
):
2297 bl_label
= "Select More/Less"
2299 def draw(self
, context
):
2300 layout
= self
.layout
2301 layout
.operator("object.select_more", text
="More")
2302 layout
.operator("object.select_less", text
="Less")
2303 UseSeparator(self
, context
)
2304 props
= layout
.operator("object.select_hierarchy", text
="Parent")
2305 props
.extend
= False
2306 props
.direction
= 'PARENT'
2307 props
= layout
.operator("object.select_hierarchy", text
="Child")
2308 props
.extend
= False
2309 props
.direction
= 'CHILD'
2310 UseSeparator(self
, context
)
2311 props
= layout
.operator("object.select_hierarchy", text
="Extend Parent")
2313 props
.direction
= 'PARENT'
2314 props
= layout
.operator("object.select_hierarchy", text
="Extend Child")
2316 props
.direction
= 'CHILD'
2320 class VIEW3D_MT_Select_Edit_Mesh(Menu
):
2323 def draw(self
, context
):
2324 layout
= self
.layout
2325 layout
.operator("view3d.select_border")
2326 layout
.operator("view3d.select_circle")
2327 UseSeparator(self
, context
)
2328 layout
.operator("mesh.select_all").action
= 'TOGGLE'
2329 layout
.operator("mesh.select_all", text
="Inverse").action
= 'INVERT'
2330 layout
.operator("mesh.select_linked", text
="Linked")
2331 layout
.operator("mesh.faces_select_linked_flat",
2332 text
="Linked Flat Faces")
2333 layout
.operator("mesh.select_random", text
="Random")
2334 layout
.operator("mesh.select_nth", text
="Every N Number of Verts")
2335 UseSeparator(self
, context
)
2336 layout
.menu("VIEW3D_MT_Edit_Mesh_Select_Trait")
2337 layout
.menu("VIEW3D_MT_Edit_Mesh_Select_Similar")
2338 layout
.menu("VIEW3D_MT_Edit_Mesh_Select_More_Less")
2339 UseSeparator(self
, context
)
2340 layout
.operator("mesh.select_mirror", text
="Mirror")
2341 layout
.operator("mesh.edges_select_sharp", text
="Sharp Edges")
2342 layout
.operator("mesh.select_axis", text
="Side of Active")
2343 layout
.operator("mesh.shortest_path_select", text
="Shortest Path")
2344 UseSeparator(self
, context
)
2345 layout
.operator("mesh.loop_multi_select", text
="Edge Loops").ring
= False
2346 layout
.operator("mesh.loop_multi_select", text
="Edge Rings").ring
= True
2347 layout
.operator("mesh.loop_to_region")
2348 layout
.operator("mesh.region_to_loop")
2351 class VIEW3D_MT_Edit_Mesh_Select_Similar(Menu
):
2352 bl_label
= "Select Similar"
2354 def draw(self
, context
):
2355 layout
= self
.layout
2356 layout
.operator_enum("mesh.select_similar", "type")
2357 layout
.operator("mesh.select_similar_region", text
="Face Regions")
2360 class VIEW3D_MT_Edit_Mesh_Select_Trait(Menu
):
2361 bl_label
= "Select All by Trait"
2363 def draw(self
, context
):
2364 layout
= self
.layout
2365 if context
.scene
.tool_settings
.mesh_select_mode
[2] is False:
2366 layout
.operator("mesh.select_non_manifold", text
="Non Manifold")
2367 layout
.operator("mesh.select_loose", text
="Loose Geometry")
2368 layout
.operator("mesh.select_interior_faces", text
="Interior Faces")
2369 layout
.operator("mesh.select_face_by_sides", text
="By Number of Verts")
2370 layout
.operator("mesh.select_ungrouped", text
="Ungrouped Verts")
2373 class VIEW3D_MT_Edit_Mesh_Select_More_Less(Menu
):
2374 bl_label
= "Select More/Less"
2376 def draw(self
, context
):
2377 layout
= self
.layout
2378 layout
.operator("mesh.select_more", text
="More")
2379 layout
.operator("mesh.select_less", text
="Less")
2380 UseSeparator(self
, context
)
2381 layout
.operator("mesh.select_next_item", text
="Next Active")
2382 layout
.operator("mesh.select_prev_item", text
="Previous Active")
2385 # Edit Curve Select #
2386 class VIEW3D_MT_Select_Edit_Curve(Menu
):
2389 def draw(self
, context
):
2390 layout
= self
.layout
2391 layout
.operator("view3d.select_border")
2392 layout
.operator("view3d.select_circle")
2393 UseSeparator(self
, context
)
2394 layout
.operator("curve.select_all").action
= 'TOGGLE'
2395 layout
.operator("curve.select_all", text
="Inverse").action
= 'INVERT'
2396 layout
.operator("curve.select_nth")
2397 UseSeparator(self
, context
)
2398 layout
.operator("curve.select_random")
2399 layout
.operator("curve.select_linked", text
="Select Linked")
2400 layout
.operator("curve.select_similar", text
="Select Similar")
2401 layout
.operator("curve.de_select_first")
2402 layout
.operator("curve.de_select_last")
2403 layout
.operator("curve.select_next")
2404 layout
.operator("curve.select_previous")
2405 UseSeparator(self
, context
)
2406 layout
.operator("curve.select_more")
2407 layout
.operator("curve.select_less")
2411 class VIEW3D_MT_SelectArmatureMenu(Menu
):
2414 def draw(self
, context
):
2415 layout
= self
.layout
2416 layout
.operator("view3d.select_border")
2417 layout
.operator("armature.select_all")
2418 layout
.operator("armature.select_inverse", text
="Inverse")
2419 layout
.operator("armature.select_hierarchy",
2420 text
="Parent").direction
= 'PARENT'
2421 layout
.operator("armature.select_hierarchy",
2422 text
="Child").direction
= 'CHILD'
2423 props
= layout
.operator("armature.select_hierarchy",
2424 text
="Extend Parent")
2426 props
.direction
= 'PARENT'
2427 props
= layout
.operator("armature.select_hierarchy",
2428 text
="Extend Child")
2430 props
.direction
= 'CHILD'
2431 layout
.operator("object.select_pattern", text
="Select Pattern...")
2434 class VIEW3D_MT_Select_Edit_Armature(Menu
):
2437 def draw(self
, context
):
2438 layout
= self
.layout
2440 layout
.operator("view3d.select_border")
2441 layout
.operator("view3d.select_circle")
2443 UseSeparator(self
, context
)
2445 layout
.operator("armature.select_all").action
= 'TOGGLE'
2446 layout
.operator("armature.select_all", text
="Inverse").action
= 'INVERT'
2447 layout
.operator("armature.select_mirror", text
="Mirror").extend
= False
2449 UseSeparator(self
, context
)
2451 layout
.operator("armature.select_more", text
="More")
2452 layout
.operator("armature.select_less", text
="Less")
2454 UseSeparator(self
, context
)
2456 props
= layout
.operator("armature.select_hierarchy", text
="Parent")
2457 props
.extend
= False
2458 props
.direction
= 'PARENT'
2460 props
= layout
.operator("armature.select_hierarchy", text
="Child")
2461 props
.extend
= False
2462 props
.direction
= 'CHILD'
2464 UseSeparator(self
, context
)
2466 props
= layout
.operator("armature.select_hierarchy", text
="Extend Parent")
2468 props
.direction
= 'PARENT'
2470 props
= layout
.operator("armature.select_hierarchy", text
="Extend Child")
2472 props
.direction
= 'CHILD'
2474 layout
.operator_menu_enum("armature.select_similar", "type", text
="Similar")
2475 layout
.operator("object.select_pattern", text
="Select Pattern...")
2478 class VIEW3D_MT_Select_Pose(Menu
):
2481 def draw(self
, context
):
2482 layout
= self
.layout
2483 layout
.operator("view3d.select_border")
2484 layout
.operator("view3d.select_circle")
2485 UseSeparator(self
, context
)
2486 layout
.operator("pose.select_all").action
= 'TOGGLE'
2487 layout
.operator("pose.select_all", text
="Inverse").action
= 'INVERT'
2488 layout
.operator("pose.select_mirror", text
="Flip Active")
2489 layout
.operator("pose.select_constraint_target",
2490 text
="Constraint Target")
2491 UseSeparator(self
, context
)
2492 layout
.operator("pose.select_linked", text
="Linked")
2493 layout
.operator("pose.select_hierarchy",
2494 text
="Parent").direction
= 'PARENT'
2495 layout
.operator("pose.select_hierarchy",
2496 text
="Child").direction
= 'CHILD'
2497 props
= layout
.operator("pose.select_hierarchy", text
="Extend Parent")
2499 props
.direction
= 'PARENT'
2500 props
= layout
.operator("pose.select_hierarchy", text
="Extend Child")
2502 props
.direction
= 'CHILD'
2503 layout
.operator_menu_enum("pose.select_grouped", "type",
2505 UseSeparator(self
, context
)
2506 layout
.operator("object.select_pattern", text
="Select Pattern...")
2507 layout
.menu("VIEW3D_MT_select_pose_more_less")
2510 class VIEW3D_MT_Select_Pose_More_Less(Menu
):
2511 bl_label
= "Select More/Less"
2513 def draw(self
, context
):
2514 layout
= self
.layout
2515 props
= layout
.operator("pose.select_hierarchy", text
="Parent")
2516 props
.extend
= False
2517 props
.direction
= 'PARENT'
2519 props
= layout
.operator("pose.select_hierarchy", text
="Child")
2520 props
.extend
= False
2521 props
.direction
= 'CHILD'
2523 props
= layout
.operator("pose.select_hierarchy", text
="Extend Parent")
2525 props
.direction
= 'PARENT'
2527 props
= layout
.operator("pose.select_hierarchy", text
="Extend Child")
2529 props
.direction
= 'CHILD'
2532 class VIEW3D_MT_PoseCopy(Menu
):
2533 bl_label
= "Pose Copy"
2535 def draw(self
, context
):
2536 layout
= self
.layout
2537 layout
.operator("pose.copy")
2538 layout
.operator("pose.paste")
2539 layout
.operator("pose.paste",
2540 text
="Paste X-Flipped Pose").flipped
= True
2543 class VIEW3D_MT_PoseNames(Menu
):
2544 bl_label
= "Pose Names"
2546 def draw(self
, context
):
2547 layout
= self
.layout
2548 layout
.operator_context
= 'EXEC_AREA'
2549 layout
.operator("pose.autoside_names",
2550 text
="AutoName Left/Right").axis
= 'XAXIS'
2551 layout
.operator("pose.autoside_names",
2552 text
="AutoName Front/Back").axis
= 'YAXIS'
2553 layout
.operator("pose.autoside_names",
2554 text
="AutoName Top/Bottom").axis
= 'ZAXIS'
2555 layout
.operator("pose.flip_names")
2559 class VIEW3D_MT_Select_Edit_Surface(Menu
):
2562 def draw(self
, context
):
2563 layout
= self
.layout
2564 layout
.operator("view3d.select_border")
2565 layout
.operator("view3d.select_circle")
2566 UseSeparator(self
, context
)
2567 layout
.operator("curve.select_all").action
= 'TOGGLE'
2568 layout
.operator("curve.select_all", text
="Inverse").action
= 'INVERT'
2569 layout
.operator("curve.select_random")
2570 layout
.operator("curve.select_nth")
2571 layout
.operator("curve.select_linked", text
="Select Linked")
2572 layout
.operator("curve.select_similar", text
="Select Similar")
2573 layout
.operator("curve.select_row")
2574 UseSeparator(self
, context
)
2575 layout
.operator("curve.select_more")
2576 layout
.operator("curve.select_less")
2580 class VIEW3D_MT_SelectMetaball(Menu
):
2583 def draw(self
, context
):
2584 layout
= self
.layout
2585 layout
.operator("view3d.select_border")
2586 layout
.operator("view3d.select_circle")
2587 UseSeparator(self
, context
)
2588 layout
.operator("mball.select_all").action
= 'TOGGLE'
2589 layout
.operator("mball.select_all").action
= 'INVERT'
2590 layout
.operator("mball.select_random_metaelems")
2593 class VIEW3D_MT_Select_Edit_Metaball(Menu
):
2596 def draw(self
, context
):
2597 layout
= self
.layout
2598 layout
.operator("view3d.select_border")
2599 layout
.operator("view3d.select_circle")
2600 layout
.operator("mball.select_all").action
= 'TOGGLE'
2601 layout
.operator("mball.select_all", text
="Inverse").action
= 'INVERT'
2602 layout
.operator("mball.select_random_metaelems")
2603 layout
.operator_menu_enum("mball.select_similar", "type", text
="Similar")
2607 class VIEW3D_MT_Selection_Mode_Particle(Menu
):
2608 bl_label
= "Particle Select and Display Mode"
2610 def draw(self
, context
):
2611 layout
= self
.layout
2612 toolsettings
= context
.tool_settings
2614 layout
.prop(toolsettings
.particle_edit
, "select_mode", expand
=True)
2617 class VIEW3D_MT_Select_Particle(Menu
):
2620 def draw(self
, context
):
2621 layout
= self
.layout
2623 layout
.operator("view3d.select_border")
2624 layout
.operator("view3d.select_circle")
2625 UseSeparator(self
, context
)
2627 layout
.operator("particle.select_all").action
= 'TOGGLE'
2628 layout
.operator("particle.select_linked")
2629 layout
.operator("particle.select_all", text
="Inverse").action
= 'INVERT'
2631 UseSeparator(self
, context
)
2632 layout
.operator("particle.select_more")
2633 layout
.operator("particle.select_less")
2635 UseSeparator(self
, context
)
2636 layout
.operator("particle.select_random")
2638 UseSeparator(self
, context
)
2639 layout
.operator("particle.select_roots", text
="Roots")
2640 layout
.operator("particle.select_tips", text
="Tips")
2643 # Lattice Edit Select #
2644 class VIEW3D_MT_Select_Edit_Lattice(Menu
):
2647 def draw(self
, context
):
2648 layout
= self
.layout
2650 layout
.operator("view3d.select_border")
2651 layout
.operator("view3d.select_circle")
2652 UseSeparator(self
, context
)
2653 layout
.operator("lattice.select_mirror")
2654 layout
.operator("lattice.select_random")
2655 layout
.operator("lattice.select_all").action
= 'TOGGLE'
2656 layout
.operator("lattice.select_all", text
="Inverse").action
= 'INVERT'
2657 UseSeparator(self
, context
)
2658 layout
.operator("lattice.select_ungrouped", text
="Ungrouped Verts")
2661 # Grease Pencil Select #
2662 class VIEW3D_MT_Select_Gpencil(Menu
):
2663 # To Do: used in 3dview header might work if mapped to mouse
2664 # Not in Class List yet
2667 def draw(self
, context
):
2668 layout
= self
.layout
2670 layout
.operator("gpencil.select_border")
2671 layout
.operator("gpencil.select_circle")
2673 UseSeparator(self
, context
)
2675 layout
.operator("gpencil.select_all", text
="(De)select All").action
= 'TOGGLE'
2676 layout
.operator("gpencil.select_all", text
="Inverse").action
= 'INVERT'
2677 layout
.operator("gpencil.select_linked", text
="Linked")
2678 # layout.operator_menu_enum("gpencil.select_grouped", "type", text="Grouped")
2679 layout
.operator("gpencil.select_grouped", text
="Grouped")
2681 UseSeparator(self
, context
)
2683 layout
.operator("gpencil.select_more")
2684 layout
.operator("gpencil.select_less")
2688 class VIEW3D_MT_Select_Edit_Text(Menu
):
2689 # To Do: used in 3dview header might work if mapped to mouse
2690 # Not in Class List yet
2693 def draw(self
, context
):
2694 layout
= self
.layout
2695 layout
.operator("font.text_copy", text
="Copy")
2696 layout
.operator("font.text_cut", text
="Cut")
2697 layout
.operator("font.text_paste", text
="Paste")
2698 layout
.operator("font.text_paste_from_file")
2699 layout
.operator("font.select_all")
2702 # Paint Mode Menus #
2703 class VIEW3D_MT_Select_Paint_Mask(Menu
):
2706 def draw(self
, context
):
2707 layout
= self
.layout
2708 layout
.operator("view3d.select_border")
2709 layout
.operator("view3d.select_circle")
2710 layout
.operator("paint.face_select_all").action
= 'TOGGLE'
2711 layout
.operator("paint.face_select_all", text
="Inverse").action
= 'INVERT'
2712 layout
.operator("paint.face_select_linked", text
="Linked")
2715 class VIEW3D_MT_Select_Paint_Mask_Vertex(Menu
):
2718 def draw(self
, context
):
2719 layout
= self
.layout
2720 layout
.operator("view3d.select_border")
2721 layout
.operator("view3d.select_circle")
2722 layout
.operator("paint.vert_select_all").action
= 'TOGGLE'
2723 layout
.operator("paint.vert_select_all", text
="Inverse").action
= 'INVERT'
2724 layout
.operator("paint.vert_select_ungrouped", text
="Ungrouped Verts")
2727 class VIEW3D_MT_Angle_Control(Menu
):
2728 bl_label
= "Angle Control"
2731 def poll(cls
, context
):
2732 settings
= UnifiedPaintPanel
.paint_settings(context
)
2736 brush
= settings
.brush
2737 tex_slot
= brush
.texture_slot
2739 return tex_slot
.has_texture_angle
and tex_slot
.has_texture_angle_source
2741 def draw(self
, context
):
2742 layout
= self
.layout
2744 settings
= UnifiedPaintPanel
.paint_settings(context
)
2745 brush
= settings
.brush
2747 sculpt
= (context
.sculpt_object
is not None)
2749 tex_slot
= brush
.texture_slot
2751 layout
.prop(tex_slot
, "use_rake", text
="Rake")
2753 if brush
.brush_capabilities
.has_random_texture_angle
and tex_slot
.has_random_texture_angle
:
2755 if brush
.sculpt_capabilities
.has_random_texture_angle
:
2756 layout
.prop(tex_slot
, "use_random", text
="Random")
2758 layout
.prop(tex_slot
, "use_random", text
="Random")
2761 # Cursor Menu Operators #
2762 class VIEW3D_OT_Pivot_Cursor(Operator
):
2763 bl_idname
= "view3d.pivot_cursor"
2764 bl_label
= "Cursor as Pivot Point"
2765 bl_description
= "Set Pivot Point back to Cursor"
2768 def poll(cls
, context
):
2769 space
= context
.space_data
2770 return (hasattr(space
, "pivot_point") and space
.pivot_point
!= 'CURSOR')
2772 def execute(self
, context
):
2773 bpy
.context
.space_data
.pivot_point
= 'CURSOR'
2777 class VIEW3D_OT_Revert_Pivot(Operator
):
2778 bl_idname
= "view3d.revert_pivot"
2779 bl_label
= "Revert Pivot Point to Median"
2780 bl_description
= "Set Pivot Point back to Median"
2783 def poll(cls
, context
):
2784 space
= context
.space_data
2785 return (hasattr(space
, "pivot_point") and space
.pivot_point
!= 'MEDIAN_POINT')
2787 def execute(self
, context
):
2788 bpy
.context
.space_data
.pivot_point
= 'MEDIAN_POINT'
2792 # Cursor Edge Intersection Defs #
2800 def edgeIntersect(context
, operator
):
2801 from mathutils
.geometry
import intersect_line_line
2803 obj
= context
.active_object
2805 if (obj
.type != "MESH"):
2806 operator
.report({'ERROR'}, "Object must be a mesh")
2811 verts
= mesh
.vertices
2813 is_editmode
= (obj
.mode
== 'EDIT')
2815 bpy
.ops
.object.mode_set(mode
='OBJECT')
2817 for e
in mesh
.edges
:
2825 bpy
.ops
.object.mode_set(mode
='EDIT')
2828 operator
.report({'ERROR'},
2829 "Operator requires exactly 2 edges to be selected")
2832 line
= intersect_line_line(verts
[edges
[0].vertices
[0]].co
,
2833 verts
[edges
[0].vertices
[1]].co
,
2834 verts
[edges
[1].vertices
[0]].co
,
2835 verts
[edges
[1].vertices
[1]].co
)
2838 operator
.report({'ERROR'}, "Selected edges do not intersect")
2841 point
= line
[0].lerp(line
[1], 0.5)
2842 context
.scene
.cursor_location
= obj
.matrix_world
* point
2845 # Cursor Edge Intersection Operator #
2846 class VIEW3D_OT_CursorToEdgeIntersection(Operator
):
2847 bl_idname
= "view3d.snap_cursor_to_edge_intersection"
2848 bl_label
= "Cursor to Edge Intersection"
2849 bl_description
= "Finds the mid-point of the shortest distance between two edges"
2852 def poll(cls
, context
):
2853 obj
= context
.active_object
2854 return (obj
is not None and obj
.type == 'MESH')
2856 def execute(self
, context
):
2857 # Prevent unsupported Execution in Local View modes
2858 space_data
= bpy
.context
.space_data
2859 if True in space_data
.layers_local_view
:
2860 self
.report({'INFO'}, 'Global Perspective modes only unable to continue.')
2862 edgeIntersect(context
, self
)
2866 # Set Mode Operator #
2867 class SetObjectMode(Operator
):
2868 bl_idname
= "object.set_object_mode"
2869 bl_label
= "Set the object interactive mode"
2870 bl_description
= "I set the interactive mode of object"
2871 bl_options
= {'REGISTER'}
2873 mode
= StringProperty(
2874 name
="Interactive mode",
2878 def execute(self
, context
):
2879 if (context
.active_object
):
2881 bpy
.ops
.object.mode_set(mode
=self
.mode
)
2883 msg
= context
.active_object
.name
+ ": It is not possible to enter into the interactive mode"
2884 self
.report(type={"WARNING"}, message
=msg
)
2886 self
.report(type={"WARNING"}, message
="There is no active object")
2890 # Origin To Selected Edit Mode #
2891 def vfeOrigin(context
):
2893 cursorPositionX
= context
.scene
.cursor_location
[0]
2894 cursorPositionY
= context
.scene
.cursor_location
[1]
2895 cursorPositionZ
= context
.scene
.cursor_location
[2]
2896 bpy
.ops
.view3d
.snap_cursor_to_selected()
2897 bpy
.ops
.object.mode_set()
2898 bpy
.ops
.object.origin_set(type='ORIGIN_CURSOR', center
='MEDIAN')
2899 bpy
.ops
.object.mode_set(mode
='EDIT')
2900 context
.scene
.cursor_location
[0] = cursorPositionX
2901 context
.scene
.cursor_location
[1] = cursorPositionY
2902 context
.scene
.cursor_location
[2] = cursorPositionZ
2908 class SetOriginToSelected(Operator
):
2909 bl_idname
= "object.setorigintoselected"
2910 bl_label
= "Set Origin to Selected"
2911 bl_description
= "Set Origin to Selected"
2914 def poll(cls
, context
):
2915 return (context
.area
.type == "VIEW_3D" and context
.active_object
is not None)
2917 def execute(self
, context
):
2918 check
= vfeOrigin(context
)
2920 self
.report({"ERROR"}, "Set Origin to Selected could not be performed")
2921 return {'CANCELLED'}
2926 # Code thanks to Isaac Weaver (wisaac) D1963
2927 class SnapCursSelToCenter(Operator
):
2928 bl_idname
= "view3d.snap_cursor_selected_to_center"
2929 bl_label
= "Snap Cursor & Selection to Center"
2930 bl_description
= ("Snap 3D cursor and selected objects to the center \n"
2931 "Works only in Object Mode")
2934 def poll(cls
, context
):
2935 return (context
.area
.type == "VIEW_3D" and context
.mode
== "OBJECT")
2937 def execute(self
, context
):
2938 context
.space_data
.cursor_location
= (0, 0, 0)
2939 for obj
in context
.selected_objects
:
2940 obj
.location
= (0, 0, 0)
2944 # Preferences utility functions
2947 def UseSeparator(operator
, context
):
2948 useSep
= bpy
.context
.user_preferences
.addons
[__name__
].preferences
.use_separators
2950 operator
.layout
.separator()
2953 # Use compact brushes menus #
2954 def UseBrushesLists():
2955 # separate function just for more convience
2956 useLists
= bpy
.context
.user_preferences
.addons
[__name__
].preferences
.use_brushes_lists
2958 return bool(useLists
)
2961 # Addon Preferences #
2962 class VIEW3D_MT_Space_Dynamic_Menu_Pref(AddonPreferences
):
2963 bl_idname
= __name__
2965 use_separators
= BoolProperty(
2966 name
="Use Separators in the menus",
2968 description
=("Use separators in the menus, a trade-off between \n"
2969 "readability vs. using more space for displaying items")
2971 use_brushes_lists
= BoolProperty(
2972 name
="Use compact menus for brushes",
2974 description
=("Use more compact menus instead \n"
2975 "of thumbnails for displaying brushes")
2978 def draw(self
, context
):
2979 layout
= self
.layout
2980 row
= layout
.row(align
=True)
2981 row
.prop(self
, "use_separators", toggle
=True)
2982 row
.prop(self
, "use_brushes_lists", toggle
=True)
2985 # List The Classes #
2988 VIEW3D_MT_Space_Dynamic_Menu
,
2991 VIEW3D_MT_Edit_Mesh
,
2992 VIEW3D_MT_TransformMenu
,
2993 VIEW3D_MT_TransformMenuEdit
,
2994 VIEW3D_MT_TransformMenuArmature
,
2995 VIEW3D_MT_TransformMenuArmatureEdit
,
2996 VIEW3D_MT_TransformMenuArmaturePose
,
2997 VIEW3D_MT_TransformMenuLite
,
2998 VIEW3D_MT_TransformMenuCamera
,
2999 VIEW3D_MT_MirrorMenu
,
3000 VIEW3D_MT_ParentMenu
,
3001 VIEW3D_MT_GroupMenu
,
3002 VIEW3D_MT_Select_Object
,
3003 VIEW3D_MT_Select_Object_More_Less
,
3004 VIEW3D_MT_Select_Edit_Mesh
,
3005 VIEW3D_MT_Edit_Mesh_Select_Similar
,
3006 VIEW3D_MT_Edit_Mesh_Select_Trait
,
3007 VIEW3D_MT_Edit_Mesh_Select_More_Less
,
3008 VIEW3D_MT_Select_Edit_Curve
,
3009 VIEW3D_MT_SelectArmatureMenu
,
3010 VIEW3D_MT_Select_Pose
,
3011 VIEW3D_MT_Select_Pose_More_Less
,
3014 VIEW3D_MT_PoseNames
,
3015 VIEW3D_MT_Select_Edit_Surface
,
3016 VIEW3D_MT_SelectMetaball
,
3017 VIEW3D_MT_Select_Edit_Metaball
,
3018 VIEW3D_MT_Select_Particle
,
3019 VIEW3D_MT_Select_Edit_Lattice
,
3020 VIEW3D_MT_Select_Edit_Armature
,
3021 VIEW3D_MT_Select_Paint_Mask
,
3022 VIEW3D_MT_Select_Paint_Mask_Vertex
,
3023 VIEW3D_MT_Angle_Control
,
3024 VIEW3D_MT_Edit_Multi
,
3025 VIEW3D_MT_EditM_Edge
,
3026 VIEW3D_MT_Edit_Curve
,
3027 VIEW3D_MT_EditCurveCtrlpoints
,
3028 VIEW3D_MT_EditCurveSegments
,
3029 VIEW3D_MT_EditCurveSpecials
,
3030 VIEW3D_MT_Edit_Armature
,
3031 VIEW3D_MT_EditArmatureTK
,
3032 VIEW3D_MT_KeyframeMenu
,
3033 VIEW3D_OT_Pivot_Cursor
,
3034 VIEW3D_OT_Revert_Pivot
,
3035 VIEW3D_MT_CursorMenu
,
3036 VIEW3D_MT_CursorMenuLite
,
3037 VIEW3D_MT_EditCursorMenu
,
3038 VIEW3D_OT_CursorToEdgeIntersection
,
3040 VIEW3D_MT_Camera_Options
,
3042 InteractiveModeArmature
,
3044 VIEW3D_MT_View_Directions
,
3045 VIEW3D_MT_View_Border
,
3046 VIEW3D_MT_View_Toggle
,
3047 VIEW3D_MT_View_Menu
,
3048 VIEW3D_MT_View_Navigation
,
3049 VIEW3D_MT_View_Align
,
3050 VIEW3D_MT_View_Align_Selected
,
3051 VIEW3D_MT_View_Cameras
,
3054 VIEW3D_Snap_Context
,
3057 VIEW3D_MT_ManipulatorMenu1
,
3058 SetOriginToSelected
,
3059 VIEW3D_MT_Object_Data_Link
,
3060 VIEW3D_MT_Duplicate
,
3061 VIEW3D_MT_Space_Dynamic_Menu_Pref
,
3062 VIEW3D_MT_Selection_Mode_Particle
,
3063 VIEW3D_MT_AutoSmooth
,
3064 VIEW3D_MT_Animation_Player
,
3065 VIEW3D_OT_Interactive_Mode_Text
,
3066 SnapCursSelToCenter
,
3067 VIEW3D_MT_Sculpt_Specials
,
3068 VIEW3D_MT_Brush_Settings
,
3069 VIEW3D_MT_Brush_Selection
,
3071 VIEW3D_MT_Hide_Masks
,
3072 VIEW3D_OT_Display_Wire_All
,
3073 VIEW3D_MT_Vertex_Colors
,
3074 VIEW3D_MT_Paint_Weights
,
3075 VIEW3D_OT_Interactive_Mode_Grease_Pencil
,
3076 VIEW3D_MT_Edit_Gpencil
,
3077 InteractiveModeOther
,
3081 # Register Classes & Hotkeys #
3084 bpy
.utils
.register_class(cls
)
3086 wm
= bpy
.context
.window_manager
3087 kc
= wm
.keyconfigs
.addon
3089 km
= kc
.keymaps
.new(name
='3D View', space_type
='VIEW_3D')
3090 kmi
= km
.keymap_items
.new('wm.call_menu', 'SPACE', 'PRESS')
3091 kmi
.properties
.name
= "VIEW3D_MT_Space_Dynamic_Menu"
3094 # Unregister Classes & Hotkeys #
3096 wm
= bpy
.context
.window_manager
3097 kc
= wm
.keyconfigs
.addon
3099 km
= kc
.keymaps
['3D View']
3100 for kmi
in km
.keymap_items
:
3101 if kmi
.idname
== 'wm.call_menu':
3102 if kmi
.properties
.name
== "VIEW3D_MT_Space_Dynamic_Menu":
3103 km
.keymap_items
.remove(kmi
)
3106 bpy
.utils
.unregister_class(cls
)
3109 if __name__
== "__main__":