StudioLight: Renaming stuffs
[blender.git] / release / scripts / startup / bl_ui / space_view3d.py
1 # ##### BEGIN GPL LICENSE BLOCK #####
2 #
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.
7 #
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.
12 #
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.
16 #
17 # ##### END GPL LICENSE BLOCK #####
18
19 # <pep8 compliant>
20 import bpy
21 from bpy.types import Header, Menu, Panel
22 from .properties_paint_common import UnifiedPaintPanel
23 from .properties_grease_pencil_common import AnnotationDataPanel, AnnotationOnionSkin
24 from bpy.app.translations import contexts as i18n_contexts
25
26
27 class VIEW3D_HT_header(Header):
28     bl_space_type = 'VIEW_3D'
29
30     def draw(self, context):
31         layout = self.layout
32
33         view = context.space_data
34         shading = view.shading
35         # mode_string = context.mode
36         obj = context.active_object
37         overlay = view.overlay
38         tool_settings = context.tool_settings
39
40         row = layout.row(align=True)
41         row.template_header()
42
43         object_mode = 'OBJECT' if obj is None else obj.mode
44
45         act_mode_item = bpy.types.Object.bl_rna.properties["mode"].enum_items[object_mode]
46
47         row.separator()
48
49         sub = row.row()
50         sub.ui_units_x = 5.5
51         sub.operator_menu_enum("object.mode_set", "mode", text=act_mode_item.name, icon=act_mode_item.icon)
52         del act_mode_item
53
54         layout.template_header_3D_mode()
55
56         # Contains buttons like Mode, Pivot, Layer, Mesh Select Mode...
57         if obj:
58             # Particle edit
59             if object_mode == 'PARTICLE_EDIT':
60                 row = layout.row()
61                 row.prop(tool_settings.particle_edit, "select_mode", text="", expand=True)
62
63         # Grease Pencil
64         if obj and obj.type == 'GPENCIL' and context.gpencil_data:
65             gpd = context.gpencil_data
66
67             if gpd.is_stroke_paint_mode:
68                 row = layout.row()
69                 sub = row.row(align=True)
70                 sub.prop(tool_settings, "use_gpencil_draw_onback", text="", icon='MOD_OPACITY')
71                 sub.separator(factor=0.4)
72                 sub.prop(tool_settings, "use_gpencil_weight_data_add", text="", icon='WPAINT_HLT')
73                 sub.separator(factor=0.4)
74                 sub.prop(tool_settings, "use_gpencil_draw_additive", text="", icon='FREEZE')
75
76             if gpd.use_stroke_edit_mode:
77                 row = layout.row(align=True)
78                 row.prop(tool_settings, "gpencil_selectmode", text="", expand=True)
79
80             if gpd.use_stroke_edit_mode or gpd.is_stroke_sculpt_mode or gpd.is_stroke_weight_mode:
81                 row = layout.row(align=True)
82
83                 if gpd.is_stroke_sculpt_mode:
84                     row.prop(tool_settings.gpencil_sculpt, "use_select_mask", text="")
85                     row.separator()
86
87                 row.prop(gpd, "use_multiedit", text="", icon='GP_MULTIFRAME_EDITING')
88
89                 sub = row.row(align=True)
90                 sub.active = gpd.use_multiedit
91                 sub.popover(
92                     panel="VIEW3D_PT_gpencil_multi_frame",
93                     text="Multiframe"
94                 )
95
96             if gpd.use_stroke_edit_mode:
97                 row = layout.row(align=True)
98                 row.prop(tool_settings.gpencil_sculpt, "use_select_mask", text="")
99
100                 row.popover(
101                     panel="VIEW3D_PT_tools_grease_pencil_interpolate",
102                     text="Interpolate"
103                 )
104
105         VIEW3D_MT_editor_menus.draw_collapsible(context, layout)
106
107         layout.separator_spacer()
108
109         # Mode & Transform Settings
110         scene = context.scene
111
112         # Orientation
113         if object_mode in {'OBJECT', 'EDIT', 'POSE', 'GPENCIL_EDIT'}:
114             orientation = scene.transform_orientation
115             current_orientation = scene.current_orientation
116
117             if not current_orientation:
118                 trans_orientation = bpy.types.Scene.bl_rna.properties["transform_orientation"].enum_items[orientation]
119                 trans_icon = getattr(trans_orientation, "icon", "BLANK1")
120                 trans_name = getattr(trans_orientation, "name", "Orientation")
121             else:
122                 trans_icon = 'OBJECT_ORIGIN'
123                 trans_name = getattr(current_orientation, "name", "Orientation")
124
125             row = layout.row(align=True)
126
127             sub = row.row()
128             sub.ui_units_x = 4
129             sub.popover(
130                 panel="VIEW3D_PT_transform_orientations",
131                 text=trans_name,
132                 icon=trans_icon,
133             )
134
135         # Snap
136         show_snap = False
137         if obj is None:
138             show_snap = True
139         else:
140             if object_mode not in {'SCULPT', 'VERTEX_PAINT', 'WEIGHT_PAINT', 'TEXTURE_PAINT',
141                                    'GPENCIL_PAINT', 'GPENCIL_SCULPT', 'GPENCIL_WEIGHT'}:
142                 show_snap = True
143             else:
144
145                 from .properties_paint_common import UnifiedPaintPanel
146                 paint_settings = UnifiedPaintPanel.paint_settings(context)
147
148                 if paint_settings:
149                     brush = paint_settings.brush
150                     if brush and brush.stroke_method == 'CURVE':
151                         show_snap = True
152
153         if show_snap:
154             snap_items = bpy.types.ToolSettings.bl_rna.properties['snap_elements'].enum_items
155             snap_elements = tool_settings.snap_elements
156             if len(snap_elements) == 1:
157                 text = ""
158                 for elem in snap_elements:
159                     icon = snap_items[elem].icon
160                     break
161             else:
162                 text = "Mix"
163                 icon = 'NONE'
164             del snap_items, snap_elements
165
166             row = layout.row(align=True)
167             row.prop(tool_settings, "use_snap", text="")
168
169             sub = row.row(align=True)
170             sub.popover(
171                 panel="VIEW3D_PT_snapping",
172                 icon=icon,
173                 text=text,
174             )
175
176         # Proportional editing
177         if obj:
178             gpd = context.gpencil_data
179             if gpd is not None and obj.type == 'GPENCIL':
180                 if gpd.use_stroke_edit_mode or gpd.is_stroke_sculpt_mode:
181                     row = layout.row(align=True)
182                     row.prop(tool_settings, "proportional_edit", icon_only=True)
183
184                     sub = row.row(align=True)
185                     sub.active = tool_settings.proportional_edit != 'DISABLED'
186                     sub.prop(tool_settings, "proportional_edit_falloff", icon_only=True)
187
188             elif object_mode in {'EDIT', 'PARTICLE_EDIT'}:
189                 row = layout.row(align=True)
190                 row.prop(tool_settings, "proportional_edit", icon_only=True)
191                 sub = row.row(align=True)
192                 sub.active = tool_settings.proportional_edit != 'DISABLED'
193                 sub.prop(tool_settings, "proportional_edit_falloff", icon_only=True)
194
195             elif object_mode == 'OBJECT':
196                 row = layout.row(align=True)
197                 row.prop(tool_settings, "use_proportional_edit_objects", icon_only=True)
198                 sub = row.row(align=True)
199                 sub.active = tool_settings.use_proportional_edit_objects
200                 sub.prop(tool_settings, "proportional_edit_falloff", icon_only=True)
201         else:
202             if context.gpencil_data and context.gpencil_data.use_stroke_edit_mode:
203                 row = layout.row(align=True)
204                 row.prop(tool_settings, "proportional_edit", icon_only=True)
205                 sub = row.row(align=True)
206                 sub.active = tool_settings.proportional_edit != 'DISABLED'
207                 sub.prop(tool_settings, "proportional_edit_falloff", icon_only=True)
208
209         # Pivot
210         if object_mode in {'OBJECT', 'EDIT', 'POSE', 'GPENCIL_EDIT', 'GPENCIL_SCULPT'}:
211             pivot_point = tool_settings.transform_pivot_point
212             act_pivot_point = bpy.types.ToolSettings.bl_rna.properties["transform_pivot_point"].enum_items[pivot_point]
213             row = layout.row(align=True)
214             row.popover(
215                 panel="VIEW3D_PT_pivot_point",
216                 icon=act_pivot_point.icon,
217                 text="",
218             )
219         # grease pencil
220         if object_mode == 'GPENCIL_PAINT':
221             origin = tool_settings.gpencil_stroke_placement_view3d
222             gp_origin = tool_settings.bl_rna.properties['gpencil_stroke_placement_view3d'].enum_items[origin]
223
224             or_icon = getattr(gp_origin, "icon", "BLANK1")
225             or_name = getattr(gp_origin, "name", "Stroke Placement")
226             layout.popover(
227                 panel="VIEW3D_PT_gpencil_origin",
228                 text=or_name,
229                 icon=or_icon,
230             )
231
232         if object_mode in {'GPENCIL_PAINT', 'GPENCIL_SCULPT'}:
233             lock = tool_settings.gpencil_sculpt.lock_axis
234             gp_lock = tool_settings.gpencil_sculpt.bl_rna.properties["lock_axis"].enum_items[lock]
235
236             lk_icon = getattr(gp_lock, "icon", "BLANK1")
237             lk_name = getattr(gp_lock, "name", "None")
238             row = layout.row()
239             row.enabled = tool_settings.gpencil_stroke_placement_view3d in {'ORIGIN', 'CURSOR'}
240             row.popover(
241                 panel="VIEW3D_PT_gpencil_lock",
242                 text=lk_name,
243                 icon=lk_icon,
244             )
245
246         layout.separator_spacer()
247
248         # Collection Visibility
249         layout.popover(
250             panel="VIEW3D_PT_collections",
251             icon='GROUP',
252             text="",
253         )
254
255         # Viewport Settings
256         layout.popover(
257             panel="VIEW3D_PT_object_type_visibility",
258             icon_value=view.icon_from_show_object_viewport,
259             text="",
260         )
261
262         row = layout.row(align=True)
263         row.prop(overlay, "show_overlays", icon='OVERLAY', text="")
264         sub = row.row(align=True)
265         sub.active = overlay.show_overlays
266         sub.popover(panel="VIEW3D_PT_overlay")
267
268         row = layout.row()
269         row.active = (shading.type in {'WIREFRAME', 'SOLID'}) or object_mode in {'EDIT'}
270
271         if shading.type == 'WIREFRAME':
272             row.prop(shading, "show_xray_wireframe", text="", icon='XRAY')
273         else:
274             row.prop(shading, "show_xray", text="", icon='XRAY')
275
276         row = layout.row(align=True)
277         row.prop(shading, "type", text="", expand=True)
278         sub = row.row(align=True)
279         sub.enabled = shading.type != 'RENDERED'
280         sub.popover(panel="VIEW3D_PT_shading")
281
282
283 class VIEW3D_MT_editor_menus(Menu):
284     bl_space_type = 'VIEW3D_MT_editor_menus'
285     bl_label = ""
286
287     def draw(self, context):
288         self.draw_menus(self.layout, context)
289
290     @staticmethod
291     def draw_menus(layout, context):
292         obj = context.active_object
293         mode_string = context.mode
294         edit_object = context.edit_object
295         gp_edit = obj and obj.mode in {'GPENCIL_EDIT', 'GPENCIL_PAINT', 'GPENCIL_SCULPT', 'GPENCIL_WEIGHT'}
296
297         layout.menu("VIEW3D_MT_view")
298
299         # Select Menu
300         if gp_edit:
301             if mode_string not in {'GPENCIL_PAINT', 'GPENCIL_WEIGHT'}:
302                 layout.menu("VIEW3D_MT_select_gpencil")
303         elif mode_string in {'PAINT_WEIGHT', 'PAINT_VERTEX', 'PAINT_TEXTURE'}:
304             mesh = obj.data
305             if mesh.use_paint_mask:
306                 layout.menu("VIEW3D_MT_select_paint_mask")
307             elif mesh.use_paint_mask_vertex and mode_string in {'PAINT_WEIGHT', 'PAINT_VERTEX'}:
308                 layout.menu("VIEW3D_MT_select_paint_mask_vertex")
309         elif mode_string != 'SCULPT':
310             layout.menu("VIEW3D_MT_select_%s" % mode_string.lower())
311
312         if gp_edit:
313             pass
314         elif mode_string == 'OBJECT':
315             layout.menu("VIEW3D_MT_add", text="Add")
316         elif mode_string == 'EDIT_MESH':
317             layout.menu("VIEW3D_MT_mesh_add", text="Add")
318         elif mode_string == 'EDIT_CURVE':
319             layout.menu("VIEW3D_MT_curve_add", text="Add")
320         elif mode_string == 'EDIT_SURFACE':
321             layout.menu("VIEW3D_MT_surface_add", text="Add")
322         elif mode_string == 'EDIT_METABALL':
323             layout.menu("VIEW3D_MT_metaball_add", text="Add")
324         elif mode_string == 'EDIT_ARMATURE':
325             layout.menu("TOPBAR_MT_edit_armature_add", text="Add")
326
327         if gp_edit:
328             if obj and obj.mode == 'GPENCIL_PAINT':
329                 layout.menu("VIEW3D_MT_paint_gpencil")
330             elif obj and obj.mode == 'GPENCIL_EDIT':
331                 layout.menu("VIEW3D_MT_edit_gpencil")
332             elif obj and obj.mode == 'GPENCIL_WEIGHT':
333                 layout.menu("VIEW3D_MT_weight_gpencil")
334
335         elif edit_object:
336             layout.menu("VIEW3D_MT_edit_%s" % edit_object.type.lower())
337
338             if mode_string == 'EDIT_MESH':
339                 layout.menu("VIEW3D_MT_edit_mesh_vertices")
340                 layout.menu("VIEW3D_MT_edit_mesh_edges")
341                 layout.menu("VIEW3D_MT_edit_mesh_faces")
342                 layout.menu("VIEW3D_MT_uv_map", text="UV")
343             elif mode_string == 'EDIT_CURVE':
344                 layout.menu("VIEW3D_MT_edit_curve_ctrlpoints")
345                 layout.menu("VIEW3D_MT_edit_curve_segments")
346
347         elif obj:
348             if mode_string != 'PAINT_TEXTURE':
349                 layout.menu("VIEW3D_MT_%s" % mode_string.lower())
350             if mode_string in {'SCULPT', 'PAINT_VERTEX', 'PAINT_WEIGHT', 'PAINT_TEXTURE'}:
351                 layout.menu("VIEW3D_MT_brush")
352             if mode_string == 'SCULPT':
353                 layout.menu("VIEW3D_MT_hide_mask")
354         else:
355             layout.menu("VIEW3D_MT_object")
356
357
358 # ********** Menu **********
359
360
361 # ********** Utilities **********
362
363
364 class ShowHideMenu:
365     bl_label = "Show/Hide"
366     _operator_name = ""
367
368     def draw(self, context):
369         layout = self.layout
370
371         layout.operator("%s.reveal" % self._operator_name, text="Show Hidden")
372         layout.operator("%s.hide" % self._operator_name, text="Hide Selected").unselected = False
373         layout.operator("%s.hide" % self._operator_name, text="Hide Unselected").unselected = True
374
375
376 # Standard transforms which apply to all cases
377 # NOTE: this doesn't seem to be able to be used directly
378 class VIEW3D_MT_transform_base(Menu):
379     bl_label = "Transform"
380     bl_category = "View"
381
382     # TODO: get rid of the custom text strings?
383     def draw(self, context):
384         layout = self.layout
385
386         layout.operator("transform.tosphere", text="To Sphere")
387         layout.operator("transform.shear", text="Shear")
388         layout.operator("transform.bend", text="Bend")
389         layout.operator("transform.push_pull", text="Push/Pull")
390
391         if context.mode != 'OBJECT':
392             layout.operator("transform.vertex_warp", text="Warp")
393             layout.operator("transform.vertex_random", text="Randomize")
394
395
396 # Generic transform menu - geometry types
397 class VIEW3D_MT_transform(VIEW3D_MT_transform_base):
398     def draw(self, context):
399         # base menu
400         VIEW3D_MT_transform_base.draw(self, context)
401
402         # generic...
403         layout = self.layout
404         layout.operator("transform.shrink_fatten", text="Shrink Fatten")
405
406         layout.separator()
407
408         layout.operator("transform.translate", text="Move Texture Space").texture_space = True
409         layout.operator("transform.resize", text="Scale Texture Space").texture_space = True
410
411
412 # Object-specific extensions to Transform menu
413 class VIEW3D_MT_transform_object(VIEW3D_MT_transform_base):
414     def draw(self, context):
415         layout = self.layout
416
417         # base menu
418         VIEW3D_MT_transform_base.draw(self, context)
419
420         # object-specific option follow...
421         layout.separator()
422
423         layout.operator("transform.translate", text="Move Texture Space").texture_space = True
424         layout.operator("transform.resize", text="Scale Texture Space").texture_space = True
425
426         layout.separator()
427
428         layout.operator_context = 'EXEC_REGION_WIN'
429         # XXX see alignmenu() in edit.c of b2.4x to get this working
430         layout.operator("transform.transform", text="Align to Transform Orientation").mode = 'ALIGN'
431
432         layout.separator()
433
434         layout.operator("object.randomize_transform")
435         layout.operator("object.align")
436
437         # TODO: there is a strange context bug here.
438         """
439         layout.operator_context = 'INVOKE_REGION_WIN'
440         layout.operator("object.transform_axis_target")
441         """
442
443
444 # Armature EditMode extensions to Transform menu
445 class VIEW3D_MT_transform_armature(VIEW3D_MT_transform_base):
446     def draw(self, context):
447         layout = self.layout
448
449         # base menu
450         VIEW3D_MT_transform_base.draw(self, context)
451
452         # armature specific extensions follow...
453         obj = context.object
454         if obj.type == 'ARMATURE' and obj.mode in {'EDIT', 'POSE'}:
455             if obj.data.display_type == 'BBONE':
456                 layout.separator()
457
458                 layout.operator("transform.transform", text="Scale BBone").mode = 'BONE_SIZE'
459             elif obj.data.display_type == 'ENVELOPE':
460                 layout.separator()
461
462                 layout.operator("transform.transform", text="Scale Envelope Distance").mode = 'BONE_SIZE'
463                 layout.operator("transform.transform", text="Scale Radius").mode = 'BONE_ENVELOPE'
464
465         if context.edit_object and context.edit_object.type == 'ARMATURE':
466             layout.separator()
467
468             layout.operator("armature.align")
469
470
471 class VIEW3D_MT_mirror(Menu):
472     bl_label = "Mirror"
473
474     def draw(self, context):
475         layout = self.layout
476
477         layout.operator("transform.mirror", text="Interactive Mirror")
478
479         layout.separator()
480
481         layout.operator_context = 'INVOKE_REGION_WIN'
482
483         props = layout.operator("transform.mirror", text="X Global")
484         props.constraint_axis = (True, False, False)
485         props.constraint_orientation = 'GLOBAL'
486         props = layout.operator("transform.mirror", text="Y Global")
487         props.constraint_axis = (False, True, False)
488         props.constraint_orientation = 'GLOBAL'
489         props = layout.operator("transform.mirror", text="Z Global")
490         props.constraint_axis = (False, False, True)
491         props.constraint_orientation = 'GLOBAL'
492
493         if context.edit_object:
494             layout.separator()
495
496             props = layout.operator("transform.mirror", text="X Local")
497             props.constraint_axis = (True, False, False)
498             props.constraint_orientation = 'LOCAL'
499             props = layout.operator("transform.mirror", text="Y Local")
500             props.constraint_axis = (False, True, False)
501             props.constraint_orientation = 'LOCAL'
502             props = layout.operator("transform.mirror", text="Z Local")
503             props.constraint_axis = (False, False, True)
504             props.constraint_orientation = 'LOCAL'
505
506             layout.operator("object.vertex_group_mirror")
507
508
509 class VIEW3D_MT_snap(Menu):
510     bl_label = "Snap"
511
512     def draw(self, context):
513         layout = self.layout
514
515         layout.operator("view3d.snap_selected_to_grid", text="Selection to Grid")
516         layout.operator("view3d.snap_selected_to_cursor", text="Selection to Cursor").use_offset = False
517         layout.operator("view3d.snap_selected_to_cursor", text="Selection to Cursor (Keep Offset)").use_offset = True
518         layout.operator("view3d.snap_selected_to_active", text="Selection to Active")
519
520         layout.separator()
521
522         layout.operator("view3d.snap_cursor_to_selected", text="Cursor to Selected")
523         layout.operator("view3d.snap_cursor_to_center", text="Cursor to World Origin")
524         layout.operator("view3d.snap_cursor_to_grid", text="Cursor to Grid")
525         layout.operator("view3d.snap_cursor_to_active", text="Cursor to Active")
526
527
528 class VIEW3D_MT_uv_map(Menu):
529     bl_label = "UV Mapping"
530
531     def draw(self, context):
532         layout = self.layout
533
534         layout.operator("uv.unwrap")
535
536         layout.operator_context = 'INVOKE_DEFAULT'
537         layout.operator("uv.smart_project")
538         layout.operator("uv.lightmap_pack")
539         layout.operator("uv.follow_active_quads")
540
541         layout.separator()
542
543         layout.operator_context = 'EXEC_REGION_WIN'
544         layout.operator("uv.cube_project")
545         layout.operator("uv.cylinder_project")
546         layout.operator("uv.sphere_project")
547
548         layout.separator()
549
550         layout.operator_context = 'INVOKE_REGION_WIN'
551         layout.operator("uv.project_from_view").scale_to_bounds = False
552         layout.operator("uv.project_from_view", text="Project from View (Bounds)").scale_to_bounds = True
553
554         layout.separator()
555
556         layout.operator("mesh.mark_seam").clear = False
557         layout.operator("mesh.mark_seam", text="Clear Seam").clear = True
558
559         layout.separator()
560
561         layout.operator("uv.reset")
562
563
564 class VIEW3D_MT_edit_proportional(Menu):
565     bl_label = "Proportional Editing"
566
567     def draw(self, context):
568         layout = self.layout
569
570         layout.props_enum(tool_settings, "proportional_edit")
571
572         layout.separator()
573
574         layout.label(text="Falloff:")
575         layout.props_enum(tool_settings, "proportional_edit_falloff")
576
577
578 # ********** View menus **********
579
580
581 class VIEW3D_MT_view(Menu):
582     bl_label = "View"
583
584     def draw(self, context):
585         layout = self.layout
586         view = context.space_data
587
588         layout.operator("view3d.toolshelf", icon='MENU_PANEL')
589         layout.operator("view3d.properties", icon='MENU_PANEL')
590
591         layout.separator()
592
593         layout.operator("view3d.view_selected", text="Frame Selected").use_all_regions = False
594         if view.region_quadviews:
595             layout.operator("view3d.view_selected", text="Frame Selected (Quad View)").use_all_regions = True
596
597         layout.operator("view3d.view_all", text="Frame All").center = False
598         layout.operator("view3d.view_persportho", text="Perspective/Orthographic")
599         layout.menu("VIEW3D_MT_view_local")
600
601         layout.separator()
602
603         layout.menu("VIEW3D_MT_view_cameras", text="Cameras")
604
605         layout.separator()
606         layout.menu("VIEW3D_MT_view_viewpoint")
607         layout.menu("VIEW3D_MT_view_navigation")
608         layout.menu("VIEW3D_MT_view_align")
609
610         layout.separator()
611
612         layout.operator_context = 'INVOKE_REGION_WIN'
613         layout.menu("VIEW3D_MT_view_borders", text="View Borders")
614
615         layout.separator()
616
617         layout.operator("screen.animation_play", text="Play Animation")
618
619         layout.separator()
620
621         layout.operator("render.opengl", icon='RENDER_STILL')
622         layout.operator("render.opengl", text="Viewport Render Animation", icon='RENDER_ANIMATION').animation = True
623
624         layout.separator()
625
626         layout.menu("INFO_MT_area")
627
628
629 class VIEW3D_MT_view_local(Menu):
630     bl_label = "Local View"
631
632     def draw(self, context):
633         layout = self.layout
634         view = context.space_data
635
636         layout.operator("view3d.localview", text="Toggle Local View")
637         layout.operator("view3d.localview_remove_from")
638
639
640 class VIEW3D_MT_view_cameras(Menu):
641     bl_label = "Cameras"
642
643     def draw(self, context):
644         layout = self.layout
645
646         layout.operator("view3d.object_as_camera")
647         layout.operator("view3d.view_camera", text="Active Camera")
648
649
650 class VIEW3D_MT_view_viewpoint(Menu):
651     bl_label = "Viewpoint"
652
653     def draw(self, context):
654         layout = self.layout
655
656         layout.operator("view3d.view_camera", text="Camera")
657
658         layout.separator()
659
660         layout.operator("view3d.view_axis", text="Top").type = 'TOP'
661         layout.operator("view3d.view_axis", text="Bottom").type = 'BOTTOM'
662
663         layout.separator()
664
665         layout.operator("view3d.view_axis", text="Front").type = 'FRONT'
666         layout.operator("view3d.view_axis", text="Back").type = 'BACK'
667
668         layout.separator()
669
670         layout.operator("view3d.view_axis", text="Right").type = 'RIGHT'
671         layout.operator("view3d.view_axis", text="Left").type = 'LEFT'
672
673
674 class VIEW3D_MT_view_navigation(Menu):
675     bl_label = "Navigation"
676
677     def draw(self, context):
678         from math import pi
679         layout = self.layout
680
681         layout.operator_enum("view3d.view_orbit", "type")
682         props = layout.operator("view3d.view_orbit", text="Orbit Opposite")
683         props.type = 'ORBITRIGHT'
684         props.angle = pi
685
686         layout.separator()
687
688         layout.operator("view3d.view_roll", text="Roll Left").type = 'LEFT'
689         layout.operator("view3d.view_roll", text="Roll Right").type = 'RIGHT'
690
691         layout.separator()
692
693         layout.operator_enum("view3d.view_pan", "type")
694
695         layout.separator()
696
697         layout.operator("view3d.zoom", text="Zoom In").delta = 1
698         layout.operator("view3d.zoom", text="Zoom Out").delta = -1
699         layout.operator("view3d.zoom_border", text="Zoom Border...")
700         layout.operator("view3d.zoom_camera_1_to_1", text="Zoom Camera 1:1")
701
702         layout.separator()
703
704         layout.operator("view3d.fly")
705         layout.operator("view3d.walk")
706
707
708 class VIEW3D_MT_view_align(Menu):
709     bl_label = "Align View"
710
711     def draw(self, context):
712         layout = self.layout
713
714         layout.menu("VIEW3D_MT_view_align_selected")
715
716         layout.separator()
717
718         layout.operator("view3d.camera_to_view", text="Align Active Camera to View")
719         layout.operator("view3d.camera_to_view_selected", text="Align Active Camera to Selected")
720
721         layout.separator()
722
723         layout.operator("view3d.view_all", text="Center Cursor and View All").center = True
724         layout.operator("view3d.view_center_cursor")
725
726         layout.separator()
727
728         layout.operator("view3d.view_lock_to_active")
729         layout.operator("view3d.view_lock_clear")
730
731
732 class VIEW3D_MT_view_align_selected(Menu):
733     bl_label = "Align View to Active"
734
735     def draw(self, context):
736         layout = self.layout
737
738         props = layout.operator("view3d.view_axis", text="Top")
739         props.align_active = True
740         props.type = 'TOP'
741
742         props = layout.operator("view3d.view_axis", text="Bottom")
743         props.align_active = True
744         props.type = 'BOTTOM'
745
746         layout.separator()
747
748         props = layout.operator("view3d.view_axis", text="Front")
749         props.align_active = True
750         props.type = 'FRONT'
751
752         props = layout.operator("view3d.view_axis", text="Back")
753         props.align_active = True
754         props.type = 'BACK'
755
756         layout.separator()
757
758         props = layout.operator("view3d.view_axis", text="Right")
759         props.align_active = True
760         props.type = 'RIGHT'
761
762         props = layout.operator("view3d.view_axis", text="Left")
763         props.align_active = True
764         props.type = 'LEFT'
765
766
767 class VIEW3D_MT_view_borders(Menu):
768     bl_label = "View Borders"
769
770     def draw(self, context):
771         layout = self.layout
772         # layout.operator("view3d.clip_border", text="Clipping Border...")
773         layout.operator("view3d.render_border", text="Render Border...")
774
775         layout.separator()
776
777         layout.operator("view3d.clear_render_border")
778
779
780 # ********** Select menus, suffix from context.mode **********
781
782 class VIEW3D_MT_select_object_more_less(Menu):
783     bl_label = "Select More/Less"
784
785     def draw(self, context):
786         layout = self.layout
787
788         layout = self.layout
789
790         layout.operator("object.select_more", text="More")
791         layout.operator("object.select_less", text="Less")
792
793         layout.separator()
794
795         props = layout.operator("object.select_hierarchy", text="Parent")
796         props.extend = False
797         props.direction = 'PARENT'
798
799         props = layout.operator("object.select_hierarchy", text="Child")
800         props.extend = False
801         props.direction = 'CHILD'
802
803         layout.separator()
804
805         props = layout.operator("object.select_hierarchy", text="Extend Parent")
806         props.extend = True
807         props.direction = 'PARENT'
808
809         props = layout.operator("object.select_hierarchy", text="Extend Child")
810         props.extend = True
811         props.direction = 'CHILD'
812
813
814 class VIEW3D_MT_select_object(Menu):
815     bl_label = "Select"
816
817     def draw(self, context):
818         layout = self.layout
819
820         layout.operator("object.select_all", text="All").action = 'SELECT'
821         layout.operator("object.select_all", text="None").action = 'DESELECT'
822         layout.operator("object.select_all", text="Invert").action = 'INVERT'
823
824         layout.separator()
825
826         layout.operator("view3d.select_box")
827         layout.operator("view3d.select_circle")
828
829         layout.separator()
830
831         layout.operator_menu_enum("object.select_by_type", "type", text="Select All by Type...")
832         layout.operator("object.select_camera", text="Select Active Camera")
833         layout.operator("object.select_mirror", text="Mirror Selection")
834         layout.operator("object.select_random", text="Select Random")
835
836         layout.separator()
837
838         layout.menu("VIEW3D_MT_select_object_more_less")
839
840         layout.separator()
841
842         layout.operator_menu_enum("object.select_grouped", "type", text="Select Grouped")
843         layout.operator_menu_enum("object.select_linked", "type", text="Select Linked")
844         layout.operator("object.select_pattern", text="Select Pattern...")
845
846
847 class VIEW3D_MT_select_pose_more_less(Menu):
848     bl_label = "Select More/Less"
849
850     def draw(self, context):
851         layout = self.layout
852
853         layout = self.layout
854
855         props = layout.operator("pose.select_hierarchy", text="Parent")
856         props.extend = False
857         props.direction = 'PARENT'
858
859         props = layout.operator("pose.select_hierarchy", text="Child")
860         props.extend = False
861         props.direction = 'CHILD'
862
863         layout.separator()
864
865         props = layout.operator("pose.select_hierarchy", text="Extend Parent")
866         props.extend = True
867         props.direction = 'PARENT'
868
869         props = layout.operator("pose.select_hierarchy", text="Extend Child")
870         props.extend = True
871         props.direction = 'CHILD'
872
873
874 class VIEW3D_MT_select_pose(Menu):
875     bl_label = "Select"
876
877     def draw(self, context):
878         layout = self.layout
879
880         layout.operator("pose.select_all", text="All").action = 'SELECT'
881         layout.operator("pose.select_all", text="None").action = 'DESELECT'
882         layout.operator("pose.select_all", text="Invert").action = 'INVERT'
883
884         layout.separator()
885
886         layout.operator("view3d.select_box")
887         layout.operator("view3d.select_circle")
888
889         layout.separator()
890
891         layout.operator("pose.select_mirror", text="Flip Active")
892
893         layout.separator()
894
895         layout.operator("pose.select_constraint_target", text="Constraint Target")
896         layout.operator("pose.select_linked", text="Linked")
897
898         layout.separator()
899
900         layout.menu("VIEW3D_MT_select_pose_more_less")
901
902         layout.separator()
903
904         layout.operator_menu_enum("pose.select_grouped", "type", text="Grouped")
905         layout.operator("object.select_pattern", text="Select Pattern...")
906
907
908 class VIEW3D_MT_select_particle(Menu):
909     bl_label = "Select"
910
911     def draw(self, context):
912         layout = self.layout
913
914         layout.operator("particle.select_all", text="All").action = 'SELECT'
915         layout.operator("particle.select_all", text="None").action = 'DESELECT'
916         layout.operator("particle.select_all", text="Invert").action = 'INVERT'
917
918         layout.separator()
919
920         layout.operator("view3d.select_box")
921         layout.operator("view3d.select_circle")
922
923         layout.separator()
924
925         layout.operator("particle.select_linked")
926
927         layout.separator()
928
929         layout.operator("particle.select_more")
930         layout.operator("particle.select_less")
931
932         layout.separator()
933
934         layout.operator("particle.select_random")
935
936         layout.separator()
937
938         layout.operator("particle.select_roots", text="Roots")
939         layout.operator("particle.select_tips", text="Tips")
940
941
942 class VIEW3D_MT_edit_mesh_select_similar(Menu):
943     bl_label = "Select Similar"
944
945     def draw(self, context):
946         layout = self.layout
947
948         layout.operator_enum("mesh.select_similar", "type")
949
950         layout.separator()
951
952         layout.operator("mesh.select_similar_region", text="Face Regions")
953
954
955 class VIEW3D_MT_edit_mesh_select_by_trait(Menu):
956     bl_label = "Select All by Trait"
957
958     def draw(self, context):
959         layout = self.layout
960         tool_settings = context.tool_settings
961         if tool_settings.mesh_select_mode[2] is False:
962             layout.operator("mesh.select_non_manifold", text="Non Manifold")
963         layout.operator("mesh.select_loose", text="Loose Geometry")
964         layout.operator("mesh.select_interior_faces", text="Interior Faces")
965         layout.operator("mesh.select_face_by_sides", text="Faces by Sides")
966
967         layout.separator()
968
969         layout.operator("mesh.select_ungrouped", text="Ungrouped Verts")
970
971
972 class VIEW3D_MT_edit_mesh_select_more_less(Menu):
973     bl_label = "Select More/Less"
974
975     def draw(self, context):
976         layout = self.layout
977
978         layout.operator("mesh.select_more", text="More")
979         layout.operator("mesh.select_less", text="Less")
980
981         layout.separator()
982
983         layout.operator("mesh.select_next_item", text="Next Active")
984         layout.operator("mesh.select_prev_item", text="Previous Active")
985
986
987 class VIEW3D_MT_edit_mesh_select_linked(Menu):
988     bl_label = "Select Linked"
989
990     def draw(self, context):
991         layout = self.layout
992
993         layout.operator("mesh.select_linked", text="Linked")
994         layout.operator("mesh.shortest_path_select", text="Shortest Path")
995         layout.operator("mesh.faces_select_linked_flat", text="Linked Flat Faces")
996
997
998 class VIEW3D_MT_edit_mesh_select_loops(Menu):
999     bl_label = "Select Loops"
1000
1001     def draw(self, context):
1002         layout = self.layout
1003
1004         layout.operator("mesh.loop_multi_select", text="Edge Loops").ring = False
1005         layout.operator("mesh.loop_multi_select", text="Edge Rings").ring = True
1006
1007         layout.separator()
1008
1009         layout.operator("mesh.loop_to_region")
1010         layout.operator("mesh.region_to_loop")
1011
1012
1013 class VIEW3D_MT_select_edit_mesh(Menu):
1014     bl_label = "Select"
1015
1016     def draw(self, context):
1017         layout = self.layout
1018
1019         # primitive
1020         layout.operator("mesh.select_all", text="All").action = 'SELECT'
1021         layout.operator("mesh.select_all", text="None").action = 'DESELECT'
1022         layout.operator("mesh.select_all", text="Invert").action = 'INVERT'
1023
1024         layout.separator()
1025
1026         layout.operator("view3d.select_box")
1027         layout.operator("view3d.select_circle")
1028
1029         layout.separator()
1030
1031         # numeric
1032         layout.operator("mesh.select_random", text="Select Random")
1033         layout.operator("mesh.select_nth")
1034
1035         layout.separator()
1036
1037         # geometric
1038         layout.operator("mesh.edges_select_sharp", text="Select Sharp Edges")
1039
1040         layout.separator()
1041
1042         # other ...
1043         layout.menu("VIEW3D_MT_edit_mesh_select_similar")
1044
1045         layout.separator()
1046
1047         layout.menu("VIEW3D_MT_edit_mesh_select_by_trait")
1048
1049         layout.separator()
1050
1051         layout.menu("VIEW3D_MT_edit_mesh_select_more_less")
1052
1053         layout.separator()
1054
1055         layout.menu("VIEW3D_MT_edit_mesh_select_loops")
1056
1057         layout.separator()
1058
1059         layout.menu("VIEW3D_MT_edit_mesh_select_linked")
1060
1061         layout.separator()
1062
1063         layout.operator("mesh.select_axis", text="Side of Active")
1064         layout.operator("mesh.select_mirror", text="Mirror Selection")
1065
1066
1067 class VIEW3D_MT_select_edit_curve(Menu):
1068     bl_label = "Select"
1069
1070     def draw(self, context):
1071         layout = self.layout
1072
1073         layout.operator("curve.select_all", text="All").action = 'SELECT'
1074         layout.operator("curve.select_all", text="None").action = 'DESELECT'
1075         layout.operator("curve.select_all", text="Invert").action = 'INVERT'
1076
1077         layout.separator()
1078
1079         layout.operator("view3d.select_box")
1080         layout.operator("view3d.select_circle")
1081
1082         layout.separator()
1083
1084         layout.operator("curve.select_random")
1085         layout.operator("curve.select_nth")
1086         layout.operator("curve.select_linked", text="Select Linked")
1087         layout.operator("curve.select_similar", text="Select Similar")
1088
1089         layout.separator()
1090
1091         layout.operator("curve.de_select_first")
1092         layout.operator("curve.de_select_last")
1093         layout.operator("curve.select_next")
1094         layout.operator("curve.select_previous")
1095
1096         layout.separator()
1097
1098         layout.operator("curve.select_more")
1099         layout.operator("curve.select_less")
1100
1101
1102 class VIEW3D_MT_select_edit_surface(Menu):
1103     bl_label = "Select"
1104
1105     def draw(self, context):
1106         layout = self.layout
1107
1108         layout.operator("curve.select_all", text="All").action = 'SELECT'
1109         layout.operator("curve.select_all", text="None").action = 'DESELECT'
1110         layout.operator("curve.select_all", text="Invert").action = 'INVERT'
1111
1112         layout.separator()
1113
1114         layout.operator("view3d.select_box")
1115         layout.operator("view3d.select_circle")
1116
1117         layout.separator()
1118
1119         layout.operator("curve.select_random")
1120         layout.operator("curve.select_nth")
1121         layout.operator("curve.select_linked", text="Select Linked")
1122         layout.operator("curve.select_similar", text="Select Similar")
1123
1124         layout.separator()
1125
1126         layout.operator("curve.select_row")
1127
1128         layout.separator()
1129
1130         layout.operator("curve.select_more")
1131         layout.operator("curve.select_less")
1132
1133
1134 class VIEW3D_MT_select_edit_text(Menu):
1135     # intentional name mismatch
1136     # select menu for 3d-text doesn't make sense
1137     bl_label = "Edit"
1138
1139     def draw(self, context):
1140         layout = self.layout
1141
1142         layout.operator("font.text_cut", text="Cut")
1143         layout.operator("font.text_copy", text="Copy", icon='COPYDOWN')
1144         layout.operator("font.text_paste", text="Paste", icon='PASTEDOWN')
1145
1146         layout.separator()
1147
1148         layout.operator("font.text_paste_from_file")
1149
1150         layout.separator()
1151
1152         layout.operator("font.select_all")
1153
1154
1155 class VIEW3D_MT_select_edit_metaball(Menu):
1156     bl_label = "Select"
1157
1158     def draw(self, context):
1159         layout = self.layout
1160
1161         layout.operator("mball.select_all", text="All").action = 'SELECT'
1162         layout.operator("mball.select_all", text="None").action = 'DESELECT'
1163         layout.operator("mball.select_all", text="Invert").action = 'INVERT'
1164
1165         layout.separator()
1166
1167         layout.operator("view3d.select_box")
1168         layout.operator("view3d.select_circle")
1169
1170         layout.separator()
1171
1172         layout.operator("mball.select_random_metaelems")
1173
1174         layout.separator()
1175
1176         layout.operator_menu_enum("mball.select_similar", "type", text="Similar")
1177
1178
1179 class VIEW3D_MT_select_edit_lattice(Menu):
1180     bl_label = "Select"
1181
1182     def draw(self, context):
1183         layout = self.layout
1184
1185         layout.operator("lattice.select_all", text="All").action = 'SELECT'
1186         layout.operator("lattice.select_all", text="None").action = 'DESELECT'
1187         layout.operator("lattice.select_all", text="Invert").action = 'INVERT'
1188
1189         layout.separator()
1190
1191         layout.operator("view3d.select_box")
1192         layout.operator("view3d.select_circle")
1193
1194         layout.separator()
1195
1196         layout.operator("lattice.select_mirror")
1197         layout.operator("lattice.select_random")
1198
1199         layout.separator()
1200
1201         layout.operator("lattice.select_more")
1202         layout.operator("lattice.select_less")
1203
1204         layout.separator()
1205
1206         layout.operator("lattice.select_ungrouped", text="Ungrouped Verts")
1207
1208
1209 class VIEW3D_MT_select_edit_armature(Menu):
1210     bl_label = "Select"
1211
1212     def draw(self, context):
1213         layout = self.layout
1214
1215         layout.operator("armature.select_all", text="All").action = 'SELECT'
1216         layout.operator("armature.select_all", text="None").action = 'DESELECT'
1217         layout.operator("armature.select_all", text="Invert").action = 'INVERT'
1218
1219         layout.separator()
1220
1221         layout.operator("view3d.select_box")
1222         layout.operator("view3d.select_circle")
1223
1224         layout.separator()
1225
1226         layout.operator("armature.select_mirror", text="Mirror").extend = False
1227
1228         layout.separator()
1229
1230         layout.operator("armature.select_more", text="More")
1231         layout.operator("armature.select_less", text="Less")
1232
1233         layout.separator()
1234
1235         props = layout.operator("armature.select_hierarchy", text="Parent")
1236         props.extend = False
1237         props.direction = 'PARENT'
1238
1239         props = layout.operator("armature.select_hierarchy", text="Child")
1240         props.extend = False
1241         props.direction = 'CHILD'
1242
1243         layout.separator()
1244
1245         props = layout.operator("armature.select_hierarchy", text="Extend Parent")
1246         props.extend = True
1247         props.direction = 'PARENT'
1248
1249         props = layout.operator("armature.select_hierarchy", text="Extend Child")
1250         props.extend = True
1251         props.direction = 'CHILD'
1252
1253         layout.operator_menu_enum("armature.select_similar", "type", text="Similar")
1254         layout.operator("object.select_pattern", text="Select Pattern...")
1255
1256
1257 class VIEW3D_MT_select_gpencil(Menu):
1258     bl_label = "Select"
1259
1260     def draw(self, context):
1261         layout = self.layout
1262
1263         layout.operator("gpencil.select_all", text="All").action = 'SELECT'
1264         layout.operator("gpencil.select_all", text="None").action = 'DESELECT'
1265         layout.operator("gpencil.select_all", text="Invert").action = 'INVERT'
1266
1267         layout.separator()
1268
1269         layout.operator("gpencil.select_box")
1270         layout.operator("gpencil.select_circle")
1271
1272         layout.separator()
1273
1274         layout.operator("gpencil.select_linked", text="Linked")
1275         layout.operator("gpencil.select_alternate")
1276         layout.operator_menu_enum("gpencil.select_grouped", "type", text="Grouped")
1277
1278         layout.separator()
1279
1280         layout.operator("gpencil.select_first")
1281         layout.operator("gpencil.select_last")
1282
1283         layout.separator()
1284
1285         layout.operator("gpencil.select_more")
1286         layout.operator("gpencil.select_less")
1287
1288
1289 class VIEW3D_MT_select_paint_mask(Menu):
1290     bl_label = "Select"
1291
1292     def draw(self, context):
1293         layout = self.layout
1294
1295         layout.operator("paint.face_select_all", text="All").action = 'SELECT'
1296         layout.operator("paint.face_select_all", text="None").action = 'DESELECT'
1297         layout.operator("paint.face_select_all", text="Invert").action = 'INVERT'
1298
1299         layout.separator()
1300
1301         layout.operator("view3d.select_box")
1302         layout.operator("view3d.select_circle")
1303
1304         layout.separator()
1305
1306         layout.operator("paint.face_select_linked", text="Linked")
1307
1308
1309 class VIEW3D_MT_select_paint_mask_vertex(Menu):
1310     bl_label = "Select"
1311
1312     def draw(self, context):
1313         layout = self.layout
1314
1315         layout.operator("paint.vert_select_all", text="All").action = 'SELECT'
1316         layout.operator("paint.vert_select_all", text="None").action = 'DESELECT'
1317         layout.operator("paint.vert_select_all", text="Invert").action = 'INVERT'
1318
1319         layout.separator()
1320
1321         layout.operator("view3d.select_box")
1322         layout.operator("view3d.select_circle")
1323
1324         layout.separator()
1325
1326         layout.operator("paint.vert_select_ungrouped", text="Ungrouped Verts")
1327
1328
1329 class VIEW3D_MT_angle_control(Menu):
1330     bl_label = "Angle Control"
1331
1332     @classmethod
1333     def poll(cls, context):
1334         settings = UnifiedPaintPanel.paint_settings(context)
1335         if not settings:
1336             return False
1337
1338         brush = settings.brush
1339         tex_slot = brush.texture_slot
1340
1341         return tex_slot.has_texture_angle and tex_slot.has_texture_angle_source
1342
1343     def draw(self, context):
1344         layout = self.layout
1345
1346         settings = UnifiedPaintPanel.paint_settings(context)
1347         brush = settings.brush
1348
1349         sculpt = (context.sculpt_object is not None)
1350
1351         tex_slot = brush.texture_slot
1352
1353         layout.prop(tex_slot, "use_rake", text="Rake")
1354
1355         if brush.brush_capabilities.has_random_texture_angle and tex_slot.has_random_texture_angle:
1356             if sculpt:
1357                 if brush.sculpt_capabilities.has_random_texture_angle:
1358                     layout.prop(tex_slot, "use_random", text="Random")
1359             else:
1360                 layout.prop(tex_slot, "use_random", text="Random")
1361
1362
1363 class VIEW3D_MT_mesh_add(Menu):
1364     bl_idname = "VIEW3D_MT_mesh_add"
1365     bl_label = "Mesh"
1366
1367     def draw(self, context):
1368         layout = self.layout
1369
1370         layout.operator_context = 'INVOKE_REGION_WIN'
1371
1372         layout.operator("mesh.primitive_plane_add", text="Plane", icon='MESH_PLANE')
1373         layout.operator("mesh.primitive_cube_add", text="Cube", icon='MESH_CUBE')
1374         layout.operator("mesh.primitive_circle_add", text="Circle", icon='MESH_CIRCLE')
1375         layout.operator("mesh.primitive_uv_sphere_add", text="UV Sphere", icon='MESH_UVSPHERE')
1376         layout.operator("mesh.primitive_ico_sphere_add", text="Ico Sphere", icon='MESH_ICOSPHERE')
1377         layout.operator("mesh.primitive_cylinder_add", text="Cylinder", icon='MESH_CYLINDER')
1378         layout.operator("mesh.primitive_cone_add", text="Cone", icon='MESH_CONE')
1379         layout.operator("mesh.primitive_torus_add", text="Torus", icon='MESH_TORUS')
1380
1381         layout.separator()
1382
1383         layout.operator("mesh.primitive_grid_add", text="Grid", icon='MESH_GRID')
1384         layout.operator("mesh.primitive_monkey_add", text="Monkey", icon='MESH_MONKEY')
1385
1386
1387 class VIEW3D_MT_curve_add(Menu):
1388     bl_idname = "VIEW3D_MT_curve_add"
1389     bl_label = "Curve"
1390
1391     def draw(self, context):
1392         layout = self.layout
1393
1394         layout.operator_context = 'INVOKE_REGION_WIN'
1395
1396         layout.operator("curve.primitive_bezier_curve_add", text="Bezier", icon='CURVE_BEZCURVE')
1397         layout.operator("curve.primitive_bezier_circle_add", text="Circle", icon='CURVE_BEZCIRCLE')
1398
1399         layout.separator()
1400
1401         layout.operator("curve.primitive_nurbs_curve_add", text="Nurbs Curve", icon='CURVE_NCURVE')
1402         layout.operator("curve.primitive_nurbs_circle_add", text="Nurbs Circle", icon='CURVE_NCIRCLE')
1403         layout.operator("curve.primitive_nurbs_path_add", text="Path", icon='CURVE_PATH')
1404
1405         layout.separator()
1406
1407         layout.operator("curve.draw", icon='LINE_DATA')
1408
1409
1410 class VIEW3D_MT_surface_add(Menu):
1411     bl_idname = "VIEW3D_MT_surface_add"
1412     bl_label = "Surface"
1413
1414     def draw(self, context):
1415         layout = self.layout
1416
1417         layout.operator_context = 'INVOKE_REGION_WIN'
1418
1419         layout.operator("surface.primitive_nurbs_surface_curve_add", text="Nurbs Curve", icon='SURFACE_NCURVE')
1420         layout.operator("surface.primitive_nurbs_surface_circle_add", text="Nurbs Circle", icon='SURFACE_NCIRCLE')
1421         layout.operator("surface.primitive_nurbs_surface_surface_add", text="Nurbs Surface", icon='SURFACE_NSURFACE')
1422         layout.operator("surface.primitive_nurbs_surface_cylinder_add",
1423                         text="Nurbs Cylinder", icon='SURFACE_NCYLINDER')
1424         layout.operator("surface.primitive_nurbs_surface_sphere_add", text="Nurbs Sphere", icon='SURFACE_NSPHERE')
1425         layout.operator("surface.primitive_nurbs_surface_torus_add", text="Nurbs Torus", icon='SURFACE_NTORUS')
1426
1427
1428 class VIEW3D_MT_metaball_add(Menu):
1429     bl_idname = "VIEW3D_MT_metaball_add"
1430     bl_label = "Metaball"
1431
1432     def draw(self, context):
1433         layout = self.layout
1434
1435         layout.operator_context = 'INVOKE_REGION_WIN'
1436         layout.operator_enum("object.metaball_add", "type")
1437
1438
1439 class TOPBAR_MT_edit_curve_add(Menu):
1440     bl_idname = "TOPBAR_MT_edit_curve_add"
1441     bl_label = "Add"
1442
1443     def draw(self, context):
1444         is_surf = context.active_object.type == 'SURFACE'
1445
1446         layout = self.layout
1447         layout.operator_context = 'EXEC_REGION_WIN'
1448
1449         if is_surf:
1450             VIEW3D_MT_surface_add.draw(self, context)
1451         else:
1452             VIEW3D_MT_curve_add.draw(self, context)
1453
1454
1455 class TOPBAR_MT_edit_armature_add(Menu):
1456     bl_idname = "TOPBAR_MT_edit_armature_add"
1457     bl_label = "Armature"
1458
1459     def draw(self, context):
1460         layout = self.layout
1461
1462         layout.operator_context = 'EXEC_REGION_WIN'
1463         layout.operator("armature.bone_primitive_add", text="Single Bone", icon='BONE_DATA')
1464
1465
1466 class VIEW3D_MT_armature_add(Menu):
1467     bl_idname = "VIEW3D_MT_armature_add"
1468     bl_label = "Armature"
1469
1470     def draw(self, context):
1471         layout = self.layout
1472
1473         layout.operator_context = 'EXEC_REGION_WIN'
1474         layout.operator("object.armature_add", text="Single Bone", icon='BONE_DATA')
1475
1476
1477 class VIEW3D_MT_light_add(Menu):
1478     bl_idname = "VIEW3D_MT_light_add"
1479     bl_label = "Light"
1480
1481     def draw(self, context):
1482         layout = self.layout
1483
1484         layout.operator_context = 'INVOKE_REGION_WIN'
1485         layout.operator_enum("object.light_add", "type")
1486
1487
1488 class VIEW3D_MT_lightprobe_add(Menu):
1489     bl_idname = "VIEW3D_MT_lightprobe_add"
1490     bl_label = "Light Probe"
1491
1492     def draw(self, context):
1493         layout = self.layout
1494
1495         layout.operator_context = 'INVOKE_REGION_WIN'
1496         layout.operator_enum("object.lightprobe_add", "type")
1497
1498
1499 class VIEW3D_MT_camera_add(Menu):
1500     bl_idname = "VIEW3D_MT_camera_add"
1501     bl_label = "Camera"
1502
1503     def draw(self, context):
1504         layout = self.layout
1505         layout.operator_context = 'EXEC_REGION_WIN'
1506         layout.operator("object.camera_add", text="Camera", icon='OUTLINER_OB_CAMERA')
1507
1508
1509 class VIEW3D_MT_add(Menu):
1510     bl_label = "Add"
1511
1512     def draw(self, context):
1513         layout = self.layout
1514
1515         # note, don't use 'EXEC_SCREEN' or operators won't get the 'v3d' context.
1516
1517         # Note: was EXEC_AREA, but this context does not have the 'rv3d', which prevents
1518         #       "align_view" to work on first call (see [#32719]).
1519         layout.operator_context = 'EXEC_REGION_WIN'
1520
1521         # layout.operator_menu_enum("object.mesh_add", "type", text="Mesh", icon='OUTLINER_OB_MESH')
1522         layout.menu("VIEW3D_MT_mesh_add", icon='OUTLINER_OB_MESH')
1523
1524         # layout.operator_menu_enum("object.curve_add", "type", text="Curve", icon='OUTLINER_OB_CURVE')
1525         layout.menu("VIEW3D_MT_curve_add", icon='OUTLINER_OB_CURVE')
1526         # layout.operator_menu_enum("object.surface_add", "type", text="Surface", icon='OUTLINER_OB_SURFACE')
1527         layout.menu("VIEW3D_MT_surface_add", icon='OUTLINER_OB_SURFACE')
1528         layout.menu("VIEW3D_MT_metaball_add", text="Metaball", icon='OUTLINER_OB_META')
1529         layout.operator("object.text_add", text="Text", icon='OUTLINER_OB_FONT')
1530         layout.operator_menu_enum("object.gpencil_add", "type", text="Grease Pencil", icon='OUTLINER_OB_GREASEPENCIL')
1531         layout.separator()
1532
1533         layout.menu("VIEW3D_MT_armature_add", icon='OUTLINER_OB_ARMATURE')
1534         layout.operator("object.add", text="Lattice", icon='OUTLINER_OB_LATTICE').type = 'LATTICE'
1535         layout.operator_menu_enum("object.empty_add", "type", text="Empty", icon='OUTLINER_OB_EMPTY')
1536         layout.menu("VIEW3D_MT_image_add", text="Image", icon='OUTLINER_OB_IMAGE')
1537
1538         layout.separator()
1539
1540         layout.operator("object.speaker_add", text="Speaker", icon='OUTLINER_OB_SPEAKER')
1541         layout.separator()
1542
1543         if VIEW3D_MT_camera_add.is_extended():
1544             layout.menu("VIEW3D_MT_camera_add", icon='OUTLINER_OB_CAMERA')
1545         else:
1546             VIEW3D_MT_camera_add.draw(self, context)
1547
1548         layout.menu("VIEW3D_MT_light_add", icon='OUTLINER_OB_LIGHT')
1549         layout.separator()
1550         layout.menu("VIEW3D_MT_lightprobe_add", icon='OUTLINER_OB_LIGHTPROBE')
1551         layout.separator()
1552
1553         layout.operator_menu_enum("object.effector_add", "type", text="Force Field", icon='OUTLINER_OB_FORCE_FIELD')
1554         layout.separator()
1555
1556         has_collections = bool(bpy.data.collections)
1557         col = layout.column()
1558         col.enabled = has_collections
1559
1560         if not has_collections or len(bpy.data.collections) > 10:
1561             col.operator_context = 'INVOKE_REGION_WIN'
1562             col.operator(
1563                 "object.collection_instance_add",
1564                 text="Collection Instance..." if has_collections else "No Collections to Instance",
1565                 icon='OUTLINER_OB_GROUP_INSTANCE',
1566             )
1567         else:
1568             col.operator_menu_enum(
1569                 "object.collection_instance_add",
1570                 "collection",
1571                 text="Collection Instance",
1572                 icon='OUTLINER_OB_GROUP_INSTANCE',
1573             )
1574
1575
1576 class VIEW3D_MT_image_add(Menu):
1577     bl_label = "Add Image"
1578
1579     def draw(self, context):
1580         layout = self.layout
1581         layout.operator("object.load_reference_image", text="Reference", icon='IMAGE_REFERENCE')
1582         layout.operator("object.load_background_image", text="Background", icon='IMAGE_BACKGROUND')
1583
1584
1585 class VIEW3D_MT_object_relations(Menu):
1586     bl_label = "Relations"
1587
1588     def draw(self, context):
1589         layout = self.layout
1590
1591         layout.operator("object.proxy_make", text="Make Proxy...")
1592
1593         layout.operator("object.make_dupli_face")
1594
1595         layout.separator()
1596
1597         layout.operator_menu_enum("object.make_local", "type", text="Make Local...")
1598         layout.menu("VIEW3D_MT_make_single_user")
1599
1600         layout.separator()
1601
1602         layout.operator("object.data_transfer")
1603         layout.operator("object.datalayout_transfer")
1604
1605
1606 class VIEW3D_MT_object(Menu):
1607     bl_context = "objectmode"
1608     bl_label = "Object"
1609
1610     def draw(self, context):
1611         layout = self.layout
1612
1613         layout.menu("VIEW3D_MT_transform_object")
1614         layout.operator_menu_enum("object.origin_set", text="Set Origin...", property="type")
1615         layout.menu("VIEW3D_MT_mirror")
1616         layout.menu("VIEW3D_MT_object_clear")
1617         layout.menu("VIEW3D_MT_object_apply")
1618         layout.menu("VIEW3D_MT_snap")
1619
1620         layout.separator()
1621
1622         layout.operator("object.duplicate_move")
1623         layout.operator("object.duplicate_move_linked")
1624         layout.operator("object.join")
1625
1626         layout.separator()
1627
1628         layout.operator("view3d.copybuffer", text="Copy Objects", icon='COPYDOWN')
1629         layout.operator("view3d.pastebuffer", text="Paste Objects", icon='PASTEDOWN')
1630
1631         layout.separator()
1632
1633         layout.menu("VIEW3D_MT_object_parent")
1634         layout.menu("VIEW3D_MT_object_collection")
1635         layout.menu("VIEW3D_MT_object_relations")
1636         layout.menu("VIEW3D_MT_object_constraints")
1637         layout.menu("VIEW3D_MT_object_track")
1638         layout.menu("VIEW3D_MT_make_links", text="Make Links...")
1639
1640         layout.separator()
1641
1642         layout.operator("object.shade_smooth")
1643         layout.operator("object.shade_flat")
1644
1645         layout.separator()
1646
1647         layout.menu("VIEW3D_MT_object_animation")
1648         layout.menu("VIEW3D_MT_object_rigid_body")
1649
1650         layout.separator()
1651
1652         layout.menu("VIEW3D_MT_object_quick_effects")
1653
1654         layout.separator()
1655
1656         layout.operator_menu_enum("object.convert", "target")
1657
1658         layout.separator()
1659
1660         layout.menu("VIEW3D_MT_object_showhide")
1661
1662         layout.separator()
1663
1664         layout.operator_context = 'EXEC_DEFAULT'
1665         layout.operator("object.delete", text="Delete").use_global = False
1666         layout.operator("object.delete", text="Delete Global").use_global = True
1667
1668
1669 class VIEW3D_MT_object_animation(Menu):
1670     bl_label = "Animation"
1671
1672     def draw(self, context):
1673         layout = self.layout
1674
1675         layout.operator("anim.keyframe_insert_menu", text="Insert Keyframe...")
1676         layout.operator("anim.keyframe_delete_v3d", text="Delete Keyframes...")
1677         layout.operator("anim.keyframe_clear_v3d", text="Clear Keyframes...")
1678         layout.operator("anim.keying_set_active_set", text="Change Keying Set...")
1679
1680         layout.separator()
1681
1682         layout.operator("nla.bake", text="Bake Action...")
1683
1684
1685 class VIEW3D_MT_object_rigid_body(Menu):
1686     bl_label = "Rigid Body"
1687
1688     def draw(self, context):
1689         layout = self.layout
1690
1691         layout.operator("rigidbody.objects_add", text="Add Active").type = 'ACTIVE'
1692         layout.operator("rigidbody.objects_add", text="Add Passive").type = 'PASSIVE'
1693
1694         layout.separator()
1695
1696         layout.operator("rigidbody.objects_remove", text="Remove")
1697
1698         layout.separator()
1699
1700         layout.operator("rigidbody.shape_change", text="Change Shape")
1701         layout.operator("rigidbody.mass_calculate", text="Calculate Mass")
1702         layout.operator("rigidbody.object_settings_copy", text="Copy from Active")
1703         layout.operator("object.visual_transform_apply", text="Apply Transformation")
1704         layout.operator("rigidbody.bake_to_keyframes", text="Bake To Keyframes")
1705
1706         layout.separator()
1707
1708         layout.operator("rigidbody.connect", text="Connect")
1709
1710
1711 class VIEW3D_MT_object_clear(Menu):
1712     bl_label = "Clear"
1713
1714     def draw(self, context):
1715         layout = self.layout
1716
1717         layout.operator("object.location_clear", text="Location").clear_delta = False
1718         layout.operator("object.rotation_clear", text="Rotation").clear_delta = False
1719         layout.operator("object.scale_clear", text="Scale").clear_delta = False
1720
1721         layout.separator()
1722
1723         layout.operator("object.origin_clear", text="Origin")
1724
1725
1726 class VIEW3D_MT_object_specials(Menu):
1727     bl_label = "Object Context Menu"
1728
1729     @classmethod
1730     def poll(cls, context):
1731         # add more special types
1732         return context.object
1733
1734     def draw(self, context):
1735
1736         layout = self.layout
1737         view = context.space_data
1738
1739         obj = context.object
1740         is_eevee = context.scene.render.engine == 'BLENDER_EEVEE'
1741
1742         if obj.type == 'MESH':
1743
1744             layout.operator("object.shade_smooth", text="Smooth Shading")
1745             layout.operator("object.shade_flat", text="Flat Shading")
1746
1747             layout.separator()
1748
1749             layout.operator_context = 'INVOKE_REGION_WIN'
1750             layout.operator_menu_enum("object.origin_set", text="Set Origin...", property="type")
1751
1752             layout.operator_context = 'INVOKE_DEFAULT'
1753             layout.operator("object.join")
1754             layout.operator_menu_enum("object.convert", "target")
1755
1756         if obj.type == 'CAMERA':
1757             layout.operator_context = 'INVOKE_REGION_WIN'
1758
1759             if obj.data.type == 'PERSP':
1760                 props = layout.operator("wm.context_modal_mouse", text="Camera Lens Angle")
1761                 props.data_path_iter = "selected_editable_objects"
1762                 props.data_path_item = "data.lens"
1763                 props.input_scale = 0.1
1764                 if obj.data.lens_unit == 'MILLIMETERS':
1765                     props.header_text = "Camera Lens Angle: %.1fmm"
1766                 else:
1767                     props.header_text = "Camera Lens Angle: %.1f\u00B0"
1768
1769             else:
1770                 props = layout.operator("wm.context_modal_mouse", text="Camera Lens Scale")
1771                 props.data_path_iter = "selected_editable_objects"
1772                 props.data_path_item = "data.ortho_scale"
1773                 props.input_scale = 0.01
1774                 props.header_text = "Camera Lens Scale: %.3f"
1775
1776             if not obj.data.dof_object:
1777                 if view and view.camera == obj and view.region_3d.view_perspective == 'CAMERA':
1778                     props = layout.operator("ui.eyedropper_depth", text="DOF Distance (Pick)")
1779                 else:
1780                     props = layout.operator("wm.context_modal_mouse", text="DOF Distance")
1781                     props.data_path_iter = "selected_editable_objects"
1782                     props.data_path_item = "data.dof_distance"
1783                     props.input_scale = 0.02
1784                     props.header_text = "DOF Distance: %.3f"
1785
1786         if obj.type in {'CURVE', 'FONT'}:
1787             layout.operator_context = 'INVOKE_REGION_WIN'
1788
1789             props = layout.operator("wm.context_modal_mouse", text="Extrude Size")
1790             props.data_path_iter = "selected_editable_objects"
1791             props.data_path_item = "data.extrude"
1792             props.input_scale = 0.01
1793             props.header_text = "Extrude Size: %.3f"
1794
1795             props = layout.operator("wm.context_modal_mouse", text="Width Size")
1796             props.data_path_iter = "selected_editable_objects"
1797             props.data_path_item = "data.offset"
1798             props.input_scale = 0.01
1799             props.header_text = "Width Size: %.3f"
1800
1801         if obj.type == 'EMPTY':
1802             layout.operator_context = 'INVOKE_REGION_WIN'
1803
1804             props = layout.operator("wm.context_modal_mouse", text="Empty Draw Size")
1805             props.data_path_iter = "selected_editable_objects"
1806             props.data_path_item = "empty_display_size"
1807             props.input_scale = 0.01
1808             props.header_text = "Empty Draw Size: %.3f"
1809
1810         if obj.type == 'LIGHT':
1811             light = obj.data
1812
1813             layout.operator_context = 'INVOKE_REGION_WIN'
1814
1815             emission_node = None
1816             if light.node_tree:
1817                 for node in light.node_tree.nodes:
1818                     if getattr(node, "type", None) == 'EMISSION':
1819                         emission_node = node
1820                         break
1821
1822             if is_eevee and not emission_node:
1823                 props = layout.operator("wm.context_modal_mouse", text="Energy")
1824                 props.data_path_iter = "selected_editable_objects"
1825                 props.data_path_item = "data.energy"
1826                 props.header_text = "Light Energy: %.3f"
1827
1828             if emission_node is not None:
1829                 props = layout.operator("wm.context_modal_mouse", text="Energy")
1830                 props.data_path_iter = "selected_editable_objects"
1831                 props.data_path_item = (
1832                     "data.node_tree"
1833                     ".nodes[\"" + emission_node.name + "\"]"
1834                     ".inputs[\"Strength\"].default_value"
1835                 )
1836                 props.header_text = "Light Energy: %.3f"
1837                 props.input_scale = 0.1
1838
1839             if light.type == 'AREA':
1840                 props = layout.operator("wm.context_modal_mouse", text="Size X")
1841                 props.data_path_iter = "selected_editable_objects"
1842                 props.data_path_item = "data.size"
1843                 props.header_text = "Light Size X: %.3f"
1844
1845                 if light.shape in {'RECTANGLE', 'ELLIPSE'}:
1846                     props = layout.operator("wm.context_modal_mouse", text="Size Y")
1847                     props.data_path_iter = "selected_editable_objects"
1848                     props.data_path_item = "data.size_y"
1849                     props.header_text = "Light Size Y: %.3f"
1850
1851             elif light.type in {'SPOT', 'POINT', 'SUN'}:
1852                 props = layout.operator("wm.context_modal_mouse", text="Radius")
1853                 props.data_path_iter = "selected_editable_objects"
1854                 props.data_path_item = "data.shadow_soft_size"
1855                 props.header_text = "Light Radius: %.3f"
1856
1857             if light.type == 'SPOT':
1858                 layout.separator()
1859
1860                 props = layout.operator("wm.context_modal_mouse", text="Spot Size")
1861                 props.data_path_iter = "selected_editable_objects"
1862                 props.data_path_item = "data.spot_size"
1863                 props.input_scale = 0.01
1864                 props.header_text = "Spot Size: %.2f"
1865
1866                 props = layout.operator("wm.context_modal_mouse", text="Spot Blend")
1867                 props.data_path_iter = "selected_editable_objects"
1868                 props.data_path_item = "data.spot_blend"
1869                 props.input_scale = -0.01
1870                 props.header_text = "Spot Blend: %.2f"
1871
1872         layout.separator()
1873
1874         layout.operator("view3d.copybuffer", text="Copy Objects", icon='COPYDOWN')
1875         layout.operator("view3d.pastebuffer", text="Paste Objects", icon='PASTEDOWN')
1876
1877         layout.separator()
1878
1879         layout.operator("object.duplicate_move", icon='DUPLICATE')
1880         layout.operator("object.duplicate_move_linked")
1881
1882         layout.separator()
1883
1884         layout.menu("VIEW3D_MT_snap")
1885         layout.menu("VIEW3D_MT_object_parent")
1886         layout.operator_context = 'INVOKE_REGION_WIN'
1887
1888         if view and view.local_view:
1889             layout.operator("view3d.localview_remove_from")
1890         else:
1891             layout.operator("object.move_to_collection")
1892
1893         layout.separator()
1894
1895         layout.operator("anim.keyframe_insert_menu", text="Insert Keyframe...")
1896
1897         layout.separator()
1898
1899         layout.operator_context = 'EXEC_DEFAULT'
1900         layout.operator("object.delete", text="Delete").use_global = False
1901
1902
1903 class VIEW3D_MT_object_shading(Menu):
1904     # XXX, this menu is a place to store shading operator in object mode
1905     bl_label = "Shading"
1906
1907     def draw(self, context):
1908         layout = self.layout
1909         layout.operator("object.shade_smooth", text="Smooth")
1910         layout.operator("object.shade_flat", text="Flat")
1911
1912
1913 class VIEW3D_MT_object_apply(Menu):
1914     bl_label = "Apply"
1915
1916     def draw(self, context):
1917         layout = self.layout
1918
1919         props = layout.operator("object.transform_apply", text="Location", text_ctxt=i18n_contexts.default)
1920         props.location, props.rotation, props.scale = True, False, False
1921
1922         props = layout.operator("object.transform_apply", text="Rotation", text_ctxt=i18n_contexts.default)
1923         props.location, props.rotation, props.scale = False, True, False
1924
1925         props = layout.operator("object.transform_apply", text="Scale", text_ctxt=i18n_contexts.default)
1926         props.location, props.rotation, props.scale = False, False, True
1927         props = layout.operator("object.transform_apply", text="Rotation & Scale", text_ctxt=i18n_contexts.default)
1928         props.location, props.rotation, props.scale = False, True, True
1929
1930         layout.separator()
1931
1932         layout.operator(
1933             "object.transforms_to_deltas",
1934             text="Location to Deltas",
1935             text_ctxt=i18n_contexts.default,
1936         ).mode = 'LOC'
1937         layout.operator(
1938             "object.transforms_to_deltas",
1939             text="Rotation to Deltas",
1940             text_ctxt=i18n_contexts.default,
1941         ).mode = 'ROT'
1942         layout.operator(
1943             "object.transforms_to_deltas",
1944             text="Scale to Deltas",
1945             text_ctxt=i18n_contexts.default,
1946         ).mode = 'SCALE'
1947
1948         layout.operator(
1949             "object.transforms_to_deltas",
1950             text="All Transforms to Deltas",
1951             text_ctxt=i18n_contexts.default,
1952         ).mode = 'ALL'
1953         layout.operator("object.anim_transforms_to_deltas")
1954
1955         layout.separator()
1956
1957         layout.operator(
1958             "object.visual_transform_apply",
1959             text="Visual Transform",
1960             text_ctxt=i18n_contexts.default,
1961         )
1962         layout.operator(
1963             "object.convert",
1964             text="Visual Geometry to Mesh",
1965             text_ctxt=i18n_contexts.default,
1966         ).target = 'MESH'
1967         layout.operator("object.duplicates_make_real")
1968
1969
1970 class VIEW3D_MT_object_parent(Menu):
1971     bl_label = "Parent"
1972
1973     def draw(self, context):
1974         layout = self.layout
1975
1976         layout.operator_enum("object.parent_set", "type")
1977
1978         layout.separator()
1979
1980         layout.operator_enum("object.parent_clear", "type")
1981
1982
1983 class VIEW3D_MT_object_track(Menu):
1984     bl_label = "Track"
1985
1986     def draw(self, context):
1987         layout = self.layout
1988
1989         layout.operator_enum("object.track_set", "type")
1990
1991         layout.separator()
1992
1993         layout.operator_enum("object.track_clear", "type")
1994
1995
1996 class VIEW3D_MT_object_collection(Menu):
1997     bl_label = "Collection"
1998
1999     def draw(self, context):
2000         layout = self.layout
2001
2002         layout.operator("collection.create")
2003         # layout.operator_menu_enum("collection.objects_remove", "collection")  # BUGGY
2004         layout.operator("collection.objects_remove")
2005         layout.operator("collection.objects_remove_all")
2006
2007         layout.separator()
2008
2009         layout.operator("collection.objects_add_active")
2010         layout.operator("collection.objects_remove_active")
2011
2012
2013 class VIEW3D_MT_object_constraints(Menu):
2014     bl_label = "Constraints"
2015
2016     def draw(self, context):
2017         layout = self.layout
2018
2019         layout.operator("object.constraint_add_with_targets")
2020         layout.operator("object.constraints_copy")
2021
2022         layout.separator()
2023
2024         layout.operator("object.constraints_clear")
2025
2026
2027 class VIEW3D_MT_object_quick_effects(Menu):
2028     bl_label = "Quick Effects"
2029
2030     def draw(self, context):
2031         layout = self.layout
2032
2033         layout.operator("object.quick_fur")
2034         layout.operator("object.quick_explode")
2035         layout.operator("object.quick_smoke")
2036         layout.operator("object.quick_fluid")
2037
2038
2039 class VIEW3D_MT_object_showhide(Menu):
2040     bl_label = "Show/Hide"
2041
2042     def draw(self, context):
2043         layout = self.layout
2044
2045         layout.operator("object.hide_view_clear", text="Show Hidden")
2046
2047         layout.separator()
2048
2049         layout.operator("object.hide_view_set", text="Hide Selected").unselected = False
2050         layout.operator("object.hide_view_set", text="Hide Unselected").unselected = True
2051
2052
2053 class VIEW3D_MT_make_single_user(Menu):
2054     bl_label = "Make Single User"
2055
2056     def draw(self, context):
2057         layout = self.layout
2058
2059         props = layout.operator("object.make_single_user", text="Object")
2060         props.object = True
2061         props.obdata = props.material = props.animation = False
2062
2063         props = layout.operator("object.make_single_user", text="Object & Data")
2064         props.object = props.obdata = True
2065         props.material = props.animation = False
2066
2067         props = layout.operator("object.make_single_user", text="Object & Data & Materials")
2068         props.object = props.obdata = props.material = True
2069         props.animation = False
2070
2071         props = layout.operator("object.make_single_user", text="Materials")
2072         props.material = True
2073         props.object = props.obdata = props.animation = False
2074
2075         props = layout.operator("object.make_single_user", text="Object Animation")
2076         props.animation = True
2077         props.object = props.obdata = props.material = False
2078
2079
2080 class VIEW3D_MT_make_links(Menu):
2081     bl_label = "Make Links"
2082
2083     def draw(self, context):
2084         layout = self.layout
2085         operator_context_default = layout.operator_context
2086
2087         if len(bpy.data.scenes) > 10:
2088             layout.operator_context = 'INVOKE_REGION_WIN'
2089             layout.operator("object.make_links_scene", text="Objects to Scene...", icon='OUTLINER_OB_EMPTY')
2090         else:
2091             layout.operator_context = 'EXEC_REGION_WIN'
2092             layout.operator_menu_enum("object.make_links_scene", "scene", text="Objects to Scene")
2093
2094         layout.separator()
2095
2096         layout.operator_context = operator_context_default
2097
2098         layout.operator_enum("object.make_links_data", "type")  # inline
2099
2100         layout.operator("object.join_uvs")  # stupid place to add this!
2101
2102
2103 class VIEW3D_MT_brush(Menu):
2104     bl_label = "Brush"
2105
2106     def draw(self, context):
2107         layout = self.layout
2108
2109         tool_settings = context.tool_settings
2110         settings = UnifiedPaintPanel.paint_settings(context)
2111         brush = getattr(settings, "brush", None)
2112
2113         ups = tool_settings.unified_paint_settings
2114         layout.prop(ups, "use_unified_size", text="Unified Size")
2115         layout.prop(ups, "use_unified_strength", text="Unified Strength")
2116         if context.image_paint_object or context.vertex_paint_object:
2117             layout.prop(ups, "use_unified_color", text="Unified Color")
2118         layout.separator()
2119
2120         # skip if no active brush
2121         if not brush:
2122             layout.label(text="No Brushes currently available", icon='INFO')
2123             return
2124
2125         # brush paint modes
2126         layout.menu("VIEW3D_MT_brush_paint_modes")
2127
2128         # brush tool
2129         if context.sculpt_object:
2130             layout.operator("brush.reset")
2131             layout.prop_menu_enum(brush, "sculpt_tool")
2132         elif context.image_paint_object:
2133             layout.prop_menu_enum(brush, "image_tool")
2134         elif context.vertex_paint_object:
2135             layout.prop_menu_enum(brush, "vertex_tool")
2136         elif context.weight_paint_object:
2137             layout.prop_menu_enum(brush, "weight_tool")
2138
2139         # TODO: still missing a lot of brush options here
2140
2141         # sculpt options
2142         if context.sculpt_object:
2143
2144             sculpt_tool = brush.sculpt_tool
2145
2146             layout.separator()
2147             layout.operator_menu_enum("brush.curve_preset", "shape", text="Curve Preset")
2148             layout.separator()
2149
2150             if sculpt_tool != 'GRAB':
2151                 layout.prop_menu_enum(brush, "stroke_method")
2152
2153                 if sculpt_tool in {'DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'}:
2154                     layout.prop_menu_enum(brush, "direction")
2155
2156                 if sculpt_tool == 'LAYER':
2157                     layout.prop(brush, "use_persistent")
2158                     layout.operator("sculpt.set_persistent_base")
2159
2160
2161 class VIEW3D_MT_brush_paint_modes(Menu):
2162     bl_label = "Enabled Modes"
2163
2164     def draw(self, context):
2165         layout = self.layout
2166
2167         settings = UnifiedPaintPanel.paint_settings(context)
2168         brush = settings.brush
2169
2170         layout.prop(brush, "use_paint_sculpt", text="Sculpt")
2171         layout.prop(brush, "use_paint_vertex", text="Vertex Paint")
2172         layout.prop(brush, "use_paint_weight", text="Weight Paint")
2173         layout.prop(brush, "use_paint_image", text="Texture Paint")
2174
2175
2176 class VIEW3D_MT_paint_vertex(Menu):
2177     bl_label = "Paint"
2178
2179     def draw(self, context):
2180         layout = self.layout
2181
2182         layout.operator("paint.vertex_color_set")
2183         layout.operator("paint.vertex_color_smooth")
2184         layout.operator("paint.vertex_color_dirt")
2185         layout.operator("paint.vertex_color_from_weight")
2186
2187         layout.separator()
2188
2189         layout.operator("paint.vertex_color_invert", text="Invert")
2190         layout.operator("paint.vertex_color_levels", text="Levels")
2191         layout.operator("paint.vertex_color_hsv", text="Hue Saturation Value")
2192         layout.operator("paint.vertex_color_brightness_contrast", text="Bright/Contrast")
2193
2194
2195 class VIEW3D_MT_hook(Menu):
2196     bl_label = "Hooks"
2197
2198     def draw(self, context):
2199         layout = self.layout
2200         layout.operator_context = 'EXEC_AREA'
2201         layout.operator("object.hook_add_newob")
2202         layout.operator("object.hook_add_selob").use_bone = False
2203         layout.operator("object.hook_add_selob", text="Hook to Selected Object Bone").use_bone = True
2204
2205         if [mod.type == 'HOOK' for mod in context.active_object.modifiers]:
2206             layout.separator()
2207
2208             layout.operator_menu_enum("object.hook_assign", "modifier")
2209             layout.operator_menu_enum("object.hook_remove", "modifier")
2210
2211             layout.separator()
2212
2213             layout.operator_menu_enum("object.hook_select", "modifier")
2214             layout.operator_menu_enum("object.hook_reset", "modifier")
2215             layout.operator_menu_enum("object.hook_recenter", "modifier")
2216
2217
2218 class VIEW3D_MT_vertex_group(Menu):
2219     bl_label = "Vertex Groups"
2220
2221     def draw(self, context):
2222         layout = self.layout
2223
2224         layout.operator_context = 'EXEC_AREA'
2225         layout.operator("object.vertex_group_assign_new")
2226
2227         ob = context.active_object
2228         if ob.mode == 'EDIT' or (ob.mode == 'WEIGHT_PAINT' and ob.type == 'MESH' and ob.data.use_paint_mask_vertex):
2229             if ob.vertex_groups.active:
2230                 layout.separator()
2231
2232                 layout.operator("object.vertex_group_assign", text="Assign to Active Group")
2233                 layout.operator(
2234                     "object.vertex_group_remove_from",
2235                     text="Remove from Active Group",
2236                 ).use_all_groups = False
2237                 layout.operator("object.vertex_group_remove_from", text="Remove from All").use_all_groups = True
2238
2239         if ob.vertex_groups.active:
2240             layout.separator()
2241
2242             layout.operator_menu_enum("object.vertex_group_set_active", "group", text="Set Active Group")
2243             layout.operator("object.vertex_group_remove", text="Remove Active Group").all = False
2244             layout.operator("object.vertex_group_remove", text="Remove All Groups").all = True
2245
2246
2247 class VIEW3D_MT_paint_weight(Menu):
2248     bl_label = "Weights"
2249
2250     @staticmethod
2251     def draw_generic(layout, is_editmode=False):
2252
2253         if not is_editmode:
2254
2255             layout.operator("paint.weight_from_bones", text="Assign Automatic From Bones").type = 'AUTOMATIC'
2256             layout.operator("paint.weight_from_bones", text="Assign From Bone Envelopes").type = 'ENVELOPES'
2257
2258             layout.separator()
2259
2260         layout.operator("object.vertex_group_normalize_all", text="Normalize All")
2261         layout.operator("object.vertex_group_normalize", text="Normalize")
2262
2263         layout.separator()
2264
2265         layout.operator("object.vertex_group_mirror", text="Mirror")
2266         layout.operator("object.vertex_group_invert", text="Invert")
2267         layout.operator("object.vertex_group_clean", text="Clean")
2268
2269         layout.separator()
2270
2271         layout.operator("object.vertex_group_quantize", text="Quantize")
2272         layout.operator("object.vertex_group_levels", text="Levels")
2273         layout.operator("object.vertex_group_smooth", text="Smooth")
2274
2275         if not is_editmode:
2276             props = layout.operator("object.data_transfer", text="Transfer Weights")
2277             props.use_reverse_transfer = True
2278             props.data_type = 'VGROUP_WEIGHTS'
2279
2280         layout.operator("object.vertex_group_limit_total", text="Limit Total")
2281         layout.operator("object.vertex_group_fix", text="Fix Deforms")
2282
2283         if not is_editmode:
2284             layout.separator()
2285
2286             layout.operator("paint.weight_set")
2287
2288     def draw(self, context):
2289         self.draw_generic(self.layout, is_editmode=False)
2290
2291
2292 class VIEW3D_MT_sculpt(Menu):
2293     bl_label = "Sculpt"
2294
2295     def draw(self, context):
2296         layout = self.layout
2297
2298         tool_settings = context.tool_settings
2299         sculpt = tool_settings.sculpt
2300
2301         layout.prop(sculpt, "use_symmetry_x")
2302         layout.prop(sculpt, "use_symmetry_y")
2303         layout.prop(sculpt, "use_symmetry_z")
2304
2305         layout.separator()
2306
2307         layout.prop(sculpt, "lock_x")
2308         layout.prop(sculpt, "lock_y")
2309         layout.prop(sculpt, "lock_z")
2310
2311         layout.separator()
2312
2313         layout.prop(sculpt, "use_threaded", text="Threaded Sculpt")
2314         layout.prop(sculpt, "show_low_resolution")
2315         layout.prop(sculpt, "show_brush")
2316         layout.prop(sculpt, "use_deform_only")
2317         layout.prop(sculpt, "show_diffuse_color")
2318         layout.prop(sculpt, "show_mask")
2319
2320
2321 class VIEW3D_MT_hide_mask(Menu):
2322     bl_label = "Hide/Mask"
2323
2324     def draw(self, context):
2325         layout = self.layout
2326
2327         props = layout.operator("paint.hide_show", text="Show All")
2328         props.action = 'SHOW'
2329         props.area = 'ALL'
2330
2331         props = layout.operator("paint.hide_show", text="Hide Bounding Box")
2332         props.action = 'HIDE'
2333         props.area = 'INSIDE'
2334
2335         props = layout.operator("paint.hide_show", text="Show Bounding Box")
2336         props.action = 'SHOW'
2337         props.area = 'INSIDE'
2338
2339         props = layout.operator("paint.hide_show", text="Hide Masked")
2340         props.area = 'MASKED'
2341         props.action = 'HIDE'
2342
2343         layout.separator()
2344
2345         props = layout.operator("paint.mask_flood_fill", text="Invert Mask")
2346         props.mode = 'INVERT'
2347
2348         props = layout.operator("paint.mask_flood_fill", text="Fill Mask")
2349         props.mode = 'VALUE'
2350         props.value = 1
2351
2352         props = layout.operator("paint.mask_flood_fill", text="Clear Mask")
2353         props.mode = 'VALUE'
2354         props.value = 0
2355
2356         props = layout.operator("view3d.select_box", text="Box Mask")
2357         props = layout.operator("paint.mask_lasso_gesture", text="Lasso Mask")
2358
2359
2360 class VIEW3D_MT_particle(Menu):
2361     bl_label = "Particle"
2362
2363     def draw(self, context):
2364         layout = self.layout
2365         tool_settings = context.tool_settings
2366
2367         particle_edit = tool_settings.particle_edit
2368
2369         layout.operator("particle.mirror")
2370
2371         layout.operator("particle.remove_doubles")
2372
2373         layout.separator()
2374
2375         if particle_edit.select_mode == 'POINT':
2376             layout.operator("particle.subdivide")
2377
2378         layout.operator("particle.unify_length")
2379         layout.operator("particle.rekey")
2380         layout.operator("particle.weight_set")
2381
2382         layout.separator()
2383
2384         layout.menu("VIEW3D_MT_particle_showhide")
2385
2386         layout.separator()
2387
2388         layout.operator("particle.delete")
2389
2390
2391 class VIEW3D_MT_particle_specials(Menu):
2392     bl_label = "Particle Context Menu"
2393
2394     def draw(self, context):
2395         layout = self.layout
2396         tool_settings = context.tool_settings
2397
2398         particle_edit = tool_settings.particle_edit
2399
2400         layout.operator("particle.rekey")
2401
2402         layout.separator()
2403
2404         layout.operator("particle.delete")
2405
2406         layout.separator()
2407
2408         layout.operator("particle.remove_doubles")
2409         layout.operator("particle.unify_length")
2410
2411         if particle_edit.select_mode == 'POINT':
2412             layout.operator("particle.subdivide")
2413
2414         layout.operator("particle.weight_set")
2415
2416         layout.separator()
2417
2418         layout.operator("particle.mirror")
2419
2420         if particle_edit.select_mode == 'POINT':
2421             layout.separator()
2422
2423             layout.operator("particle.select_all", text="All").action = 'SELECT'
2424             layout.operator("particle.select_all", text="None").action = 'DESELECT'
2425             layout.operator("particle.select_all", text="Invert").action = 'INVERT'
2426
2427             layout.separator()
2428
2429             layout.operator("particle.select_roots")
2430             layout.operator("particle.select_tips")
2431
2432             layout.separator()
2433
2434             layout.operator("particle.select_random")
2435
2436             layout.separator()
2437
2438             layout.operator("particle.select_more")
2439             layout.operator("particle.select_less")
2440
2441             layout.separator()
2442
2443             layout.operator("particle.select_linked")
2444
2445
2446 class VIEW3D_MT_particle_showhide(ShowHideMenu, Menu):
2447     _operator_name = "particle"
2448
2449
2450 class VIEW3D_MT_pose(Menu):
2451     bl_label = "Pose"
2452
2453     def draw(self, context):
2454         layout = self.layout
2455
2456         layout.menu("VIEW3D_MT_transform_armature")
2457
2458         layout.menu("VIEW3D_MT_pose_transform")
2459         layout.menu("VIEW3D_MT_pose_apply")
2460
2461         layout.menu("VIEW3D_MT_snap")
2462
2463         layout.separator()
2464
2465         layout.menu("VIEW3D_MT_object_animation")
2466
2467         layout.separator()
2468
2469         layout.menu("VIEW3D_MT_pose_slide")
2470         layout.menu("VIEW3D_MT_pose_propagate")
2471
2472         layout.separator()
2473
2474         layout.operator("pose.copy", icon='COPYDOWN')
2475         layout.operator("pose.paste", icon='PASTEDOWN').flipped = False
2476         layout.operator("pose.paste", text="Paste Pose Flipped").flipped = True
2477
2478         layout.separator()
2479
2480         layout.menu("VIEW3D_MT_pose_library")
2481         layout.menu("VIEW3D_MT_pose_motion")
2482         layout.menu("VIEW3D_MT_pose_group")
2483
2484         layout.separator()
2485
2486         layout.menu("VIEW3D_MT_object_parent")
2487         layout.menu("VIEW3D_MT_pose_ik")
2488         layout.menu("VIEW3D_MT_pose_constraints")
2489
2490         layout.separator()
2491
2492         layout.operator_context = 'EXEC_AREA'
2493         layout.operator("pose.autoside_names", text="AutoName Left/Right").axis = 'XAXIS'
2494         layout.operator("pose.autoside_names", text="AutoName Front/Back").axis = 'YAXIS'
2495         layout.operator("pose.autoside_names", text="AutoName Top/Bottom").axis = 'ZAXIS'
2496
2497         layout.operator("pose.flip_names")
2498
2499         layout.operator("pose.quaternions_flip")
2500
2501         layout.separator()
2502
2503         layout.operator_context = 'INVOKE_AREA'
2504         layout.operator("armature.armature_layers", text="Change Armature Layers...")
2505         layout.operator("pose.bone_layers", text="Change Bone Layers...")
2506
2507         layout.separator()
2508
2509         layout.menu("VIEW3D_MT_pose_showhide")
2510         layout.menu("VIEW3D_MT_bone_options_toggle", text="Bone Settings")
2511
2512
2513 class VIEW3D_MT_pose_transform(Menu):
2514     bl_label = "Clear Transform"
2515
2516     def draw(self, context):
2517         layout = self.layout
2518
2519         layout.operator("pose.transforms_clear", text="All")
2520
2521         layout.separator()
2522
2523         layout.operator("pose.loc_clear", text="Location")
2524         layout.operator("pose.rot_clear", text="Rotation")
2525         layout.operator("pose.scale_clear", text="Scale")
2526
2527         layout.separator()
2528
2529         layout.operator("pose.user_transforms_clear", text="Reset Unkeyed")
2530
2531
2532 class VIEW3D_MT_pose_slide(Menu):
2533     bl_label = "In-Betweens"
2534
2535     def draw(self, context):
2536         layout = self.layout
2537
2538         layout.operator("pose.push")
2539         layout.operator("pose.relax")
2540         layout.operator("pose.breakdown")
2541
2542
2543 class VIEW3D_MT_pose_propagate(Menu):
2544     bl_label = "Propagate"
2545
2546     def draw(self, context):
2547         layout = self.layout
2548
2549         layout.operator("pose.propagate").mode = 'WHILE_HELD'
2550
2551         layout.separator()
2552
2553         layout.operator("pose.propagate", text="To Next Keyframe").mode = 'NEXT_KEY'
2554         layout.operator("pose.propagate", text="To Last Keyframe (Make Cyclic)").mode = 'LAST_KEY'
2555
2556         layout.separator()
2557
2558         layout.operator("pose.propagate", text="On Selected Keyframes").mode = 'SELECTED_KEYS'
2559
2560         layout.separator()
2561
2562         layout.operator("pose.propagate", text="On Selected Markers").mode = 'SELECTED_MARKERS'
2563
2564
2565 class VIEW3D_MT_pose_library(Menu):
2566     bl_label = "Pose Library"
2567
2568     def draw(self, context):
2569         layout = self.layout
2570
2571         layout.operator("poselib.browse_interactive", text="Browse Poses...")
2572
2573         layout.separator()
2574
2575         layout.operator("poselib.pose_add", text="Add Pose...")
2576         layout.operator("poselib.pose_rename", text="Rename Pose...")
2577         layout.operator("poselib.pose_remove", text="Remove Pose...")
2578
2579
2580 class VIEW3D_MT_pose_motion(Menu):
2581     bl_label = "Motion Paths"
2582
2583     def draw(self, context):
2584         layout = self.layout
2585
2586         layout.operator("pose.paths_calculate", text="Calculate")
2587         layout.operator("pose.paths_clear", text="Clear")
2588
2589
2590 class VIEW3D_MT_pose_group(Menu):
2591     bl_label = "Bone Groups"
2592
2593     def draw(self, context):
2594         layout = self.layout
2595
2596         pose = context.active_object.pose
2597
2598         layout.operator_context = 'EXEC_AREA'
2599         layout.operator("pose.group_assign", text="Assign to New Group").type = 0
2600
2601         if pose.bone_groups:
2602             active_group = pose.bone_groups.active_index + 1
2603             layout.operator("pose.group_assign", text="Assign to Group").type = active_group
2604
2605             layout.separator()
2606
2607             # layout.operator_context = 'INVOKE_AREA'
2608             layout.operator("pose.group_unassign")
2609             layout.operator("pose.group_remove")
2610
2611
2612 class VIEW3D_MT_pose_ik(Menu):
2613     bl_label = "Inverse Kinematics"
2614
2615     def draw(self, context):
2616         layout = self.layout
2617
2618         layout.operator("pose.ik_add")
2619         layout.operator("pose.ik_clear")
2620
2621
2622 class VIEW3D_MT_pose_constraints(Menu):
2623     bl_label = "Constraints"
2624
2625     def draw(self, context):
2626         layout = self.layout
2627
2628         layout.operator("pose.constraint_add_with_targets", text="Add (With Targets)...")
2629         layout.operator("pose.constraints_copy")
2630         layout.operator("pose.constraints_clear")
2631
2632
2633 class VIEW3D_MT_pose_showhide(ShowHideMenu, Menu):
2634     _operator_name = "pose"
2635
2636
2637 class VIEW3D_MT_pose_apply(Menu):
2638     bl_label = "Apply"
2639
2640     def draw(self, context):
2641         layout = self.layout
2642
2643         layout.operator("pose.armature_apply")
2644         layout.operator("pose.visual_transform_apply")
2645
2646
2647 class VIEW3D_MT_pose_specials(Menu):
2648     bl_label = "Pose Context Menu"
2649
2650     def draw(self, context):
2651         layout = self.layout
2652
2653         layout.operator("anim.keyframe_insert_menu", text="Insert Keyframe...")
2654
2655         layout.separator()
2656
2657         layout.operator("pose.copy", icon='COPYDOWN')
2658         layout.operator("pose.paste", icon='PASTEDOWN').flipped = False
2659         layout.operator("pose.paste", text="Paste X-Flipped Pose").flipped = True
2660
2661         layout.separator()
2662
2663         layout.operator("pose.select_constraint_target")
2664
2665         layout.separator()
2666
2667         layout.operator("pose.paths_calculate", text="Calculate")
2668         layout.operator("pose.paths_clear", text="Clear")
2669
2670         layout.separator()
2671
2672         layout.operator("pose.paths_calculate")
2673         layout.operator("pose.paths_clear")
2674
2675         layout.separator()
2676
2677         layout.operator("pose.hide").unselected = False
2678         layout.operator("pose.reveal")
2679
2680         layout.separator()
2681
2682         layout.operator("pose.user_transforms_clear")
2683
2684
2685 class BoneOptions:
2686     def draw(self, context):
2687         layout = self.layout
2688
2689         options = [
2690             "show_wire",
2691             "use_deform",
2692             "use_envelope_multiply",
2693             "use_inherit_rotation",
2694             "use_inherit_scale",
2695         ]
2696
2697         if context.mode == 'EDIT_ARMATURE':
2698             bone_props = bpy.types.EditBone.bl_rna.properties
2699             data_path_iter = "selected_bones"
2700             opt_suffix = ""
2701             options.append("lock")
2702         else:  # pose-mode
2703             bone_props = bpy.types.Bone.bl_rna.properties
2704             data_path_iter = "selected_pose_bones"
2705             opt_suffix = "bone."
2706
2707         for opt in options:
2708             props = layout.operator("wm.context_collection_boolean_set", text=bone_props[opt].name,
2709                                     text_ctxt=i18n_contexts.default)
2710             props.data_path_iter = data_path_iter
2711             props.data_path_item = opt_suffix + opt
2712             props.type = self.type
2713
2714
2715 class VIEW3D_MT_bone_options_toggle(Menu, BoneOptions):
2716     bl_label = "Toggle Bone Options"
2717     type = 'TOGGLE'
2718
2719
2720 class VIEW3D_MT_bone_options_enable(Menu, BoneOptions):
2721     bl_label = "Enable Bone Options"
2722     type = 'ENABLE'
2723
2724
2725 class VIEW3D_MT_bone_options_disable(Menu, BoneOptions):
2726     bl_label = "Disable Bone Options"
2727     type = 'DISABLE'
2728
2729
2730 # ********** Edit Menus, suffix from ob.type **********
2731
2732
2733 class VIEW3D_MT_edit_mesh(Menu):
2734     bl_label = "Mesh"
2735
2736     def draw(self, context):
2737         layout = self.layout
2738
2739         with_bullet = bpy.app.build_options.bullet
2740
2741         layout.menu("VIEW3D_MT_transform")
2742         layout.menu("VIEW3D_MT_mirror")
2743         layout.menu("VIEW3D_MT_snap")
2744
2745         layout.separator()
2746
2747         layout.operator("mesh.duplicate_move", text="Duplicate")
2748         layout.menu("VIEW3D_MT_edit_mesh_extrude")
2749         layout.operator("mesh.split")
2750         layout.operator("mesh.bisect")
2751
2752         if with_bullet:
2753             layout.operator("mesh.convex_hull")
2754
2755         layout.separator()
2756
2757         layout.operator("mesh.symmetrize")
2758         layout.operator("mesh.symmetry_snap")
2759
2760         layout.separator()
2761
2762         layout.menu("VIEW3D_MT_edit_mesh_normals")
2763         layout.menu("VIEW3D_MT_edit_mesh_shading")
2764         layout.menu("VIEW3D_MT_edit_mesh_weights")
2765         layout.operator_menu_enum("mesh.sort_elements", "type", text="Sort Elements...")
2766
2767         layout.separator()
2768
2769         layout.menu("VIEW3D_MT_edit_mesh_showhide")
2770         layout.operator_menu_enum("mesh.separate", "type")
2771         layout.menu("VIEW3D_MT_edit_mesh_clean")
2772
2773         layout.separator()
2774
2775         layout.menu("VIEW3D_MT_edit_mesh_delete")
2776
2777
2778 class VIEW3D_MT_edit_mesh_specials(Menu):
2779     bl_label = "Mesh Context Menu"
2780
2781     def draw(self, context):
2782         layout = self.layout
2783
2784         select_mode = context.tool_settings.mesh_select_mode
2785
2786         layout.operator_context = 'INVOKE_REGION_WIN'
2787
2788         layout.operator("mesh.subdivide", text="Subdivide")
2789
2790         layout.separator()
2791
2792         layout.operator("mesh.duplicate_move", text="Duplicate")
2793
2794         # Vertex Select Commands
2795         if select_mode[0]:
2796             layout.separator()
2797
2798             layout.operator("mesh.edge_face_add", text="New Edge/Face from Vertices")
2799             layout.operator("mesh.vert_connect_path", text="Connect Vertex Path")
2800             layout.operator("mesh.vert_connect", text="Connect Vertex Pairs")
2801
2802             layout.separator()
2803
2804             layout.operator("mesh.vertices_smooth", text="Smooth")
2805             layout.operator("mesh.vertices_smooth_laplacian", text="Smooth Laplacian")
2806
2807             layout.separator()
2808             layout.operator("mesh.merge", text="Merge Vertices...")
2809             layout.operator("mesh.remove_doubles", text="Remove Double Vertices")
2810             layout.operator("mesh.dissolve_verts")
2811             layout.operator("mesh.delete", text="Delete Vertices").type = 'VERT'
2812
2813         # Edge Select Commands
2814         if select_mode[1]:
2815             layout.separator()
2816
2817             layout.operator("mesh.bridge_edge_loops", text="Bridge Edge Loops")
2818
2819             layout.separator()
2820
2821             layout.operator("mesh.dissolve_edges")
2822             layout.operator("mesh.delete", text="Delete Edges").type = 'EDGE'
2823
2824         # Face Select Commands
2825         if select_mode[2]:
2826             layout.separator()
2827
2828             layout.operator("mesh.faces_shade_smooth")
2829             layout.operator("mesh.faces_shade_flat")
2830
2831             layout.separator()
2832
2833             layout.operator("mesh.bridge_edge_loops", text="Bridge Faces")
2834
2835             layout.separator()
2836
2837             layout.operator("mesh.poke")
2838
2839             layout.separator()
2840
2841             props = layout.operator("mesh.quads_convert_to_tris")
2842             props.quad_method = props.ngon_method = 'BEAUTY'
2843             layout.operator("mesh.tris_convert_to_quads")
2844
2845             layout.separator()
2846
2847             layout.menu("VIEW3D_MT_uv_map", text="UV Unwrap Faces...")
2848
2849             layout.separator()
2850
2851             layout.operator("mesh.dissolve_faces")
2852             layout.operator("mesh.delete", text="Delete Faces").type = 'FACE'
2853
2854         # General Mesh Commands
2855
2856         layout.separator()
2857
2858         layout.menu("VIEW3D_MT_snap", text="Snap...")
2859         layout.operator("transform.mirror", text="Mirror")
2860         layout.operator("mesh.symmetrize")
2861         layout.operator("mesh.symmetry_snap")
2862
2863         layout.separator()
2864
2865         layout.operator("mesh.hide", text="Hide").unselected = False
2866         layout.operator("mesh.reveal", text="Reveal")
2867
2868
2869 class VIEW3D_MT_edit_mesh_select_mode(Menu):
2870     bl_label = "Mesh Select Mode"
2871
2872     def draw(self, context):
2873         layout = self.layout
2874
2875         layout.operator_context = 'INVOKE_REGION_WIN'
2876         layout.operator("mesh.select_mode", text="Vertex", icon='VERTEXSEL').type = 'VERT'
2877         layout.operator("mesh.select_mode", text="Edge", icon='EDGESEL').type = 'EDGE'
2878         layout.operator("mesh.select_mode", text="Face", icon='FACESEL').type = 'FACE'
2879
2880
2881 class VIEW3D_MT_edit_mesh_extrude(Menu):
2882     bl_label = "Extrude"
2883
2884     _extrude_funcs = {
2885         'VERT': lambda layout:
2886             layout.operator("mesh.extrude_vertices_move", text="Extrude Vertices"),
2887         'EDGE': lambda layout:
2888             layout.operator("mesh.extrude_edges_move", text="Extrude Edges"),
2889         'REGION': lambda layout:
2890             layout.operator("view3d.edit_mesh_extrude_move_normal", text="Extrude Faces"),
2891         'REGION_VERT_NORMAL': lambda layout:
2892             layout.operator("view3d.edit_mesh_extrude_move_shrink_fatten", text="Extrude Faces Along Normals"),
2893         'FACE': lambda layout:
2894             layout.operator("mesh.extrude_faces_move", text="Extrude Individual Faces"),
2895     }
2896
2897     @staticmethod
2898     def extrude_options(context):
2899         tool_settings = context.tool_settings
2900         select_mode = tool_settings.mesh_select_mode
2901         mesh = context.object.data
2902
2903         menu = []
2904         if mesh.total_face_sel:
2905             menu += ['REGION', 'REGION_VERT_NORMAL', 'FACE']
2906         if mesh.total_edge_sel and (select_mode[0] or select_mode[1]):
2907             menu += ['EDGE']
2908         if mesh.total_vert_sel and select_mode[0]:
2909             menu += ['VERT']
2910
2911         # should never get here
2912         return menu
2913
2914     def draw(self, context):
2915         layout = self.layout
2916         layout.operator_context = 'INVOKE_REGION_WIN'
2917
2918         for menu_id in self.extrude_options(context):
2919             self._extrude_funcs[menu_id](layout)
2920
2921
2922 class VIEW3D_MT_edit_mesh_vertices(Menu):
2923     bl_label = "Vertex"
2924
2925     def draw(self, context):
2926         layout = self.layout
2927         layout.operator_context = 'INVOKE_REGION_WIN'
2928
2929         layout.operator("mesh.extrude_vertices_move", text="Extrude Vertices"),
2930         layout.operator("mesh.bevel", text="Bevel Vertices").vertex_only = True
2931
2932         layout.separator()
2933
2934         layout.operator("mesh.edge_face_add", text="New Edge/Face from Vertices")
2935         layout.operator("mesh.vert_connect_path", text="Connect Vertex Path")
2936         layout.operator("mesh.vert_connect", text="Connect Vertex Pairs")
2937
2938         layout.separator()
2939
2940         props = layout.operator("mesh.rip_move", text="Rip Vertices")
2941         props.MESH_OT_rip.use_fill = False
2942         props = layout.operator("mesh.rip_move", text="Rip Vertices and Fill")
2943         props.MESH_OT_rip.use_fill = True
2944         layout.operator("mesh.rip_edge_move", text="Rip Vertices and Extend")
2945
2946         layout.separator()
2947
2948         layout.operator("transform.vert_slide", text="Slide Vertices")
2949         layout.operator("mesh.vertices_smooth", text="Smooth Vertices")
2950
2951         layout.separator()
2952
2953         layout.operator("mesh.blend_from_shape")
2954         layout.operator("mesh.shape_propagate_to_all", text="Propagate to Shapes")
2955
2956         layout.separator()
2957
2958         layout.operator("mesh.merge", text="Merge Vertices")
2959         layout.operator("mesh.remove_doubles", text="Remove Double Vertices")
2960
2961         layout.separator()
2962
2963         layout.menu("VIEW3D_MT_vertex_group")
2964         layout.menu("VIEW3D_MT_hook")
2965
2966         layout.separator()
2967
2968         layout.operator("object.vertex_parent_set")
2969
2970
2971 class VIEW3D_MT_edit_mesh_edges_data(Menu):
2972     bl_label = "Edge Data"
2973
2974     def draw(self, context):
2975         layout = self.layout
2976
2977         with_freestyle = bpy.app.build_options.freestyle
2978
2979         layout.operator_context = 'INVOKE_REGION_WIN'
2980
2981         layout.operator("transform.edge_crease")
2982         layout.operator("transform.edge_bevelweight")
2983
2984         layout.separator()
2985
2986         layout.operator("mesh.mark_seam").clear = False
2987         layout.operator("mesh.mark_seam", text="Clear Seam").clear = True
2988
2989         layout.separator()
2990
2991         layout.operator("mesh.mark_sharp")
2992         layout.operator("mesh.mark_sharp", text="Clear Sharp").clear = True
2993
2994         layout.operator("mesh.mark_sharp", text="Mark Sharp from Vertices").use_verts = True
2995         props = layout.operator("mesh.mark_sharp", text="Clear Sharp from Vertices")
2996         props.use_verts = True
2997         props.clear = True
2998
2999         if with_freestyle:
3000             layout.separator()
3001
3002             layout.operator("mesh.mark_freestyle_edge").clear = False
3003             layout.operator("mesh.mark_freestyle_edge", text="Clear Freestyle Edge").clear = True
3004
3005
3006 class VIEW3D_MT_edit_mesh_edges(Menu):
3007     bl_label = "Edge"
3008
3009     def draw(self, context):
3010         layout = self.layout
3011
3012         with_freestyle = bpy.app.build_options.freestyle
3013
3014         layout.operator_context = 'INVOKE_REGION_WIN'
3015
3016         layout.operator("mesh.extrude_edges_move", text="Extrude Edges"),
3017         layout.operator("mesh.bevel", text="Bevel Edges").vertex_only = False
3018         layout.operator("mesh.bridge_edge_loops")
3019
3020         layout.separator()
3021
3022         layout.operator("mesh.subdivide")
3023         layout.operator("mesh.subdivide_edgering")
3024         layout.operator("mesh.unsubdivide")
3025
3026         layout.separator()
3027
3028         layout.operator("mesh.edge_rotate", text="Rotate Edge CW").use_ccw = False
3029         layout.operator("mesh.edge_rotate", text="Rotate Edge CCW").use_ccw = True
3030
3031         layout.separator()
3032
3033         layout.operator("transform.edge_slide")
3034         layout.operator("mesh.edge_split")
3035
3036         layout.separator()
3037
3038         layout.operator("transform.edge_crease")
3039         layout.operator("transform.edge_bevelweight")
3040
3041         layout.separator()
3042
3043         layout.operator("mesh.mark_seam").clear = False
3044         layout.operator("mesh.mark_seam", text="Clear Seam").clear = True
3045
3046         layout.separator()
3047
3048         layout.operator("mesh.mark_sharp")
3049         layout.operator("mesh.mark_sharp", text="Clear Sharp").clear = True
3050
3051         layout.operator("mesh.mark_sharp", text="Mark Sharp from Vertices").use_verts = True
3052         props = layout.operator("mesh.mark_sharp", text="Clear Sharp from Vertices")
3053         props.use_verts = True
3054         props.clear = True
3055
3056         if with_freestyle:
3057             layout.separator()
3058
3059             layout.operator("mesh.mark_freestyle_edge").clear = False
3060             layout.operator("mesh.mark_freestyle_edge", text="Clear Freestyle Edge").clear = True
3061
3062
3063 class VIEW3D_MT_edit_mesh_faces_data(Menu):
3064     bl_label = "Face Data"
3065
3066     def draw(self, context):
3067         layout = self.layout
3068
3069         with_freestyle = bpy.app.build_options.freestyle
3070
3071         layout.operator_context = 'INVOKE_REGION_WIN'
3072
3073         layout.operator("mesh.colors_rotate")
3074         layout.operator("mesh.colors_reverse")
3075
3076         layout.separator()
3077
3078         layout.operator("mesh.uvs_rotate")
3079         layout.operator("mesh.uvs_reverse")
3080
3081         layout.separator()
3082
3083         if with_freestyle:
3084             layout.operator("mesh.mark_freestyle_face").clear = False
3085             layout.operator("mesh.mark_freestyle_face", text="Clear Freestyle Face").clear = True
3086
3087
3088 class VIEW3D_MT_edit_mesh_faces(Menu):
3089     bl_label = "Face"
3090     bl_idname = "VIEW3D_MT_edit_mesh_faces"
3091
3092     def draw(self, context):
3093         layout = self.layout
3094
3095         layout.operator_context = 'INVOKE_REGION_WIN'
3096
3097         layout.operator("view3d.edit_mesh_extrude_move_normal", text="Extrude Faces"),
3098         layout.operator("view3d.edit_mesh_extrude_move_shrink_fatten", text="Extrude Faces Along Normals"),
3099         layout.operator("mesh.extrude_faces_move", text="Extrude Individual Faces"),
3100
3101         layout.separator()
3102
3103         layout.operator("mesh.inset")
3104         layout.operator("mesh.poke")
3105         props = layout.operator("mesh.quads_convert_to_tris")
3106         props.quad_method = props.ngon_method = 'BEAUTY'
3107         layout.operator("mesh.tris_convert_to_quads")
3108         layout.operator("mesh.solidify", text="Solidify Faces")
3109         layout.operator("mesh.wireframe")
3110
3111         layout.separator()
3112
3113         layout.operator("mesh.fill")
3114         layout.operator("mesh.fill_grid")
3115         layout.operator("mesh.beautify_fill")
3116
3117         layout.separator()
3118
3119         layout.operator("mesh.intersect")
3120         layout.operator("mesh.intersect_boolean")
3121
3122         layout.separator()
3123
3124         layout.operator("mesh.face_split_by_edges")
3125
3126         layout.separator()
3127
3128         layout.operator("mesh.faces_shade_smooth")
3129         layout.operator("mesh.faces_shade_flat")
3130
3131         layout.separator()
3132
3133         layout.menu("VIEW3D_MT_edit_mesh_faces_data")
3134
3135
3136 class VIEW3D_MT_edit_mesh_normals(Menu):
3137     bl_label = "Normals"
3138
3139     def draw(self, context):
3140         layout = self.layout
3141
3142         layout.operator("mesh.normals_make_consistent", text="Recalculate Outside").inside = False
3143         layout.operator("mesh.normals_make_consistent", text="Recalculate Inside").inside = True
3144
3145         layout.separator()
3146
3147         layout.operator("mesh.flip_normals")
3148         layout.operator("mesh.set_normals_from_faces", text="Set From Faces")
3149
3150         layout.operator("transform.rotate_normal", text="Rotate Normal")
3151         layout.operator("mesh.point_normals", text="Point normals to target")
3152
3153         layout.operator("mesh.merge_normals", text="Merge")
3154         layout.operator("mesh.split_normals", text="Split")
3155
3156         layout.operator("mesh.average_normals", text="Average Normals")
3157
3158         layout.label(text="Normal Vector")
3159
3160         layout.operator("mesh.normals_tools", text="Copy").mode = 'COPY'
3161         layout.operator("mesh.normals_tools", text="Paste").mode = 'PASTE'
3162
3163         layout.operator("mesh.normals_tools", text="Multiply").mode = 'MULTIPLY'
3164         layout.operator("mesh.normals_tools", text="Add").mode = 'ADD'
3165
3166         layout.operator("mesh.normals_tools", text="Reset").mode = 'RESET'
3167
3168         layout.operator("mesh.smoothen_normals", text="Smoothen")
3169
3170         layout.label(text="Face Strength")
3171         layout.operator("mesh.mod_weighted_strength", text="Face Select", icon='FACESEL').set = False
3172         layout.operator("mesh.mod_weighted_strength", text="Set Strength", icon='ADD').set = True
3173
3174
3175 class VIEW3D_MT_edit_mesh_shading(Menu):
3176     bl_label = "Shading"
3177
3178     def draw(self, context):
3179         layout = self.layout
3180
3181         layout.operator("mesh.faces_shade_smooth", text="Smooth Faces")
3182         layout.operator("mesh.faces_shade_flat", text="Flat Faces")
3183
3184         layout.separator()
3185
3186         layout.operator("mesh.mark_sharp", text="Smooth Edges").clear = True
3187         layout.operator("mesh.mark_sharp", text="Sharp Edges")
3188
3189         layout.separator()
3190
3191         props = layout.operator("mesh.mark_sharp", text="Smooth Vertices")
3192         props.use_verts = True
3193         props.clear = True
3194
3195         layout.operator("mesh.mark_sharp", text="Sharp Vertices").use_verts = True
3196
3197
3198 class VIEW3D_MT_edit_mesh_weights(Menu):
3199     bl_label = "Weights"
3200
3201     def draw(self, context):
3202         VIEW3D_MT_paint_weight.draw_generic(self.layout, is_editmode=True)
3203
3204
3205 class VIEW3D_MT_edit_mesh_clean(Menu):
3206     bl_label = "Clean Up"
3207
3208     def draw(self, context):
3209         layout = self.layout
3210
3211         layout.operator("mesh.delete_loose")
3212
3213         layout.separator()
3214
3215         layout.operator("mesh.decimate")
3216         layout.operator("mesh.dissolve_degenerate")
3217         layout.operator("mesh.dissolve_limited")
3218         layout.operator("mesh.face_make_planar")
3219
3220         layout.separator()
3221
3222         layout.operator("mesh.vert_connect_nonplanar")
3223         layout.operator("mesh.vert_connect_concave")
3224         layout.operator("mesh.remove_doubles")
3225         layout.operator("mesh.fill_holes")
3226
3227
3228 class VIEW3D_MT_edit_mesh_delete(Menu):
3229     bl_label = "Delete"
3230
3231     def draw(self, context):
3232         layout = self.layout
3233
3234         layout.operator_enum("mesh.delete", "type")
3235
3236         layout.separator()
3237
3238         layout.operator("mesh.dissolve_verts")
3239         layout.operator("mesh.dissolve_edges")
3240         layout.operator("mesh.dissolve_faces")
3241
3242         layout.separator()
3243
3244         layout.operator("mesh.dissolve_limited")
3245
3246         layout.separator()
3247
3248         layout.operator("mesh.edge_collapse")
3249         layout.operator("mesh.delete_edgeloop", text="Edge Loops")
3250
3251
3252 class VIEW3D_MT_edit_mesh_showhide(ShowHideMenu, Menu):
3253     _operator_name = "mesh"
3254
3255
3256 class VIEW3D_MT_edit_gpencil_delete(Menu):
3257     bl_label = "Delete"
3258
3259     def draw(self, context):
3260         layout = self.layout
3261
3262         layout.operator_enum("gpencil.delete", "type")
3263
3264         layout.separator()
3265
3266         layout.operator_enum("gpencil.dissolve", "type")
3267
3268         layout.separator()
3269
3270         layout.operator("gpencil.active_frames_delete_all")
3271 # Edit Curve
3272 # draw_curve is used by VIEW3D_MT_edit_curve and VIEW3D_MT_edit_surface
3273
3274
3275 def draw_curve(self, context):
3276     layout = self.layout
3277
3278     layout.menu("VIEW3D_MT_transform")
3279     layout.menu("VIEW3D_MT_mirror")
3280     layout.menu("VIEW3D_MT_snap")
3281
3282     layout.separator()
3283
3284     layout.operator("curve.spin")
3285     layout.operator("curve.duplicate_move")
3286
3287     layout.separator()
3288
3289     layout.operator("curve.split")
3290     layout.operator("curve.separate")
3291     layout.operator("curve.cyclic_toggle")
3292     layout.operator_menu_enum("curve.spline_type_set", "type")
3293
3294     layout.separator()
3295
3296     layout.menu("VIEW3D_MT_edit_curve_showhide")
3297     layout.menu("VIEW3D_MT_edit_curve_clean")
3298     layout.menu("VIEW3D_MT_edit_curve_delete")
3299
3300
3301 class VIEW3D_MT_edit_curve(Menu):
3302     bl_label = "Curve"
3303
3304     draw = draw_curve
3305
3306
3307 class VIEW3D_MT_edit_curve_ctrlpoints(Menu):
3308     bl_label = "Control Points"
3309
3310     def draw(self, context):
3311         layout = self.layout
3312
3313         edit_object = context.edit_object
3314
3315         if edit_object.type == 'CURVE':
3316             layout.operator("curve.extrude_move")
3317
3318             layout.separator()
3319
3320             layout.operator("curve.make_segment")
3321
3322             layout.separator()
3323
3324             layout.operator("transform.tilt")
3325             layout.operator("curve.tilt_clear")
3326
3327             layout.separator()
3328
3329             layout.operator_menu_enum("curve.handle_type_set", "type")
3330             layout.operator("curve.normals_make_consistent")
3331
3332             layout.separator()
3333
3334             layout.operator("curve.smooth")
3335             layout.operator("curve.smooth_weight")
3336             layout.operator("curve.smooth_radius")
3337             layout.operator("curve.smooth_tilt")
3338
3339             layout.separator()
3340
3341         layout.menu("VIEW3D_MT_hook")
3342
3343         layout.separator()
3344
3345         layout.operator("object.vertex_parent_set")
3346
3347
3348 class VIEW3D_MT_edit_curve_segments(Menu):
3349     bl_label = "Segments"
3350
3351     def draw(self, context):
3352         layout = self.layout
3353
3354         layout.operator("curve.subdivide")
3355         layout.operator("curve.switch_direction")
3356
3357
3358 class VIEW3D_MT_edit_curve_clean(Menu):
3359     bl_label = "Clean Up"
3360
3361     def draw(self, context):
3362         layout = self.layout
3363
3364         layout.operator("curve.decimate")
3365
3366
3367 class VIEW3D_MT_edit_curve_specials(Menu):
3368     bl_label = "Curve Context Menu"
3369
3370     def draw(self, context):
3371         # TODO(campbell): match mesh vertex menu.
3372         layout = self.layout
3373
3374         layout.operator("curve.subdivide")
3375         layout.operator("curve.switch_direction")
3376         layout.operator("curve.spline_weight_set")
3377         layout.operator("curve.radius_set")
3378
3379         layout.separator()
3380
3381         layout.operator("curve.smooth")
3382         layout.operator("curve.smooth_weight")
3383         layout.operator("curve.smooth_radius")
3384         layout.operator("curve.smooth_tilt")
3385
3386
3387 class VIEW3D_MT_edit_curve_delete(Menu):
3388     bl_label = "Delete"
3389
3390     def draw(self, context):
3391         layout = self.layout
3392
3393         layout.operator_enum("curve.delete", "type")
3394
3395         layout.separator()
3396
3397         layout.operator("curve.dissolve_verts")
3398
3399
3400 class VIEW3D_MT_edit_curve_showhide(ShowHideMenu, Menu):
3401     _operator_name = "curve"
3402
3403
3404 class VIEW3D_MT_edit_surface(Menu):
3405     bl_label = "Surface"
3406
3407     draw = draw_curve
3408
3409
3410 class VIEW3D_MT_edit_font(Menu):
3411     bl_label = "Text"
3412
3413     def draw(self, context):
3414         layout = self.layout
3415
3416         layout.menu("VIEW3D_MT_edit_text_chars")
3417
3418         layout.separator()
3419
3420         layout.operator("font.style_toggle", text="Toggle Bold").style = 'BOLD'
3421         layout.operator("font.style_toggle", text="Toggle Italic").style = 'ITALIC'
3422
3423         layout.separator()
3424
3425         layout.operator("font.style_toggle", text="Toggle Underline").style = 'UNDERLINE'
3426         layout.operator("font.style_toggle", text="Toggle Small Caps").style = 'SMALL_CAPS'
3427
3428
3429 class VIEW3D_MT_edit_text_chars(Menu):
3430     bl_label = "Special Characters"
3431
3432     def draw(self, context):
3433         layout = self.layout
3434
3435         layout.operator("font.text_insert", text="Copyright").text = "\u00A9"
3436         layout.operator("font.text_insert", text="Registered Trademark").text = "\u00AE"
3437
3438         layout.separator()
3439
3440         layout.operator("font.text_insert", text="Degree Sign").text = "\u00B0"
3441         layout.operator("font.text_insert", text="Multiplication Sign").text = "\u00D7"
3442         layout.operator("font.text_insert", text="Circle").text = "\u008A"
3443
3444         layout.separator()
3445
3446         layout.operator("font.text_insert", text="Superscript 1").text = "\u00B9"
3447         layout.operator("font.text_insert", text="Superscript 2").text = "\u00B2"
3448         layout.operator("font.text_insert", text="Superscript 3").text = "\u00B3"
3449
3450         layout.separator()
3451
3452         layout.operator("font.text_insert", text="Double >>").text = "\u00BB"
3453         layout.operator("font.text_insert", text="Double <<").text = "\u00AB"
3454         layout.operator("font.text_insert", text="Promillage").text = "\u2030"
3455
3456         layout.separator()
3457
3458         layout.operator("font.text_insert", text="Dutch Florin").text = "\u00A4"
3459         layout.operator("font.text_insert", text="British Pound").text = "\u00A3"
3460         layout.operator("font.text_insert", text="Japanese Yen").text = "\u00A5"
3461
3462         layout.separator()
3463
3464         layout.operator("font.text_insert", text="German S").text = "\u00DF"
3465         layout.operator("font.text_insert", text="Spanish Question Mark").text = "\u00BF"
3466         layout.operator("font.text_insert", text="Spanish Exclamation Mark").text = "\u00A1"
3467
3468
3469 class VIEW3D_MT_edit_meta(Menu):
3470     bl_label = "Metaball"
3471
3472     def draw(self, context):
3473         layout = self.layout
3474
3475         layout.menu("VIEW3D_MT_transform")
3476         layout.menu("VIEW3D_MT_mirror")
3477         layout.menu("VIEW3D_MT_snap")
3478
3479         layout.separator()
3480
3481         layout.operator("mball.duplicate_metaelems")
3482
3483         layout.separator()
3484
3485         layout.menu("VIEW3D_MT_edit_meta_showhide")
3486
3487         layout.operator_context = 'EXEC_DEFAULT'
3488         layout.operator("mball.delete_metaelems", text="Delete")
3489
3490
3491 class VIEW3D_MT_edit_meta_showhide(Menu):
3492     bl_label = "Show/Hide"
3493
3494     def draw(self, context):
3495         layout = self.layout
3496
3497         layout.operator("mball.reveal_metaelems", text="Show Hidden")
3498         layout.operator("mball.hide_metaelems", text="Hide Selected").unselected = False
3499         layout.operator("mball.hide_metaelems", text="Hide Unselected").unselected = True
3500
3501
3502 class VIEW3D_MT_edit_lattice(Menu):
3503     bl_label = "Lattice"
3504
3505     def draw(self, context):
3506         layout = self.layout
3507
3508         layout.separator()
3509
3510         layout.menu("VIEW3D_MT_transform")
3511         layout.menu("VIEW3D_MT_mirror")
3512         layout.menu("VIEW3D_MT_snap")
3513         layout.operator_menu_enum("lattice.flip", "axis")
3514
3515         layout.separator()
3516
3517         layout.operator("lattice.make_regular")
3518
3519         layout.separator()
3520
3521         layout.operator("object.vertex_parent_set")
3522
3523
3524 class VIEW3D_MT_edit_armature(Menu):
3525     bl_label = "Armature"
3526
3527     def draw(self, context):
3528         layout = self.layout
3529
3530         edit_object = context.edit_object
3531         arm = edit_object.data
3532
3533         layout.menu("VIEW3D_MT_transform_armature")
3534         layout.menu("VIEW3D_MT_mirror")
3535         layout.menu("VIEW3D_MT_snap")
3536         layout.menu("VIEW3D_MT_edit_armature_roll")
3537
3538         layout.separator()
3539
3540         layout.operator("armature.extrude_move")
3541
3542         if arm.use_mirror_x:
3543             layout.operator("armature.extrude_forked")
3544
3545         layout.operator("armature.duplicate_move")
3546         layout.operator("armature.merge")
3547         layout.operator("armature.fill")
3548         layout.operator("armature.split")
3549         layout.operator("armature.separate")
3550
3551         layout.separator()
3552
3553         layout.operator("armature.subdivide", text="Subdivide")
3554         layout.operator("armature.switch_direction", text="Switch Direction")
3555
3556         layout.separator()
3557
3558         layout.operator_context = 'EXEC_AREA'
3559         layout.operator("armature.symmetrize")
3560         layout.operator("armature.autoside_names", text="AutoName Left/Right").type = 'XAXIS'
3561         layout.operator("armature.autoside_names", text="AutoName Front/Back").type = 'YAXIS'
3562         layout.operator("armature.autoside_names", text="AutoName Top/Bottom").type = 'ZAXIS'
3563         layout.operator("armature.flip_names")
3564
3565         layout.separator()
3566
3567         layout.operator_context = 'INVOKE_DEFAULT'
3568         layout.operator("armature.armature_layers")
3569         layout.operator("armature.bone_layers")
3570
3571         layout.separator()
3572
3573         layout.menu("VIEW3D_MT_edit_armature_parent")
3574
3575         layout.separator()
3576
3577         layout.menu("VIEW3D_MT_bone_options_toggle", text="Bone Settings")
3578
3579 &