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