f13c7095f67718f4b9eb98571adb7794dd4681ee
[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 = settings.brush
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         # brush paint modes
1712         layout.menu("VIEW3D_MT_brush_paint_modes")
1713
1714         # brush tool
1715         if context.sculpt_object:
1716             layout.operator("brush.reset")
1717             layout.prop_menu_enum(brush, "sculpt_tool")
1718         elif context.image_paint_object:
1719             layout.prop_menu_enum(brush, "image_tool")
1720         elif context.vertex_paint_object or context.weight_paint_object:
1721             layout.prop_menu_enum(brush, "vertex_tool")
1722
1723         # skip if no active brush
1724         if not brush:
1725             return
1726
1727         # TODO: still missing a lot of brush options here
1728
1729         # sculpt options
1730         if context.sculpt_object:
1731
1732             sculpt_tool = brush.sculpt_tool
1733
1734             layout.separator()
1735             layout.operator_menu_enum("brush.curve_preset", "shape", text="Curve Preset")
1736             layout.separator()
1737
1738             if sculpt_tool != 'GRAB':
1739                 layout.prop_menu_enum(brush, "stroke_method")
1740
1741                 if sculpt_tool in {'DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'}:
1742                     layout.prop_menu_enum(brush, "direction")
1743
1744                 if sculpt_tool == 'LAYER':
1745                     layout.prop(brush, "use_persistent")
1746                     layout.operator("sculpt.set_persistent_base")
1747
1748
1749 class VIEW3D_MT_brush_paint_modes(Menu):
1750     bl_label = "Enabled Modes"
1751
1752     def draw(self, context):
1753         layout = self.layout
1754
1755         settings = UnifiedPaintPanel.paint_settings(context)
1756         brush = settings.brush
1757
1758         layout.prop(brush, "use_paint_sculpt", text="Sculpt")
1759         layout.prop(brush, "use_paint_vertex", text="Vertex Paint")
1760         layout.prop(brush, "use_paint_weight", text="Weight Paint")
1761         layout.prop(brush, "use_paint_image", text="Texture Paint")
1762
1763
1764 # ********** Vertex paint menu **********
1765
1766
1767 class VIEW3D_MT_paint_vertex(Menu):
1768     bl_label = "Paint"
1769
1770     def draw(self, context):
1771         layout = self.layout
1772
1773         layout.operator("ed.undo")
1774         layout.operator("ed.redo")
1775
1776         layout.separator()
1777
1778         layout.operator("paint.vertex_color_set")
1779         layout.operator("paint.vertex_color_smooth")
1780         layout.operator("paint.vertex_color_dirt")
1781
1782         layout.separator()
1783
1784         layout.operator("paint.vertex_color_invert", text="Invert")
1785         layout.operator("paint.vertex_color_levels", text="Levels")
1786         layout.operator("paint.vertex_color_hsv", text="Hue Saturation Value")
1787         layout.operator("paint.vertex_color_brightness_contrast", text="Bright/Contrast")
1788
1789
1790 class VIEW3D_MT_hook(Menu):
1791     bl_label = "Hooks"
1792
1793     def draw(self, context):
1794         layout = self.layout
1795         layout.operator_context = 'EXEC_AREA'
1796         layout.operator("object.hook_add_newob")
1797         layout.operator("object.hook_add_selob").use_bone = False
1798         layout.operator("object.hook_add_selob", text="Hook to Selected Object Bone").use_bone = True
1799
1800         if [mod.type == 'HOOK' for mod in context.active_object.modifiers]:
1801             layout.separator()
1802             layout.operator_menu_enum("object.hook_assign", "modifier")
1803             layout.operator_menu_enum("object.hook_remove", "modifier")
1804             layout.separator()
1805             layout.operator_menu_enum("object.hook_select", "modifier")
1806             layout.operator_menu_enum("object.hook_reset", "modifier")
1807             layout.operator_menu_enum("object.hook_recenter", "modifier")
1808
1809
1810 class VIEW3D_MT_vertex_group(Menu):
1811     bl_label = "Vertex Groups"
1812
1813     def draw(self, context):
1814         layout = self.layout
1815
1816         layout.operator_context = 'EXEC_AREA'
1817         layout.operator("object.vertex_group_assign_new")
1818
1819         ob = context.active_object
1820         if ob.mode == 'EDIT' or (ob.mode == 'WEIGHT_PAINT' and ob.type == 'MESH' and ob.data.use_paint_mask_vertex):
1821             if ob.vertex_groups.active:
1822                 layout.separator()
1823                 layout.operator("object.vertex_group_assign", text="Assign to Active Group")
1824                 layout.operator("object.vertex_group_remove_from", text="Remove from Active Group").use_all_groups = False
1825                 layout.operator("object.vertex_group_remove_from", text="Remove from All").use_all_groups = True
1826                 layout.separator()
1827
1828         if ob.vertex_groups.active:
1829             layout.operator_menu_enum("object.vertex_group_set_active", "group", text="Set Active Group")
1830             layout.operator("object.vertex_group_remove", text="Remove Active Group").all = False
1831             layout.operator("object.vertex_group_remove", text="Remove All Groups").all = True
1832
1833
1834 # ********** Weight paint menu **********
1835
1836
1837 class VIEW3D_MT_paint_weight(Menu):
1838     bl_label = "Weights"
1839
1840     def draw(self, context):
1841         layout = self.layout
1842
1843         layout.operator("ed.undo")
1844         layout.operator("ed.redo")
1845         layout.operator("ed.undo_history")
1846
1847         layout.separator()
1848
1849         layout.operator("paint.weight_from_bones", text="Assign Automatic From Bones").type = 'AUTOMATIC'
1850         layout.operator("paint.weight_from_bones", text="Assign From Bone Envelopes").type = 'ENVELOPES'
1851
1852         layout.separator()
1853
1854         layout.operator("object.vertex_group_normalize_all", text="Normalize All")
1855         layout.operator("object.vertex_group_normalize", text="Normalize")
1856         layout.operator("object.vertex_group_mirror", text="Mirror")
1857         layout.operator("object.vertex_group_invert", text="Invert")
1858         layout.operator("object.vertex_group_clean", text="Clean")
1859         layout.operator("object.vertex_group_quantize", text="Quantize")
1860         layout.operator("object.vertex_group_levels", text="Levels")
1861         layout.operator("object.vertex_group_smooth", text="Smooth")
1862         props = layout.operator("object.data_transfer", text="Transfer Weights")
1863         props.use_reverse_transfer = True
1864         props.data_type = 'VGROUP_WEIGHTS'
1865         layout.operator("object.vertex_group_limit_total", text="Limit Total")
1866         layout.operator("object.vertex_group_fix", text="Fix Deforms")
1867
1868         layout.separator()
1869
1870         layout.operator("paint.weight_set")
1871
1872
1873 # ********** Sculpt menu **********
1874
1875
1876 class VIEW3D_MT_sculpt(Menu):
1877     bl_label = "Sculpt"
1878
1879     def draw(self, context):
1880         layout = self.layout
1881
1882         toolsettings = context.tool_settings
1883         sculpt = toolsettings.sculpt
1884
1885         layout.operator("ed.undo")
1886         layout.operator("ed.redo")
1887
1888         layout.separator()
1889
1890         layout.prop(sculpt, "use_symmetry_x")
1891         layout.prop(sculpt, "use_symmetry_y")
1892         layout.prop(sculpt, "use_symmetry_z")
1893         layout.separator()
1894         layout.prop(sculpt, "lock_x")
1895         layout.prop(sculpt, "lock_y")
1896         layout.prop(sculpt, "lock_z")
1897
1898         layout.separator()
1899         layout.prop(sculpt, "use_threaded", text="Threaded Sculpt")
1900         layout.prop(sculpt, "show_low_resolution")
1901         layout.prop(sculpt, "show_brush")
1902         layout.prop(sculpt, "use_deform_only")
1903         layout.prop(sculpt, "show_diffuse_color")
1904
1905
1906 class VIEW3D_MT_hide_mask(Menu):
1907     bl_label = "Hide/Mask"
1908
1909     def draw(self, context):
1910         layout = self.layout
1911
1912         props = layout.operator("paint.hide_show", text="Show All")
1913         props.action = 'SHOW'
1914         props.area = 'ALL'
1915
1916         props = layout.operator("paint.hide_show", text="Hide Bounding Box")
1917         props.action = 'HIDE'
1918         props.area = 'INSIDE'
1919
1920         props = layout.operator("paint.hide_show", text="Show Bounding Box")
1921         props.action = 'SHOW'
1922         props.area = 'INSIDE'
1923
1924         props = layout.operator("paint.hide_show", text="Hide Masked")
1925         props.area = 'MASKED'
1926         props.action = 'HIDE'
1927
1928         layout.separator()
1929
1930         props = layout.operator("paint.mask_flood_fill", text="Invert Mask")
1931         props.mode = 'INVERT'
1932
1933         props = layout.operator("paint.mask_flood_fill", text="Fill Mask")
1934         props.mode = 'VALUE'
1935         props.value = 1
1936
1937         props = layout.operator("paint.mask_flood_fill", text="Clear Mask")
1938         props.mode = 'VALUE'
1939         props.value = 0
1940
1941         props = layout.operator("view3d.select_border", text="Box Mask")
1942         props = layout.operator("paint.mask_lasso_gesture", text="Lasso Mask")
1943
1944
1945 # ********** Particle menu **********
1946
1947
1948 class VIEW3D_MT_particle(Menu):
1949     bl_label = "Particle"
1950
1951     def draw(self, context):
1952         layout = self.layout
1953
1954         particle_edit = context.tool_settings.particle_edit
1955
1956         layout.operator("ed.undo")
1957         layout.operator("ed.redo")
1958         layout.operator("ed.undo_history")
1959
1960         layout.separator()
1961
1962         layout.operator("particle.mirror")
1963
1964         layout.separator()
1965
1966         layout.operator("particle.remove_doubles")
1967         layout.operator("particle.delete")
1968
1969         if particle_edit.select_mode == 'POINT':
1970             layout.operator("particle.subdivide")
1971
1972         layout.operator("particle.unify_length")
1973         layout.operator("particle.rekey")
1974         layout.operator("particle.weight_set")
1975
1976         layout.separator()
1977
1978         layout.menu("VIEW3D_MT_particle_showhide")
1979
1980
1981 class VIEW3D_MT_particle_specials(Menu):
1982     bl_label = "Specials"
1983
1984     def draw(self, context):
1985         layout = self.layout
1986
1987         particle_edit = context.tool_settings.particle_edit
1988
1989         layout.operator("particle.rekey")
1990         layout.operator("particle.delete")
1991         layout.operator("particle.remove_doubles")
1992         layout.operator("particle.unify_length")
1993
1994         if particle_edit.select_mode == 'POINT':
1995             layout.operator("particle.subdivide")
1996
1997         layout.operator("particle.weight_set")
1998         layout.separator()
1999
2000         layout.operator("particle.mirror")
2001
2002         if particle_edit.select_mode == 'POINT':
2003             layout.separator()
2004             layout.operator("particle.select_roots")
2005             layout.operator("particle.select_tips")
2006
2007             layout.separator()
2008
2009             layout.operator("particle.select_random")
2010
2011             layout.separator()
2012
2013             layout.operator("particle.select_more")
2014             layout.operator("particle.select_less")
2015
2016             layout.separator()
2017
2018             layout.operator("particle.select_all").action = 'TOGGLE'
2019             layout.operator("particle.select_linked")
2020             layout.operator("particle.select_all", text="Inverse").action = 'INVERT'
2021
2022
2023 class VIEW3D_MT_particle_showhide(ShowHideMenu, Menu):
2024     _operator_name = "particle"
2025
2026
2027 # ********** Pose Menu **********
2028
2029
2030 class VIEW3D_MT_pose(Menu):
2031     bl_label = "Pose"
2032
2033     def draw(self, context):
2034         layout = self.layout
2035
2036         layout.operator("ed.undo")
2037         layout.operator("ed.redo")
2038         layout.operator("ed.undo_history")
2039
2040         layout.separator()
2041
2042         layout.menu("VIEW3D_MT_transform_armature")
2043
2044         layout.menu("VIEW3D_MT_pose_transform")
2045         layout.menu("VIEW3D_MT_pose_apply")
2046
2047         layout.menu("VIEW3D_MT_snap")
2048
2049         layout.separator()
2050
2051         layout.menu("VIEW3D_MT_object_animation")
2052
2053         layout.separator()
2054
2055         layout.menu("VIEW3D_MT_pose_slide")
2056         layout.menu("VIEW3D_MT_pose_propagate")
2057
2058         layout.separator()
2059
2060         layout.operator("pose.copy")
2061         layout.operator("pose.paste").flipped = False
2062         layout.operator("pose.paste", text="Paste X-Flipped Pose").flipped = True
2063
2064         layout.separator()
2065
2066         layout.menu("VIEW3D_MT_pose_library")
2067         layout.menu("VIEW3D_MT_pose_motion")
2068         layout.menu("VIEW3D_MT_pose_group")
2069
2070         layout.separator()
2071
2072         layout.menu("VIEW3D_MT_object_parent")
2073         layout.menu("VIEW3D_MT_pose_ik")
2074         layout.menu("VIEW3D_MT_pose_constraints")
2075
2076         layout.separator()
2077
2078         layout.operator_context = 'EXEC_AREA'
2079         layout.operator("pose.autoside_names", text="AutoName Left/Right").axis = 'XAXIS'
2080         layout.operator("pose.autoside_names", text="AutoName Front/Back").axis = 'YAXIS'
2081         layout.operator("pose.autoside_names", text="AutoName Top/Bottom").axis = 'ZAXIS'
2082
2083         layout.operator("pose.flip_names")
2084
2085         layout.operator("pose.quaternions_flip")
2086
2087         layout.separator()
2088
2089         layout.operator_context = 'INVOKE_AREA'
2090         layout.operator("armature.armature_layers", text="Change Armature Layers...")
2091         layout.operator("pose.bone_layers", text="Change Bone Layers...")
2092
2093         layout.separator()
2094
2095         layout.menu("VIEW3D_MT_pose_showhide")
2096         layout.menu("VIEW3D_MT_bone_options_toggle", text="Bone Settings")
2097
2098
2099 class VIEW3D_MT_pose_transform(Menu):
2100     bl_label = "Clear Transform"
2101
2102     def draw(self, context):
2103         layout = self.layout
2104
2105         layout.operator("pose.transforms_clear", text="All")
2106
2107         layout.separator()
2108
2109         layout.operator("pose.loc_clear", text="Location")
2110         layout.operator("pose.rot_clear", text="Rotation")
2111         layout.operator("pose.scale_clear", text="Scale")
2112
2113         layout.separator()
2114
2115         layout.operator("pose.user_transforms_clear", text="Reset unkeyed")
2116
2117
2118 class VIEW3D_MT_pose_slide(Menu):
2119     bl_label = "In-Betweens"
2120
2121     def draw(self, context):
2122         layout = self.layout
2123
2124         layout.operator("pose.push")
2125         layout.operator("pose.relax")
2126         layout.operator("pose.breakdown")
2127
2128
2129 class VIEW3D_MT_pose_propagate(Menu):
2130     bl_label = "Propagate"
2131
2132     def draw(self, context):
2133         layout = self.layout
2134
2135         layout.operator("pose.propagate").mode = 'WHILE_HELD'
2136
2137         layout.separator()
2138
2139         layout.operator("pose.propagate", text="To Next Keyframe").mode = 'NEXT_KEY'
2140         layout.operator("pose.propagate", text="To Last Keyframe (Make Cyclic)").mode = 'LAST_KEY'
2141
2142         layout.separator()
2143
2144         layout.operator("pose.propagate", text="On Selected Keyframes").mode = 'SELECTED_KEYS'
2145
2146         layout.separator()
2147
2148         layout.operator("pose.propagate", text="On Selected Markers").mode = 'SELECTED_MARKERS'
2149
2150
2151 class VIEW3D_MT_pose_library(Menu):
2152     bl_label = "Pose Library"
2153
2154     def draw(self, context):
2155         layout = self.layout
2156
2157         layout.operator("poselib.browse_interactive", text="Browse Poses...")
2158
2159         layout.separator()
2160
2161         layout.operator("poselib.pose_add", text="Add Pose...")
2162         layout.operator("poselib.pose_rename", text="Rename Pose...")
2163         layout.operator("poselib.pose_remove", text="Remove Pose...")
2164
2165
2166 class VIEW3D_MT_pose_motion(Menu):
2167     bl_label = "Motion Paths"
2168
2169     def draw(self, context):
2170         layout = self.layout
2171
2172         layout.operator("pose.paths_calculate", text="Calculate")
2173         layout.operator("pose.paths_clear", text="Clear")
2174
2175
2176 class VIEW3D_MT_pose_group(Menu):
2177     bl_label = "Bone Groups"
2178
2179     def draw(self, context):
2180         layout = self.layout
2181
2182         pose = context.active_object.pose
2183
2184         layout.operator_context = 'EXEC_AREA'
2185         layout.operator("pose.group_assign", text="Assign to New Group").type = 0
2186         if pose.bone_groups:
2187             active_group = pose.bone_groups.active_index + 1
2188             layout.operator("pose.group_assign", text="Assign to Group").type = active_group
2189
2190             layout.separator()
2191
2192             # layout.operator_context = 'INVOKE_AREA'
2193             layout.operator("pose.group_unassign")
2194             layout.operator("pose.group_remove")
2195
2196
2197 class VIEW3D_MT_pose_ik(Menu):
2198     bl_label = "Inverse Kinematics"
2199
2200     def draw(self, context):
2201         layout = self.layout
2202
2203         layout.operator("pose.ik_add")
2204         layout.operator("pose.ik_clear")
2205
2206
2207 class VIEW3D_MT_pose_constraints(Menu):
2208     bl_label = "Constraints"
2209
2210     def draw(self, context):
2211         layout = self.layout
2212
2213         layout.operator("pose.constraint_add_with_targets", text="Add (With Targets)...")
2214         layout.operator("pose.constraints_copy")
2215         layout.operator("pose.constraints_clear")
2216
2217
2218 class VIEW3D_MT_pose_showhide(ShowHideMenu, Menu):
2219     _operator_name = "pose"
2220
2221
2222 class VIEW3D_MT_pose_apply(Menu):
2223     bl_label = "Apply"
2224
2225     def draw(self, context):
2226         layout = self.layout
2227
2228         layout.operator("pose.armature_apply")
2229         layout.operator("pose.visual_transform_apply")
2230
2231
2232 class VIEW3D_MT_pose_specials(Menu):
2233     bl_label = "Specials"
2234
2235     def draw(self, context):
2236         layout = self.layout
2237
2238         layout.operator("paint.weight_from_bones", text="Assign Automatic from Bones").type = 'AUTOMATIC'
2239         layout.operator("paint.weight_from_bones", text="Assign from Bone Envelopes").type = 'ENVELOPES'
2240
2241         layout.separator()
2242
2243         layout.operator("pose.select_constraint_target")
2244         layout.operator("pose.flip_names")
2245         layout.operator("pose.paths_calculate")
2246         layout.operator("pose.paths_clear")
2247         layout.operator("pose.user_transforms_clear")
2248         layout.operator("pose.user_transforms_clear", text="Clear User Transforms (All)").only_selected = False
2249         layout.operator("pose.relax")
2250
2251         layout.separator()
2252
2253         layout.operator_menu_enum("pose.autoside_names", "axis")
2254
2255
2256 class BoneOptions:
2257     def draw(self, context):
2258         layout = self.layout
2259
2260         options = [
2261             "show_wire",
2262             "use_deform",
2263             "use_envelope_multiply",
2264             "use_inherit_rotation",
2265             "use_inherit_scale",
2266         ]
2267
2268         if context.mode == 'EDIT_ARMATURE':
2269             bone_props = bpy.types.EditBone.bl_rna.properties
2270             data_path_iter = "selected_bones"
2271             opt_suffix = ""
2272             options.append("lock")
2273         else:  # pose-mode
2274             bone_props = bpy.types.Bone.bl_rna.properties
2275             data_path_iter = "selected_pose_bones"
2276             opt_suffix = "bone."
2277
2278         for opt in options:
2279             props = layout.operator("wm.context_collection_boolean_set", text=bone_props[opt].name,
2280                                     text_ctxt=i18n_contexts.default)
2281             props.data_path_iter = data_path_iter
2282             props.data_path_item = opt_suffix + opt
2283             props.type = self.type
2284
2285
2286 class VIEW3D_MT_bone_options_toggle(Menu, BoneOptions):
2287     bl_label = "Toggle Bone Options"
2288     type = 'TOGGLE'
2289
2290
2291 class VIEW3D_MT_bone_options_enable(Menu, BoneOptions):
2292     bl_label = "Enable Bone Options"
2293     type = 'ENABLE'
2294
2295
2296 class VIEW3D_MT_bone_options_disable(Menu, BoneOptions):
2297     bl_label = "Disable Bone Options"
2298     type = 'DISABLE'
2299
2300
2301 # ********** Edit Menus, suffix from ob.type **********
2302
2303
2304 class VIEW3D_MT_edit_mesh(Menu):
2305     bl_label = "Mesh"
2306
2307     def draw(self, context):
2308         layout = self.layout
2309
2310         toolsettings = context.tool_settings
2311
2312         layout.operator("ed.undo")
2313         layout.operator("ed.redo")
2314         layout.operator("ed.undo_history")
2315
2316         layout.separator()
2317
2318         layout.menu("VIEW3D_MT_transform")
2319         layout.menu("VIEW3D_MT_mirror")
2320         layout.menu("VIEW3D_MT_snap")
2321
2322         layout.separator()
2323
2324         layout.menu("VIEW3D_MT_uv_map", text="UV Unwrap...")
2325
2326         layout.separator()
2327
2328         layout.operator("mesh.duplicate_move")
2329         layout.menu("VIEW3D_MT_edit_mesh_extrude")
2330         layout.menu("VIEW3D_MT_edit_mesh_delete")
2331
2332         layout.separator()
2333
2334         layout.menu("VIEW3D_MT_edit_mesh_vertices")
2335         layout.menu("VIEW3D_MT_edit_mesh_edges")
2336         layout.menu("VIEW3D_MT_edit_mesh_faces")
2337         layout.menu("VIEW3D_MT_edit_mesh_normals")
2338         layout.menu("VIEW3D_MT_edit_mesh_clean")
2339
2340         layout.separator()
2341
2342         layout.operator("mesh.symmetrize")
2343         layout.operator("mesh.symmetry_snap")
2344         layout.operator("mesh.bisect")
2345         layout.operator_menu_enum("mesh.sort_elements", "type", text="Sort Elements...")
2346
2347         layout.separator()
2348
2349         layout.prop(toolsettings, "use_mesh_automerge")
2350         layout.menu("VIEW3D_MT_edit_proportional")
2351
2352         layout.separator()
2353
2354         layout.menu("VIEW3D_MT_edit_mesh_showhide")
2355
2356
2357 class VIEW3D_MT_edit_mesh_specials(Menu):
2358     bl_label = "Specials"
2359
2360     def draw(self, context):
2361         layout = self.layout
2362
2363         layout.operator_context = 'INVOKE_REGION_WIN'
2364
2365         layout.operator("mesh.subdivide", text="Subdivide").smoothness = 0.0
2366         layout.operator("mesh.subdivide", text="Subdivide Smooth").smoothness = 1.0
2367
2368         layout.separator()
2369
2370         layout.operator("mesh.merge", text="Merge...")
2371         layout.operator("mesh.remove_doubles")
2372
2373         layout.separator()
2374
2375         layout.operator("mesh.hide", text="Hide").unselected = False
2376         layout.operator("mesh.reveal", text="Reveal")
2377         layout.operator("mesh.select_all", text="Select Inverse").action = 'INVERT'
2378
2379         layout.separator()
2380
2381         layout.operator("mesh.flip_normals")
2382         layout.operator("mesh.vertices_smooth", text="Smooth")
2383         layout.operator("mesh.vertices_smooth_laplacian", text="Laplacian Smooth")
2384
2385         layout.separator()
2386
2387         layout.operator("mesh.inset")
2388         layout.operator("mesh.bevel", text="Bevel")
2389         layout.operator("mesh.bridge_edge_loops")
2390
2391         layout.separator()
2392
2393         layout.operator("mesh.faces_shade_smooth")
2394         layout.operator("mesh.faces_shade_flat")
2395
2396         layout.separator()
2397
2398         layout.operator("mesh.blend_from_shape")
2399         layout.operator("mesh.shape_propagate_to_all")
2400         layout.operator("mesh.shortest_path_select")
2401         layout.operator("mesh.sort_elements")
2402         layout.operator("mesh.symmetrize")
2403         layout.operator("mesh.symmetry_snap")
2404
2405
2406 class VIEW3D_MT_edit_mesh_select_mode(Menu):
2407     bl_label = "Mesh Select Mode"
2408
2409     def draw(self, context):
2410         layout = self.layout
2411
2412         layout.operator_context = 'INVOKE_REGION_WIN'
2413         layout.operator("mesh.select_mode", text="Vertex", icon='VERTEXSEL').type = 'VERT'
2414         layout.operator("mesh.select_mode", text="Edge", icon='EDGESEL').type = 'EDGE'
2415         layout.operator("mesh.select_mode", text="Face", icon='FACESEL').type = 'FACE'
2416
2417
2418 class VIEW3D_MT_edit_mesh_extrude(Menu):
2419     bl_label = "Extrude"
2420
2421     _extrude_funcs = {
2422         'VERT': lambda layout:
2423             layout.operator("mesh.extrude_vertices_move", text="Vertices Only"),
2424         'EDGE': lambda layout:
2425             layout.operator("mesh.extrude_edges_move", text="Edges Only"),
2426         'FACE': lambda layout:
2427             layout.operator("mesh.extrude_faces_move", text="Individual Faces"),
2428         'REGION': lambda layout:
2429             layout.operator("view3d.edit_mesh_extrude_move_normal", text="Region"),
2430         'REGION_VERT_NORMAL': lambda layout:
2431             layout.operator("view3d.edit_mesh_extrude_move_shrink_fatten", text="Region (Vertex Normals)"),
2432     }
2433
2434     @staticmethod
2435     def extrude_options(context):
2436         mesh = context.object.data
2437         select_mode = context.tool_settings.mesh_select_mode
2438
2439         menu = []
2440         if mesh.total_face_sel:
2441             menu += ['REGION', 'REGION_VERT_NORMAL', 'FACE']
2442         if mesh.total_edge_sel and (select_mode[0] or select_mode[1]):
2443             menu += ['EDGE']
2444         if mesh.total_vert_sel and select_mode[0]:
2445             menu += ['VERT']
2446
2447         # should never get here
2448         return menu
2449
2450     def draw(self, context):
2451         layout = self.layout
2452         layout.operator_context = 'INVOKE_REGION_WIN'
2453
2454         for menu_id in self.extrude_options(context):
2455             self._extrude_funcs[menu_id](layout)
2456
2457
2458 class VIEW3D_MT_edit_mesh_vertices(Menu):
2459     bl_label = "Vertices"
2460
2461     def draw(self, context):
2462         layout = self.layout
2463         layout.operator_context = 'INVOKE_REGION_WIN'
2464
2465         with_bullet = bpy.app.build_options.bullet
2466
2467         layout.operator("mesh.merge")
2468         layout.operator("mesh.remove_doubles")
2469         layout.operator("mesh.rip_move")
2470         layout.operator("mesh.rip_move_fill")
2471         layout.operator("mesh.rip_edge_move")
2472         layout.operator("mesh.split")
2473         layout.operator_menu_enum("mesh.separate", "type")
2474         layout.operator("mesh.vert_connect_path", text="Connect Vertex Path")
2475         layout.operator("mesh.vert_connect", text="Connect Vertices")
2476         layout.operator("transform.vert_slide", text="Slide")
2477
2478         layout.separator()
2479
2480         layout.operator("mesh.mark_sharp", text="Mark Sharp Edges").use_verts = True
2481         props = layout.operator("mesh.mark_sharp", text="Clear Sharp Edges")
2482         props.use_verts = True
2483         props.clear = True
2484
2485         layout.separator()
2486
2487         layout.operator("mesh.bevel").vertex_only = True
2488         if with_bullet:
2489             layout.operator("mesh.convex_hull")
2490         layout.operator("mesh.vertices_smooth")
2491
2492         layout.operator("mesh.blend_from_shape")
2493
2494         layout.operator("object.vertex_group_smooth")
2495         layout.operator("mesh.shape_propagate_to_all")
2496
2497         layout.separator()
2498
2499         layout.menu("VIEW3D_MT_vertex_group")
2500         layout.menu("VIEW3D_MT_hook")
2501
2502         layout.separator()
2503
2504         layout.operator("object.vertex_parent_set")
2505
2506
2507 class VIEW3D_MT_edit_mesh_edges(Menu):
2508     bl_label = "Edges"
2509
2510     def draw(self, context):
2511         layout = self.layout
2512
2513         with_freestyle = bpy.app.build_options.freestyle
2514
2515         layout.operator_context = 'INVOKE_REGION_WIN'
2516
2517         layout.operator("mesh.edge_face_add")
2518         layout.operator("mesh.subdivide")
2519         layout.operator("mesh.subdivide_edgering")
2520         layout.operator("mesh.unsubdivide")
2521
2522         layout.separator()
2523
2524         layout.operator("transform.edge_crease")
2525         layout.operator("transform.edge_bevelweight")
2526
2527         layout.separator()
2528
2529         layout.operator("mesh.mark_seam").clear = False
2530         layout.operator("mesh.mark_seam", text="Clear Seam").clear = True
2531
2532         layout.separator()
2533
2534         layout.operator("mesh.mark_sharp")
2535         layout.operator("mesh.mark_sharp", text="Clear Sharp").clear = True
2536
2537         layout.separator()
2538
2539         if with_freestyle:
2540             layout.operator("mesh.mark_freestyle_edge").clear = False
2541             layout.operator("mesh.mark_freestyle_edge", text="Clear Freestyle Edge").clear = True
2542             layout.separator()
2543
2544         layout.operator("mesh.edge_rotate", text="Rotate Edge CW").use_ccw = False
2545         layout.operator("mesh.edge_rotate", text="Rotate Edge CCW").use_ccw = True
2546
2547         layout.separator()
2548
2549         layout.operator("mesh.bevel").vertex_only = False
2550         layout.operator("mesh.edge_split")
2551         layout.operator("mesh.bridge_edge_loops")
2552
2553         layout.separator()
2554
2555         layout.operator("transform.edge_slide")
2556         layout.operator("mesh.loop_multi_select", text="Edge Loops").ring = False
2557         layout.operator("mesh.loop_multi_select", text="Edge Rings").ring = True
2558         layout.operator("mesh.loop_to_region")
2559         layout.operator("mesh.region_to_loop")
2560
2561
2562 class VIEW3D_MT_edit_mesh_faces(Menu):
2563     bl_label = "Faces"
2564     bl_idname = "VIEW3D_MT_edit_mesh_faces"
2565
2566     def draw(self, context):
2567         layout = self.layout
2568
2569         with_freestyle = bpy.app.build_options.freestyle
2570
2571         layout.operator_context = 'INVOKE_REGION_WIN'
2572
2573         layout.operator("mesh.flip_normals")
2574         layout.operator("mesh.edge_face_add")
2575         layout.operator("mesh.fill")
2576         layout.operator("mesh.fill_grid")
2577         layout.operator("mesh.beautify_fill")
2578         layout.operator("mesh.inset")
2579         layout.operator("mesh.bevel").vertex_only = False
2580         layout.operator("mesh.solidify")
2581         layout.operator("mesh.intersect")
2582         layout.operator("mesh.intersect_boolean")
2583         layout.operator("mesh.wireframe")
2584
2585         layout.separator()
2586
2587         if with_freestyle:
2588             layout.operator("mesh.mark_freestyle_face").clear = False
2589             layout.operator("mesh.mark_freestyle_face", text="Clear Freestyle Face").clear = True
2590             layout.separator()
2591
2592         layout.operator("mesh.poke")
2593         props = layout.operator("mesh.quads_convert_to_tris")
2594         props.quad_method = props.ngon_method = 'BEAUTY'
2595         layout.operator("mesh.tris_convert_to_quads")
2596         layout.operator("mesh.face_split_by_edges")
2597
2598         layout.separator()
2599
2600         layout.operator("mesh.faces_shade_smooth")
2601         layout.operator("mesh.faces_shade_flat")
2602
2603         layout.operator("mesh.normals_make_consistent", text="Recalculate Normals").inside = False
2604
2605         layout.separator()
2606
2607         layout.operator("mesh.edge_rotate", text="Rotate Edge CW").use_ccw = False
2608
2609         layout.separator()
2610
2611         layout.operator("mesh.uvs_rotate")
2612         layout.operator("mesh.uvs_reverse")
2613         layout.operator("mesh.colors_rotate")
2614         layout.operator("mesh.colors_reverse")
2615
2616
2617 class VIEW3D_MT_edit_mesh_normals(Menu):
2618     bl_label = "Normals"
2619
2620     def draw(self, context):
2621         layout = self.layout
2622
2623         layout.operator("mesh.normals_make_consistent", text="Recalculate Outside").inside = False
2624         layout.operator("mesh.normals_make_consistent", text="Recalculate Inside").inside = True
2625
2626         layout.separator()
2627
2628         layout.operator("mesh.flip_normals")
2629
2630
2631 class VIEW3D_MT_edit_mesh_clean(Menu):
2632     bl_label = "Clean up"
2633
2634     def draw(self, context):
2635         layout = self.layout
2636
2637         layout.operator("mesh.delete_loose")
2638
2639         layout.separator()
2640
2641         layout.operator("mesh.decimate")
2642         layout.operator("mesh.dissolve_degenerate")
2643         layout.operator("mesh.dissolve_limited")
2644         layout.operator("mesh.face_make_planar")
2645         layout.operator("mesh.vert_connect_nonplanar")
2646         layout.operator("mesh.vert_connect_concave")
2647         layout.operator("mesh.remove_doubles")
2648         layout.operator("mesh.fill_holes")
2649
2650
2651 class VIEW3D_MT_edit_mesh_delete(Menu):
2652     bl_label = "Delete"
2653
2654     def draw(self, context):
2655         layout = self.layout
2656
2657         layout.operator_enum("mesh.delete", "type")
2658
2659         layout.separator()
2660
2661         layout.operator("mesh.dissolve_verts")
2662         layout.operator("mesh.dissolve_edges")
2663         layout.operator("mesh.dissolve_faces")
2664
2665         layout.separator()
2666
2667         layout.operator("mesh.dissolve_limited")
2668
2669         layout.separator()
2670
2671         layout.operator("mesh.edge_collapse")
2672         layout.operator("mesh.delete_edgeloop", text="Edge Loops")
2673
2674
2675 class VIEW3D_MT_edit_mesh_showhide(ShowHideMenu, Menu):
2676     _operator_name = "mesh"
2677
2678
2679 class VIEW3D_MT_edit_gpencil_delete(Menu):
2680     bl_label = "Delete"
2681
2682     def draw(self, context):
2683         layout = self.layout
2684
2685         layout.operator_enum("gpencil.delete", "type")
2686
2687         layout.separator()
2688
2689         layout.operator("gpencil.dissolve")
2690
2691         layout.separator()
2692
2693         layout.operator("gpencil.active_frames_delete_all")
2694
2695
2696 # Edit Curve
2697 # draw_curve is used by VIEW3D_MT_edit_curve and VIEW3D_MT_edit_surface
2698
2699
2700 def draw_curve(self, context):
2701     layout = self.layout
2702
2703     toolsettings = context.tool_settings
2704
2705     layout.menu("VIEW3D_MT_transform")
2706     layout.menu("VIEW3D_MT_mirror")
2707     layout.menu("VIEW3D_MT_snap")
2708
2709     layout.separator()
2710
2711     layout.operator("curve.extrude_move")
2712     layout.operator("curve.spin")
2713     layout.operator("curve.duplicate_move")
2714     layout.operator("curve.split")
2715     layout.operator("curve.separate")
2716     layout.operator("curve.make_segment")
2717     layout.operator("curve.cyclic_toggle")
2718     layout.menu("VIEW3D_MT_edit_curve_delete")
2719
2720     layout.separator()
2721
2722     layout.menu("VIEW3D_MT_edit_curve_ctrlpoints")
2723     layout.menu("VIEW3D_MT_edit_curve_segments")
2724
2725     layout.separator()
2726
2727     layout.menu("VIEW3D_MT_edit_proportional")
2728
2729     layout.separator()
2730
2731     layout.menu("VIEW3D_MT_edit_curve_showhide")
2732
2733
2734 class VIEW3D_MT_edit_curve(Menu):
2735     bl_label = "Curve"
2736
2737     draw = draw_curve
2738
2739
2740 class VIEW3D_MT_edit_curve_ctrlpoints(Menu):
2741     bl_label = "Control Points"
2742
2743     def draw(self, context):
2744         layout = self.layout
2745
2746         edit_object = context.edit_object
2747
2748         if edit_object.type == 'CURVE':
2749             layout.operator("transform.tilt")
2750             layout.operator("curve.tilt_clear")
2751
2752             layout.separator()
2753
2754             layout.operator_menu_enum("curve.handle_type_set", "type")
2755             layout.operator("curve.normals_make_consistent")
2756
2757             layout.separator()
2758
2759         layout.menu("VIEW3D_MT_hook")
2760
2761         layout.separator()
2762
2763         layout.operator("object.vertex_parent_set")
2764
2765
2766 class VIEW3D_MT_edit_curve_segments(Menu):
2767     bl_label = "Segments"
2768
2769     def draw(self, context):
2770         layout = self.layout
2771
2772         layout.operator("curve.subdivide")
2773         layout.operator("curve.switch_direction")
2774
2775
2776 class VIEW3D_MT_edit_curve_specials(Menu):
2777     bl_label = "Specials"
2778
2779     def draw(self, context):
2780         layout = self.layout
2781
2782         layout.operator("curve.subdivide")
2783         layout.operator("curve.switch_direction")
2784         layout.operator("curve.spline_weight_set")
2785         layout.operator("curve.radius_set")
2786         layout.operator("curve.smooth")
2787         layout.operator("curve.smooth_weight")
2788         layout.operator("curve.smooth_radius")
2789         layout.operator("curve.smooth_tilt")
2790
2791
2792 class VIEW3D_MT_edit_curve_delete(Menu):
2793     bl_label = "Delete"
2794
2795     def draw(self, context):
2796         layout = self.layout
2797
2798         layout.operator_enum("curve.delete", "type")
2799
2800         layout.separator()
2801
2802         layout.operator("curve.dissolve_verts")
2803
2804
2805 class VIEW3D_MT_edit_curve_showhide(ShowHideMenu, Menu):
2806     _operator_name = "curve"
2807
2808
2809 class VIEW3D_MT_edit_surface(Menu):
2810     bl_label = "Surface"
2811
2812     draw = draw_curve
2813
2814
2815 class VIEW3D_MT_edit_font(Menu):
2816     bl_label = "Text"
2817
2818     def draw(self, context):
2819         layout = self.layout
2820
2821         layout.menu("VIEW3D_MT_edit_text_chars")
2822
2823         layout.separator()
2824
2825         layout.operator("font.style_toggle", text="Toggle Bold").style = 'BOLD'
2826         layout.operator("font.style_toggle", text="Toggle Italic").style = 'ITALIC'
2827         layout.operator("font.style_toggle", text="Toggle Underline").style = 'UNDERLINE'
2828         layout.operator("font.style_toggle", text="Toggle Small Caps").style = 'SMALL_CAPS'
2829
2830
2831 class VIEW3D_MT_edit_text_chars(Menu):
2832     bl_label = "Special Characters"
2833
2834     def draw(self, context):
2835         layout = self.layout
2836
2837         layout.operator("font.text_insert", text="Copyright").text = "\u00A9"
2838         layout.operator("font.text_insert", text="Registered Trademark").text = "\u00AE"
2839
2840         layout.separator()
2841
2842         layout.operator("font.text_insert", text="Degree Sign").text = "\u00B0"
2843         layout.operator("font.text_insert", text="Multiplication Sign").text = "\u00D7"
2844         layout.operator("font.text_insert", text="Circle").text = "\u008A"
2845         layout.operator("font.text_insert", text="Superscript 1").text = "\u00B9"
2846         layout.operator("font.text_insert", text="Superscript 2").text = "\u00B2"
2847         layout.operator("font.text_insert", text="Superscript 3").text = "\u00B3"
2848         layout.operator("font.text_insert", text="Double >>").text = "\u00BB"
2849         layout.operator("font.text_insert", text="Double <<").text = "\u00AB"
2850         layout.operator("font.text_insert", text="Promillage").text = "\u2030"
2851
2852         layout.separator()
2853
2854         layout.operator("font.text_insert", text="Dutch Florin").text = "\u00A4"
2855         layout.operator("font.text_insert", text="British Pound").text = "\u00A3"
2856         layout.operator("font.text_insert", text="Japanese Yen").text = "\u00A5"
2857
2858         layout.separator()
2859
2860         layout.operator("font.text_insert", text="German S").text = "\u00DF"
2861         layout.operator("font.text_insert", text="Spanish Question Mark").text = "\u00BF"
2862         layout.operator("font.text_insert", text="Spanish Exclamation Mark").text = "\u00A1"
2863
2864
2865 class VIEW3D_MT_edit_meta(Menu):
2866     bl_label = "Metaball"
2867
2868     def draw(self, context):
2869         layout = self.layout
2870
2871         toolsettings = context.tool_settings
2872
2873         layout.operator("ed.undo")
2874         layout.operator("ed.redo")
2875         layout.operator("ed.undo_history")
2876
2877         layout.separator()
2878
2879         layout.menu("VIEW3D_MT_transform")
2880         layout.menu("VIEW3D_MT_mirror")
2881         layout.menu("VIEW3D_MT_snap")
2882
2883         layout.separator()
2884
2885         layout.operator("mball.delete_metaelems", text="Delete...")
2886         layout.operator("mball.duplicate_metaelems")
2887
2888         layout.separator()
2889
2890         layout.menu("VIEW3D_MT_edit_proportional")
2891
2892         layout.separator()
2893
2894         layout.menu("VIEW3D_MT_edit_meta_showhide")
2895
2896
2897 class VIEW3D_MT_edit_meta_showhide(Menu):
2898     bl_label = "Show/Hide"
2899
2900     def draw(self, context):
2901         layout = self.layout
2902
2903         layout.operator("mball.reveal_metaelems", text="Show Hidden")
2904         layout.operator("mball.hide_metaelems", text="Hide Selected").unselected = False
2905         layout.operator("mball.hide_metaelems", text="Hide Unselected").unselected = True
2906
2907
2908 class VIEW3D_MT_edit_lattice(Menu):
2909     bl_label = "Lattice"
2910
2911     def draw(self, context):
2912         layout = self.layout
2913
2914         toolsettings = context.tool_settings
2915
2916         layout.menu("VIEW3D_MT_transform")
2917         layout.menu("VIEW3D_MT_mirror")
2918         layout.menu("VIEW3D_MT_snap")
2919         layout.operator_menu_enum("lattice.flip", "axis")
2920
2921         layout.separator()
2922
2923         layout.operator("lattice.make_regular")
2924
2925         layout.separator()
2926
2927         layout.operator("object.vertex_parent_set")
2928
2929         layout.separator()
2930
2931         layout.menu("VIEW3D_MT_edit_proportional")
2932
2933
2934 class VIEW3D_MT_edit_armature(Menu):
2935     bl_label = "Armature"
2936
2937     def draw(self, context):
2938         layout = self.layout
2939
2940         edit_object = context.edit_object
2941         arm = edit_object.data
2942
2943         layout.menu("VIEW3D_MT_transform_armature")
2944         layout.menu("VIEW3D_MT_mirror")
2945         layout.menu("VIEW3D_MT_snap")
2946         layout.menu("VIEW3D_MT_edit_armature_roll")
2947
2948         layout.separator()
2949
2950         layout.operator("armature.extrude_move")
2951
2952         if arm.use_mirror_x:
2953             layout.operator("armature.extrude_forked")
2954
2955         layout.operator("armature.duplicate_move")
2956         layout.operator("armature.merge")
2957         layout.operator("armature.fill")
2958         layout.operator("armature.delete")
2959         layout.operator("armature.split")
2960         layout.operator("armature.separate")
2961
2962         layout.separator()
2963
2964         layout.operator("armature.subdivide", text="Subdivide")
2965         layout.operator("armature.switch_direction", text="Switch Direction")
2966
2967         layout.separator()
2968
2969         layout.operator_context = 'EXEC_AREA'
2970         layout.operator("armature.symmetrize")
2971         layout.operator("armature.autoside_names", text="AutoName Left/Right").type = 'XAXIS'
2972         layout.operator("armature.autoside_names", text="AutoName Front/Back").type = 'YAXIS'
2973         layout.operator("armature.autoside_names", text="AutoName Top/Bottom").type = 'ZAXIS'
2974         layout.operator("armature.flip_names")
2975
2976         layout.separator()
2977
2978         layout.operator_context = 'INVOKE_DEFAULT'
2979         layout.operator("armature.armature_layers")
2980         layout.operator("armature.bone_layers")
2981
2982         layout.separator()
2983
2984         layout.menu("VIEW3D_MT_edit_armature_parent")
2985
2986         layout.separator()
2987
2988         layout.menu("VIEW3D_MT_bone_options_toggle", text="Bone Settings")
2989
2990
2991 class VIEW3D_MT_armature_specials(Menu):
2992     bl_label = "Specials"
2993
2994     def draw(self, context):
2995         layout = self.layout
2996
2997         layout.operator_context = 'INVOKE_REGION_WIN'
2998
2999         layout.operator("armature.subdivide", text="Subdivide")
3000         layout.operator("armature.switch_direction", text="Switch Direction")
3001
3002         layout.separator()
3003
3004         layout.operator_context = 'EXEC_REGION_WIN'
3005         layout.operator("armature.autoside_names", text="AutoName Left/Right").type = 'XAXIS'
3006         layout.operator("armature.autoside_names", text="AutoName Front/Back").type = 'YAXIS'
3007         layout.operator("armature.autoside_names", text="AutoName Top/Bottom").type = 'ZAXIS'
3008         layout.operator("armature.flip_names", text="Flip Names")
3009         layout.operator("armature.symmetrize")
3010
3011
3012 class VIEW3D_MT_edit_armature_parent(Menu):
3013     bl_label = "Parent"
3014
3015     def draw(self, context):
3016         layout = self.layout
3017
3018         layout.operator("armature.parent_set", text="Make")
3019         layout.operator("armature.parent_clear", text="Clear")
3020
3021
3022 class VIEW3D_MT_edit_armature_roll(Menu):
3023     bl_label = "Bone Roll"
3024
3025     def draw(self, context):
3026         layout = self.layout
3027
3028         layout.operator_menu_enum("armature.calculate_roll", "type")
3029
3030         layout.separator()
3031
3032         layout.operator("transform.transform", text="Set Roll").mode = 'BONE_ROLL'
3033         layout.operator("armature.roll_clear")
3034
3035
3036 class VIEW3D_MT_edit_armature_delete(Menu):
3037     bl_label = "Delete"
3038
3039     def draw(self, context):
3040         layout = self.layout
3041
3042         layout.operator("armature.delete", text="Delete Bones")
3043
3044         layout.separator()
3045
3046         layout.operator("armature.dissolve", text="Dissolve")
3047
3048
3049 # ********** GPencil Stroke Edit menu **********
3050
3051
3052 class VIEW3D_MT_edit_gpencil(Menu):
3053     bl_label = "GPencil"
3054
3055     def draw(self, context):
3056         toolsettings = context.tool_settings
3057
3058         layout = self.layout
3059
3060         layout.operator("ed.undo")
3061         layout.operator("ed.redo")
3062         layout.operator("ed.undo_history")
3063
3064         layout.separator()
3065
3066         layout.operator("gpencil.brush_paint", text="Sculpt Strokes").wait_for_input = True
3067         layout.prop_menu_enum(toolsettings.gpencil_sculpt, "tool", text="Sculpt Brush")
3068
3069         layout.separator()
3070
3071         layout.menu("VIEW3D_MT_edit_gpencil_transform")
3072         layout.operator("transform.mirror", text="Mirror")
3073         layout.menu("GPENCIL_MT_snap")
3074
3075         layout.separator()
3076
3077         layout.menu("VIEW3D_MT_object_animation")   # NOTE: provides keyingset access...
3078         layout.menu("VIEW3D_MT_edit_gpencil_interpolate")
3079
3080         layout.separator()
3081
3082         layout.menu("VIEW3D_MT_edit_gpencil_delete")
3083         layout.operator("gpencil.duplicate_move", text="Duplicate")
3084         layout.operator("gpencil.stroke_subdivide", text="Subdivide")
3085
3086         layout.separator()
3087
3088         layout.operator_menu_enum("gpencil.stroke_join", "type", text="Join...")
3089         layout.operator("gpencil.stroke_flip", text="Flip Direction")
3090
3091         layout.separator()
3092
3093         layout.operator("gpencil.copy", text="Copy")
3094         layout.operator("gpencil.paste", text="Paste")
3095
3096         layout.separator()
3097
3098         layout.menu("VIEW3D_MT_edit_proportional")
3099
3100         layout.separator()
3101
3102         layout.operator("gpencil.reveal")
3103         layout.operator("gpencil.hide", text="Show Active Layer Only").unselected = True
3104         layout.operator("gpencil.hide", text="Hide Active Layer").unselected = False
3105
3106         layout.separator()
3107
3108         layout.operator_menu_enum("gpencil.move_to_layer", "layer", text="Move to Layer")
3109         layout.operator("gpencil.stroke_change_color", text="Move to Color")
3110         layout.operator_menu_enum("gpencil.stroke_arrange", "direction", text="Arrange Strokes...")
3111
3112         layout.separator()
3113
3114         layout.operator_menu_enum("gpencil.convert", "type", text="Convert to Geometry...")
3115
3116
3117 class VIEW3D_MT_edit_gpencil_transform(Menu):
3118     bl_label = "Transform"
3119
3120     def draw(self, context):
3121         layout = self.layout
3122
3123         layout.operator("transform.translate")
3124         layout.operator("transform.rotate")
3125         layout.operator("transform.resize", text="Scale")
3126
3127         layout.separator()
3128
3129         layout.operator("transform.bend", text="Bend")
3130         layout.operator("transform.shear", text="Shear")
3131         layout.operator("transform.tosphere", text="To Sphere")
3132         layout.operator("transform.transform", text="Shrink Fatten").mode = 'GPENCIL_SHRINKFATTEN'
3133
3134         layout.separator()
3135
3136         layout.operator("gpencil.reproject")
3137
3138
3139 class VIEW3D_MT_edit_gpencil_interpolate(Menu):
3140     bl_label = "Interpolate"
3141
3142     def draw(self, context):
3143         layout = self.layout
3144
3145         layout.operator("gpencil.interpolate", text="Interpolate")
3146         layout.operator("gpencil.interpolate_sequence", text="Sequence")
3147
3148
3149 # ********** Panel **********
3150
3151
3152 class VIEW3D_PT_grease_pencil(GreasePencilDataPanel, Panel):
3153     bl_space_type = 'VIEW_3D'
3154     bl_region_type = 'UI'
3155
3156     # NOTE: this is just a wrapper around the generic GP Panel
3157
3158
3159 class VIEW3D_PT_grease_pencil_palettecolor(GreasePencilPaletteColorPanel, Panel):
3160     bl_space_type = 'VIEW_3D'
3161     bl_region_type = 'UI'
3162
3163     # NOTE: this is just a wrapper around the generic GP Panel
3164
3165
3166 class VIEW3D_PT_view3d_properties(Panel):
3167     bl_space_type = 'VIEW_3D'
3168     bl_region_type = 'UI'
3169     bl_label = "View"
3170
3171     @classmethod
3172     def poll(cls, context):
3173         view = context.space_data
3174         return (view)
3175
3176     def draw(self, context):
3177         layout = self.layout
3178
3179         view = context.space_data
3180
3181         col = layout.column()
3182         col.active = bool(view.region_3d.view_perspective != 'CAMERA' or view.region_quadviews)
3183         col.prop(view, "lens")
3184         col.label(text="Lock to Object:")
3185         col.prop(view, "lock_object", text="")
3186         lock_object = view.lock_object
3187         if lock_object:
3188             if lock_object.type == 'ARMATURE':
3189                 col.prop_search(view, "lock_bone", lock_object.data,
3190                                 "edit_bones" if lock_object.mode == 'EDIT'
3191                                 else "bones",
3192                                 text="")
3193         else:
3194             col.prop(view, "lock_cursor", text="Lock to Cursor")
3195
3196         col = layout.column()
3197         col.prop(view, "lock_camera")
3198
3199         col = layout.column(align=True)
3200         col.label(text="Clip:")
3201         col.prop(view, "clip_start", text="Start")
3202         col.prop(view, "clip_end", text="End")
3203
3204         subcol = col.column(align=True)
3205         subcol.enabled = not view.lock_camera_and_layers
3206         subcol.label(text="Local Camera:")
3207         subcol.prop(view, "camera", text="")
3208
3209         col = layout.column(align=True)
3210         col.prop(view, "use_render_border")
3211         col.active = view.region_3d.view_perspective != 'CAMERA'
3212
3213
3214 class VIEW3D_PT_view3d_cursor(Panel):
3215     bl_space_type = 'VIEW_3D'
3216     bl_region_type = 'UI'
3217     bl_label = "3D Cursor"
3218
3219     @classmethod
3220     def poll(cls, context):
3221         view = context.space_data
3222         return (view is not None)
3223
3224     def draw(self, context):
3225         layout = self.layout
3226
3227         view = context.space_data
3228         layout.column().prop(view, "cursor_location", text="Location")
3229
3230
3231 class VIEW3D_PT_view3d_name(Panel):
3232     bl_space_type = 'VIEW_3D'
3233     bl_region_type = 'UI'
3234     bl_label = "Item"
3235
3236     @classmethod
3237     def poll(cls, context):
3238         return (context.space_data and context.active_object)
3239
3240     def draw(self, context):
3241         layout = self.layout
3242
3243         ob = context.active_object
3244         row = layout.row()
3245         row.label(text="", icon='OBJECT_DATA')
3246         row.prop(ob, "name", text="")
3247
3248         if ob.type == 'ARMATURE' and ob.mode in {'EDIT', 'POSE'}:
3249             bone = context.active_bone
3250             if bone:
3251                 row = layout.row()
3252                 row.label(text="", icon='BONE_DATA')
3253                 row.prop(bone, "name", text="")
3254
3255
3256 class VIEW3D_PT_view3d_display(Panel):
3257     bl_space_type = 'VIEW_3D'
3258     bl_region_type = 'UI'
3259     bl_label = "Display"
3260     bl_options = {'DEFAULT_CLOSED'}
3261
3262     @classmethod
3263     def poll(cls, context):
3264         view = context.space_data
3265         return (view)
3266
3267     def draw(self, context):
3268         layout = self.layout
3269
3270         view = context.space_data
3271         scene = context.scene
3272
3273         col = layout.column()
3274         col.prop(view, "show_only_render")
3275         col.prop(view, "show_world")
3276
3277         col = layout.column()
3278         display_all = not view.show_only_render
3279         col.active = display_all
3280         col.prop(view, "show_outline_selected")
3281         col.prop(view, "show_all_objects_origin")
3282         col.prop(view, "show_relationship_lines")
3283
3284         col = layout.column()
3285         col.active = display_all
3286         split = col.split(percentage=0.55)
3287         split.prop(view, "show_floor", text="Grid Floor")
3288
3289         row = split.row(align=True)
3290         row.prop(view, "show_axis_x", text="X", toggle=True)
3291         row.prop(view, "show_axis_y", text="Y", toggle=True)
3292         row.prop(view, "show_axis_z", text="Z", toggle=True)
3293
3294         sub = col.column(align=True)
3295         sub.active = bool(view.show_floor or view.region_quadviews or not view.region_3d.is_perspective)
3296         subsub = sub.column(align=True)
3297         subsub.active = view.show_floor
3298         subsub.prop(view, "grid_lines", text="Lines")
3299         sub.prop(view, "grid_scale", text="Scale")
3300         subsub = sub.column(align=True)
3301         subsub.active = scene.unit_settings.system == 'NONE'
3302         subsub.prop(view, "grid_subdivisions", text="Subdivisions")
3303
3304         layout.separator()
3305
3306         layout.operator("screen.region_quadview", text="Toggle Quad View")
3307
3308         if view.region_quadviews:
3309             region = view.region_quadviews[2]
3310             col = layout.column()
3311             col.prop(region, "lock_rotation")
3312             row = col.row()
3313             row.enabled = region.lock_rotation
3314             row.prop(region, "show_sync_view")
3315             row = col.row()
3316             row.enabled = region.lock_rotation and region.show_sync_view
3317             row.prop(region, "use_box_clip")
3318
3319
3320 class VIEW3D_PT_view3d_stereo(Panel):
3321     bl_space_type = 'VIEW_3D'
3322     bl_region_type = 'UI'
3323     bl_label = "Stereoscopy"
3324     bl_options = {'DEFAULT_CLOSED'}
3325
3326     @classmethod
3327     def poll(cls, context):
3328         scene = context.scene
3329
3330         multiview = scene.render.use_multiview
3331         return context.space_data and multiview
3332
3333     def draw(self, context):
3334         layout = self.layout
3335         view = context.space_data
3336
3337         basic_stereo = context.scene.render.views_format == 'STEREO_3D'
3338
3339         col = layout.column()
3340         col.row().prop(view, "stereo_3d_camera", expand=True)
3341
3342         col.label(text="Display:")
3343         row = col.row()
3344         row.active = basic_stereo
3345         row.prop(view, "show_stereo_3d_cameras")
3346         row = col.row()
3347         row.active = basic_stereo
3348         split = row.split()
3349         split.prop(view, "show_stereo_3d_convergence_plane")
3350         split = row.split()
3351         split.prop(view, "stereo_3d_convergence_plane_alpha", text="Alpha")
3352         split.active = view.show_stereo_3d_convergence_plane
3353         row = col.row()
3354         split = row.split()
3355         split.prop(view, "show_stereo_3d_volume")
3356         split = row.split()
3357         split.prop(view, "stereo_3d_volume_alpha", text="Alpha")
3358
3359
3360 class VIEW3D_PT_view3d_shading(Panel):
3361     bl_space_type = 'VIEW_3D'
3362     bl_region_type = 'UI'
3363     bl_label = "Shading"
3364
3365     def draw(self, context):
3366         layout = self.layout
3367
3368         view = context.space_data
3369         scene = context.scene
3370         gs = scene.game_settings
3371         obj = context.object
3372
3373         col = layout.column()
3374
3375         if not scene.render.use_shading_nodes:
3376             col.prop(gs, "material_mode", text="")
3377
3378         if view.viewport_shade == 'SOLID':
3379             col.prop(view, "show_textured_solid")
3380             col.prop(view, "use_matcap")
3381             if view.use_matcap:
3382                 col.template_icon_view(view, "matcap_icon")
3383         if view.viewport_shade == 'TEXTURED' or context.mode == 'PAINT_TEXTURE':
3384             if scene.render.use_shading_nodes or gs.material_mode != 'GLSL':
3385                 col.prop(view, "show_textured_shadeless")
3386
3387         col.prop(view, "show_backface_culling")
3388
3389         if view.viewport_shade not in {'BOUNDBOX', 'WIREFRAME'}:
3390             if obj and obj.mode == 'EDIT':
3391                 col.prop(view, "show_occlude_wire")
3392
3393         fx_settings = view.fx_settings
3394
3395         if view.viewport_shade not in {'BOUNDBOX', 'WIREFRAME'}:
3396             sub = col.column()
3397             sub.active = view.region_3d.view_perspective == 'CAMERA'
3398             sub.prop(fx_settings, "use_dof")
3399             col.prop(fx_settings, "use_ssao", text="Ambient Occlusion")
3400             if fx_settings.use_ssao:
3401                 ssao_settings = fx_settings.ssao
3402                 subcol = col.column(align=True)
3403                 subcol.prop(ssao_settings, "factor")
3404                 subcol.prop(ssao_settings, "distance_max")
3405                 subcol.prop(ssao_settings, "attenuation")
3406                 subcol.prop(ssao_settings, "samples")
3407                 subcol.prop(ssao_settings, "color")
3408
3409
3410 class VIEW3D_PT_view3d_motion_tracking(Panel):
3411     bl_space_type = 'VIEW_3D'
3412     bl_region_type = 'UI'
3413     bl_label = "Motion Tracking"
3414     bl_options = {'DEFAULT_CLOSED'}
3415
3416     @classmethod
3417     def poll(cls, context):
3418         view = context.space_data
3419         return (view)
3420
3421     def draw_header(self, context):
3422         view = context.space_data
3423
3424         self.layout.prop(view, "show_reconstruction", text="")
3425
3426     def draw(self, context):
3427         layout = self.layout
3428
3429         view = context.space_data
3430
3431         col = layout.column()
3432         col.active = view.show_reconstruction
3433         col.prop(view, "show_camera_path", text="Camera Path")
3434         col.prop(view, "show_bundle_names", text="3D Marker Names")
3435         col.label(text="Track Type and Size:")
3436         row = col.row(align=True)
3437         row.prop(view, "tracks_draw_type", text="")
3438         row.prop(view, "tracks_draw_size", text="")
3439
3440
3441 class VIEW3D_PT_view3d_meshdisplay(Panel):
3442     bl_space_type = 'VIEW_3D'
3443     bl_region_type = 'UI'
3444     bl_label = "Mesh Display"
3445
3446     @classmethod
3447     def poll(cls, context):
3448         # The active object check is needed because of local-mode
3449         return (context.active_object and (context.mode == 'EDIT_MESH'))
3450
3451     def draw(self, context):
3452         layout = self.layout
3453         with_freestyle = bpy.app.build_options.freestyle
3454
3455         mesh = context.active_object.data
3456         scene = context.scene
3457
3458         split = layout.split()
3459
3460         col = split.column()
3461         col.label(text="Overlays:")
3462         col.prop(mesh, "show_faces", text="Faces")
3463         col.prop(mesh, "show_edges", text="Edges")
3464         col.prop(mesh, "show_edge_crease", text="Creases")
3465         if with_freestyle:
3466             col.prop(mesh, "show_edge_seams", text="Seams")
3467
3468         layout.prop(mesh, "show_weight")
3469
3470         col = split.column()
3471         col.label()
3472         if not with_freestyle:
3473             col.prop(mesh, "show_edge_seams", text="Seams")
3474         col.prop(mesh, "show_edge_sharp", text="Sharp", text_ctxt=i18n_contexts.plural)
3475         col.prop(mesh, "show_edge_bevel_weight", text="Bevel")
3476         if with_freestyle:
3477             col.prop(mesh, "show_freestyle_edge_marks", text="Edge Marks")
3478             col.prop(mesh, "show_freestyle_face_marks", text="Face Marks")
3479
3480         col = layout.column()
3481
3482         col.separator()
3483         col.label(text="Normals:")
3484         row = col.row(align=True)
3485
3486         row.prop(mesh, "show_normal_vertex", text="", icon='VERTEXSEL')
3487         row.prop(mesh, "show_normal_loop", text="", icon='LOOPSEL')
3488         row.prop(mesh, "show_normal_face", text="", icon='FACESEL')
3489
3490         sub = row.row(align=True)
3491         sub.active = mesh.show_normal_vertex or mesh.show_normal_face or mesh.show_normal_loop
3492         sub.prop(scene.tool_settings, "normal_size", text="Size")
3493
3494         col.separator()
3495         split = layout.split()
3496         col = split.column()
3497         col.label(text="Edge Info:")
3498         col.prop(mesh, "show_extra_edge_length", text="Length")
3499         col.prop(mesh, "show_extra_edge_angle", text="Angle")
3500         col = split.column()
3501         col.label(text="Face Info:")
3502         col.prop(mesh, "show_extra_face_area", text="Area")
3503         col.prop(mesh, "show_extra_face_angle", text="Angle")
3504         if bpy.app.debug:
3505             layout.prop(mesh, "show_extra_indices")
3506
3507
3508 class VIEW3D_PT_view3d_meshstatvis(Panel):
3509     bl_space_type = 'VIEW_3D'
3510     bl_region_type = 'UI'
3511     bl_label = "Mesh Analysis"
3512
3513     @classmethod
3514     def poll(cls, context):
3515         # The active object check is needed because of local-mode
3516         return (context.active_object and (context.mode == 'EDIT_MESH'))
3517
3518     def draw_header(self, context):
3519         mesh = context.active_object.data
3520
3521         self.layout.prop(mesh, "show_statvis", text="")
3522
3523     def draw(self, context):
3524         layout = self.layout
3525
3526         mesh = context.active_object.data
3527         statvis = context.tool_settings.statvis
3528         layout.active = mesh.show_statvis
3529
3530         layout.prop(statvis, "type")
3531         statvis_type = statvis.type
3532         if statvis_type == 'OVERHANG':
3533             row = layout.row(align=True)
3534             row.prop(statvis, "overhang_min", text="")
3535             row.prop(statvis, "overhang_max", text="")
3536             layout.prop(statvis, "overhang_axis", expand=True)
3537         elif statvis_type == 'THICKNESS':
3538             row = layout.row(align=True)
3539             row.prop(statvis, "thickness_min", text="")
3540             row.prop(statvis, "thickness_max", text="")
3541             layout.prop(statvis, "thickness_samples")
3542         elif statvis_type == 'INTERSECT':
3543             pass
3544         elif statvis_type == 'DISTORT':
3545             row = layout.row(align=True)
3546             row.prop(statvis, "distort_min", text="")
3547             row.prop(statvis, "distort_max", text="")
3548         elif statvis_type == 'SHARP':
3549             row = layout.row(align=True)
3550             row.prop(statvis, "sharp_min", text="")
3551             row.prop(statvis, "sharp_max", text="")
3552
3553
3554 class VIEW3D_PT_view3d_curvedisplay(Panel):
3555     bl_space_type = 'VIEW_3D'
3556     bl_region_type = 'UI'
3557     bl_label = "Curve Display"
3558
3559     @classmethod
3560     def poll(cls, context):
3561         editmesh = context.mode == 'EDIT_CURVE'
3562         return (editmesh)
3563
3564     def draw(self, context):
3565         layout = self.layout
3566
3567         curve = context.active_object.data
3568