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