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