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