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'
59 # No Object Selected #
60 if not context
.active_object
:
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'}:
117 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
118 UseSeparator(self
, context
)
119 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
120 layout
.menu("VIEW3D_MT_Select_Edit_Mesh", icon
='RESTRICT_SELECT_OFF')
121 layout
.menu("VIEW3D_MT_Edit_Multi", icon
='VERTEXSEL')
122 UseSeparator(self
, context
)
123 layout
.menu("INFO_MT_mesh_add", text
="Add Mesh", icon
='OUTLINER_OB_MESH')
124 layout
.menu("VIEW3D_MT_Edit_Mesh", text
="Mesh", icon
='MESH_DATA')
125 UseSeparator(self
, context
)
126 layout
.menu("VIEW3D_MT_TransformMenuEdit", icon
='MANIPUL')
127 layout
.menu("VIEW3D_MT_MirrorMenu", icon
='MOD_MIRROR')
128 layout
.menu("VIEW3D_MT_EditCursorMenu", icon
='CURSOR')
129 UseSeparator(self
, context
)
130 layout
.menu("VIEW3D_MT_UV_Map", icon
='MOD_UVPROJECT')
131 layout
.menu("VIEW3D_MT_edit_mesh_specials", icon
='SOLO_OFF')
132 layout
.menu("VIEW3D_MT_edit_mesh_extrude", icon
='ORTHO')
133 UseSeparator(self
, context
)
134 layout
.operator_menu_enum("object.modifier_add", "type", icon
='MODIFIER')
135 layout
.operator_menu_enum("object.constraint_add",
136 "type", text
="Add Constraint", icon
='CONSTRAINT')
137 UseSeparator(self
, context
)
138 layout
.menu("VIEW3D_MT_edit_mesh_delete", icon
='X')
139 UseSeparator(self
, context
)
140 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
141 layout
.menu("VIEW3D_MT_Object_Interactive_Mode", icon
='EDIT')
142 UseSeparator(self
, context
)
143 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
144 layout
.operator("view3d.properties", icon
='MENU_PANEL')
147 if obj
and obj
.type == 'MESH' and obj
.mode
in {'SCULPT'}:
149 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
150 UseSeparator(self
, context
)
151 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
152 UseSeparator(self
, context
)
153 layout
.menu("VIEW3D_MT_Sculpts", icon
='SCULPTMODE_HLT')
154 layout
.menu("VIEW3D_MT_Brush_Selection", text
="Sculpt Tool", icon
='BRUSH_SCULPT_DRAW')
155 layout
.menu("VIEW3D_MT_Brush_Settings", icon
='BRUSH_DATA')
156 layout
.menu("VIEW3D_MT_Hide_Masks", icon
='RESTRICT_VIEW_OFF')
157 UseSeparator(self
, context
)
158 layout
.menu("VIEW3D_MT_Sculpt_Specials", icon
='SOLO_OFF')
159 UseSeparator(self
, context
)
160 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
161 layout
.menu("VIEW3D_MT_Object_Interactive_Mode", icon
='EDIT')
162 UseSeparator(self
, context
)
163 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
164 layout
.operator("view3d.properties", icon
='MENU_PANEL')
167 if obj
and obj
.type == 'MESH' and obj
.mode
in {'VERTEX_PAINT'}:
169 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
170 UseSeparator(self
, context
)
171 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
172 UseSeparator(self
, context
)
173 layout
.menu("VIEW3D_MT_Brush_Settings", icon
='BRUSH_DATA')
174 layout
.menu("VIEW3D_MT_Brush_Selection",
175 text
="Vertex Paint Tool", icon
='BRUSH_VERTEXDRAW')
176 layout
.menu("VIEW3D_MT_Vertex_Colors", icon
='GROUP_VCOL')
177 UseSeparator(self
, context
)
178 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
179 layout
.menu("VIEW3D_MT_Object_Interactive_Mode", icon
='EDIT')
180 UseSeparator(self
, context
)
181 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
182 layout
.operator("view3d.properties", icon
='MENU_PANEL')
184 # Weight Paint Menu #
185 if obj
and obj
.type == 'MESH' and obj
.mode
in {'WEIGHT_PAINT'}:
187 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
188 UseSeparator(self
, context
)
189 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
190 UseSeparator(self
, context
)
191 layout
.menu("VIEW3D_MT_Paint_Weights", icon
='WPAINT_HLT')
192 layout
.menu("VIEW3D_MT_Brush_Settings", icon
='BRUSH_DATA')
193 layout
.menu("VIEW3D_MT_Brush_Selection",
194 text
="Weight Paint Tool", icon
='BRUSH_TEXMASK')
195 UseSeparator(self
, context
)
196 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
197 layout
.menu("VIEW3D_MT_Object_Interactive_Mode", icon
='EDIT')
198 UseSeparator(self
, context
)
199 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
200 layout
.operator("view3d.properties", icon
='MENU_PANEL')
203 if obj
and obj
.type == 'MESH' and obj
.mode
in {'TEXTURE_PAINT'}:
205 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
206 UseSeparator(self
, context
)
207 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
208 layout
.menu("VIEW3D_MT_Brush_Settings", icon
='BRUSH_DATA')
209 layout
.menu("VIEW3D_MT_Brush_Selection",
210 text
="Texture Paint Tool", icon
='SCULPTMODE_HLT')
211 UseSeparator(self
, context
)
212 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
213 layout
.menu("VIEW3D_MT_Object_Interactive_Mode", icon
='EDIT')
214 UseSeparator(self
, context
)
215 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
216 layout
.operator("view3d.properties", icon
='MENU_PANEL')
218 # Curve Object Mode #
219 if obj
and obj
.type == 'CURVE' and obj
.mode
in {'OBJECT'}:
221 layout
.operator_context
= 'INVOKE_REGION_WIN'
222 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
223 UseSeparator(self
, context
)
224 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
225 layout
.menu("VIEW3D_MT_Select_Object", icon
='RESTRICT_SELECT_OFF')
226 UseSeparator(self
, context
)
227 layout
.menu("VIEW3D_MT_AddMenu", icon
='OBJECT_DATAMODE')
228 layout
.menu("VIEW3D_MT_Object", icon
='VIEW3D')
229 UseSeparator(self
, context
)
230 layout
.menu("VIEW3D_MT_TransformMenu", icon
='MANIPUL')
231 layout
.menu("VIEW3D_MT_MirrorMenu", icon
='MOD_MIRROR')
232 layout
.menu("VIEW3D_MT_CursorMenu", icon
='CURSOR')
233 UseSeparator(self
, context
)
234 layout
.menu("VIEW3D_MT_ParentMenu", icon
='ROTACTIVE')
235 layout
.menu("VIEW3D_MT_GroupMenu", icon
='GROUP')
236 UseSeparator(self
, context
)
237 layout
.menu("VIEW3D_MT_object_specials", text
="Specials", icon
='SOLO_OFF')
238 layout
.menu("VIEW3D_MT_Camera_Options", icon
='OUTLINER_OB_CAMERA')
239 UseSeparator(self
, context
)
240 layout
.operator_menu_enum("object.modifier_add", "type", icon
='MODIFIER')
241 layout
.operator_menu_enum("object.constraint_add",
242 "type", text
="Add Constraint", icon
='CONSTRAINT')
243 UseSeparator(self
, context
)
244 layout
.operator("object.delete", text
="Delete Object", icon
='X')
245 UseSeparator(self
, context
)
246 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
247 layout
.menu("VIEW3D_MT_Object_Interactive_Other", icon
='OBJECT_DATA')
248 UseSeparator(self
, context
)
249 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
250 layout
.operator("view3d.properties", icon
='MENU_PANEL')
253 if obj
and obj
.type == 'CURVE' and obj
.mode
in {'EDIT'}:
255 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
256 UseSeparator(self
, context
)
257 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
258 layout
.menu("VIEW3D_MT_Select_Edit_Curve",
259 icon
='RESTRICT_SELECT_OFF')
260 UseSeparator(self
, context
)
261 layout
.menu("INFO_MT_curve_add", text
="Add Curve",
262 icon
='OUTLINER_OB_CURVE')
263 layout
.menu("VIEW3D_MT_Edit_Curve", icon
='CURVE_DATA')
264 UseSeparator(self
, context
)
265 layout
.menu("VIEW3D_MT_TransformMenu", icon
='MANIPUL')
266 layout
.menu("VIEW3D_MT_MirrorMenu", icon
='MOD_MIRROR')
267 layout
.menu("VIEW3D_MT_CursorMenu", icon
='CURSOR')
268 layout
.menu("VIEW3D_MT_EditCurveCtrlpoints",
269 icon
='CURVE_BEZCURVE')
270 layout
.menu("VIEW3D_MT_EditCurveSpecials",
272 UseSeparator(self
, context
)
273 layout
.operator("curve.delete", text
="Delete Object",
275 UseSeparator(self
, context
)
276 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
277 layout
.menu("VIEW3D_MT_Object_Interactive_Other", icon
='OBJECT_DATA')
278 UseSeparator(self
, context
)
279 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
280 layout
.operator("view3d.properties", icon
='MENU_PANEL')
282 # Surface Object Mode #
283 if obj
and obj
.type == 'SURFACE' and obj
.mode
in {'OBJECT'}:
285 layout
.operator_context
= 'INVOKE_REGION_WIN'
286 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
287 UseSeparator(self
, context
)
288 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
289 layout
.menu("VIEW3D_MT_Select_Object", icon
='RESTRICT_SELECT_OFF')
290 UseSeparator(self
, context
)
291 layout
.menu("VIEW3D_MT_AddMenu", icon
='OBJECT_DATAMODE')
292 layout
.menu("VIEW3D_MT_Object", icon
='VIEW3D')
293 UseSeparator(self
, context
)
294 layout
.menu("VIEW3D_MT_TransformMenu", icon
='MANIPUL')
295 layout
.menu("VIEW3D_MT_MirrorMenu", icon
='MOD_MIRROR')
296 layout
.menu("VIEW3D_MT_CursorMenu", icon
='CURSOR')
297 UseSeparator(self
, context
)
298 layout
.menu("VIEW3D_MT_ParentMenu", icon
='ROTACTIVE')
299 layout
.menu("VIEW3D_MT_GroupMenu", icon
='GROUP')
300 UseSeparator(self
, context
)
301 layout
.menu("VIEW3D_MT_object_specials", text
="Specials", icon
='SOLO_OFF')
302 layout
.menu("VIEW3D_MT_Camera_Options", icon
='OUTLINER_OB_CAMERA')
303 layout
.operator_menu_enum("object.modifier_add", "type", icon
='MODIFIER')
304 layout
.operator_menu_enum("object.constraint_add",
305 "type", text
="Add Constraint", icon
='CONSTRAINT')
306 UseSeparator(self
, context
)
307 layout
.operator("object.delete", text
="Delete Object", icon
='X')
308 UseSeparator(self
, context
)
309 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
310 layout
.menu("VIEW3D_MT_Object_Interactive_Other", icon
='OBJECT_DATA')
311 UseSeparator(self
, context
)
312 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
313 layout
.operator("view3d.properties", icon
='MENU_PANEL')
316 if obj
and obj
.type == 'SURFACE' and obj
.mode
in {'EDIT'}:
318 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
319 UseSeparator(self
, context
)
320 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
321 layout
.menu("VIEW3D_MT_Select_Edit_Surface", icon
='RESTRICT_SELECT_OFF')
322 UseSeparator(self
, context
)
323 layout
.menu("INFO_MT_surface_add", text
="Add Surface",
324 icon
='OUTLINER_OB_SURFACE')
325 layout
.menu("VIEW3D_MT_TransformMenu", icon
='MANIPUL')
326 layout
.menu("VIEW3D_MT_MirrorMenu", icon
='MOD_MIRROR')
327 layout
.menu("VIEW3D_MT_CursorMenu", icon
='CURSOR')
328 UseSeparator(self
, context
)
329 layout
.prop_menu_enum(settings
, "proportional_edit",
331 layout
.prop_menu_enum(settings
, "proportional_edit_falloff",
333 layout
.menu("VIEW3D_MT_EditCurveSpecials",
335 UseSeparator(self
, context
)
336 layout
.operator("curve.delete", text
="Delete Object",
338 UseSeparator(self
, context
)
339 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
340 layout
.menu("VIEW3D_MT_Object_Interactive_Other", icon
='OBJECT_DATA')
341 UseSeparator(self
, context
)
342 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
343 layout
.operator("view3d.properties", icon
='MENU_PANEL')
345 # Metaball Object Mode #
346 if obj
and obj
.type == 'META' and obj
.mode
in {'OBJECT'}:
348 layout
.operator_context
= 'INVOKE_REGION_WIN'
349 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
350 UseSeparator(self
, context
)
351 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
352 layout
.menu("VIEW3D_MT_Select_Object", icon
='RESTRICT_SELECT_OFF')
353 UseSeparator(self
, context
)
354 layout
.menu("VIEW3D_MT_AddMenu", icon
='OBJECT_DATAMODE')
355 layout
.menu("VIEW3D_MT_Object", icon
='VIEW3D')
356 UseSeparator(self
, context
)
357 layout
.menu("VIEW3D_MT_TransformMenu", icon
='MANIPUL')
358 layout
.menu("VIEW3D_MT_MirrorMenu", icon
='MOD_MIRROR')
359 layout
.menu("VIEW3D_MT_CursorMenu", icon
='CURSOR')
360 UseSeparator(self
, context
)
361 layout
.menu("VIEW3D_MT_ParentMenu", icon
='ROTACTIVE')
362 layout
.menu("VIEW3D_MT_GroupMenu", icon
='GROUP')
363 UseSeparator(self
, context
)
364 layout
.menu("VIEW3D_MT_object_specials", text
="Specials", icon
='SOLO_OFF')
365 layout
.menu("VIEW3D_MT_Camera_Options", icon
='OUTLINER_OB_CAMERA')
366 UseSeparator(self
, context
)
367 layout
.operator_menu_enum("object.constraint_add",
368 "type", text
="Add Constraint", icon
='CONSTRAINT')
369 layout
.operator("object.delete", text
="Delete Object", icon
='X')
370 UseSeparator(self
, context
)
371 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
372 layout
.menu("VIEW3D_MT_Object_Interactive_Other", icon
='OBJECT_DATA')
373 UseSeparator(self
, context
)
374 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
375 layout
.operator("view3d.properties", icon
='MENU_PANEL')
378 if obj
and obj
.type == 'META' and obj
.mode
in {'EDIT'}:
380 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
381 UseSeparator(self
, context
)
382 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
383 layout
.menu("VIEW3D_MT_SelectMetaball", icon
='RESTRICT_SELECT_OFF')
384 UseSeparator(self
, context
)
385 layout
.operator_menu_enum("object.metaball_add", "type",
387 icon
='OUTLINER_OB_META')
388 layout
.menu("VIEW3D_MT_TransformMenu", icon
='MANIPUL')
389 layout
.menu("VIEW3D_MT_MirrorMenu", icon
='MOD_MIRROR')
390 layout
.menu("VIEW3D_MT_CursorMenu", icon
='CURSOR')
391 UseSeparator(self
, context
)
392 layout
.prop_menu_enum(settings
, "proportional_edit",
394 layout
.prop_menu_enum(settings
, "proportional_edit_falloff",
396 UseSeparator(self
, context
)
397 layout
.operator("mball.delete_metaelems", text
="Delete Object",
399 UseSeparator(self
, context
)
400 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
401 layout
.menu("VIEW3D_MT_Object_Interactive_Other", icon
='OBJECT_DATA')
402 UseSeparator(self
, context
)
403 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
404 layout
.operator("view3d.properties", icon
='MENU_PANEL')
407 if obj
and obj
.type == 'FONT' and obj
.mode
in {'OBJECT'}:
409 layout
.operator_context
= 'INVOKE_REGION_WIN'
410 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
411 UseSeparator(self
, context
)
412 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
413 layout
.menu("VIEW3D_MT_Select_Object", icon
='RESTRICT_SELECT_OFF')
414 UseSeparator(self
, context
)
415 layout
.menu("VIEW3D_MT_AddMenu", icon
='OBJECT_DATAMODE')
416 layout
.menu("VIEW3D_MT_Object", icon
='VIEW3D')
417 UseSeparator(self
, context
)
418 layout
.menu("VIEW3D_MT_TransformMenu", icon
='MANIPUL')
419 layout
.menu("VIEW3D_MT_MirrorMenu", icon
='MOD_MIRROR')
420 layout
.menu("VIEW3D_MT_CursorMenu", icon
='CURSOR')
421 UseSeparator(self
, context
)
422 layout
.menu("VIEW3D_MT_ParentMenu", icon
='ROTACTIVE')
423 layout
.menu("VIEW3D_MT_GroupMenu", icon
='GROUP')
424 UseSeparator(self
, context
)
425 layout
.menu("VIEW3D_MT_object_specials", text
="Specials", icon
='SOLO_OFF')
426 layout
.menu("VIEW3D_MT_Camera_Options", icon
='OUTLINER_OB_CAMERA')
427 UseSeparator(self
, context
)
428 layout
.operator_menu_enum("object.modifier_add", "type", icon
='MODIFIER')
429 layout
.operator_menu_enum("object.constraint_add",
430 "type", text
="Add Constraint", icon
='CONSTRAINT')
431 UseSeparator(self
, context
)
432 layout
.operator("object.delete", text
="Delete Object", icon
='X')
433 UseSeparator(self
, context
)
434 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
435 # New Entry For Switching to Editmode
436 layout
.operator("view3d.interactive_mode_text", icon
='VIEW3D')
437 UseSeparator(self
, context
)
438 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
439 layout
.operator("view3d.properties", icon
='MENU_PANEL')
442 # To Do: Space is already reserved for the typing tool
443 if obj
and obj
.type == 'FONT' and obj
.mode
in {'EDIT'}:
445 layout
.operator_context
= 'INVOKE_REGION_WIN'
446 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
447 UseSeparator(self
, context
)
448 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
449 layout
.menu("VIEW3D_MT_select_edit_text", icon
='VIEW3D')
450 layout
.menu("VIEW3D_MT_edit_font", icon
='RESTRICT_SELECT_OFF')
451 UseSeparator(self
, context
)
452 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
453 layout
.operator("object.editmode_toggle", text
="Enter Object Mode",
455 UseSeparator(self
, context
)
456 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
457 layout
.operator("view3d.properties", icon
='MENU_PANEL')
459 # Camera Object Mode #
460 if obj
and obj
.type == 'CAMERA' and obj
.mode
in {'OBJECT'}:
462 layout
.operator_context
= 'INVOKE_REGION_WIN'
463 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
464 UseSeparator(self
, context
)
465 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
466 layout
.menu("VIEW3D_MT_Select_Object", icon
='RESTRICT_SELECT_OFF')
467 UseSeparator(self
, context
)
468 layout
.menu("VIEW3D_MT_AddMenu", icon
='OBJECT_DATAMODE')
469 layout
.menu("VIEW3D_MT_Object", icon
='VIEW3D')
470 UseSeparator(self
, context
)
471 layout
.menu("VIEW3D_MT_TransformMenu", icon
='MANIPUL')
472 layout
.menu("VIEW3D_MT_CursorMenuLite", icon
='CURSOR')
473 UseSeparator(self
, context
)
474 layout
.menu("VIEW3D_MT_ParentMenu", icon
='ROTACTIVE')
475 layout
.menu("VIEW3D_MT_GroupMenu", icon
='GROUP')
476 UseSeparator(self
, context
)
477 layout
.menu("VIEW3D_MT_object_specials", text
="Specials", icon
='SOLO_OFF')
478 layout
.menu("VIEW3D_MT_Camera_Options", icon
='OUTLINER_OB_CAMERA')
479 UseSeparator(self
, context
)
480 layout
.operator_menu_enum("object.constraint_add",
481 "type", text
="Add Constraint", icon
='CONSTRAINT')
482 UseSeparator(self
, context
)
483 layout
.operator("object.delete", text
="Delete Object", icon
='X')
484 UseSeparator(self
, context
)
485 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
486 UseSeparator(self
, context
)
487 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
488 layout
.operator("view3d.properties", icon
='MENU_PANEL')
491 if obj
and obj
.type == 'LAMP' and obj
.mode
in {'OBJECT'}:
493 layout
.operator_context
= 'INVOKE_REGION_WIN'
494 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
495 UseSeparator(self
, context
)
496 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
497 layout
.menu("VIEW3D_MT_Select_Object", icon
='RESTRICT_SELECT_OFF')
498 UseSeparator(self
, context
)
499 layout
.menu("VIEW3D_MT_AddMenu", icon
='OBJECT_DATAMODE')
500 layout
.menu("VIEW3D_MT_Object", icon
='VIEW3D')
501 UseSeparator(self
, context
)
502 layout
.menu("VIEW3D_MT_TransformMenuLite", icon
='MANIPUL')
503 layout
.menu("VIEW3D_MT_CursorMenuLite", icon
='CURSOR')
504 UseSeparator(self
, context
)
505 layout
.menu("VIEW3D_MT_ParentMenu", icon
='ROTACTIVE')
506 layout
.menu("VIEW3D_MT_GroupMenu", icon
='GROUP')
507 UseSeparator(self
, context
)
508 layout
.menu("VIEW3D_MT_object_specials", text
="Specials", icon
='SOLO_OFF')
509 layout
.menu("VIEW3D_MT_Camera_Options", icon
='OUTLINER_OB_CAMERA')
510 UseSeparator(self
, context
)
511 layout
.operator_menu_enum("object.constraint_add",
512 "type", text
="Add Constraint", icon
='CONSTRAINT')
513 UseSeparator(self
, context
)
514 layout
.operator("object.delete", text
="Delete Object", icon
='X')
515 UseSeparator(self
, context
)
516 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
517 UseSeparator(self
, context
)
518 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
519 layout
.operator("view3d.properties", icon
='MENU_PANEL')
521 # Armature Object Mode #
522 if obj
and obj
.type == 'ARMATURE' and obj
.mode
in {'OBJECT'}:
524 layout
.operator_context
= 'INVOKE_REGION_WIN'
525 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
526 UseSeparator(self
, context
)
527 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
528 layout
.menu("VIEW3D_MT_Select_Object", icon
='RESTRICT_SELECT_OFF')
529 UseSeparator(self
, context
)
530 layout
.menu("VIEW3D_MT_AddMenu", icon
='OBJECT_DATAMODE')
531 layout
.menu("VIEW3D_MT_Object", icon
='VIEW3D')
532 UseSeparator(self
, context
)
533 layout
.menu("VIEW3D_MT_TransformMenuArmature", icon
='MANIPUL')
534 layout
.menu("VIEW3D_MT_MirrorMenu", icon
='MOD_MIRROR')
535 layout
.menu("VIEW3D_MT_CursorMenuLite", icon
='CURSOR')
536 UseSeparator(self
, context
)
537 layout
.menu("VIEW3D_MT_ParentMenu", icon
='ROTACTIVE')
538 layout
.menu("VIEW3D_MT_GroupMenu", icon
='GROUP')
539 UseSeparator(self
, context
)
540 layout
.menu("VIEW3D_MT_object_specials", text
="Specials", icon
='SOLO_OFF')
541 layout
.menu("VIEW3D_MT_Camera_Options", icon
='OUTLINER_OB_CAMERA')
542 UseSeparator(self
, context
)
543 layout
.operator_menu_enum("object.constraint_add",
544 "type", text
="Add Constraint", icon
='CONSTRAINT')
545 UseSeparator(self
, context
)
546 layout
.operator("object.delete", text
="Delete Object", icon
='X')
547 UseSeparator(self
, context
)
548 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
549 layout
.menu("VIEW3D_MT_Object_Interactive_Armature", icon
='VIEW3D')
550 UseSeparator(self
, context
)
551 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
552 layout
.operator("view3d.properties", icon
='MENU_PANEL')
555 if obj
and obj
.type == 'ARMATURE' and obj
.mode
in {'EDIT'}:
557 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
558 UseSeparator(self
, context
)
559 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
560 layout
.menu("VIEW3D_MT_Select_Edit_Armature",
561 icon
='RESTRICT_SELECT_OFF')
562 UseSeparator(self
, context
)
563 layout
.menu("INFO_MT_armature_add", text
="Add Armature",
564 icon
='OUTLINER_OB_ARMATURE')
565 layout
.menu("VIEW3D_MT_Edit_Armature", text
="Armature",
566 icon
='OUTLINER_DATA_ARMATURE')
567 layout
.menu("VIEW3D_MT_EditArmatureTK",
568 icon
='ARMATURE_DATA')
569 UseSeparator(self
, context
)
570 layout
.menu("VIEW3D_MT_TransformMenuArmatureEdit", icon
='MANIPUL')
571 layout
.menu("VIEW3D_MT_MirrorMenu", icon
='MOD_MIRROR')
572 layout
.menu("VIEW3D_MT_CursorMenuLite", icon
='CURSOR')
573 layout
.menu("VIEW3D_MT_ParentMenu", icon
='ROTACTIVE')
574 layout
.menu("VIEW3D_MT_armature_specials", icon
='SOLO_OFF')
575 layout
.menu("VIEW3D_MT_edit_armature_roll",
577 UseSeparator(self
, context
)
578 layout
.operator("armature.delete", text
="Delete Object",
580 UseSeparator(self
, context
)
581 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
582 layout
.menu("VIEW3D_MT_Object_Interactive_Armature", icon
='VIEW3D')
583 UseSeparator(self
, context
)
584 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
585 layout
.operator("view3d.properties", icon
='MENU_PANEL')
588 if obj
and obj
.type == 'ARMATURE' and obj
.mode
in {'POSE'}:
590 arm
= context
.active_object
.data
592 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
593 UseSeparator(self
, context
)
594 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
595 layout
.menu("VIEW3D_MT_Select_Pose", icon
='RESTRICT_SELECT_OFF')
596 UseSeparator(self
, context
)
597 layout
.menu("VIEW3D_MT_Pose", icon
='OUTLINER_DATA_POSE')
598 layout
.menu("VIEW3D_MT_TransformMenuArmaturePose", icon
='MANIPUL')
599 layout
.menu("VIEW3D_MT_pose_transform", icon
='EMPTY_DATA')
600 UseSeparator(self
, context
)
601 layout
.menu("VIEW3D_MT_CursorMenuLite", icon
='CURSOR')
602 layout
.menu("VIEW3D_MT_PoseCopy", icon
='FILE')
604 if arm
.draw_type
in {'BBONE', 'ENVELOPE'}:
605 layout
.operator("transform.transform",
606 text
="Scale Envelope Distance").mode
= 'BONE_SIZE'
608 layout
.menu("VIEW3D_MT_pose_apply", icon
='AUTO')
609 layout
.operator("pose.relax", icon
='ARMATURE_DATA')
610 layout
.menu("VIEW3D_MT_KeyframeMenu", icon
='KEY_HLT')
611 layout
.menu("VIEW3D_MT_pose_specials", icon
='SOLO_OFF')
612 layout
.menu("VIEW3D_MT_pose_group", icon
='GROUP_BONE')
613 UseSeparator(self
, context
)
614 layout
.operator_menu_enum("pose.constraint_add",
615 "type", text
="Add Constraint", icon
='CONSTRAINT_BONE')
616 UseSeparator(self
, context
)
617 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
618 layout
.menu("VIEW3D_MT_Object_Interactive_Armature", icon
='VIEW3D')
619 UseSeparator(self
, context
)
620 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
621 layout
.operator("view3d.properties", icon
='MENU_PANEL')
623 # Lattice Object Mode #
624 if obj
and obj
.type == 'LATTICE' and obj
.mode
in {'OBJECT'}:
626 layout
.operator_context
= 'INVOKE_REGION_WIN'
627 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
628 UseSeparator(self
, context
)
629 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
630 layout
.menu("VIEW3D_MT_Select_Object", icon
='RESTRICT_SELECT_OFF')
631 UseSeparator(self
, context
)
632 layout
.menu("VIEW3D_MT_AddMenu", icon
='OBJECT_DATAMODE')
633 layout
.menu("VIEW3D_MT_Object", icon
='VIEW3D')
634 UseSeparator(self
, context
)
635 layout
.menu("VIEW3D_MT_TransformMenu", icon
='MANIPUL')
636 layout
.menu("VIEW3D_MT_MirrorMenu", icon
='MOD_MIRROR')
637 layout
.menu("VIEW3D_MT_CursorMenu", icon
='CURSOR')
638 UseSeparator(self
, context
)
639 layout
.menu("VIEW3D_MT_ParentMenu", icon
='ROTACTIVE')
640 layout
.menu("VIEW3D_MT_GroupMenu", icon
='GROUP')
641 UseSeparator(self
, context
)
642 layout
.menu("VIEW3D_MT_object_specials", text
="Specials", icon
='SOLO_OFF')
643 layout
.menu("VIEW3D_MT_Camera_Options", icon
='OUTLINER_OB_CAMERA')
644 UseSeparator(self
, context
)
645 layout
.operator_menu_enum("object.modifier_add", "type", icon
='MODIFIER')
646 layout
.operator_menu_enum("object.constraint_add",
647 "type", text
="Add Constraint", icon
='CONSTRAINT')
648 UseSeparator(self
, context
)
649 layout
.operator("object.delete", text
="Delete Object", icon
='X')
650 UseSeparator(self
, context
)
651 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
652 layout
.menu("VIEW3D_MT_Object_Interactive_Other", icon
='OBJECT_DATA')
653 UseSeparator(self
, context
)
654 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
655 layout
.operator("view3d.properties", icon
='MENU_PANEL')
658 if obj
and obj
.type == 'LATTICE' and obj
.mode
in {'EDIT'}:
660 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
661 UseSeparator(self
, context
)
662 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
663 layout
.menu("VIEW3D_MT_Select_Edit_Lattice",
664 icon
='RESTRICT_SELECT_OFF')
665 UseSeparator(self
, context
)
666 layout
.menu("VIEW3D_MT_TransformMenu", icon
='MANIPUL')
667 layout
.menu("VIEW3D_MT_MirrorMenu", icon
='MOD_MIRROR')
668 layout
.menu("VIEW3D_MT_CursorMenu", icon
='CURSOR')
669 UseSeparator(self
, context
)
670 layout
.prop_menu_enum(settings
, "proportional_edit",
672 layout
.prop_menu_enum(settings
, "proportional_edit_falloff",
674 UseSeparator(self
, context
)
675 layout
.operator("lattice.make_regular")
676 UseSeparator(self
, context
)
677 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
678 layout
.menu("VIEW3D_MT_Object_Interactive_Other", icon
='OBJECT_DATA')
679 UseSeparator(self
, context
)
680 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
681 layout
.operator("view3d.properties", icon
='MENU_PANEL')
683 # Empty Object Mode #
684 if obj
and obj
.type == 'EMPTY' and obj
.mode
in {'OBJECT'}:
686 layout
.operator_context
= 'INVOKE_REGION_WIN'
687 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
688 UseSeparator(self
, context
)
689 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
690 layout
.menu("VIEW3D_MT_Select_Object", icon
='RESTRICT_SELECT_OFF')
691 UseSeparator(self
, context
)
692 layout
.menu("VIEW3D_MT_AddMenu", icon
='OBJECT_DATAMODE')
693 layout
.menu("VIEW3D_MT_Object", icon
='VIEW3D')
694 UseSeparator(self
, context
)
695 layout
.menu("VIEW3D_MT_TransformMenuLite", icon
='MANIPUL')
696 layout
.menu("VIEW3D_MT_MirrorMenu", icon
='MOD_MIRROR')
697 layout
.menu("VIEW3D_MT_CursorMenuLite", icon
='CURSOR')
698 UseSeparator(self
, context
)
699 layout
.menu("VIEW3D_MT_ParentMenu", icon
='ROTACTIVE')
700 layout
.menu("VIEW3D_MT_GroupMenu", icon
='GROUP')
701 UseSeparator(self
, context
)
702 layout
.menu("VIEW3D_MT_object_specials", text
="Specials", icon
='SOLO_OFF')
703 layout
.menu("VIEW3D_MT_Camera_Options", icon
='OUTLINER_OB_CAMERA')
704 UseSeparator(self
, context
)
705 layout
.operator_menu_enum("object.constraint_add",
706 "type", text
="Add Constraint", icon
='CONSTRAINT')
707 UseSeparator(self
, context
)
708 layout
.operator("object.delete", text
="Delete Object", icon
='X')
709 UseSeparator(self
, context
)
710 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
711 UseSeparator(self
, context
)
712 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
713 layout
.operator("view3d.properties", icon
='MENU_PANEL')
715 # Speaker Object Mode #
716 if obj
and obj
.type == 'SPEAKER' and obj
.mode
in {'OBJECT'}:
718 layout
.operator_context
= 'INVOKE_REGION_WIN'
719 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
720 UseSeparator(self
, context
)
721 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
722 layout
.menu("VIEW3D_MT_Select_Object", icon
='RESTRICT_SELECT_OFF')
723 UseSeparator(self
, context
)
724 layout
.menu("VIEW3D_MT_AddMenu", icon
='OBJECT_DATAMODE')
725 layout
.menu("VIEW3D_MT_Object", icon
='VIEW3D')
726 UseSeparator(self
, context
)
727 layout
.menu("VIEW3D_MT_TransformMenuLite", icon
='MANIPUL')
728 layout
.menu("VIEW3D_MT_CursorMenuLite", icon
='CURSOR')
729 UseSeparator(self
, context
)
730 layout
.menu("VIEW3D_MT_ParentMenu", icon
='ROTACTIVE')
731 layout
.menu("VIEW3D_MT_GroupMenu", icon
='GROUP')
732 UseSeparator(self
, context
)
733 layout
.operator_menu_enum("object.constraint_add",
734 "type", text
="Add Constraint", icon
='CONSTRAINT')
735 UseSeparator(self
, context
)
736 layout
.operator("object.delete", text
="Delete Object", icon
='X')
737 UseSeparator(self
, context
)
738 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
739 UseSeparator(self
, context
)
740 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
741 layout
.operator("view3d.properties", icon
='MENU_PANEL')
744 if obj
and context
.mode
== 'PARTICLE':
746 layout
.operator("wm.search_menu", text
="Search", icon
='VIEWZOOM')
747 UseSeparator(self
, context
)
748 layout
.menu("VIEW3D_MT_View_Menu", icon
='ZOOM_ALL')
749 layout
.menu("VIEW3D_MT_Select_Particle",
750 icon
='RESTRICT_SELECT_OFF')
751 layout
.menu("VIEW3D_MT_Selection_Mode_Particle",
752 text
="Select and Display Mode", icon
='PARTICLE_PATH')
753 UseSeparator(self
, context
)
754 layout
.menu("VIEW3D_MT_TransformMenu", icon
='MANIPUL')
755 layout
.menu("VIEW3D_MT_MirrorMenu", icon
='MOD_MIRROR')
756 layout
.menu("VIEW3D_MT_CursorMenuLite", icon
='CURSOR')
757 UseSeparator(self
, context
)
758 layout
.prop_menu_enum(settings
, "proportional_edit",
760 layout
.prop_menu_enum(settings
, "proportional_edit_falloff",
762 UseSeparator(self
, context
)
763 layout
.menu("VIEW3D_MT_particle", icon
='PARTICLEMODE')
764 layout
.menu("VIEW3D_MT_particle_specials", text
="Hair Specials", icon
='HAIR')
765 UseSeparator(self
, context
)
766 layout
.operator("object.delete", text
="Delete Object", icon
='X')
767 UseSeparator(self
, context
)
768 layout
.menu("VIEW3D_MT_UndoS", icon
='ARROW_LEFTRIGHT')
769 layout
.menu("VIEW3D_MT_Object_Interactive_Mode", icon
='VIEW3D')
770 UseSeparator(self
, context
)
771 layout
.operator("view3d.toolshelf", icon
='MENU_PANEL')
772 layout
.operator("view3d.properties", icon
='MENU_PANEL')
777 # ********** Object Menu **********
778 class VIEW3D_MT_Object(Menu
):
779 bl_context
= "objectmode"
782 def draw(self
, context
):
784 view
= context
.space_data
785 is_local_view
= (view
.local_view
is not None)
787 layout
.operator("object.delete", text
="Delete...").use_global
= False
788 UseSeparator(self
, context
)
789 layout
.menu("VIEW3D_MT_object_parent")
790 layout
.menu("VIEW3D_MT_Duplicate")
791 layout
.operator("object.join")
794 layout
.operator_context
= 'EXEC_REGION_WIN'
795 layout
.operator("object.move_to_layer", text
="Move out of Local View")
796 layout
.operator_context
= 'INVOKE_REGION_WIN'
798 layout
.operator("object.move_to_layer", text
="Move to Layer...")
800 layout
.menu("VIEW3D_MT_make_links", text
="Make Links...")
801 layout
.menu("VIEW3D_MT_Object_Data_Link")
802 UseSeparator(self
, context
)
803 layout
.menu("VIEW3D_MT_AutoSmooth", icon
='ALIASED')
804 UseSeparator(self
, context
)
805 layout
.menu("VIEW3D_MT_object_constraints")
806 layout
.menu("VIEW3D_MT_object_track")
807 layout
.menu("VIEW3D_MT_object_animation")
808 UseSeparator(self
, context
)
809 layout
.menu("VIEW3D_MT_object_game")
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.lamp_add", "type",
845 icon
="OUTLINER_OB_LAMP")
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
)
852 layout
.operator_menu_enum("object.group_instance_add", "group",
853 text
="Group Instance",
857 # ********** Object Manipulator **********
858 class VIEW3D_MT_ManipulatorMenu1(Menu
):
859 bl_label
= "Manipulator"
861 def draw(self
, context
):
863 layout
.operator_context
= 'INVOKE_REGION_WIN'
864 props
= layout
.operator("view3d.enable_manipulator", text
='Translate', icon
='MAN_TRANS')
865 props
.translate
= True
866 props
= layout
.operator("view3d.enable_manipulator", text
='Rotate', icon
='MAN_ROT')
868 props
= layout
.operator("view3d.enable_manipulator", text
='Scale', icon
='MAN_SCALE')
870 UseSeparator(self
, context
)
871 props
= layout
.operator("view3d.enable_manipulator", text
='Combo', icon
='MAN_SCALE')
874 props
.translate
= True
875 props
= layout
.operator("view3d.enable_manipulator", text
='Hide', icon
='MAN_SCALE')
878 props
.translate
= False
881 # ********** Object Mirror **********
882 class VIEW3D_MT_MirrorMenu(Menu
):
885 def draw(self
, context
):
887 layout
.operator("transform.mirror", text
="Interactive Mirror")
888 UseSeparator(self
, context
)
889 layout
.operator_context
= 'INVOKE_REGION_WIN'
890 props
= layout
.operator("transform.mirror", text
="X Global")
891 props
.constraint_axis
= (True, False, False)
892 props
.constraint_orientation
= 'GLOBAL'
893 props
= layout
.operator("transform.mirror", text
="Y Global")
894 props
.constraint_axis
= (False, True, False)
895 props
.constraint_orientation
= 'GLOBAL'
896 props
= layout
.operator("transform.mirror", text
="Z Global")
897 props
.constraint_axis
= (False, False, True)
898 props
.constraint_orientation
= 'GLOBAL'
900 if context
.edit_object
:
902 UseSeparator(self
, context
)
903 props
= layout
.operator("transform.mirror", text
="X Local")
904 props
.constraint_axis
= (True, False, False)
905 props
.constraint_orientation
= 'LOCAL'
906 props
= layout
.operator("transform.mirror", text
="Y Local")
907 props
.constraint_axis
= (False, True, False)
908 props
.constraint_orientation
= 'LOCAL'
909 props
= layout
.operator("transform.mirror", text
="Z Local")
910 props
.constraint_axis
= (False, False, True)
911 props
.constraint_orientation
= 'LOCAL'
912 UseSeparator(self
, context
)
913 layout
.operator("object.vertex_group_mirror")
916 # ********** Object Snap Cursor **********
917 class VIEW3D_MT_Pivot(Menu
):
920 def draw(self
, context
):
922 layout
.prop(context
.space_data
, "pivot_point", expand
=True)
923 if context
.active_object
.mode
== 'OBJECT':
924 UseSeparator(self
, context
)
925 layout
.prop(context
.space_data
, "use_pivot_point_align", text
="Center Points")
928 class VIEW3D_Snap_Context(Menu
):
929 bl_label
= "Snapping"
931 def draw(self
, context
):
933 toolsettings
= context
.tool_settings
934 layout
.prop(toolsettings
, "snap_element", expand
=True)
935 layout
.prop(toolsettings
, "use_snap")
938 class VIEW3D_Snap_Origin(Menu
):
941 def draw(self
, context
):
943 layout
.operator_context
= 'EXEC_AREA'
944 layout
.operator("object.origin_set",
945 text
="Geometry to Origin").type = 'GEOMETRY_ORIGIN'
946 UseSeparator(self
, context
)
947 layout
.operator("object.origin_set",
948 text
="Origin to Geometry").type = 'ORIGIN_GEOMETRY'
949 layout
.operator("object.origin_set",
950 text
="Origin to 3D Cursor").type = 'ORIGIN_CURSOR'
951 layout
.operator("object.origin_set",
952 text
="Origin to Center of Mass").type = 'ORIGIN_CENTER_OF_MASS'
955 class VIEW3D_MT_CursorMenu(Menu
):
956 bl_label
= "Snap Cursor"
958 def draw(self
, context
):
960 layout
.operator_context
= 'INVOKE_REGION_WIN'
961 layout
.menu("VIEW3D_Snap_Origin")
962 layout
.menu("VIEW3D_Snap_Context")
963 UseSeparator(self
, context
)
964 layout
.operator("view3d.snap_cursor_to_selected",
965 text
="Cursor to Selected")
966 layout
.operator("view3d.snap_cursor_to_center",
967 text
="Cursor to Center")
968 layout
.operator("view3d.snap_cursor_to_grid",
969 text
="Cursor to Grid")
970 layout
.operator("view3d.snap_cursor_to_active",
971 text
="Cursor to Active")
972 UseSeparator(self
, context
)
973 layout
.operator("view3d.snap_selected_to_cursor", text
="Selection to Cursor").use_offset
= False
974 layout
.operator("view3d.snap_selected_to_cursor", text
="Selection to Cursor (Offset)").use_offset
= True
975 layout
.operator("view3d.snap_selected_to_grid",
976 text
="Selection to Grid")
977 layout
.operator("view3d.snap_cursor_selected_to_center",
978 text
="Selection and Cursor to Center")
979 UseSeparator(self
, context
)
980 layout
.menu("VIEW3D_MT_Pivot")
981 layout
.operator("view3d.pivot_cursor",
982 text
="Set Cursor as Pivot Point")
983 layout
.operator("view3d.revert_pivot",
984 text
="Revert Pivot Point")
987 class VIEW3D_MT_CursorMenuLite(Menu
):
988 bl_label
= "Snap Cursor"
990 def draw(self
, context
):
992 layout
.operator_context
= 'INVOKE_REGION_WIN'
993 layout
.menu("VIEW3D_Snap_Origin")
994 UseSeparator(self
, context
)
995 layout
.operator("view3d.snap_cursor_to_selected",
996 text
="Cursor to Selected")
997 layout
.operator("view3d.snap_cursor_to_center",
998 text
="Cursor to Center")
999 layout
.operator("view3d.snap_cursor_to_grid",
1000 text
="Cursor to Grid")
1001 layout
.operator("view3d.snap_cursor_to_active",
1002 text
="Cursor to Active")
1003 UseSeparator(self
, context
)
1004 layout
.operator("view3d.snap_selected_to_cursor", text
="Selection to Cursor").use_offset
= False
1005 layout
.operator("view3d.snap_selected_to_cursor", text
="Selection to Cursor (Offset)").use_offset
= True
1006 layout
.operator("view3d.snap_selected_to_grid",
1007 text
="Selection to Grid")
1008 layout
.operator("view3d.snap_cursor_selected_to_center",
1009 text
="Selection and Cursor to Center")
1010 UseSeparator(self
, context
)
1011 layout
.menu("VIEW3D_MT_Pivot")
1012 layout
.operator("view3d.pivot_cursor",
1013 text
="Set Cursor as Pivot Point")
1014 layout
.operator("view3d.revert_pivot",
1015 text
="Revert Pivot Point")
1018 # ********** Object Interactive Mode **********
1019 class InteractiveMode(Menu
):
1020 bl_idname
= "VIEW3D_MT_Object_Interactive_Mode"
1021 bl_label
= "Interactive Mode"
1022 bl_description
= "Menu of objects' interactive modes (Window Types)"
1024 def draw(self
, context
):
1025 layout
= self
.layout
1026 obj
= context
.active_object
1027 psys
= hasattr(obj
, "particle_systems")
1028 psys_items
= len(obj
.particle_systems
.items()) > 0 if psys
else False
1030 layout
.operator(SetObjectMode
.bl_idname
, text
="Object", icon
="OBJECT_DATAMODE").mode
= "OBJECT"
1031 layout
.operator(SetObjectMode
.bl_idname
, text
="Edit", icon
="EDITMODE_HLT").mode
= "EDIT"
1032 layout
.operator(SetObjectMode
.bl_idname
, text
="Sculpt", icon
="SCULPTMODE_HLT").mode
= "SCULPT"
1033 layout
.operator(SetObjectMode
.bl_idname
, text
="Vertex Paint", icon
="VPAINT_HLT").mode
= "VERTEX_PAINT"
1034 layout
.operator(SetObjectMode
.bl_idname
, text
="Weight Paint", icon
="WPAINT_HLT").mode
= "WEIGHT_PAINT"
1035 layout
.operator(SetObjectMode
.bl_idname
, text
="Texture Paint", icon
="TPAINT_HLT").mode
= "TEXTURE_PAINT"
1036 if obj
and psys_items
:
1037 layout
.operator(SetObjectMode
.bl_idname
, text
="Particle Edit",
1038 icon
="PARTICLEMODE").mode
= "PARTICLE_EDIT"
1039 if context
.gpencil_data
:
1040 layout
.operator("view3d.interactive_mode_grease_pencil", icon
="GREASEPENCIL")
1043 # ********** Object Armature Interactive Mode **********
1044 class InteractiveModeArmature(Menu
):
1045 bl_idname
= "VIEW3D_MT_Object_Interactive_Armature"
1046 bl_label
= "Interactive Mode"
1047 bl_description
= "Menu of objects interactive mode"
1049 def draw(self
, context
):
1050 layout
= self
.layout
1052 layout
.operator(SetObjectMode
.bl_idname
, text
="Object", icon
="OBJECT_DATAMODE").mode
= "OBJECT"
1053 layout
.operator(SetObjectMode
.bl_idname
, text
="Edit", icon
="EDITMODE_HLT").mode
= "EDIT"
1054 layout
.operator(SetObjectMode
.bl_idname
, text
="Pose", icon
="POSE_HLT").mode
= "POSE"
1055 if context
.gpencil_data
:
1056 layout
.operator("view3d.interactive_mode_grease_pencil", icon
="GREASEPENCIL")
1059 # ********** Interactive Mode Other **********
1060 class InteractiveModeOther(Menu
):
1061 bl_idname
= "VIEW3D_MT_Object_Interactive_Other"
1062 bl_label
= "Interactive Mode"
1063 bl_description
= "Menu of objects interactive mode"
1065 def draw(self
, context
):
1066 layout
= self
.layout
1067 layout
.operator("object.editmode_toggle", text
="Edit/Object Toggle",
1069 if context
.gpencil_data
:
1070 layout
.operator("view3d.interactive_mode_grease_pencil", icon
="GREASEPENCIL")
1073 # ********** Grease Pencil Interactive Mode **********
1074 class VIEW3D_OT_Interactive_Mode_Grease_Pencil(Operator
):
1075 bl_idname
= "view3d.interactive_mode_grease_pencil"
1076 bl_label
= "Edit Strokes"
1077 bl_description
= "Toggle Edit Strokes for Grease Pencil"
1080 def poll(cls
, context
):
1081 return (context
.gpencil_data
is not None)
1083 def execute(self
, context
):
1085 bpy
.ops
.gpencil
.editmode_toggle()
1087 self
.report({'WARNING'}, "It is not possible to enter into the interactive mode")
1091 class VIEW3D_MT_Edit_Gpencil(Menu
):
1092 bl_label
= "GPencil"
1094 def draw(self
, context
):
1095 toolsettings
= context
.tool_settings
1096 layout
= self
.layout
1098 layout
.operator("gpencil.brush_paint", text
="Sculpt Strokes").wait_for_input
= True
1099 layout
.prop_menu_enum(toolsettings
.gpencil_sculpt
, "tool", text
="Sculpt Brush")
1100 UseSeparator(self
, context
)
1102 layout
.menu("VIEW3D_MT_edit_gpencil_transform")
1103 layout
.operator("transform.mirror", text
="Mirror")
1104 layout
.menu("GPENCIL_MT_snap")
1105 UseSeparator(self
, context
)
1107 layout
.menu("VIEW3D_MT_object_animation") # NOTE: provides keyingset access...
1108 UseSeparator(self
, context
)
1110 layout
.menu("VIEW3D_MT_edit_gpencil_delete")
1111 layout
.operator("gpencil.duplicate_move", text
="Duplicate")
1112 UseSeparator(self
, context
)
1114 layout
.menu("VIEW3D_MT_select_gpencil")
1115 UseSeparator(self
, context
)
1117 layout
.operator("gpencil.copy", text
="Copy")
1118 layout
.operator("gpencil.paste", text
="Paste")
1119 UseSeparator(self
, context
)
1121 layout
.prop_menu_enum(toolsettings
, "proportional_edit")
1122 layout
.prop_menu_enum(toolsettings
, "proportional_edit_falloff")
1123 UseSeparator(self
, context
)
1125 layout
.operator("gpencil.reveal")
1126 layout
.operator("gpencil.hide", text
="Show Active Layer Only").unselected
= True
1127 layout
.operator("gpencil.hide", text
="Hide Active Layer").unselected
= False
1128 UseSeparator(self
, context
)
1130 layout
.operator_menu_enum("gpencil.move_to_layer", "layer", text
="Move to Layer")
1131 layout
.operator_menu_enum("gpencil.convert", "type", text
="Convert to Geometry...")
1134 # ********** Text Interactive Mode **********
1135 class VIEW3D_OT_Interactive_Mode_Text(Operator
):
1136 bl_idname
= "view3d.interactive_mode_text"
1137 bl_label
= "Enter Edit Mode"
1138 bl_description
= "Toggle object's editmode"
1141 def poll(cls
, context
):
1142 return (context
.active_object
is not None)
1144 def execute(self
, context
):
1145 bpy
.ops
.object.editmode_toggle()
1146 self
.report({'INFO'}, "Spacebar shortcut won't work in the Text Edit mode")
1150 # ********** Object Parent **********
1151 class VIEW3D_MT_ParentMenu(Menu
):
1154 def draw(self
, context
):
1155 layout
= self
.layout
1157 layout
.operator("object.parent_set", text
="Set")
1158 layout
.operator("object.parent_clear", text
="Clear")
1161 # ********** Object Group **********
1162 class VIEW3D_MT_GroupMenu(Menu
):
1165 def draw(self
, context
):
1166 layout
= self
.layout
1167 layout
.operator("group.create")
1168 layout
.operator("group.objects_add_active")
1169 UseSeparator(self
, context
)
1170 layout
.operator("group.objects_remove")
1171 layout
.operator("group.objects_remove_all")
1172 layout
.operator("group.objects_remove_active")
1175 # ********** Object Camera Options **********
1176 class VIEW3D_MT_Camera_Options(Menu
):
1179 def draw(self
, context
):
1180 layout
= self
.layout
1181 layout
.operator_context
= 'EXEC_REGION_WIN'
1182 layout
.operator("object.camera_add", text
="Add Camera", icon
='OUTLINER_OB_CAMERA')
1183 self
.layout
.operator("view3d.object_as_camera", text
="Object As Camera", icon
='OUTLINER_OB_CAMERA')
1184 self
.layout
.operator("view3d.viewnumpad", text
="View Active Camera",
1185 icon
='OUTLINER_OB_CAMERA').type = 'CAMERA'
1188 class VIEW3D_MT_Object_Data_Link(Menu
):
1189 bl_label
= "Object Data"
1191 def draw(self
, context
):
1192 layout
= self
.layout
1194 layout
.operator_menu_enum("object.make_local", "type", text
="Make Local...")
1195 layout
.menu("VIEW3D_MT_make_single_user")
1196 layout
.operator("object.proxy_make", text
="Make Proxy...")
1197 layout
.operator("object.make_dupli_face")
1198 UseSeparator(self
, context
)
1199 layout
.operator("object.data_transfer")
1200 layout
.operator("object.datalayout_transfer")
1203 class VIEW3D_MT_Duplicate(Menu
):
1204 bl_label
= "Duplicate"
1206 def draw(self
, context
):
1207 layout
= self
.layout
1209 layout
.operator("object.duplicate_move")
1210 layout
.operator("object.duplicate_move_linked")
1213 class VIEW3D_MT_KeyframeMenu(Menu
):
1214 bl_label
= "Keyframe"
1216 def draw(self
, context
):
1217 layout
= self
.layout
1218 layout
.operator("anim.keyframe_insert_menu",
1219 text
="Insert Keyframe...")
1220 layout
.operator("anim.keyframe_delete_v3d",
1221 text
="Delete Keyframe...")
1222 layout
.operator("anim.keying_set_active_set",
1223 text
="Change Keying Set...")
1226 class VIEW3D_MT_UndoS(Menu
):
1227 bl_label
= "Undo/Redo"
1229 def draw(self
, context
):
1230 layout
= self
.layout
1232 layout
.operator("ed.undo")
1233 layout
.operator("ed.redo")
1234 UseSeparator(self
, context
)
1235 layout
.operator("ed.undo_history")
1238 # ********** Normals / Auto Smooth Menu **********
1239 # Thanks to marvin.k.breuer for the Autosmooth part of the menu
1240 class VIEW3D_MT_AutoSmooth(Menu
):
1241 bl_label
= "Normals / Auto Smooth"
1243 def draw(self
, context
):
1244 layout
= self
.layout
1245 obj
= context
.object
1246 obj_data
= context
.active_object
.data
1248 # moved the VIEW3D_MT_edit_mesh_normals contents here under an Edit mode check
1249 if obj
and obj
.type == 'MESH' and obj
.mode
in {'EDIT'}:
1250 layout
.operator("mesh.normals_make_consistent",
1251 text
="Recalculate Outside").inside
= False
1252 layout
.operator("mesh.normals_make_consistent",
1253 text
="Recalculate Inside").inside
= True
1254 layout
.operator("mesh.flip_normals")
1255 UseSeparator(self
, context
)
1257 layout
.prop(obj_data
, "show_double_sided", text
="Normals: Double Sided")
1258 UseSeparator(self
, context
)
1259 layout
.prop(obj_data
, "use_auto_smooth", text
="Normals: Auto Smooth")
1261 # Auto Smooth Angle - two tab spaces to align it with the rest of the menu
1262 layout
.prop(obj_data
, "auto_smooth_angle",
1263 text
=" Auto Smooth Angle")
1266 # Edit Mode Menu's #
1268 # ********** Edit Mesh **********
1269 class VIEW3D_MT_Edit_Mesh(Menu
):
1272 def draw(self
, context
):
1273 layout
= self
.layout
1274 toolsettings
= context
.tool_settings
1275 view
= context
.space_data
1277 layout
.menu("VIEW3D_MT_edit_mesh_vertices", icon
='VERTEXSEL')
1278 layout
.menu("VIEW3D_MT_edit_mesh_edges", icon
='EDGESEL')
1279 layout
.menu("VIEW3D_MT_edit_mesh_faces", icon
='FACESEL')
1280 UseSeparator(self
, context
)
1281 layout
.operator("mesh.duplicate_move")
1282 UseSeparator(self
, context
)
1283 layout
.menu("VIEW3D_MT_edit_mesh_clean", icon
='AUTO')
1284 layout
.prop(view
, "use_occlude_geometry")
1285 UseSeparator(self
, context
)
1286 layout
.menu("VIEW3D_MT_AutoSmooth", icon
='META_DATA')
1287 layout
.operator("mesh.loopcut_slide",
1288 text
="Loopcut", icon
='UV_EDGESEL')
1289 UseSeparator(self
, context
)
1290 layout
.operator("mesh.symmetrize")
1291 layout
.operator("mesh.symmetry_snap")
1292 UseSeparator(self
, context
)
1293 layout
.operator("mesh.bisect")
1294 layout
.operator_menu_enum("mesh.sort_elements", "type", text
="Sort Elements...")
1295 UseSeparator(self
, context
)
1296 layout
.prop_menu_enum(toolsettings
, "proportional_edit")
1297 layout
.prop_menu_enum(toolsettings
, "proportional_edit_falloff")
1298 UseSeparator(self
, context
)
1300 layout
.prop(toolsettings
, "use_mesh_automerge")
1301 # Double Threshold - two tab spaces to align it with the rest of the menu
1302 layout
.prop(toolsettings
, "double_threshold", text
=" Double Threshold")
1304 UseSeparator(self
, context
)
1305 layout
.menu("VIEW3D_MT_edit_mesh_showhide")
1308 # ********** Edit Multiselect **********
1309 class VIEW3D_MT_Edit_Multi(Menu
):
1310 bl_label
= "Multi Select"
1312 def draw(self
, context
):
1313 layout
= self
.layout
1314 layout
.operator_context
= 'INVOKE_REGION_WIN'
1316 prop
= layout
.operator("wm.context_set_value", text
="Vertex Select",
1318 prop
.value
= "(True, False, False)"
1319 prop
.data_path
= "tool_settings.mesh_select_mode"
1321 prop
= layout
.operator("wm.context_set_value", text
="Edge Select",
1323 prop
.value
= "(False, True, False)"
1324 prop
.data_path
= "tool_settings.mesh_select_mode"
1326 prop
= layout
.operator("wm.context_set_value", text
="Face Select",
1328 prop
.value
= "(False, False, True)"
1329 prop
.data_path
= "tool_settings.mesh_select_mode"
1330 UseSeparator(self
, context
)
1332 prop
= layout
.operator("wm.context_set_value",
1333 text
="Vertex & Edge Select",
1334 icon
='EDITMODE_HLT')
1335 prop
.value
= "(True, True, False)"
1336 prop
.data_path
= "tool_settings.mesh_select_mode"
1338 prop
= layout
.operator("wm.context_set_value",
1339 text
="Vertex & Face Select",
1341 prop
.value
= "(True, False, True)"
1342 prop
.data_path
= "tool_settings.mesh_select_mode"
1344 prop
= layout
.operator("wm.context_set_value",
1345 text
="Edge & Face Select",
1347 prop
.value
= "(False, True, True)"
1348 prop
.data_path
= "tool_settings.mesh_select_mode"
1349 UseSeparator(self
, context
)
1351 prop
= layout
.operator("wm.context_set_value",
1352 text
="Vertex & Edge & Face Select",
1354 prop
.value
= "(True, True, True)"
1355 prop
.data_path
= "tool_settings.mesh_select_mode"
1358 # ********** Edit Mesh Edge **********
1359 class VIEW3D_MT_EditM_Edge(Menu
):
1362 def draw(self
, context
):
1363 layout
= self
.layout
1364 layout
.operator_context
= 'INVOKE_REGION_WIN'
1366 layout
.operator("mesh.mark_seam")
1367 layout
.operator("mesh.mark_seam", text
="Clear Seam").clear
= True
1368 UseSeparator(self
, context
)
1370 layout
.operator("mesh.mark_sharp")
1371 layout
.operator("mesh.mark_sharp", text
="Clear Sharp").clear
= True
1372 layout
.operator("mesh.extrude_move_along_normals", text
="Extrude")
1373 UseSeparator(self
, context
)
1375 layout
.operator("mesh.edge_rotate",
1376 text
="Rotate Edge CW").direction
= 'CW'
1377 layout
.operator("mesh.edge_rotate",
1378 text
="Rotate Edge CCW").direction
= 'CCW'
1379 UseSeparator(self
, context
)
1381 layout
.operator("TFM_OT_edge_slide", text
="Edge Slide")
1382 layout
.operator("mesh.loop_multi_select", text
="Edge Loop")
1383 layout
.operator("mesh.loop_multi_select", text
="Edge Ring").ring
= True
1384 layout
.operator("mesh.loop_to_region")
1385 layout
.operator("mesh.region_to_loop")
1388 # ********** Edit Mesh Cursor **********
1389 class VIEW3D_MT_EditCursorMenu(Menu
):
1390 bl_label
= "Snap Cursor"
1392 def draw(self
, context
):
1393 layout
= self
.layout
1394 layout
.operator_context
= 'INVOKE_REGION_WIN'
1395 layout
.operator("object.setorigintoselected",
1396 text
="Origin to Selected V/F/E")
1397 UseSeparator(self
, context
)
1398 layout
.menu("VIEW3D_Snap_Origin")
1399 layout
.menu("VIEW3D_Snap_Context")
1400 UseSeparator(self
, context
)
1401 layout
.operator("view3d.snap_cursor_to_selected",
1402 text
="Cursor to Selected")
1403 layout
.operator("view3d.snap_cursor_to_center",
1404 text
="Cursor to Center")
1405 layout
.operator("view3d.snap_cursor_to_grid",
1406 text
="Cursor to Grid")
1407 layout
.operator("view3d.snap_cursor_to_active",
1408 text
="Cursor to Active")
1409 layout
.operator("view3d.snap_cursor_to_edge_intersection",
1410 text
="Cursor to Edge Intersection")
1411 UseSeparator(self
, context
)
1412 layout
.operator("view3d.snap_selected_to_cursor", text
="Selection to Cursor").use_offset
= False
1413 layout
.operator("view3d.snap_selected_to_cursor", text
="Selection to Cursor (Offset)").use_offset
= True
1414 layout
.operator("view3d.snap_selected_to_grid",
1415 text
="Selection to Grid")
1416 UseSeparator(self
, context
)
1417 layout
.menu("VIEW3D_MT_Pivot")
1418 layout
.operator("view3d.pivot_cursor",
1419 text
="Set Cursor as Pivot Point")
1420 layout
.operator("view3d.revert_pivot",
1421 text
="Revert Pivot Point")
1424 # ********** Edit Mesh UV **********
1425 class VIEW3D_MT_UV_Map(Menu
):
1426 bl_label
= "UV Mapping"
1428 def draw(self
, context
):
1429 layout
= self
.layout
1430 layout
.operator("uv.unwrap")
1431 UseSeparator(self
, context
)
1432 layout
.operator_context
= 'INVOKE_DEFAULT'
1433 layout
.operator("uv.smart_project")
1434 layout
.operator("uv.lightmap_pack")
1435 layout
.operator("uv.follow_active_quads")
1436 layout
.operator_context
= 'EXEC_REGION_WIN'
1437 layout
.operator("uv.cube_project")
1438 layout
.operator("uv.cylinder_project")
1439 layout
.operator("uv.sphere_project")
1440 layout
.operator_context
= 'INVOKE_REGION_WIN'
1441 UseSeparator(self
, context
)
1442 layout
.operator("uv.project_from_view").scale_to_bounds
= False
1443 layout
.operator("uv.project_from_view", text
="Project from View (Bounds)").scale_to_bounds
= True
1444 UseSeparator(self
, context
)
1445 layout
.operator("uv.reset")
1448 # ********** Edit Curve **********
1449 class VIEW3D_MT_Edit_Curve(Menu
):
1452 def draw(self
, context
):
1453 layout
= self
.layout
1455 toolsettings
= context
.tool_settings
1457 layout
.operator("curve.extrude_move")
1458 layout
.operator("curve.spin")
1459 layout
.operator("curve.duplicate_move")
1460 layout
.operator("curve.split")
1461 layout
.operator("curve.separate")
1462 layout
.operator("curve.make_segment")
1463 layout
.operator("curve.cyclic_toggle")
1464 UseSeparator(self
, context
)
1465 layout
.operator("curve.delete", text
="Delete...")
1466 UseSeparator(self
, context
)
1467 layout
.menu("VIEW3D_MT_edit_curve_segments")
1468 layout
.prop_menu_enum(toolsettings
, "proportional_edit",
1470 layout
.prop_menu_enum(toolsettings
, "proportional_edit_falloff",
1472 layout
.menu("VIEW3D_MT_edit_curve_showhide")
1475 class VIEW3D_MT_EditCurveCtrlpoints(Menu
):
1476 bl_label
= "Control Points"
1478 def draw(self
, context
):
1479 layout
= self
.layout
1481 edit_object
= context
.edit_object
1483 if edit_object
.type == 'CURVE':
1484 layout
.operator("transform.transform").mode
= 'TILT'
1485 layout
.operator("curve.tilt_clear")
1486 layout
.operator("curve.separate")
1487 layout
.operator_menu_enum("curve.handle_type_set", "type")
1488 layout
.menu("VIEW3D_MT_hook")
1491 class VIEW3D_MT_EditCurveSegments(Menu
):
1492 bl_label
= "Curve Segments"
1494 def draw(self
, context
):
1495 layout
= self
.layout
1496 layout
.operator("curve.subdivide")
1497 layout
.operator("curve.switch_direction")
1500 class VIEW3D_MT_EditCurveSpecials(Menu
):
1501 bl_label
= "Specials"
1503 def draw(self
, context
):
1504 layout
= self
.layout
1505 layout
.operator("curve.subdivide")
1506 UseSeparator(self
, context
)
1507 layout
.operator("curve.switch_direction")
1508 layout
.operator("curve.spline_weight_set")
1509 layout
.operator("curve.radius_set")
1510 UseSeparator(self
, context
)
1511 layout
.operator("curve.smooth")
1512 layout
.operator("curve.smooth_weight")
1513 layout
.operator("curve.smooth_radius")
1514 layout
.operator("curve.smooth_tilt")
1518 # Thanks to CoDEmanX for the code
1519 class VIEW3D_MT_Brush_Selection(Menu
):
1520 bl_label
= "Brush Tool"
1522 def draw(self
, context
):
1523 layout
= self
.layout
1524 settings
= UnifiedPaintPanel
.paint_settings(context
)
1526 # check if brush exists (for instance, in paint mode before adding a slot)
1527 if hasattr(settings
, 'brush'):
1528 brush
= settings
.brush
1533 layout
.label(text
="No Brushes currently available", icon
="INFO")
1536 if not context
.particle_edit_object
:
1537 if UseBrushesLists():
1538 flow
= layout
.column_flow(columns
=3)
1540 for brsh
in bpy
.data
.brushes
:
1541 if (context
.sculpt_object
and brsh
.use_paint_sculpt
):
1542 props
= flow
.operator("wm.context_set_id", text
=brsh
.name
,
1543 icon_value
=layout
.icon(brsh
))
1544 props
.data_path
= "tool_settings.sculpt.brush"
1545 props
.value
= brsh
.name
1546 elif (context
.image_paint_object
and brsh
.use_paint_image
):
1547 props
= flow
.operator("wm.context_set_id", text
=brsh
.name
,
1548 icon_value
=layout
.icon(brsh
))
1549 props
.data_path
= "tool_settings.image_paint.brush"
1550 props
.value
= brsh
.name
1551 elif (context
.vertex_paint_object
and brsh
.use_paint_vertex
):
1552 props
= flow
.operator("wm.context_set_id", text
=brsh
.name
,
1553 icon_value
=layout
.icon(brsh
))
1554 props
.data_path
= "tool_settings.vertex_paint.brush"
1555 props
.value
= brsh
.name
1556 elif (context
.weight_paint_object
and brsh
.use_paint_weight
):
1557 props
= flow
.operator("wm.context_set_id", text
=brsh
.name
,
1558 icon_value
=layout
.icon(brsh
))
1559 props
.data_path
= "tool_settings.weight_paint.brush"
1560 props
.value
= brsh
.name
1562 layout
.template_ID_preview(settings
, "brush", new
="brush.add", rows
=3, cols
=8)
1565 class VIEW3D_MT_Brush_Settings(Menu
):
1566 bl_label
= "Brush Settings"
1568 def draw(self
, context
):
1569 layout
= self
.layout
1570 settings
= UnifiedPaintPanel
.paint_settings(context
)
1571 brush
= getattr(settings
, "brush", None)
1573 ups
= context
.tool_settings
.unified_paint_settings
1574 layout
.prop(ups
, "use_unified_size", text
="Unified Size")
1575 layout
.prop(ups
, "use_unified_strength", text
="Unified Strength")
1576 if context
.image_paint_object
or context
.vertex_paint_object
:
1577 layout
.prop(ups
, "use_unified_color", text
="Unified Color")
1578 UseSeparator(self
, context
)
1581 layout
.label(text
="No Brushes currently available", icon
="INFO")
1584 layout
.menu("VIEW3D_MT_brush_paint_modes")
1586 if context
.sculpt_object
:
1587 sculpt_tool
= brush
.sculpt_tool
1589 UseSeparator(self
, context
)
1590 layout
.operator_menu_enum("brush.curve_preset", "shape", text
="Curve Preset")
1591 UseSeparator(self
, context
)
1593 if sculpt_tool
!= 'GRAB':
1594 layout
.prop_menu_enum(brush
, "stroke_method")
1596 if sculpt_tool
in {'DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'}:
1597 layout
.prop_menu_enum(brush
, "direction")
1599 if sculpt_tool
== 'LAYER':
1600 layout
.prop(brush
, "use_persistent")
1601 layout
.operator("sculpt.set_persistent_base")
1605 class VIEW3D_MT_Sculpts(Menu
):
1608 def draw(self
, context
):
1609 layout
= self
.layout
1610 toolsettings
= context
.tool_settings
1611 sculpt
= toolsettings
.sculpt
1613 layout
.prop(sculpt
, "use_symmetry_x")
1614 layout
.prop(sculpt
, "use_symmetry_y")
1615 layout
.prop(sculpt
, "use_symmetry_z")
1617 UseSeparator(self
, context
)
1618 layout
.prop(sculpt
, "lock_x")
1619 layout
.prop(sculpt
, "lock_y")
1620 layout
.prop(sculpt
, "lock_z")
1622 UseSeparator(self
, context
)
1623 layout
.prop(sculpt
, "use_threaded", text
="Threaded Sculpt")
1624 layout
.prop(sculpt
, "show_low_resolution")
1625 layout
.prop(sculpt
, "use_deform_only")
1627 UseSeparator(self
, context
)
1628 layout
.prop(sculpt
, "show_brush")
1629 layout
.prop(sculpt
, "show_diffuse_color")
1632 class VIEW3D_MT_Hide_Masks(Menu
):
1633 bl_label
= "Hide/Mask"
1635 def draw(self
, context
):
1636 layout
= self
.layout
1638 props
= layout
.operator("paint.mask_lasso_gesture", text
="Lasso Mask")
1639 UseSeparator(self
, context
)
1640 props
= layout
.operator("view3d.select_border", text
="Box Mask", icon
="BORDER_RECT")
1641 props
= layout
.operator("paint.hide_show", text
="Box Hide")
1642 props
.action
= 'HIDE'
1643 props
.area
= 'INSIDE'
1645 props
= layout
.operator("paint.hide_show", text
="Box Show")
1646 props
.action
= 'SHOW'
1647 props
.area
= 'INSIDE'
1648 UseSeparator(self
, context
)
1650 props
= layout
.operator("paint.mask_flood_fill", text
="Fill Mask", icon
="BORDER_RECT")
1651 props
.mode
= 'VALUE'
1654 props
= layout
.operator("paint.mask_flood_fill", text
="Clear Mask")
1655 props
.mode
= 'VALUE'
1658 layout
.operator("paint.mask_flood_fill", text
="Invert Mask").mode
= 'INVERT'
1659 UseSeparator(self
, context
)
1661 props
= layout
.operator("paint.hide_show", text
="Show All", icon
="RESTRICT_VIEW_OFF")
1662 props
.action
= 'SHOW'
1665 props
= layout
.operator("paint.hide_show", text
="Hide Masked", icon
="RESTRICT_VIEW_ON")
1666 props
.area
= 'MASKED'
1667 props
.action
= 'HIDE'
1670 # Sculpt Specials Menu (Thanks to marvin.k.breuer) #
1671 class VIEW3D_MT_Sculpt_Specials(Menu
):
1672 bl_label
= "Sculpt Specials"
1674 def draw(self
, context
):
1675 layout
= self
.layout
1676 settings
= context
.tool_settings
1678 if context
.sculpt_object
.use_dynamic_topology_sculpting
:
1679 layout
.operator("sculpt.dynamic_topology_toggle",
1680 icon
='X', text
="Disable Dyntopo")
1681 UseSeparator(self
, context
)
1683 if (settings
.sculpt
.detail_type_method
== 'CONSTANT'):
1684 layout
.prop(settings
.sculpt
, "constant_detail", text
="Const.")
1685 layout
.operator("sculpt.sample_detail_size", text
="", icon
='EYEDROPPER')
1687 layout
.prop(settings
.sculpt
, "detail_size", text
="Detail")
1688 UseSeparator(self
, context
)
1690 layout
.operator("sculpt.symmetrize", icon
='ARROW_LEFTRIGHT')
1691 layout
.prop(settings
.sculpt
, "symmetrize_direction", "")
1692 UseSeparator(self
, context
)
1694 layout
.operator("sculpt.optimize")
1695 if (settings
.sculpt
.detail_type_method
== 'CONSTANT'):
1696 layout
.operator("sculpt.detail_flood_fill")
1697 UseSeparator(self
, context
)
1699 layout
.prop(settings
.sculpt
, "detail_refine_method", text
="")
1700 layout
.prop(settings
.sculpt
, "detail_type_method", text
="")
1701 UseSeparator(self
, context
)
1702 layout
.prop(settings
.sculpt
, "use_smooth_shading", "Smooth")
1704 layout
.operator("sculpt.dynamic_topology_toggle",
1705 icon
='SCULPT_DYNTOPO', text
="Enable Dyntopo")
1708 # Display Wire (Thanks to marvin.k.breuer) #
1709 class VIEW3D_OT_Display_Wire_All(Operator
):
1710 bl_label
= "Wire on All Objects"
1711 bl_idname
= "view3d.display_wire_all"
1712 bl_description
= "Enable/Disable Display Wire on All Objects"
1715 def poll(cls
, context
):
1716 return context
.active_object
is not None
1718 def execute(self
, context
):
1720 for obj
in bpy
.data
.objects
:
1723 obj
.show_all_edges
= False
1724 obj
.show_wire
= False
1726 obj
.show_all_edges
= True
1727 obj
.show_wire
= True
1733 self
.report({'WARNING'},
1734 "Wire on All Objects could not be completed for some objects")
1739 # Vertex Color Menu #
1740 class VIEW3D_MT_Vertex_Colors(Menu
):
1741 bl_label
= "Vertex Colors"
1743 def draw(self
, context
):
1744 layout
= self
.layout
1745 layout
.operator("paint.vertex_color_set")
1746 UseSeparator(self
, context
)
1748 layout
.operator("paint.vertex_color_smooth")
1749 layout
.operator("paint.vertex_color_dirt")
1752 # Weight Paint Menu #
1753 class VIEW3D_MT_Paint_Weights(Menu
):
1754 bl_label
= "Weights"
1756 def draw(self
, context
):
1757 layout
= self
.layout
1759 layout
.operator("paint.weight_from_bones",
1760 text
="Assign Automatic From Bones").type = 'AUTOMATIC'
1761 layout
.operator("paint.weight_from_bones",
1762 text
="Assign From Bone Envelopes").type = 'ENVELOPES'
1763 UseSeparator(self
, context
)
1765 layout
.operator("object.vertex_group_normalize_all", text
="Normalize All")
1766 layout
.operator("object.vertex_group_normalize", text
="Normalize")
1767 UseSeparator(self
, context
)
1769 layout
.operator("object.vertex_group_mirror", text
="Mirror")
1770 layout
.operator("object.vertex_group_invert", text
="Invert")
1771 UseSeparator(self
, context
)
1773 layout
.operator("object.vertex_group_clean", text
="Clean")
1774 layout
.operator("object.vertex_group_quantize", text
="Quantize")
1775 UseSeparator(self
, context
)
1777 layout
.operator("object.vertex_group_levels", text
="Levels")
1778 layout
.operator("object.vertex_group_smooth", text
="Smooth")
1779 UseSeparator(self
, context
)
1781 props
= layout
.operator("object.data_transfer", text
="Transfer Weights")
1782 props
.use_reverse_transfer
= True
1783 props
.data_type
= 'VGROUP_WEIGHTS'
1784 UseSeparator(self
, context
)
1786 layout
.operator("object.vertex_group_limit_total", text
="Limit Total")
1787 layout
.operator("object.vertex_group_fix", text
="Fix Deforms")
1788 UseSeparator(self
, context
)
1790 layout
.operator("paint.weight_set")
1795 class VIEW3D_MT_Edit_Armature(Menu
):
1796 bl_label
= "Armature"
1798 def draw(self
, context
):
1799 layout
= self
.layout
1800 toolsettings
= context
.tool_settings
1802 layout
.prop_menu_enum(toolsettings
, "proportional_edit", icon
="PROP_CON")
1803 layout
.prop_menu_enum(toolsettings
, "proportional_edit_falloff", icon
="SMOOTHCURVE")
1804 UseSeparator(self
, context
)
1806 layout
.menu("VIEW3D_MT_bone_options_toggle", text
="Bone Settings")
1807 layout
.operator("armature.merge")
1808 layout
.operator("armature.fill")
1809 layout
.operator("armature.split")
1810 layout
.operator("armature.separate")
1811 layout
.operator("armature.switch_direction", text
="Switch Direction")
1813 layout
.operator_context
= 'EXEC_AREA'
1814 layout
.operator("armature.symmetrize")
1815 UseSeparator(self
, context
)
1817 layout
.operator("armature.delete")
1818 UseSeparator(self
, context
)
1820 layout
.operator_context
= 'INVOKE_DEFAULT'
1821 layout
.operator("armature.armature_layers")
1822 layout
.operator("armature.bone_layers")
1825 class VIEW3D_MT_EditArmatureTK(Menu
):
1826 bl_label
= "Armature Tools"
1828 def draw(self
, context
):
1829 layout
= self
.layout
1830 layout
.operator("armature.subdivide", text
="Subdivide")
1831 layout
.operator("armature.extrude_move")
1832 layout
.operator("armature.extrude_forked")
1833 layout
.operator("armature.duplicate_move")
1834 UseSeparator(self
, context
)
1835 layout
.menu("VIEW3D_MT_edit_armature_delete")
1836 UseSeparator(self
, context
)
1837 layout
.operator("transform.transform",
1838 text
="Scale Envelope Distance").mode
= 'BONE_SIZE'
1839 layout
.operator("transform.transform",
1840 text
="Scale B-Bone Width").mode
= 'BONE_SIZE'
1843 # Armature Pose Menu's #
1845 class VIEW3D_MT_Pose(Menu
):
1848 def draw(self
, context
):
1849 layout
= self
.layout
1851 layout
.menu("VIEW3D_MT_object_animation")
1852 layout
.menu("VIEW3D_MT_pose_slide")
1853 layout
.menu("VIEW3D_MT_pose_propagate")
1854 layout
.menu("VIEW3D_MT_pose_library")
1855 layout
.menu("VIEW3D_MT_pose_motion")
1856 UseSeparator(self
, context
)
1857 layout
.menu("VIEW3D_MT_pose_group")
1858 layout
.menu("VIEW3D_MT_object_parent")
1859 UseSeparator(self
, context
)
1860 layout
.menu("VIEW3D_MT_pose_ik")
1861 layout
.menu("VIEW3D_MT_pose_constraints")
1862 layout
.menu("VIEW3D_MT_PoseNames")
1863 layout
.operator("pose.quaternions_flip")
1864 layout
.operator_context
= 'INVOKE_AREA'
1865 UseSeparator(self
, context
)
1866 layout
.operator("armature.armature_layers", text
="Change Armature Layers...")
1867 layout
.operator("pose.bone_layers", text
="Change Bone Layers...")
1868 UseSeparator(self
, context
)
1869 layout
.menu("VIEW3D_MT_pose_showhide")
1870 layout
.menu("VIEW3D_MT_bone_options_toggle", text
="Bone Settings")
1873 # Transform Menu's #
1875 class VIEW3D_MT_TransformMenu(Menu
):
1876 bl_label
= "Transform"
1878 def draw(self
, context
):
1879 layout
= self
.layout
1880 layout
.menu("VIEW3D_MT_ManipulatorMenu1")
1881 UseSeparator(self
, context
)
1882 layout
.operator("transform.translate", text
="Grab/Move")
1883 layout
.operator("transform.rotate", text
="Rotate")
1884 layout
.operator("transform.resize", text
="Scale")
1885 UseSeparator(self
, context
)
1886 layout
.menu("VIEW3D_MT_object_clear")
1887 layout
.menu("VIEW3D_MT_object_apply")
1888 UseSeparator(self
, context
)
1889 layout
.operator("transform.translate", text
="Move Texture Space").texture_space
= True
1890 layout
.operator("transform.resize", text
="Scale Texture Space").texture_space
= True
1891 UseSeparator(self
, context
)
1892 layout
.operator("object.randomize_transform")
1893 layout
.operator("transform.tosphere", text
="To Sphere")
1894 layout
.operator("transform.shear", text
="Shear")
1895 layout
.operator("transform.bend", text
="Bend")
1896 layout
.operator("transform.push_pull", text
="Push/Pull")
1897 UseSeparator(self
, context
)
1898 layout
.operator("object.align")
1899 layout
.operator_context
= 'EXEC_REGION_WIN'
1900 layout
.operator("transform.transform",
1901 text
="Align to Transform Orientation").mode
= 'ALIGN'
1904 # ********** Edit Mesh Transform **********
1905 class VIEW3D_MT_TransformMenuEdit(Menu
):
1906 bl_label
= "Transform"
1908 def draw(self
, context
):
1909 layout
= self
.layout
1910 layout
.menu("VIEW3D_MT_ManipulatorMenu1")
1911 UseSeparator(self
, context
)
1912 layout
.operator("transform.translate", text
="Grab/Move")
1913 layout
.operator("transform.rotate", text
="Rotate")
1914 layout
.operator("transform.resize", text
="Scale")
1915 UseSeparator(self
, context
)
1916 layout
.operator("transform.tosphere", text
="To Sphere")
1917 layout
.operator("transform.shear", text
="Shear")
1918 layout
.operator("transform.bend", text
="Bend")
1919 layout
.operator("transform.push_pull", text
="Push/Pull")
1920 layout
.operator("transform.vertex_warp", text
="Warp")
1921 layout
.operator("transform.vertex_random", text
="Randomize")
1922 UseSeparator(self
, context
)
1923 layout
.operator("transform.translate", text
="Move Texture Space").texture_space
= True
1924 layout
.operator("transform.resize", text
="Scale Texture Space").texture_space
= True
1925 UseSeparator(self
, context
)
1926 layout
.operator_context
= 'EXEC_REGION_WIN'
1927 layout
.operator("transform.transform",
1928 text
="Align to Transform Orientation").mode
= 'ALIGN'
1929 layout
.operator_context
= 'EXEC_AREA'
1930 layout
.operator("object.origin_set",
1931 text
="Geometry to Origin").type = 'GEOMETRY_ORIGIN'
1934 # ********** Transform Lite/Short **********
1935 class VIEW3D_MT_TransformMenuLite(Menu
):
1936 bl_label
= "Transform"
1938 def draw(self
, context
):
1939 layout
= self
.layout
1940 layout
.menu("VIEW3D_MT_ManipulatorMenu1")
1941 UseSeparator(self
, context
)
1942 layout
.operator("transform.translate", text
="Grab/Move")
1943 layout
.operator("transform.rotate", text
="Rotate")
1944 layout
.operator("transform.resize", text
="Scale")
1945 UseSeparator(self
, context
)
1946 layout
.menu("VIEW3D_MT_object_clear")
1947 layout
.menu("VIEW3D_MT_object_apply")
1948 UseSeparator(self
, context
)
1949 layout
.operator("transform.transform",
1950 text
="Align to Transform Orientation").mode
= 'ALIGN'
1953 # ********** Transform Camera **********
1954 class VIEW3D_MT_TransformMenuCamera(Menu
):
1955 bl_label
= "Transform"
1957 def draw(self
, context
):
1958 layout
= self
.layout
1960 layout
.menu("VIEW3D_MT_ManipulatorMenu1")
1961 layout
.menu("VIEW3D_MT_object_clear")
1962 layout
.menu("VIEW3D_MT_object_apply")
1963 layout
.operator("transform.translate", text
="Grab/Move")
1964 layout
.operator("transform.rotate", text
="Rotate")
1965 layout
.operator("transform.resize", text
="Scale")
1966 layout
.operator("object.align")
1967 layout
.operator_context
= 'EXEC_REGION_WIN'
1968 UseSeparator(self
, context
)
1969 layout
.operator("transform.transform",
1970 text
="Align to Transform Orientation").mode
= 'ALIGN'
1973 # ********** Transform Armature **********
1974 class VIEW3D_MT_TransformMenuArmature(Menu
):
1975 bl_label
= "Transform"
1977 def draw(self
, context
):
1978 layout
= self
.layout
1980 layout
.menu("VIEW3D_MT_ManipulatorMenu1")
1981 UseSeparator(self
, context
)
1982 layout
.operator("transform.translate", text
="Grab/Move")
1983 layout
.operator("transform.rotate", text
="Rotate")
1984 layout
.operator("transform.resize", text
="Scale")
1985 UseSeparator(self
, context
)
1986 layout
.operator("armature.align")
1987 layout
.operator("object.align")
1988 layout
.operator_context
= 'EXEC_AREA'
1989 UseSeparator(self
, context
)
1990 layout
.operator("object.origin_set",
1991 text
="Geometry to Origin").type = 'GEOMETRY_ORIGIN'
1992 layout
.operator("object.origin_set",
1993 text
="Origin to Geometry").type = 'ORIGIN_GEOMETRY'
1994 layout
.operator("object.origin_set",
1995 text
="Origin to 3D Cursor").type = 'ORIGIN_CURSOR'
1996 layout
.operator("object.origin_set",
1997 text
="Origin to Center of Mass").type = 'ORIGIN_CENTER_OF_MASS'
2000 # ********** Transform Armature Edit **********
2001 class VIEW3D_MT_TransformMenuArmatureEdit(Menu
):
2002 bl_label
= "Transform"
2004 def draw(self
, context
):
2005 layout
= self
.layout
2006 layout
.menu("VIEW3D_MT_ManipulatorMenu1")
2007 UseSeparator(self
, context
)
2008 layout
.operator("transform.translate", text
="Grab/Move")
2009 layout
.operator("transform.rotate", text
="Rotate")
2010 layout
.operator("transform.resize", text
="Scale")
2011 UseSeparator(self
, context
)
2012 layout
.operator("transform.tosphere", text
="To Sphere")
2013 layout
.operator("transform.shear", text
="Shear")
2014 layout
.operator("transform.bend", text
="Bend")
2015 layout
.operator("transform.push_pull", text
="Push/Pull")
2016 layout
.operator("transform.vertex_warp", text
="Warp")
2017 UseSeparator(self
, context
)
2018 layout
.operator("transform.vertex_random", text
="Randomize")
2019 layout
.operator("armature.align")
2020 layout
.operator_context
= 'EXEC_AREA'
2023 # ********** Transform Armature Pose **********
2024 class VIEW3D_MT_TransformMenuArmaturePose(Menu
):
2025 bl_label
= "Transform"
2027 def draw(self
, context
):
2028 layout
= self
.layout
2029 layout
.menu("VIEW3D_MT_ManipulatorMenu1")
2030 layout
.operator("transform.translate", text
="Grab/Move")
2031 layout
.operator("transform.rotate", text
="Rotate")
2032 layout
.operator("transform.resize", text
="Scale")
2033 UseSeparator(self
, context
)
2034 layout
.operator("pose.transforms_clear", text
="Clear All")
2035 layout
.operator("pose.loc_clear", text
="Location")
2036 layout
.operator("pose.rot_clear", text
="Rotation")
2037 layout
.operator("pose.scale_clear", text
="Scale")
2039 UseSeparator(self
, context
)
2041 layout
.operator("pose.user_transforms_clear", text
="Reset unkeyed")
2042 obj
= context
.object
2043 if obj
.type == 'ARMATURE' and obj
.mode
in {'EDIT', 'POSE'}:
2044 if obj
.data
.draw_type
== 'BBONE':
2045 layout
.operator("transform.transform", text
="Scale BBone").mode
= 'BONE_SIZE'
2046 elif obj
.data
.draw_type
== 'ENVELOPE':
2047 layout
.operator("transform.transform", text
="Scale Envelope Distance").mode
= 'BONE_SIZE'
2048 layout
.operator("transform.transform", text
="Scale Radius").mode
= 'BONE_ENVELOPE'
2053 class VIEW3D_MT_View_Directions(Menu
):
2054 bl_label
= "Directions"
2056 def draw(self
, context
):
2057 layout
= self
.layout
2058 layout
.operator("view3d.viewnumpad", text
="Camera").type = 'CAMERA'
2059 UseSeparator(self
, context
)
2060 layout
.operator("view3d.viewnumpad", text
="Top").type = 'TOP'
2061 layout
.operator("view3d.viewnumpad", text
="Bottom").type = 'BOTTOM'
2062 UseSeparator(self
, context
)
2063 layout
.operator("view3d.viewnumpad", text
="Front").type = 'FRONT'
2064 layout
.operator("view3d.viewnumpad", text
="Back").type = 'BACK'
2065 UseSeparator(self
, context
)
2066 layout
.operator("view3d.viewnumpad", text
="Right").type = 'RIGHT'
2067 layout
.operator("view3d.viewnumpad", text
="Left").type = 'LEFT'
2070 class VIEW3D_MT_View_Border(Menu
):
2071 bl_label
= "Set Border"
2073 def draw(self
, context
):
2074 layout
= self
.layout
2075 layout
.operator_context
= 'INVOKE_REGION_WIN'
2076 layout
.operator("view3d.clip_border", text
="Clipping Border...")
2077 layout
.operator("view3d.zoom_border", text
="Zoom Border...")
2078 layout
.operator("view3d.render_border", text
="Render Border...").camera_only
= False
2081 class VIEW3D_MT_View_Toggle(Menu
):
2082 bl_label
= "View Toggle"
2084 def draw(self
, context
):
2085 layout
= self
.layout
2086 layout
.operator_context
= 'INVOKE_REGION_WIN'
2087 layout
.operator("screen.area_dupli")
2088 UseSeparator(self
, context
)
2089 layout
.operator("screen.region_quadview")
2090 layout
.operator("screen.screen_full_area", text
="Toggle Maximize Area")
2091 layout
.operator("screen.screen_full_area").use_hide_panels
= True
2094 class VIEW3D_MT_View_Menu(Menu
):
2097 def draw(self
, context
):
2098 layout
= self
.layout
2099 layout
.menu("VIEW3D_MT_Shade")
2100 UseSeparator(self
, context
)
2101 layout
.menu("VIEW3D_MT_view_cameras", text
="Cameras")
2102 layout
.menu("VIEW3D_MT_View_Directions")
2103 layout
.menu("VIEW3D_MT_View_Navigation")
2104 UseSeparator(self
, context
)
2105 layout
.menu("VIEW3D_MT_View_Align")
2106 layout
.menu("VIEW3D_MT_View_Toggle")
2107 layout
.operator("view3d.view_persportho")
2108 layout
.operator("view3d.localview", text
="View Global/Local")
2109 layout
.operator("view3d.view_selected").use_all_regions
= False
2110 layout
.operator("view3d.view_all").center
= False
2111 UseSeparator(self
, context
)
2112 layout
.menu("VIEW3D_MT_View_Border")
2113 layout
.operator("view3d.layers", text
="Show All Layers").nr
= 0
2114 UseSeparator(self
, context
)
2115 # New menu entry for Animation player
2116 layout
.menu("VIEW3D_MT_Animation_Player",
2117 text
="Playback Animation", icon
='PLAY')
2120 class VIEW3D_MT_View_Navigation(Menu
):
2121 bl_label
= "Navigation"
2123 def draw(self
, context
):
2125 layout
= self
.layout
2126 layout
.operator_enum("view3d.view_orbit", "type")
2127 props
= layout
.operator("view3d.view_orbit", "Orbit Opposite")
2128 props
.type = 'ORBITRIGHT'
2131 UseSeparator(self
, context
)
2132 layout
.operator("view3d.view_roll", text
="Roll Left").type = 'LEFT'
2133 layout
.operator("view3d.view_roll", text
="Roll Right").type = 'RIGHT'
2134 UseSeparator(self
, context
)
2135 layout
.operator_enum("view3d.view_pan", "type")
2136 UseSeparator(self
, context
)
2137 layout
.operator("view3d.zoom", text
="Zoom In").delta
= 1
2138 layout
.operator("view3d.zoom", text
="Zoom Out").delta
= -1
2139 UseSeparator(self
, context
)
2140 layout
.operator("view3d.zoom_camera_1_to_1", text
="Zoom Camera 1:1")
2141 UseSeparator(self
, context
)
2142 layout
.operator("view3d.fly")
2143 layout
.operator("view3d.walk")
2146 class VIEW3D_MT_View_Align(Menu
):
2147 bl_label
= "Align View"
2149 def draw(self
, context
):
2150 layout
= self
.layout
2151 layout
.operator("view3d.view_all", text
="Center Cursor and View All").center
= True
2152 layout
.operator("view3d.view_center_cursor")
2153 UseSeparator(self
, context
)
2154 layout
.operator("view3d.camera_to_view", text
="Align Active Camera to View")
2155 layout
.operator("view3d.camera_to_view_selected", text
="Align Active Camera to Selected")
2156 UseSeparator(self
, context
)
2157 layout
.operator("view3d.view_selected")
2158 layout
.operator("view3d.view_lock_to_active")
2159 layout
.operator("view3d.view_lock_clear")
2162 class VIEW3D_MT_View_Align_Selected(Menu
):
2163 bl_label
= "Align View to Active"
2165 def draw(self
, context
):
2166 layout
= self
.layout
2167 props
= layout
.operator("view3d.viewnumpad", text
="Top")
2168 props
.align_active
= True
2170 props
= layout
.operator("view3d.viewnumpad", text
="Bottom")
2171 props
.align_active
= True
2172 props
.type = 'BOTTOM'
2173 props
= layout
.operator("view3d.viewnumpad", text
="Front")
2174 props
.align_active
= True
2175 props
.type = 'FRONT'
2176 props
= layout
.operator("view3d.viewnumpad", text
="Back")
2177 props
.align_active
= True
2179 props
= layout
.operator("view3d.viewnumpad", text
="Right")
2180 props
.align_active
= True
2181 props
.type = 'RIGHT'
2182 props
= layout
.operator("view3d.viewnumpad", text
="Left")
2183 props
.align_active
= True
2187 class VIEW3D_MT_View_Cameras(Menu
):
2188 bl_label
= "Cameras"
2190 def draw(self
, context
):
2191 layout
= self
.layout
2192 layout
.operator("view3d.object_as_camera")
2193 layout
.operator("view3d.viewnumpad", text
="Active Camera").type = 'CAMERA'
2196 # Matcap and AO, Wire all and X-Ray entries thanks to marvin.k.breuer
2197 class VIEW3D_MT_Shade(Menu
):
2200 def draw(self
, context
):
2201 layout
= self
.layout
2203 layout
.prop(context
.space_data
, "viewport_shade", expand
=True)
2204 UseSeparator(self
, context
)
2206 if context
.active_object
:
2207 if(context
.mode
== 'EDIT_MESH'):
2208 layout
.operator("MESH_OT_faces_shade_smooth")
2209 layout
.operator("MESH_OT_faces_shade_flat")
2211 layout
.operator("OBJECT_OT_shade_smooth")
2212 layout
.operator("OBJECT_OT_shade_flat")
2214 UseSeparator(self
, context
)
2215 layout
.operator("view3d.display_wire_all", text
="Wire all", icon
='WIRE')
2216 layout
.prop(context
.object, "show_x_ray", text
="X-Ray", icon
="META_CUBE")
2218 UseSeparator(self
, context
)
2219 layout
.prop(context
.space_data
.fx_settings
, "use_ssao",
2220 text
="Ambient Occlusion", icon
="GROUP")
2221 layout
.prop(context
.space_data
, "use_matcap", icon
="MATCAP_01")
2223 if context
.space_data
.use_matcap
:
2224 row
= layout
.column(1)
2227 row
.template_icon_view(context
.space_data
, "matcap_icon")
2230 # Animation Player (Thanks to marvin.k.breuer) #
2231 class VIEW3D_MT_Animation_Player(Menu
):
2232 bl_label
= "Animation Player"
2234 def draw(self
, context
):
2235 layout
= self
.layout
2237 layout
.operator("screen.frame_jump", text
="Jump REW", icon
='REW').end
= False
2238 layout
.operator("screen.keyframe_jump", text
="Previous FR", icon
='PREV_KEYFRAME').next
= False
2240 UseSeparator(self
, context
)
2241 layout
.operator("screen.animation_play", text
="Reverse", icon
='PLAY_REVERSE').reverse
= True
2242 layout
.operator("screen.animation_play", text
="PLAY", icon
='PLAY')
2243 layout
.operator("screen.animation_play", text
="Stop", icon
='PAUSE')
2244 UseSeparator(self
, context
)
2246 layout
.operator("screen.keyframe_jump", text
="Next FR", icon
='NEXT_KEYFRAME').next
= True
2247 layout
.operator("screen.frame_jump", text
="Jump FF", icon
='FF').end
= True
2253 class VIEW3D_MT_Select_Object(Menu
):
2256 def draw(self
, context
):
2257 layout
= self
.layout
2258 layout
.operator_context
= 'INVOKE_REGION_WIN'
2259 layout
.operator("view3d.select_border")
2260 layout
.operator("view3d.select_circle")
2261 UseSeparator(self
, context
)
2262 layout
.operator("object.select_all").action
= 'TOGGLE'
2263 layout
.operator("object.select_all", text
="Inverse").action
= 'INVERT'
2264 layout
.operator("object.select_random", text
="Random")
2265 layout
.operator("object.select_mirror", text
="Mirror")
2266 UseSeparator(self
, context
)
2267 layout
.operator("object.select_by_layer", text
="Select All by Layer")
2268 layout
.operator_menu_enum("object.select_by_type", "type",
2269 text
="Select All by Type...")
2270 layout
.operator_menu_enum("object.select_grouped", "type",
2272 layout
.operator_menu_enum("object.select_linked", "type",
2274 layout
.operator("object.select_camera", text
="Select Camera")
2275 UseSeparator(self
, context
)
2276 layout
.menu("VIEW3D_MT_Select_Object_More_Less", text
="More/Less")
2277 layout
.operator("object.select_pattern", text
="Select Pattern...")
2280 class VIEW3D_MT_Select_Object_More_Less(Menu
):
2281 bl_label
= "Select More/Less"
2283 def draw(self
, context
):
2284 layout
= self
.layout
2285 layout
.operator("object.select_more", text
="More")
2286 layout
.operator("object.select_less", text
="Less")
2287 UseSeparator(self
, context
)
2288 props
= layout
.operator("object.select_hierarchy", text
="Parent")
2289 props
.extend
= False
2290 props
.direction
= 'PARENT'
2291 props
= layout
.operator("object.select_hierarchy", text
="Child")
2292 props
.extend
= False
2293 props
.direction
= 'CHILD'
2294 UseSeparator(self
, context
)
2295 props
= layout
.operator("object.select_hierarchy", text
="Extend Parent")
2297 props
.direction
= 'PARENT'
2298 props
= layout
.operator("object.select_hierarchy", text
="Extend Child")
2300 props
.direction
= 'CHILD'
2304 class VIEW3D_MT_Select_Edit_Mesh(Menu
):
2307 def draw(self
, context
):
2308 layout
= self
.layout
2309 layout
.operator("view3d.select_border")
2310 layout
.operator("view3d.select_circle")
2311 UseSeparator(self
, context
)
2312 layout
.operator("mesh.select_all").action
= 'TOGGLE'
2313 layout
.operator("mesh.select_all", text
="Inverse").action
= 'INVERT'
2314 layout
.operator("mesh.select_linked", text
="Linked")
2315 layout
.operator("mesh.faces_select_linked_flat",
2316 text
="Linked Flat Faces")
2317 layout
.operator("mesh.select_random", text
="Random")
2318 layout
.operator("mesh.select_nth", text
="Every N Number of Verts")
2319 UseSeparator(self
, context
)
2320 layout
.menu("VIEW3D_MT_Edit_Mesh_Select_Trait")
2321 layout
.menu("VIEW3D_MT_Edit_Mesh_Select_Similar")
2322 layout
.menu("VIEW3D_MT_Edit_Mesh_Select_More_Less")
2323 UseSeparator(self
, context
)
2324 layout
.operator("mesh.select_mirror", text
="Mirror")
2325 layout
.operator("mesh.edges_select_sharp", text
="Sharp Edges")
2326 layout
.operator("mesh.select_axis", text
="Side of Active")
2327 layout
.operator("mesh.shortest_path_select", text
="Shortest Path")
2328 UseSeparator(self
, context
)
2329 layout
.operator("mesh.loop_multi_select", text
="Edge Loops").ring
= False
2330 layout
.operator("mesh.loop_multi_select", text
="Edge Rings").ring
= True
2331 layout
.operator("mesh.loop_to_region")
2332 layout
.operator("mesh.region_to_loop")
2335 class VIEW3D_MT_Edit_Mesh_Select_Similar(Menu
):
2336 bl_label
= "Select Similar"
2338 def draw(self
, context
):
2339 layout
= self
.layout
2340 layout
.operator_enum("mesh.select_similar", "type")
2341 layout
.operator("mesh.select_similar_region", text
="Face Regions")
2344 class VIEW3D_MT_Edit_Mesh_Select_Trait(Menu
):
2345 bl_label
= "Select All by Trait"
2347 def draw(self
, context
):
2348 layout
= self
.layout
2349 if context
.scene
.tool_settings
.mesh_select_mode
[2] is False:
2350 layout
.operator("mesh.select_non_manifold", text
="Non Manifold")
2351 layout
.operator("mesh.select_loose", text
="Loose Geometry")
2352 layout
.operator("mesh.select_interior_faces", text
="Interior Faces")
2353 layout
.operator("mesh.select_face_by_sides", text
="By Number of Verts")
2354 layout
.operator("mesh.select_ungrouped", text
="Ungrouped Verts")
2357 class VIEW3D_MT_Edit_Mesh_Select_More_Less(Menu
):
2358 bl_label
= "Select More/Less"
2360 def draw(self
, context
):
2361 layout
= self
.layout
2362 layout
.operator("mesh.select_more", text
="More")
2363 layout
.operator("mesh.select_less", text
="Less")
2364 UseSeparator(self
, context
)
2365 layout
.operator("mesh.select_next_item", text
="Next Active")
2366 layout
.operator("mesh.select_prev_item", text
="Previous Active")
2369 # Edit Curve Select #
2370 class VIEW3D_MT_Select_Edit_Curve(Menu
):
2373 def draw(self
, context
):
2374 layout
= self
.layout
2375 layout
.operator("view3d.select_border")
2376 layout
.operator("view3d.select_circle")
2377 UseSeparator(self
, context
)
2378 layout
.operator("curve.select_all").action
= 'TOGGLE'
2379 layout
.operator("curve.select_all", text
="Inverse").action
= 'INVERT'
2380 layout
.operator("curve.select_nth")
2381 UseSeparator(self
, context
)
2382 layout
.operator("curve.select_random")
2383 layout
.operator("curve.select_linked", text
="Select Linked")
2384 layout
.operator("curve.select_similar", text
="Select Similar")
2385 layout
.operator("curve.de_select_first")
2386 layout
.operator("curve.de_select_last")
2387 layout
.operator("curve.select_next")
2388 layout
.operator("curve.select_previous")
2389 UseSeparator(self
, context
)
2390 layout
.operator("curve.select_more")
2391 layout
.operator("curve.select_less")
2395 class VIEW3D_MT_SelectArmatureMenu(Menu
):
2398 def draw(self
, context
):
2399 layout
= self
.layout
2400 layout
.operator("view3d.select_border")
2401 layout
.operator("armature.select_all")
2402 layout
.operator("armature.select_inverse", text
="Inverse")
2403 layout
.operator("armature.select_hierarchy",
2404 text
="Parent").direction
= 'PARENT'
2405 layout
.operator("armature.select_hierarchy",
2406 text
="Child").direction
= 'CHILD'
2407 props
= layout
.operator("armature.select_hierarchy",
2408 text
="Extend Parent")
2410 props
.direction
= 'PARENT'
2411 props
= layout
.operator("armature.select_hierarchy",
2412 text
="Extend Child")
2414 props
.direction
= 'CHILD'
2415 layout
.operator("object.select_pattern", text
="Select Pattern...")
2418 class VIEW3D_MT_Select_Edit_Armature(Menu
):
2421 def draw(self
, context
):
2422 layout
= self
.layout
2424 layout
.operator("view3d.select_border")
2425 layout
.operator("view3d.select_circle")
2427 UseSeparator(self
, context
)
2429 layout
.operator("armature.select_all").action
= 'TOGGLE'
2430 layout
.operator("armature.select_all", text
="Inverse").action
= 'INVERT'
2431 layout
.operator("armature.select_mirror", text
="Mirror").extend
= False
2433 UseSeparator(self
, context
)
2435 layout
.operator("armature.select_more", text
="More")
2436 layout
.operator("armature.select_less", text
="Less")
2438 UseSeparator(self
, context
)
2440 props
= layout
.operator("armature.select_hierarchy", text
="Parent")
2441 props
.extend
= False
2442 props
.direction
= 'PARENT'
2444 props
= layout
.operator("armature.select_hierarchy", text
="Child")
2445 props
.extend
= False
2446 props
.direction
= 'CHILD'
2448 UseSeparator(self
, context
)
2450 props
= layout
.operator("armature.select_hierarchy", text
="Extend Parent")
2452 props
.direction
= 'PARENT'
2454 props
= layout
.operator("armature.select_hierarchy", text
="Extend Child")
2456 props
.direction
= 'CHILD'
2458 layout
.operator_menu_enum("armature.select_similar", "type", text
="Similar")
2459 layout
.operator("object.select_pattern", text
="Select Pattern...")
2462 class VIEW3D_MT_Select_Pose(Menu
):
2465 def draw(self
, context
):
2466 layout
= self
.layout
2467 layout
.operator("view3d.select_border")
2468 layout
.operator("view3d.select_circle")
2469 UseSeparator(self
, context
)
2470 layout
.operator("pose.select_all").action
= 'TOGGLE'
2471 layout
.operator("pose.select_all", text
="Inverse").action
= 'INVERT'
2472 layout
.operator("pose.select_mirror", text
="Flip Active")
2473 layout
.operator("pose.select_constraint_target",
2474 text
="Constraint Target")
2475 UseSeparator(self
, context
)
2476 layout
.operator("pose.select_linked", text
="Linked")
2477 layout
.operator("pose.select_hierarchy",
2478 text
="Parent").direction
= 'PARENT'
2479 layout
.operator("pose.select_hierarchy",
2480 text
="Child").direction
= 'CHILD'
2481 props
= layout
.operator("pose.select_hierarchy", text
="Extend Parent")
2483 props
.direction
= 'PARENT'
2484 props
= layout
.operator("pose.select_hierarchy", text
="Extend Child")
2486 props
.direction
= 'CHILD'
2487 layout
.operator_menu_enum("pose.select_grouped", "type",
2489 UseSeparator(self
, context
)
2490 layout
.operator("object.select_pattern", text
="Select Pattern...")
2491 layout
.menu("VIEW3D_MT_select_pose_more_less")
2494 class VIEW3D_MT_Select_Pose_More_Less(Menu
):
2495 bl_label
= "Select More/Less"
2497 def draw(self
, context
):
2498 layout
= self
.layout
2499 props
= layout
.operator("pose.select_hierarchy", text
="Parent")
2500 props
.extend
= False
2501 props
.direction
= 'PARENT'
2503 props
= layout
.operator("pose.select_hierarchy", text
="Child")
2504 props
.extend
= False
2505 props
.direction
= 'CHILD'
2507 props
= layout
.operator("pose.select_hierarchy", text
="Extend Parent")
2509 props
.direction
= 'PARENT'
2511 props
= layout
.operator("pose.select_hierarchy", text
="Extend Child")
2513 props
.direction
= 'CHILD'
2516 class VIEW3D_MT_PoseCopy(Menu
):
2517 bl_label
= "Pose Copy"
2519 def draw(self
, context
):
2520 layout
= self
.layout
2521 layout
.operator("pose.copy")
2522 layout
.operator("pose.paste")
2523 layout
.operator("pose.paste",
2524 text
="Paste X-Flipped Pose").flipped
= True
2527 class VIEW3D_MT_PoseNames(Menu
):
2528 bl_label
= "Pose Names"
2530 def draw(self
, context
):
2531 layout
= self
.layout
2532 layout
.operator_context
= 'EXEC_AREA'
2533 layout
.operator("pose.autoside_names",
2534 text
="AutoName Left/Right").axis
= 'XAXIS'
2535 layout
.operator("pose.autoside_names",
2536 text
="AutoName Front/Back").axis
= 'YAXIS'
2537 layout
.operator("pose.autoside_names",
2538 text
="AutoName Top/Bottom").axis
= 'ZAXIS'
2539 layout
.operator("pose.flip_names")
2543 class VIEW3D_MT_Select_Edit_Surface(Menu
):
2546 def draw(self
, context
):
2547 layout
= self
.layout
2548 layout
.operator("view3d.select_border")
2549 layout
.operator("view3d.select_circle")
2550 UseSeparator(self
, context
)
2551 layout
.operator("curve.select_all").action
= 'TOGGLE'
2552 layout
.operator("curve.select_all", text
="Inverse").action
= 'INVERT'
2553 layout
.operator("curve.select_random")
2554 layout
.operator("curve.select_nth")
2555 layout
.operator("curve.select_linked", text
="Select Linked")
2556 layout
.operator("curve.select_similar", text
="Select Similar")
2557 layout
.operator("curve.select_row")
2558 UseSeparator(self
, context
)
2559 layout
.operator("curve.select_more")
2560 layout
.operator("curve.select_less")
2564 class VIEW3D_MT_SelectMetaball(Menu
):
2567 def draw(self
, context
):
2568 layout
= self
.layout
2569 layout
.operator("view3d.select_border")
2570 layout
.operator("view3d.select_circle")
2571 UseSeparator(self
, context
)
2572 layout
.operator("mball.select_all").action
= 'TOGGLE'
2573 layout
.operator("mball.select_all").action
= 'INVERT'
2574 layout
.operator("mball.select_random_metaelems")
2577 class VIEW3D_MT_Select_Edit_Metaball(Menu
):
2580 def draw(self
, context
):
2581 layout
= self
.layout
2582 layout
.operator("view3d.select_border")
2583 layout
.operator("view3d.select_circle")
2584 layout
.operator("mball.select_all").action
= 'TOGGLE'
2585 layout
.operator("mball.select_all", text
="Inverse").action
= 'INVERT'
2586 layout
.operator("mball.select_random_metaelems")
2587 layout
.operator_menu_enum("mball.select_similar", "type", text
="Similar")
2591 class VIEW3D_MT_Selection_Mode_Particle(Menu
):
2592 bl_label
= "Particle Select and Display Mode"
2594 def draw(self
, context
):
2595 layout
= self
.layout
2596 toolsettings
= context
.tool_settings
2598 layout
.prop(toolsettings
.particle_edit
, "select_mode", expand
=True)
2601 class VIEW3D_MT_Select_Particle(Menu
):
2604 def draw(self
, context
):
2605 layout
= self
.layout
2607 layout
.operator("view3d.select_border")
2608 layout
.operator("view3d.select_circle")
2609 UseSeparator(self
, context
)
2611 layout
.operator("particle.select_all").action
= 'TOGGLE'
2612 layout
.operator("particle.select_linked")
2613 layout
.operator("particle.select_all", text
="Inverse").action
= 'INVERT'
2615 UseSeparator(self
, context
)
2616 layout
.operator("particle.select_more")
2617 layout
.operator("particle.select_less")
2619 UseSeparator(self
, context
)
2620 layout
.operator("particle.select_random")
2622 UseSeparator(self
, context
)
2623 layout
.operator("particle.select_roots", text
="Roots")
2624 layout
.operator("particle.select_tips", text
="Tips")
2627 # Lattice Edit Select #
2628 class VIEW3D_MT_Select_Edit_Lattice(Menu
):
2631 def draw(self
, context
):
2632 layout
= self
.layout
2634 layout
.operator("view3d.select_border")
2635 layout
.operator("view3d.select_circle")
2636 UseSeparator(self
, context
)
2637 layout
.operator("lattice.select_mirror")
2638 layout
.operator("lattice.select_random")
2639 layout
.operator("lattice.select_all").action
= 'TOGGLE'
2640 layout
.operator("lattice.select_all", text
="Inverse").action
= 'INVERT'
2641 UseSeparator(self
, context
)
2642 layout
.operator("lattice.select_ungrouped", text
="Ungrouped Verts")
2645 # Grease Pencil Select #
2646 class VIEW3D_MT_Select_Gpencil(Menu
):
2647 # To Do: used in 3dview header might work if mapped to mouse
2648 # Not in Class List yet
2651 def draw(self
, context
):
2652 layout
= self
.layout
2654 layout
.operator("gpencil.select_border")
2655 layout
.operator("gpencil.select_circle")
2657 UseSeparator(self
, context
)
2659 layout
.operator("gpencil.select_all", text
="(De)select All").action
= 'TOGGLE'
2660 layout
.operator("gpencil.select_all", text
="Inverse").action
= 'INVERT'
2661 layout
.operator("gpencil.select_linked", text
="Linked")
2662 # layout.operator_menu_enum("gpencil.select_grouped", "type", text="Grouped")
2663 layout
.operator("gpencil.select_grouped", text
="Grouped")
2665 UseSeparator(self
, context
)
2667 layout
.operator("gpencil.select_more")
2668 layout
.operator("gpencil.select_less")
2672 class VIEW3D_MT_Select_Edit_Text(Menu
):
2673 # To Do: used in 3dview header might work if mapped to mouse
2674 # Not in Class List yet
2677 def draw(self
, context
):
2678 layout
= self
.layout
2679 layout
.operator("font.text_copy", text
="Copy")
2680 layout
.operator("font.text_cut", text
="Cut")
2681 layout
.operator("font.text_paste", text
="Paste")
2682 layout
.operator("font.text_paste_from_file")
2683 layout
.operator("font.select_all")
2686 # Paint Mode Menus #
2687 class VIEW3D_MT_Select_Paint_Mask(Menu
):
2690 def draw(self
, context
):
2691 layout
= self
.layout
2692 layout
.operator("view3d.select_border")
2693 layout
.operator("view3d.select_circle")
2694 layout
.operator("paint.face_select_all").action
= 'TOGGLE'
2695 layout
.operator("paint.face_select_all", text
="Inverse").action
= 'INVERT'
2696 layout
.operator("paint.face_select_linked", text
="Linked")
2699 class VIEW3D_MT_Select_Paint_Mask_Vertex(Menu
):
2702 def draw(self
, context
):
2703 layout
= self
.layout
2704 layout
.operator("view3d.select_border")
2705 layout
.operator("view3d.select_circle")
2706 layout
.operator("paint.vert_select_all").action
= 'TOGGLE'
2707 layout
.operator("paint.vert_select_all", text
="Inverse").action
= 'INVERT'
2708 layout
.operator("paint.vert_select_ungrouped", text
="Ungrouped Verts")
2711 class VIEW3D_MT_Angle_Control(Menu
):
2712 bl_label
= "Angle Control"
2715 def poll(cls
, context
):
2716 settings
= UnifiedPaintPanel
.paint_settings(context
)
2720 brush
= settings
.brush
2721 tex_slot
= brush
.texture_slot
2723 return tex_slot
.has_texture_angle
and tex_slot
.has_texture_angle_source
2725 def draw(self
, context
):
2726 layout
= self
.layout
2728 settings
= UnifiedPaintPanel
.paint_settings(context
)
2729 brush
= settings
.brush
2731 sculpt
= (context
.sculpt_object
is not None)
2733 tex_slot
= brush
.texture_slot
2735 layout
.prop(tex_slot
, "use_rake", text
="Rake")
2737 if brush
.brush_capabilities
.has_random_texture_angle
and tex_slot
.has_random_texture_angle
:
2739 if brush
.sculpt_capabilities
.has_random_texture_angle
:
2740 layout
.prop(tex_slot
, "use_random", text
="Random")
2742 layout
.prop(tex_slot
, "use_random", text
="Random")
2745 # Cursor Menu Operators #
2746 class VIEW3D_OT_Pivot_Cursor(Operator
):
2747 bl_idname
= "view3d.pivot_cursor"
2748 bl_label
= "Cursor as Pivot Point"
2749 bl_description
= "Set Pivot Point back to Cursor"
2752 def poll(cls
, context
):
2753 space
= context
.space_data
2754 return (hasattr(space
, "pivot_point") and space
.pivot_point
!= 'CURSOR')
2756 def execute(self
, context
):
2757 bpy
.context
.space_data
.pivot_point
= 'CURSOR'
2761 class VIEW3D_OT_Revert_Pivot(Operator
):
2762 bl_idname
= "view3d.revert_pivot"
2763 bl_label
= "Revert Pivot Point to Median"
2764 bl_description
= "Set Pivot Point back to Median"
2767 def poll(cls
, context
):
2768 space
= context
.space_data
2769 return (hasattr(space
, "pivot_point") and space
.pivot_point
!= 'MEDIAN_POINT')
2771 def execute(self
, context
):
2772 bpy
.context
.space_data
.pivot_point
= 'MEDIAN_POINT'
2776 # Cursor Edge Intersection Defs #
2784 def edgeIntersect(context
, operator
):
2785 from mathutils
.geometry
import intersect_line_line
2787 obj
= context
.active_object
2789 if (obj
.type != "MESH"):
2790 operator
.report({'ERROR'}, "Object must be a mesh")
2795 verts
= mesh
.vertices
2797 is_editmode
= (obj
.mode
== 'EDIT')
2799 bpy
.ops
.object.mode_set(mode
='OBJECT')
2801 for e
in mesh
.edges
:
2809 bpy
.ops
.object.mode_set(mode
='EDIT')
2812 operator
.report({'ERROR'},
2813 "Operator requires exactly 2 edges to be selected")
2816 line
= intersect_line_line(verts
[edges
[0].vertices
[0]].co
,
2817 verts
[edges
[0].vertices
[1]].co
,
2818 verts
[edges
[1].vertices
[0]].co
,
2819 verts
[edges
[1].vertices
[1]].co
)
2822 operator
.report({'ERROR'}, "Selected edges do not intersect")
2825 point
= line
[0].lerp(line
[1], 0.5)
2826 context
.scene
.cursor_location
= obj
.matrix_world
* point
2829 # Cursor Edge Intersection Operator #
2830 class VIEW3D_OT_CursorToEdgeIntersection(Operator
):
2831 bl_idname
= "view3d.snap_cursor_to_edge_intersection"
2832 bl_label
= "Cursor to Edge Intersection"
2833 bl_description
= "Finds the mid-point of the shortest distance between two edges"
2836 def poll(cls
, context
):
2837 obj
= context
.active_object
2838 return (obj
is not None and obj
.type == 'MESH')
2840 def execute(self
, context
):
2841 # Prevent unsupported Execution in Local View modes
2842 space_data
= bpy
.context
.space_data
2843 if True in space_data
.layers_local_view
:
2844 self
.report({'INFO'}, 'Global Perspective modes only unable to continue.')
2846 edgeIntersect(context
, self
)
2850 # Set Mode Operator #
2851 class SetObjectMode(Operator
):
2852 bl_idname
= "object.set_object_mode"
2853 bl_label
= "Set the object interactive mode"
2854 bl_description
= "I set the interactive mode of object"
2855 bl_options
= {'REGISTER'}
2857 mode
= StringProperty(
2858 name
="Interactive mode",
2862 def execute(self
, context
):
2863 if (context
.active_object
):
2865 bpy
.ops
.object.mode_set(mode
=self
.mode
)
2867 msg
= context
.active_object
.name
+ ": It is not possible to enter into the interactive mode"
2868 self
.report(type={"WARNING"}, message
=msg
)
2870 self
.report(type={"WARNING"}, message
="There is no active object")
2874 # Origin To Selected Edit Mode #
2875 def vfeOrigin(context
):
2877 cursorPositionX
= context
.scene
.cursor_location
[0]
2878 cursorPositionY
= context
.scene
.cursor_location
[1]
2879 cursorPositionZ
= context
.scene
.cursor_location
[2]
2880 bpy
.ops
.view3d
.snap_cursor_to_selected()
2881 bpy
.ops
.object.mode_set()
2882 bpy
.ops
.object.origin_set(type='ORIGIN_CURSOR', center
='MEDIAN')
2883 bpy
.ops
.object.mode_set(mode
='EDIT')
2884 context
.scene
.cursor_location
[0] = cursorPositionX
2885 context
.scene
.cursor_location
[1] = cursorPositionY
2886 context
.scene
.cursor_location
[2] = cursorPositionZ
2892 class SetOriginToSelected(Operator
):
2893 bl_idname
= "object.setorigintoselected"
2894 bl_label
= "Set Origin to Selected"
2895 bl_description
= "Set Origin to Selected"
2898 def poll(cls
, context
):
2899 return (context
.area
.type == "VIEW_3D" and context
.active_object
is not None)
2901 def execute(self
, context
):
2902 check
= vfeOrigin(context
)
2904 self
.report({"ERROR"}, "Set Origin to Selected could not be performed")
2905 return {'CANCELLED'}
2910 # Code thanks to Isaac Weaver (wisaac) D1963
2911 class SnapCursSelToCenter(Operator
):
2912 bl_idname
= "view3d.snap_cursor_selected_to_center"
2913 bl_label
= "Snap Cursor & Selection to Center"
2914 bl_description
= ("Snap 3D cursor and selected objects to the center \n"
2915 "Works only in Object Mode")
2918 def poll(cls
, context
):
2919 return (context
.area
.type == "VIEW_3D" and context
.mode
== "OBJECT")
2921 def execute(self
, context
):
2922 context
.space_data
.cursor_location
= (0, 0, 0)
2923 for obj
in context
.selected_objects
:
2924 obj
.location
= (0, 0, 0)
2928 # Preferences utility functions
2931 def UseSeparator(operator
, context
):
2932 useSep
= bpy
.context
.user_preferences
.addons
[__name__
].preferences
.use_separators
2934 operator
.layout
.separator()
2937 # Use compact brushes menus #
2938 def UseBrushesLists():
2939 # separate function just for more convience
2940 useLists
= bpy
.context
.user_preferences
.addons
[__name__
].preferences
.use_brushes_lists
2942 return bool(useLists
)
2945 # Addon Preferences #
2946 class VIEW3D_MT_Space_Dynamic_Menu_Pref(AddonPreferences
):
2947 bl_idname
= __name__
2949 use_separators
= BoolProperty(
2950 name
="Use Separators in the menus",
2952 description
=("Use separators in the menus, a trade-off between \n"
2953 "readability vs. using more space for displaying items")
2955 use_brushes_lists
= BoolProperty(
2956 name
="Use compact menus for brushes",
2958 description
=("Use more compact menus instead \n"
2959 "of thumbnails for displaying brushes")
2962 def draw(self
, context
):
2963 layout
= self
.layout
2964 row
= layout
.row(align
=True)
2965 row
.prop(self
, "use_separators", toggle
=True)
2966 row
.prop(self
, "use_brushes_lists", toggle
=True)
2969 # List The Classes #
2972 VIEW3D_MT_Space_Dynamic_Menu
,
2975 VIEW3D_MT_Edit_Mesh
,
2976 VIEW3D_MT_TransformMenu
,
2977 VIEW3D_MT_TransformMenuEdit
,
2978 VIEW3D_MT_TransformMenuArmature
,
2979 VIEW3D_MT_TransformMenuArmatureEdit
,
2980 VIEW3D_MT_TransformMenuArmaturePose
,
2981 VIEW3D_MT_TransformMenuLite
,
2982 VIEW3D_MT_TransformMenuCamera
,
2983 VIEW3D_MT_MirrorMenu
,
2984 VIEW3D_MT_ParentMenu
,
2985 VIEW3D_MT_GroupMenu
,
2986 VIEW3D_MT_Select_Object
,
2987 VIEW3D_MT_Select_Object_More_Less
,
2988 VIEW3D_MT_Select_Edit_Mesh
,
2989 VIEW3D_MT_Edit_Mesh_Select_Similar
,
2990 VIEW3D_MT_Edit_Mesh_Select_Trait
,
2991 VIEW3D_MT_Edit_Mesh_Select_More_Less
,
2992 VIEW3D_MT_Select_Edit_Curve
,
2993 VIEW3D_MT_SelectArmatureMenu
,
2994 VIEW3D_MT_Select_Pose
,
2995 VIEW3D_MT_Select_Pose_More_Less
,
2998 VIEW3D_MT_PoseNames
,
2999 VIEW3D_MT_Select_Edit_Surface
,
3000 VIEW3D_MT_SelectMetaball
,
3001 VIEW3D_MT_Select_Edit_Metaball
,
3002 VIEW3D_MT_Select_Particle
,
3003 VIEW3D_MT_Select_Edit_Lattice
,
3004 VIEW3D_MT_Select_Edit_Armature
,
3005 VIEW3D_MT_Select_Paint_Mask
,
3006 VIEW3D_MT_Select_Paint_Mask_Vertex
,
3007 VIEW3D_MT_Angle_Control
,
3008 VIEW3D_MT_Edit_Multi
,
3009 VIEW3D_MT_EditM_Edge
,
3010 VIEW3D_MT_Edit_Curve
,
3011 VIEW3D_MT_EditCurveCtrlpoints
,
3012 VIEW3D_MT_EditCurveSegments
,
3013 VIEW3D_MT_EditCurveSpecials
,
3014 VIEW3D_MT_Edit_Armature
,
3015 VIEW3D_MT_EditArmatureTK
,
3016 VIEW3D_MT_KeyframeMenu
,
3017 VIEW3D_OT_Pivot_Cursor
,
3018 VIEW3D_OT_Revert_Pivot
,
3019 VIEW3D_MT_CursorMenu
,
3020 VIEW3D_MT_CursorMenuLite
,
3021 VIEW3D_MT_EditCursorMenu
,
3022 VIEW3D_OT_CursorToEdgeIntersection
,
3024 VIEW3D_MT_Camera_Options
,
3026 InteractiveModeArmature
,
3028 VIEW3D_MT_View_Directions
,
3029 VIEW3D_MT_View_Border
,
3030 VIEW3D_MT_View_Toggle
,
3031 VIEW3D_MT_View_Menu
,
3032 VIEW3D_MT_View_Navigation
,
3033 VIEW3D_MT_View_Align
,
3034 VIEW3D_MT_View_Align_Selected
,
3035 VIEW3D_MT_View_Cameras
,
3038 VIEW3D_Snap_Context
,
3041 VIEW3D_MT_ManipulatorMenu1
,
3042 SetOriginToSelected
,
3043 VIEW3D_MT_Object_Data_Link
,
3044 VIEW3D_MT_Duplicate
,
3045 VIEW3D_MT_Space_Dynamic_Menu_Pref
,
3046 VIEW3D_MT_Selection_Mode_Particle
,
3047 VIEW3D_MT_AutoSmooth
,
3048 VIEW3D_MT_Animation_Player
,
3049 VIEW3D_OT_Interactive_Mode_Text
,
3050 SnapCursSelToCenter
,
3051 VIEW3D_MT_Sculpt_Specials
,
3052 VIEW3D_MT_Brush_Settings
,
3053 VIEW3D_MT_Brush_Selection
,
3055 VIEW3D_MT_Hide_Masks
,
3056 VIEW3D_OT_Display_Wire_All
,
3057 VIEW3D_MT_Vertex_Colors
,
3058 VIEW3D_MT_Paint_Weights
,
3059 VIEW3D_OT_Interactive_Mode_Grease_Pencil
,
3060 VIEW3D_MT_Edit_Gpencil
,
3061 InteractiveModeOther
,
3065 # Register Classes & Hotkeys #
3068 bpy
.utils
.register_class(cls
)
3070 wm
= bpy
.context
.window_manager
3071 kc
= wm
.keyconfigs
.addon
3073 km
= kc
.keymaps
.new(name
='3D View', space_type
='VIEW_3D')
3074 kmi
= km
.keymap_items
.new('wm.call_menu', 'SPACE', 'PRESS')
3075 kmi
.properties
.name
= "VIEW3D_MT_Space_Dynamic_Menu"
3078 # Unregister Classes & Hotkeys #
3080 wm
= bpy
.context
.window_manager
3081 kc
= wm
.keyconfigs
.addon
3083 km
= kc
.keymaps
['3D View']
3084 for kmi
in km
.keymap_items
:
3085 if kmi
.idname
== 'wm.call_menu':
3086 if kmi
.properties
.name
== "VIEW3D_MT_Space_Dynamic_Menu":
3087 km
.keymap_items
.remove(kmi
)
3090 bpy
.utils
.unregister_class(cls
)
3093 if __name__
== "__main__":