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