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