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