1 # ##### BEGIN GPL LICENSE BLOCK #####
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.
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.
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.
17 # ##### END GPL LICENSE BLOCK #####
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
27 class VIEW3D_HT_header(Header):
28 bl_space_type = 'VIEW_3D'
30 def draw(self, context):
33 view = context.space_data
34 # mode_string = context.mode
35 obj = context.active_object
36 toolsettings = context.tool_settings
38 row = layout.row(align=True)
40 sub = row.row(align=True)
42 VIEW3D_MT_editor_menus.draw_collapsible(context, layout)
44 # Contains buttons like Mode, Pivot, Manipulator, Layer, Mesh Select Mode...
46 layout.template_header_3D()
51 if mode == 'PARTICLE_EDIT':
52 row.prop(toolsettings.particle_edit, "select_mode", text="", expand=True)
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="")
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)
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)
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, "use_snap_grid_absolute", text="")
92 row.prop(toolsettings, "snap_target", text="")
94 if mode in {'OBJECT', 'POSE'} and snap_element != 'VOLUME':
95 row.prop(toolsettings, "use_snap_align_rotation", text="")
97 row.prop(toolsettings, "use_snap_self", text="")
99 if snap_element == 'VOLUME':
100 row.prop(toolsettings, "use_snap_peel_object", text="")
101 elif snap_element == 'FACE':
102 row.prop(toolsettings, "use_snap_project", text="")
106 if (mode == 'EDIT' and obj.type == 'MESH'):
107 layout.prop(toolsettings, "use_mesh_automerge", text="", icon='AUTOMERGE_ON')
110 row = layout.row(align=True)
111 row.operator("render.opengl", text="", icon='RENDER_STILL')
112 row.operator("render.opengl", text="", icon='RENDER_ANIMATION').animation = True
115 if obj and mode == 'POSE':
116 row = layout.row(align=True)
117 row.operator("pose.copy", text="", icon='COPYDOWN')
118 row.operator("pose.paste", text="", icon='PASTEDOWN').flipped = False
119 row.operator("pose.paste", text="", icon='PASTEFLIPDOWN').flipped = True
122 if context.gpencil_data and context.gpencil_data.use_stroke_edit_mode:
123 row = layout.row(align=True)
124 row.operator("gpencil.copy", text="", icon='COPYDOWN')
125 row.operator("gpencil.paste", text="", icon='PASTEDOWN')
127 layout.prop(context.gpencil_data, "use_onion_skinning", text="Onion Skins", icon='PARTICLE_PATH') # XXX: icon
130 class VIEW3D_MT_editor_menus(Menu):
131 bl_space_type = 'VIEW3D_MT_editor_menus'
134 def draw(self, context):
135 self.draw_menus(self.layout, context)
138 def draw_menus(layout, context):
139 obj = context.active_object
140 mode_string = context.mode
141 edit_object = context.edit_object
142 gp_edit = context.gpencil_data and context.gpencil_data.use_stroke_edit_mode
144 layout.menu("VIEW3D_MT_view")
148 layout.menu("VIEW3D_MT_select_gpencil")
149 elif mode_string in {'PAINT_WEIGHT', 'PAINT_VERTEX', 'PAINT_TEXTURE'}:
151 if mesh.use_paint_mask:
152 layout.menu("VIEW3D_MT_select_paint_mask")
153 elif mesh.use_paint_mask_vertex and mode_string == 'PAINT_WEIGHT':
154 layout.menu("VIEW3D_MT_select_paint_mask_vertex")
155 elif mode_string != 'SCULPT':
156 layout.menu("VIEW3D_MT_select_%s" % mode_string.lower())
160 elif mode_string == 'OBJECT':
161 layout.menu("INFO_MT_add", text="Add")
162 elif mode_string == 'EDIT_MESH':
163 layout.menu("INFO_MT_mesh_add", text="Add")
164 elif mode_string == 'EDIT_CURVE':
165 layout.menu("INFO_MT_curve_add", text="Add")
166 elif mode_string == 'EDIT_SURFACE':
167 layout.menu("INFO_MT_surface_add", text="Add")
168 elif mode_string == 'EDIT_METABALL':
169 layout.menu("INFO_MT_metaball_add", text="Add")
170 elif mode_string == 'EDIT_ARMATURE':
171 layout.menu("INFO_MT_edit_armature_add", text="Add")
174 layout.menu("VIEW3D_MT_edit_gpencil")
176 layout.menu("VIEW3D_MT_edit_%s" % edit_object.type.lower())
178 if mode_string != 'PAINT_TEXTURE':
179 layout.menu("VIEW3D_MT_%s" % mode_string.lower())
180 if mode_string in {'SCULPT', 'PAINT_VERTEX', 'PAINT_WEIGHT', 'PAINT_TEXTURE'}:
181 layout.menu("VIEW3D_MT_brush")
182 if mode_string == 'SCULPT':
183 layout.menu("VIEW3D_MT_hide_mask")
185 layout.menu("VIEW3D_MT_object")
188 # ********** Menu **********
191 # ********** Utilities **********
195 bl_label = "Show/Hide"
198 def draw(self, context):
201 layout.operator("%s.reveal" % self._operator_name, text="Show Hidden")
202 layout.operator("%s.hide" % self._operator_name, text="Hide Selected").unselected = False
203 layout.operator("%s.hide" % self._operator_name, text="Hide Unselected").unselected = True
206 # Standard transforms which apply to all cases
207 # NOTE: this doesn't seem to be able to be used directly
208 class VIEW3D_MT_transform_base(Menu):
209 bl_label = "Transform"
211 # TODO: get rid of the custom text strings?
212 def draw(self, context):
215 layout.operator("transform.translate", text="Grab/Move")
216 # TODO: sub-menu for grab per axis
217 layout.operator("transform.rotate", text="Rotate")
218 # TODO: sub-menu for rot per axis
219 layout.operator("transform.resize", text="Scale")
220 # TODO: sub-menu for scale per axis
224 layout.operator("transform.tosphere", text="To Sphere")
225 layout.operator("transform.shear", text="Shear")
226 layout.operator("transform.bend", text="Bend")
227 layout.operator("transform.push_pull", text="Push/Pull")
229 if context.mode != 'OBJECT':
230 layout.operator("transform.vertex_warp", text="Warp")
231 layout.operator("transform.vertex_random", text="Randomize")
234 # Generic transform menu - geometry types
235 class VIEW3D_MT_transform(VIEW3D_MT_transform_base):
236 def draw(self, context):
238 VIEW3D_MT_transform_base.draw(self, context)
242 layout.operator("transform.shrink_fatten", text="Shrink Fatten")
246 layout.operator("transform.translate", text="Move Texture Space").texture_space = True
247 layout.operator("transform.resize", text="Scale Texture Space").texture_space = True
250 # Object-specific extensions to Transform menu
251 class VIEW3D_MT_transform_object(VIEW3D_MT_transform_base):
252 def draw(self, context):
256 VIEW3D_MT_transform_base.draw(self, context)
258 # object-specific option follow...
261 layout.operator("transform.translate", text="Move Texture Space").texture_space = True
262 layout.operator("transform.resize", text="Scale Texture Space").texture_space = True
266 layout.operator_context = 'EXEC_REGION_WIN'
267 layout.operator("transform.transform", text="Align to Transform Orientation").mode = 'ALIGN' # XXX see alignmenu() in edit.c of b2.4x to get this working
271 layout.operator_context = 'EXEC_AREA'
273 layout.operator("object.origin_set", text="Geometry to Origin").type = 'GEOMETRY_ORIGIN'
274 layout.operator("object.origin_set", text="Origin to Geometry").type = 'ORIGIN_GEOMETRY'
275 layout.operator("object.origin_set", text="Origin to 3D Cursor").type = 'ORIGIN_CURSOR'
276 layout.operator("object.origin_set", text="Origin to Center of Mass").type = 'ORIGIN_CENTER_OF_MASS'
279 layout.operator("object.randomize_transform")
280 layout.operator("object.align")
284 layout.operator("object.anim_transforms_to_deltas")
287 # Armature EditMode extensions to Transform menu
288 class VIEW3D_MT_transform_armature(VIEW3D_MT_transform_base):
289 def draw(self, context):
293 VIEW3D_MT_transform_base.draw(self, context)
295 # armature specific extensions follow...
299 if obj.type == 'ARMATURE' and obj.mode in {'EDIT', 'POSE'}:
300 if obj.data.draw_type == 'BBONE':
301 layout.operator("transform.transform", text="Scale BBone").mode = 'BONE_SIZE'
302 elif obj.data.draw_type == 'ENVELOPE':
303 layout.operator("transform.transform", text="Scale Envelope Distance").mode = 'BONE_SIZE'
304 layout.operator("transform.transform", text="Scale Radius").mode = 'BONE_ENVELOPE'
306 if context.edit_object and context.edit_object.type == 'ARMATURE':
307 layout.operator("armature.align")
310 class VIEW3D_MT_mirror(Menu):
313 def draw(self, context):
316 layout.operator("transform.mirror", text="Interactive Mirror")
320 layout.operator_context = 'INVOKE_REGION_WIN'
322 props = layout.operator("transform.mirror", text="X Global")
323 props.constraint_axis = (True, False, False)
324 props.constraint_orientation = 'GLOBAL'
325 props = layout.operator("transform.mirror", text="Y Global")
326 props.constraint_axis = (False, True, False)
327 props.constraint_orientation = 'GLOBAL'
328 props = layout.operator("transform.mirror", text="Z Global")
329 props.constraint_axis = (False, False, True)
330 props.constraint_orientation = 'GLOBAL'
332 if context.edit_object:
335 props = layout.operator("transform.mirror", text="X Local")
336 props.constraint_axis = (True, False, False)
337 props.constraint_orientation = 'LOCAL'
338 props = layout.operator("transform.mirror", text="Y Local")
339 props.constraint_axis = (False, True, False)
340 props.constraint_orientation = 'LOCAL'
341 props = layout.operator("transform.mirror", text="Z Local")
342 props.constraint_axis = (False, False, True)
343 props.constraint_orientation = 'LOCAL'
345 layout.operator("object.vertex_group_mirror")
348 class VIEW3D_MT_snap(Menu):
351 def draw(self, context):
354 layout.operator("view3d.snap_selected_to_grid", text="Selection to Grid")
355 layout.operator("view3d.snap_selected_to_cursor", text="Selection to Cursor").use_offset = False
356 layout.operator("view3d.snap_selected_to_cursor", text="Selection to Cursor (Offset)").use_offset = True
360 layout.operator("view3d.snap_cursor_to_selected", text="Cursor to Selected")
361 layout.operator("view3d.snap_cursor_to_center", text="Cursor to Center")
362 layout.operator("view3d.snap_cursor_to_grid", text="Cursor to Grid")
363 layout.operator("view3d.snap_cursor_to_active", text="Cursor to Active")
366 class VIEW3D_MT_uv_map(Menu):
367 bl_label = "UV Mapping"
369 def draw(self, context):
372 layout.operator("uv.unwrap")
374 layout.operator_context = 'INVOKE_DEFAULT'
375 layout.operator("uv.smart_project")
376 layout.operator("uv.lightmap_pack")
377 layout.operator("uv.follow_active_quads")
381 layout.operator_context = 'EXEC_REGION_WIN'
382 layout.operator("uv.cube_project")
383 layout.operator("uv.cylinder_project")
384 layout.operator("uv.sphere_project")
388 layout.operator_context = 'INVOKE_REGION_WIN'
389 layout.operator("uv.project_from_view").scale_to_bounds = False
390 layout.operator("uv.project_from_view", text="Project from View (Bounds)").scale_to_bounds = True
394 layout.operator("uv.reset")
397 # ********** View menus **********
400 class VIEW3D_MT_view(Menu):
403 def draw(self, context):
406 layout.operator("view3d.properties", icon='MENU_PANEL')
407 layout.operator("view3d.toolshelf", icon='MENU_PANEL')
411 layout.operator("view3d.viewnumpad", text="Camera").type = 'CAMERA'
412 layout.operator("view3d.viewnumpad", text="Top").type = 'TOP'
413 layout.operator("view3d.viewnumpad", text="Bottom").type = 'BOTTOM'
414 layout.operator("view3d.viewnumpad", text="Front").type = 'FRONT'
415 layout.operator("view3d.viewnumpad", text="Back").type = 'BACK'
416 layout.operator("view3d.viewnumpad", text="Right").type = 'RIGHT'
417 layout.operator("view3d.viewnumpad", text="Left").type = 'LEFT'
419 layout.menu("VIEW3D_MT_view_cameras", text="Cameras")
423 layout.operator("view3d.view_persportho")
427 layout.menu("VIEW3D_MT_view_navigation")
428 layout.menu("VIEW3D_MT_view_align")
432 layout.operator_context = 'INVOKE_REGION_WIN'
434 layout.operator("view3d.clip_border", text="Clipping Border...")
435 layout.operator("view3d.zoom_border", text="Zoom Border...")
436 layout.operator("view3d.render_border", text="Render Border...").camera_only = False
440 layout.operator("view3d.layers", text="Show All Layers").nr = 0
444 layout.operator("view3d.localview", text="View Global/Local")
445 layout.operator("view3d.view_selected").use_all_regions = False
446 layout.operator("view3d.view_all").center = False
450 layout.operator("screen.animation_play", text="Playback Animation")
454 layout.operator("screen.area_dupli")
455 layout.operator("screen.region_quadview")
456 layout.operator("screen.screen_full_area", text="Toggle Maximize Area")
457 layout.operator("screen.screen_full_area").use_hide_panels = True
460 class VIEW3D_MT_view_navigation(Menu):
461 bl_label = "Navigation"
463 def draw(self, context):
467 layout.operator_enum("view3d.view_orbit", "type")
468 props = layout.operator("view3d.view_orbit", "Orbit Opposite")
469 props.type = 'ORBITRIGHT'
474 layout.operator("view3d.view_roll", text="Roll Left").angle = pi / -12.0
475 layout.operator("view3d.view_roll", text="Roll Right").angle = pi / 12.0
479 layout.operator_enum("view3d.view_pan", "type")
483 layout.operator("view3d.zoom", text="Zoom In").delta = 1
484 layout.operator("view3d.zoom", text="Zoom Out").delta = -1
485 layout.operator("view3d.zoom_camera_1_to_1", text="Zoom Camera 1:1")
489 layout.operator("view3d.fly")
490 layout.operator("view3d.walk")
493 class VIEW3D_MT_view_align(Menu):
494 bl_label = "Align View"
496 def draw(self, context):
499 layout.menu("VIEW3D_MT_view_align_selected")
503 layout.operator("view3d.view_all", text="Center Cursor and View All").center = True
504 layout.operator("view3d.camera_to_view", text="Align Active Camera to View")
505 layout.operator("view3d.camera_to_view_selected", text="Align Active Camera to Selected")
506 layout.operator("view3d.view_selected")
507 layout.operator("view3d.view_center_cursor")
511 layout.operator("view3d.view_lock_to_active")
512 layout.operator("view3d.view_lock_clear")
515 class VIEW3D_MT_view_align_selected(Menu):
516 bl_label = "Align View to Active"
518 def draw(self, context):
521 props = layout.operator("view3d.viewnumpad", text="Top")
522 props.align_active = True
525 props = layout.operator("view3d.viewnumpad", text="Bottom")
526 props.align_active = True
527 props.type = 'BOTTOM'
529 props = layout.operator("view3d.viewnumpad", text="Front")
530 props.align_active = True
533 props = layout.operator("view3d.viewnumpad", text="Back")
534 props.align_active = True
537 props = layout.operator("view3d.viewnumpad", text="Right")
538 props.align_active = True
541 props = layout.operator("view3d.viewnumpad", text="Left")
542 props.align_active = True
546 class VIEW3D_MT_view_cameras(Menu):
549 def draw(self, context):
552 layout.operator("view3d.object_as_camera")
553 layout.operator("view3d.viewnumpad", text="Active Camera").type = 'CAMERA'
556 # ********** Select menus, suffix from context.mode **********
558 class VIEW3D_MT_select_object_more_less(Menu):
559 bl_label = "Select More/Less"
561 def draw(self, context):
566 layout.operator("object.select_more", text="More")
567 layout.operator("object.select_less", text="Less")
571 props = layout.operator("object.select_hierarchy", text="Parent")
573 props.direction = 'PARENT'
575 props = layout.operator("object.select_hierarchy", text="Child")
577 props.direction = 'CHILD'
581 props = layout.operator("object.select_hierarchy", text="Extend Parent")
583 props.direction = 'PARENT'
585 props = layout.operator("object.select_hierarchy", text="Extend Child")
587 props.direction = 'CHILD'
590 class VIEW3D_MT_select_object(Menu):
593 def draw(self, context):
596 layout.operator("view3d.select_border")
597 layout.operator("view3d.select_circle")
601 layout.operator("object.select_all").action = 'TOGGLE'
602 layout.operator("object.select_all", text="Inverse").action = 'INVERT'
603 layout.operator("object.select_random", text="Random")
604 layout.operator("object.select_mirror", text="Mirror")
605 layout.operator("object.select_by_layer", text="Select All by Layer")
606 layout.operator_menu_enum("object.select_by_type", "type", text="Select All by Type...")
607 layout.operator("object.select_camera", text="Select Camera")
611 layout.menu("VIEW3D_MT_select_object_more_less")
615 layout.operator_menu_enum("object.select_grouped", "type", text="Grouped")
616 layout.operator_menu_enum("object.select_linked", "type", text="Linked")
617 layout.operator("object.select_pattern", text="Select Pattern...")
620 class VIEW3D_MT_select_pose_more_less(Menu):
621 bl_label = "Select More/Less"
623 def draw(self, context):
628 props = layout.operator("pose.select_hierarchy", text="Parent")
630 props.direction = 'PARENT'
632 props = layout.operator("pose.select_hierarchy", text="Child")
634 props.direction = 'CHILD'
638 props = layout.operator("pose.select_hierarchy", text="Extend Parent")
640 props.direction = 'PARENT'
642 props = layout.operator("pose.select_hierarchy", text="Extend Child")
644 props.direction = 'CHILD'
647 class VIEW3D_MT_select_pose(Menu):
650 def draw(self, context):
653 layout.operator("view3d.select_border")
654 layout.operator("view3d.select_circle")
658 layout.operator("pose.select_all").action = 'TOGGLE'
659 layout.operator("pose.select_all", text="Inverse").action = 'INVERT'
660 layout.operator("pose.select_mirror", text="Flip Active")
661 layout.operator("pose.select_constraint_target", text="Constraint Target")
662 layout.operator("pose.select_linked", text="Linked")
666 layout.menu("VIEW3D_MT_select_pose_more_less")
670 layout.operator_menu_enum("pose.select_grouped", "type", text="Grouped")
671 layout.operator("object.select_pattern", text="Select Pattern...")
674 class VIEW3D_MT_select_particle(Menu):
677 def draw(self, context):
680 layout.operator("view3d.select_border")
684 layout.operator("particle.select_all").action = 'TOGGLE'
685 layout.operator("particle.select_linked")
686 layout.operator("particle.select_all", text="Inverse").action = 'INVERT'
690 layout.operator("particle.select_more")
691 layout.operator("particle.select_less")
695 layout.operator("particle.select_random")
699 layout.operator("particle.select_roots", text="Roots")
700 layout.operator("particle.select_tips", text="Tips")
703 class VIEW3D_MT_edit_mesh_select_similar(Menu):
704 bl_label = "Select Similar"
706 def draw(self, context):
709 layout.operator_enum("mesh.select_similar", "type")
713 layout.operator("mesh.select_similar_region", text="Face Regions")
716 class VIEW3D_MT_edit_mesh_select_by_trait(Menu):
717 bl_label = "Select All by Trait"
719 def draw(self, context):
721 if context.scene.tool_settings.mesh_select_mode[2] is False:
722 layout.operator("mesh.select_non_manifold", text="Non Manifold")
723 layout.operator("mesh.select_loose", text="Loose Geometry")
724 layout.operator("mesh.select_interior_faces", text="Interior Faces")
725 layout.operator("mesh.select_face_by_sides")
729 layout.operator("mesh.select_ungrouped", text="Ungrouped Verts")
732 class VIEW3D_MT_edit_mesh_select_more_less(Menu):
733 bl_label = "Select More/Less"
735 def draw(self, context):
738 layout.operator("mesh.select_more", text="More")
739 layout.operator("mesh.select_less", text="Less")
743 layout.operator("mesh.select_next_item", text="Next Active")
744 layout.operator("mesh.select_prev_item", text="Previous Active")
747 class VIEW3D_MT_select_edit_mesh(Menu):
750 def draw(self, context):
753 layout.operator("view3d.select_border")
754 layout.operator("view3d.select_circle")
759 layout.operator("mesh.select_all").action = 'TOGGLE'
760 layout.operator("mesh.select_all", text="Inverse").action = 'INVERT'
765 layout.operator("mesh.select_random", text="Random")
766 layout.operator("mesh.select_nth")
771 layout.operator("mesh.edges_select_sharp", text="Sharp Edges")
772 layout.operator("mesh.faces_select_linked_flat", text="Linked Flat Faces")
777 layout.menu("VIEW3D_MT_edit_mesh_select_similar")
781 layout.menu("VIEW3D_MT_edit_mesh_select_by_trait")
785 layout.menu("VIEW3D_MT_edit_mesh_select_more_less")
789 layout.operator("mesh.select_mirror", text="Mirror")
790 layout.operator("mesh.select_axis", text="Side of Active")
792 layout.operator("mesh.select_linked", text="Linked")
793 layout.operator("mesh.shortest_path_select", text="Shortest Path")
794 layout.operator("mesh.loop_multi_select", text="Edge Loops").ring = False
795 layout.operator("mesh.loop_multi_select", text="Edge Rings").ring = True
799 layout.operator("mesh.loop_to_region")
800 layout.operator("mesh.region_to_loop")
803 class VIEW3D_MT_select_edit_curve(Menu):
806 def draw(self, context):
809 layout.operator("view3d.select_border")
810 layout.operator("view3d.select_circle")
814 layout.operator("curve.select_all").action = 'TOGGLE'
815 layout.operator("curve.select_all", text="Inverse").action = 'INVERT'
816 layout.operator("curve.select_random")
817 layout.operator("curve.select_nth")
818 layout.operator("curve.select_linked", text="Select Linked")
819 layout.operator("curve.select_similar", text="Select Similar")
823 layout.operator("curve.de_select_first")
824 layout.operator("curve.de_select_last")
825 layout.operator("curve.select_next")
826 layout.operator("curve.select_previous")
830 layout.operator("curve.select_more")
831 layout.operator("curve.select_less")
834 class VIEW3D_MT_select_edit_surface(Menu):
837 def draw(self, context):
840 layout.operator("view3d.select_border")
841 layout.operator("view3d.select_circle")
845 layout.operator("curve.select_all").action = 'TOGGLE'
846 layout.operator("curve.select_all", text="Inverse").action = 'INVERT'
847 layout.operator("curve.select_random")
848 layout.operator("curve.select_nth")
849 layout.operator("curve.select_linked", text="Select Linked")
850 layout.operator("curve.select_similar", text="Select Similar")
854 layout.operator("curve.select_row")
858 layout.operator("curve.select_more")
859 layout.operator("curve.select_less")
862 class VIEW3D_MT_select_edit_text(Menu):
863 # intentional name mis-match
864 # select menu for 3d-text doesn't make sense
867 def draw(self, context):
870 layout.operator("font.text_copy", text="Copy")
871 layout.operator("font.text_cut", text="Cut")
872 layout.operator("font.text_paste", text="Paste")
876 layout.operator("font.text_paste_from_file")
877 layout.operator("font.text_paste_from_clipboard")
881 layout.operator("font.select_all")
884 class VIEW3D_MT_select_edit_metaball(Menu):
887 def draw(self, context):
890 layout.operator("view3d.select_border")
891 layout.operator("view3d.select_circle")
895 layout.operator("mball.select_all").action = 'TOGGLE'
896 layout.operator("mball.select_all", text="Inverse").action = 'INVERT'
900 layout.operator("mball.select_random_metaelems")
904 layout.operator_menu_enum("mball.select_similar", "type", text="Similar")
907 class VIEW3D_MT_select_edit_lattice(Menu):
910 def draw(self, context):
913 layout.operator("view3d.select_border")
914 layout.operator("view3d.select_circle")
918 layout.operator("lattice.select_mirror")
919 layout.operator("lattice.select_random")
920 layout.operator("lattice.select_all").action = 'TOGGLE'
921 layout.operator("lattice.select_all", text="Inverse").action = 'INVERT'
925 layout.operator("lattice.select_ungrouped", text="Ungrouped Verts")
928 class VIEW3D_MT_select_edit_armature(Menu):
931 def draw(self, context):
934 layout.operator("view3d.select_border")
935 layout.operator("view3d.select_circle")
939 layout.operator("armature.select_all").action = 'TOGGLE'
940 layout.operator("armature.select_all", text="Inverse").action = 'INVERT'
941 layout.operator("armature.select_mirror", text="Mirror").extend = False
945 layout.operator("armature.select_more", text="More")
946 layout.operator("armature.select_less", text="Less")
950 props = layout.operator("armature.select_hierarchy", text="Parent")
952 props.direction = 'PARENT'
954 props = layout.operator("armature.select_hierarchy", text="Child")
956 props.direction = 'CHILD'
960 props = layout.operator("armature.select_hierarchy", text="Extend Parent")
962 props.direction = 'PARENT'
964 props = layout.operator("armature.select_hierarchy", text="Extend Child")
966 props.direction = 'CHILD'
968 layout.operator_menu_enum("armature.select_similar", "type", text="Similar")
969 layout.operator("object.select_pattern", text="Select Pattern...")
972 class VIEW3D_MT_select_gpencil(Menu):
975 def draw(self, context):
978 layout.operator("gpencil.select_border")
979 layout.operator("gpencil.select_circle")
983 layout.operator("gpencil.select_all", text="(De)select All").action = 'TOGGLE'
984 layout.operator("gpencil.select_all", text="Inverse").action = 'INVERT'
985 layout.operator("gpencil.select_linked", text="Linked")
986 #layout.operator_menu_enum("gpencil.select_grouped", "type", text="Grouped")
987 layout.operator("gpencil.select_grouped", text="Grouped")
991 layout.operator("gpencil.select_more")
992 layout.operator("gpencil.select_less")
995 class VIEW3D_MT_select_paint_mask(Menu):
998 def draw(self, context):
1001 layout.operator("view3d.select_border")
1002 layout.operator("view3d.select_circle")
1006 layout.operator("paint.face_select_all").action = 'TOGGLE'
1007 layout.operator("paint.face_select_all", text="Inverse").action = 'INVERT'
1011 layout.operator("paint.face_select_linked", text="Linked")
1014 class VIEW3D_MT_select_paint_mask_vertex(Menu):
1017 def draw(self, context):
1018 layout = self.layout
1020 layout.operator("view3d.select_border")
1021 layout.operator("view3d.select_circle")
1025 layout.operator("paint.vert_select_all").action = 'TOGGLE'
1026 layout.operator("paint.vert_select_all", text="Inverse").action = 'INVERT'
1030 layout.operator("paint.vert_select_ungrouped", text="Ungrouped Verts")
1033 class VIEW3D_MT_angle_control(Menu):
1034 bl_label = "Angle Control"
1037 def poll(cls, context):
1038 settings = UnifiedPaintPanel.paint_settings(context)
1042 brush = settings.brush
1043 tex_slot = brush.texture_slot
1045 return tex_slot.has_texture_angle and tex_slot.has_texture_angle_source
1047 def draw(self, context):
1048 layout = self.layout
1050 settings = UnifiedPaintPanel.paint_settings(context)
1051 brush = settings.brush
1053 sculpt = (context.sculpt_object is not None)
1055 tex_slot = brush.texture_slot
1057 layout.prop(tex_slot, "use_rake", text="Rake")
1059 if brush.brush_capabilities.has_random_texture_angle and tex_slot.has_random_texture_angle:
1061 if brush.sculpt_capabilities.has_random_texture_angle:
1062 layout.prop(tex_slot, "use_random", text="Random")
1064 layout.prop(tex_slot, "use_random", text="Random")
1067 # ********** Add menu **********
1069 # XXX: INFO_MT_ names used to keep backwards compatibility (Addons etc that hook into the menu)
1072 class INFO_MT_mesh_add(Menu):
1073 bl_idname = "INFO_MT_mesh_add"
1076 def draw(self, context):
1077 from .space_view3d_toolbar import VIEW3D_PT_tools_add_object
1079 layout = self.layout
1081 layout.operator_context = 'INVOKE_REGION_WIN'
1083 VIEW3D_PT_tools_add_object.draw_add_mesh(layout)
1086 class INFO_MT_curve_add(Menu):
1087 bl_idname = "INFO_MT_curve_add"
1090 def draw(self, context):
1091 from .space_view3d_toolbar import VIEW3D_PT_tools_add_object
1092 layout = self.layout
1094 layout.operator_context = 'INVOKE_REGION_WIN'
1096 VIEW3D_PT_tools_add_object.draw_add_curve(layout)
1099 class INFO_MT_surface_add(Menu):
1100 bl_idname = "INFO_MT_surface_add"
1101 bl_label = "Surface"
1103 def draw(self, context):
1104 from .space_view3d_toolbar import VIEW3D_PT_tools_add_object
1105 layout = self.layout
1107 layout.operator_context = 'INVOKE_REGION_WIN'
1109 VIEW3D_PT_tools_add_object.draw_add_surface(layout)
1112 class INFO_MT_metaball_add(Menu):
1113 bl_idname = "INFO_MT_metaball_add"
1114 bl_label = "Metaball"
1116 def draw(self, context):
1117 layout = self.layout
1119 layout.operator_context = 'INVOKE_REGION_WIN'
1120 layout.operator_enum("object.metaball_add", "type")
1123 class INFO_MT_edit_curve_add(Menu):
1124 bl_idname = "INFO_MT_edit_curve_add"
1127 def draw(self, context):
1128 is_surf = context.active_object.type == 'SURFACE'
1130 layout = self.layout
1131 layout.operator_context = 'EXEC_REGION_WIN'
1134 INFO_MT_surface_add.draw(self, context)
1136 INFO_MT_curve_add.draw(self, context)
1139 class INFO_MT_edit_armature_add(Menu):
1140 bl_idname = "INFO_MT_edit_armature_add"
1141 bl_label = "Armature"
1143 def draw(self, context):
1144 layout = self.layout
1146 layout.operator_context = 'EXEC_REGION_WIN'
1147 layout.operator("armature.bone_primitive_add", text="Single Bone", icon='BONE_DATA')
1150 class INFO_MT_armature_add(Menu):
1151 bl_idname = "INFO_MT_armature_add"
1152 bl_label = "Armature"
1154 def draw(self, context):
1155 layout = self.layout
1157 layout.operator_context = 'EXEC_REGION_WIN'
1158 layout.operator("object.armature_add", text="Single Bone", icon='BONE_DATA')
1161 class INFO_MT_lamp_add(Menu):
1162 bl_idname = "INFO_MT_lamp_add"
1165 def draw(self, context):
1166 layout = self.layout
1168 layout.operator_context = 'INVOKE_REGION_WIN'
1169 layout.operator_enum("object.lamp_add", "type")
1172 class INFO_MT_add(Menu):
1175 def draw(self, context):
1176 layout = self.layout
1178 # note, don't use 'EXEC_SCREEN' or operators wont get the 'v3d' context.
1180 # Note: was EXEC_AREA, but this context does not have the 'rv3d', which prevents
1181 # "align_view" to work on first call (see [#32719]).
1182 layout.operator_context = 'EXEC_REGION_WIN'
1184 #layout.operator_menu_enum("object.mesh_add", "type", text="Mesh", icon='OUTLINER_OB_MESH')
1185 layout.menu("INFO_MT_mesh_add", icon='OUTLINER_OB_MESH')
1187 #layout.operator_menu_enum("object.curve_add", "type", text="Curve", icon='OUTLINER_OB_CURVE')
1188 layout.menu("INFO_MT_curve_add", icon='OUTLINER_OB_CURVE')
1189 #layout.operator_menu_enum("object.surface_add", "type", text="Surface", icon='OUTLINER_OB_SURFACE')
1190 layout.menu("INFO_MT_surface_add", icon='OUTLINER_OB_SURFACE')
1191 layout.menu("INFO_MT_metaball_add", text="Metaball", icon='OUTLINER_OB_META')
1192 layout.operator("object.text_add", text="Text", icon='OUTLINER_OB_FONT')
1195 layout.menu("INFO_MT_armature_add", icon='OUTLINER_OB_ARMATURE')
1196 layout.operator("object.add", text="Lattice", icon='OUTLINER_OB_LATTICE').type = 'LATTICE'
1197 layout.operator_menu_enum("object.empty_add", "type", text="Empty", icon='OUTLINER_OB_EMPTY')
1200 layout.operator("object.speaker_add", text="Speaker", icon='OUTLINER_OB_SPEAKER')
1203 layout.operator("object.camera_add", text="Camera", icon='OUTLINER_OB_CAMERA')
1204 layout.menu("INFO_MT_lamp_add", icon='OUTLINER_OB_LAMP')
1207 layout.operator_menu_enum("object.effector_add", "type", text="Force Field", icon='OUTLINER_OB_EMPTY')
1210 if len(bpy.data.groups) > 10:
1211 layout.operator_context = 'INVOKE_REGION_WIN'
1212 layout.operator("object.group_instance_add", text="Group Instance...", icon='OUTLINER_OB_EMPTY')
1214 layout.operator_menu_enum("object.group_instance_add", "group", text="Group Instance", icon='OUTLINER_OB_EMPTY')
1217 # ********** Object menu **********
1220 class VIEW3D_MT_object(Menu):
1221 bl_context = "objectmode"
1224 def draw(self, context):
1225 layout = self.layout
1227 layout.operator("ed.undo")
1228 layout.operator("ed.redo")
1229 layout.operator("ed.undo_history")
1233 layout.menu("VIEW3D_MT_transform_object")
1234 layout.menu("VIEW3D_MT_mirror")
1235 layout.menu("VIEW3D_MT_object_clear")
1236 layout.menu("VIEW3D_MT_object_apply")
1237 layout.menu("VIEW3D_MT_snap")
1241 layout.menu("VIEW3D_MT_object_animation")
1245 layout.operator("object.duplicate_move")
1246 layout.operator("object.duplicate_move_linked")
1247 layout.operator("object.delete", text="Delete...").use_global = False
1248 layout.operator("object.proxy_make", text="Make Proxy...")
1249 layout.menu("VIEW3D_MT_make_links", text="Make Links...")
1250 layout.operator("object.make_dupli_face")
1251 layout.operator_menu_enum("object.make_local", "type", text="Make Local...")
1252 layout.menu("VIEW3D_MT_make_single_user")
1256 layout.menu("VIEW3D_MT_object_parent")
1257 layout.menu("VIEW3D_MT_object_track")
1258 layout.menu("VIEW3D_MT_object_group")
1259 layout.menu("VIEW3D_MT_object_constraints")
1263 layout.menu("VIEW3D_MT_object_quick_effects")
1267 layout.menu("VIEW3D_MT_object_game")
1271 layout.operator("object.join")
1272 layout.operator("object.data_transfer")
1273 layout.operator("object.datalayout_transfer")
1277 layout.operator("object.move_to_layer", text="Move to Layer...")
1278 layout.menu("VIEW3D_MT_object_showhide")
1280 layout.operator_menu_enum("object.convert", "target")
1283 class VIEW3D_MT_object_animation(Menu):
1284 bl_label = "Animation"
1286 def draw(self, context):
1287 layout = self.layout
1289 layout.operator("anim.keyframe_insert_menu", text="Insert Keyframe...")
1290 layout.operator("anim.keyframe_delete_v3d", text="Delete Keyframes...")
1291 layout.operator("anim.keyframe_clear_v3d", text="Clear Keyframes...")
1292 layout.operator("anim.keying_set_active_set", text="Change Keying Set...")
1296 layout.operator("nla.bake", text="Bake Action...")
1299 class VIEW3D_MT_object_clear(Menu):
1302 def draw(self, context):
1303 layout = self.layout
1305 layout.operator("object.location_clear", text="Location")
1306 layout.operator("object.rotation_clear", text="Rotation")
1307 layout.operator("object.scale_clear", text="Scale")
1308 layout.operator("object.origin_clear", text="Origin")
1311 class VIEW3D_MT_object_specials(Menu):
1312 bl_label = "Specials"
1315 def poll(cls, context):
1316 # add more special types
1317 return context.object
1319 def draw(self, context):
1320 layout = self.layout
1322 scene = context.scene
1323 obj = context.object
1325 if obj.type == 'CAMERA':
1326 layout.operator_context = 'INVOKE_REGION_WIN'
1328 if obj.data.type == 'PERSP':
1329 props = layout.operator("wm.context_modal_mouse", text="Camera Lens Angle")
1330 props.data_path_iter = "selected_editable_objects"
1331 props.data_path_item = "data.lens"
1332 props.input_scale = 0.1
1333 if obj.data.lens_unit == 'MILLIMETERS':
1334 props.header_text = "Camera Lens Angle: %.1fmm"
1336 props.header_text = "Camera Lens Angle: %.1f\u00B0"
1339 props = layout.operator("wm.context_modal_mouse", text="Camera Lens Scale")
1340 props.data_path_iter = "selected_editable_objects"
1341 props.data_path_item = "data.ortho_scale"
1342 props.input_scale = 0.01
1343 props.header_text = "Camera Lens Scale: %.3f"
1345 if not obj.data.dof_object:
1346 view = context.space_data
1347 if view and view.camera == obj and view.region_3d.view_perspective == 'CAMERA':
1348 props = layout.operator("ui.eyedropper_depth", text="DOF Distance (Pick)")
1350 props = layout.operator("wm.context_modal_mouse", text="DOF Distance")
1351 props.data_path_iter = "selected_editable_objects"
1352 props.data_path_item = "data.dof_distance"
1353 props.input_scale = 0.02
1354 props.header_text = "DOF Distance: %.3f"
1357 if obj.type in {'CURVE', 'FONT'}:
1358 layout.operator_context = 'INVOKE_REGION_WIN'
1360 props = layout.operator("wm.context_modal_mouse", text="Extrude Size")
1361 props.data_path_iter = "selected_editable_objects"
1362 props.data_path_item = "data.extrude"
1363 props.input_scale = 0.01
1364 props.header_text = "Extrude Size: %.3f"
1366 props = layout.operator("wm.context_modal_mouse", text="Width Size")
1367 props.data_path_iter = "selected_editable_objects"
1368 props.data_path_item = "data.offset"
1369 props.input_scale = 0.01
1370 props.header_text = "Width Size: %.3f"
1372 if obj.type == 'EMPTY':
1373 layout.operator_context = 'INVOKE_REGION_WIN'
1375 props = layout.operator("wm.context_modal_mouse", text="Empty Draw Size")
1376 props.data_path_iter = "selected_editable_objects"
1377 props.data_path_item = "empty_draw_size"
1378 props.input_scale = 0.01
1379 props.header_text = "Empty Draw Size: %.3f"
1381 if obj.type == 'LAMP':
1384 layout.operator_context = 'INVOKE_REGION_WIN'
1386 if scene.render.use_shading_nodes:
1388 value = lamp.node_tree.nodes["Emission"].inputs["Strength"].default_value
1389 except AttributeError:
1392 if value is not None:
1393 props = layout.operator("wm.context_modal_mouse", text="Strength")
1394 props.data_path_iter = "selected_editable_objects"
1395 props.data_path_item = "data.node_tree.nodes[\"Emission\"].inputs[\"Strength\"].default_value"
1396 props.header_text = "Lamp Strength: %.3f"
1397 props.input_scale = 0.1
1400 if lamp.type == 'AREA':
1401 props = layout.operator("wm.context_modal_mouse", text="Size X")
1402 props.data_path_iter = "selected_editable_objects"
1403 props.data_path_item = "data.size"
1404 props.header_text = "Lamp Size X: %.3f"
1406 if lamp.shape == 'RECTANGLE':
1407 props = layout.operator("wm.context_modal_mouse", text="Size Y")
1408 props.data_path_iter = "selected_editable_objects"
1409 props.data_path_item = "data.size_y"
1410 props.header_text = "Lamp Size Y: %.3f"
1412 elif lamp.type in {'SPOT', 'POINT', 'SUN'}:
1413 props = layout.operator("wm.context_modal_mouse", text="Size")
1414 props.data_path_iter = "selected_editable_objects"
1415 props.data_path_item = "data.shadow_soft_size"
1416 props.header_text = "Lamp Size: %.3f"
1418 props = layout.operator("wm.context_modal_mouse", text="Energy")
1419 props.data_path_iter = "selected_editable_objects"
1420 props.data_path_item = "data.energy"
1421 props.header_text = "Lamp Energy: %.3f"
1423 if lamp.type in {'SPOT', 'AREA', 'POINT'}:
1424 props = layout.operator("wm.context_modal_mouse", text="Falloff Distance")
1425 props.data_path_iter = "selected_editable_objects"
1426 props.data_path_item = "data.distance"
1427 props.input_scale = 0.1
1428 props.header_text = "Lamp Falloff Distance: %.1f"
1430 if lamp.type == 'SPOT':
1432 props = layout.operator("wm.context_modal_mouse", text="Spot Size")
1433 props.data_path_iter = "selected_editable_objects"
1434 props.data_path_item = "data.spot_size"
1435 props.input_scale = 0.01
1436 props.header_text = "Spot Size: %.2f"
1438 props = layout.operator("wm.context_modal_mouse", text="Spot Blend")
1439 props.data_path_iter = "selected_editable_objects"
1440 props.data_path_item = "data.spot_blend"
1441 props.input_scale = -0.01
1442 props.header_text = "Spot Blend: %.2f"
1444 if not scene.render.use_shading_nodes:
1445 props = layout.operator("wm.context_modal_mouse", text="Clip Start")
1446 props.data_path_iter = "selected_editable_objects"
1447 props.data_path_item = "data.shadow_buffer_clip_start"
1448 props.input_scale = 0.05
1449 props.header_text = "Clip Start: %.2f"
1451 props = layout.operator("wm.context_modal_mouse", text="Clip End")
1452 props.data_path_iter = "selected_editable_objects"
1453 props.data_path_item = "data.shadow_buffer_clip_end"
1454 props.input_scale = 0.05
1455 props.header_text = "Clip End: %.2f"
1459 props = layout.operator("object.isolate_type_render")
1460 props = layout.operator("object.hide_render_clear_all")
1463 class VIEW3D_MT_object_apply(Menu):
1466 def draw(self, context):
1467 layout = self.layout
1469 props = layout.operator("object.transform_apply", text="Location", text_ctxt=i18n_contexts.default)
1470 props.location, props.rotation, props.scale = True, False, False
1472 props = layout.operator("object.transform_apply", text="Rotation", text_ctxt=i18n_contexts.default)
1473 props.location, props.rotation, props.scale = False, True, False
1475 props = layout.operator("object.transform_apply", text="Scale", text_ctxt=i18n_contexts.default)
1476 props.location, props.rotation, props.scale = False, False, True
1477 props = layout.operator("object.transform_apply", text="Rotation & Scale", text_ctxt=i18n_contexts.default)
1478 props.location, props.rotation, props.scale = False, True, True
1482 layout.operator("object.visual_transform_apply", text="Visual Transform", text_ctxt=i18n_contexts.default)
1483 layout.operator("object.duplicates_make_real")
1486 class VIEW3D_MT_object_parent(Menu):
1489 def draw(self, context):
1490 layout = self.layout
1492 layout.operator_enum("object.parent_set", "type")
1494 layout.operator_enum("object.parent_clear", "type")
1497 class VIEW3D_MT_object_track(Menu):
1500 def draw(self, context):
1501 layout = self.layout
1503 layout.operator_enum("object.track_set", "type")
1505 layout.operator_enum("object.track_clear", "type")
1508 class VIEW3D_MT_object_group(Menu):
1511 def draw(self, context):
1512 layout = self.layout
1514 layout.operator("group.create")
1515 # layout.operator_menu_enum("group.objects_remove", "group") # BUGGY
1516 layout.operator("group.objects_remove")
1517 layout.operator("group.objects_remove_all")
1521 layout.operator("group.objects_add_active")
1522 layout.operator("group.objects_remove_active")
1525 class VIEW3D_MT_object_constraints(Menu):
1526 bl_label = "Constraints"
1528 def draw(self, context):
1529 layout = self.layout
1531 layout.operator("object.constraint_add_with_targets")
1532 layout.operator("object.constraints_copy")
1533 layout.operator("object.constraints_clear")
1536 class VIEW3D_MT_object_quick_effects(Menu):
1537 bl_label = "Quick Effects"
1539 def draw(self, context):
1540 layout = self.layout
1542 layout.operator("object.quick_fur")
1543 layout.operator("object.quick_explode")
1544 layout.operator("object.quick_smoke")
1545 layout.operator("object.quick_fluid")
1548 class VIEW3D_MT_object_showhide(Menu):
1549 bl_label = "Show/Hide"
1551 def draw(self, context):
1552 layout = self.layout
1554 layout.operator("object.hide_view_clear", text="Show Hidden")
1555 layout.operator("object.hide_view_set", text="Hide Selected").unselected = False
1556 layout.operator("object.hide_view_set", text="Hide Unselected").unselected = True
1559 class VIEW3D_MT_make_single_user(Menu):
1560 bl_label = "Make Single User"
1562 def draw(self, context):
1563 layout = self.layout
1565 props = layout.operator("object.make_single_user", text="Object")
1567 props.obdata = props.material = props.texture = props.animation = False
1569 props = layout.operator("object.make_single_user", text="Object & Data")
1570 props.object = props.obdata = True
1571 props.material = props.texture = props.animation = False
1573 props = layout.operator("object.make_single_user", text="Object & Data & Materials+Tex")
1574 props.object = props.obdata = props.material = props.texture = True
1575 props.animation = False
1577 props = layout.operator("object.make_single_user", text="Materials+Tex")
1578 props.material = props.texture = True
1579 props.object = props.obdata = props.animation = False
1581 props = layout.operator("object.make_single_user", text="Object Animation")
1582 props.animation = True
1583 props.object = props.obdata = props.material = props.texture = False
1586 class VIEW3D_MT_make_links(Menu):
1587 bl_label = "Make Links"
1589 def draw(self, context):
1590 layout = self.layout
1591 operator_context_default = layout.operator_context
1592 if len(bpy.data.scenes) > 10:
1593 layout.operator_context = 'INVOKE_REGION_WIN'
1594 layout.operator("object.make_links_scene", text="Objects to Scene...", icon='OUTLINER_OB_EMPTY')
1596 layout.operator_context = 'EXEC_REGION_WIN'
1597 layout.operator_menu_enum("object.make_links_scene", "scene", text="Objects to Scene...")
1598 layout.operator_context = operator_context_default
1600 layout.operator_enum("object.make_links_data", "type") # inline
1602 layout.operator("object.join_uvs") # stupid place to add this!
1605 class VIEW3D_MT_object_game(Menu):
1608 def draw(self, context):
1609 layout = self.layout
1611 layout.operator("object.logic_bricks_copy", text="Copy Logic Bricks")
1612 layout.operator("object.game_physics_copy", text="Copy Physics Properties")
1616 layout.operator("object.game_property_copy", text="Replace Properties").operation = 'REPLACE'
1617 layout.operator("object.game_property_copy", text="Merge Properties").operation = 'MERGE'
1618 layout.operator_menu_enum("object.game_property_copy", "property", text="Copy Properties...")
1622 layout.operator("object.game_property_clear")
1625 # ********** Brush menu **********
1626 class VIEW3D_MT_brush(Menu):
1629 def draw(self, context):
1630 layout = self.layout
1632 settings = UnifiedPaintPanel.paint_settings(context)
1633 brush = settings.brush
1635 ups = context.tool_settings.unified_paint_settings
1636 layout.prop(ups, "use_unified_size", text="Unified Size")
1637 layout.prop(ups, "use_unified_strength", text="Unified Strength")
1638 if context.image_paint_object or context.vertex_paint_object:
1639 layout.prop(ups, "use_unified_color", text="Unified Color")
1643 layout.menu("VIEW3D_MT_brush_paint_modes")
1646 if context.sculpt_object:
1647 layout.operator("brush.reset")
1648 layout.prop_menu_enum(brush, "sculpt_tool")
1649 elif context.image_paint_object:
1650 layout.prop_menu_enum(brush, "image_tool")
1651 elif context.vertex_paint_object or context.weight_paint_object:
1652 layout.prop_menu_enum(brush, "vertex_tool")
1654 # skip if no active brush
1658 # TODO: still missing a lot of brush options here
1661 if context.sculpt_object:
1663 sculpt_tool = brush.sculpt_tool
1666 layout.operator_menu_enum("brush.curve_preset", "shape", text="Curve Preset")
1669 if sculpt_tool != 'GRAB':
1670 layout.prop_menu_enum(brush, "stroke_method")
1672 if sculpt_tool in {'DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'}:
1673 layout.prop_menu_enum(brush, "direction")
1675 if sculpt_tool == 'LAYER':
1676 layout.prop(brush, "use_persistent")
1677 layout.operator("sculpt.set_persistent_base")
1680 class VIEW3D_MT_brush_paint_modes(Menu):
1681 bl_label = "Enabled Modes"
1683 def draw(self, context):
1684 layout = self.layout
1686 settings = UnifiedPaintPanel.paint_settings(context)
1687 brush = settings.brush
1689 layout.prop(brush, "use_paint_sculpt", text="Sculpt")
1690 layout.prop(brush, "use_paint_vertex", text="Vertex Paint")
1691 layout.prop(brush, "use_paint_weight", text="Weight Paint")
1692 layout.prop(brush, "use_paint_image", text="Texture Paint")
1694 # ********** Vertex paint menu **********
1697 class VIEW3D_MT_paint_vertex(Menu):
1700 def draw(self, context):
1701 layout = self.layout
1703 layout.operator("ed.undo")
1704 layout.operator("ed.redo")
1708 layout.operator("paint.vertex_color_set")
1709 layout.operator("paint.vertex_color_smooth")
1710 layout.operator("paint.vertex_color_dirt")
1713 class VIEW3D_MT_hook(Menu):
1716 def draw(self, context):
1717 layout = self.layout
1718 layout.operator_context = 'EXEC_AREA'
1719 layout.operator("object.hook_add_newob")
1720 layout.operator("object.hook_add_selob").use_bone = False
1721 layout.operator("object.hook_add_selob", text="Hook to Selected Object Bone").use_bone = True
1723 if [mod.type == 'HOOK' for mod in context.active_object.modifiers]:
1725 layout.operator_menu_enum("object.hook_assign", "modifier")
1726 layout.operator_menu_enum("object.hook_remove", "modifier")
1728 layout.operator_menu_enum("object.hook_select", "modifier")
1729 layout.operator_menu_enum("object.hook_reset", "modifier")
1730 layout.operator_menu_enum("object.hook_recenter", "modifier")
1733 class VIEW3D_MT_vertex_group(Menu):
1734 bl_label = "Vertex Groups"
1736 def draw(self, context):
1737 layout = self.layout
1739 layout.operator_context = 'EXEC_AREA'
1740 layout.operator("object.vertex_group_assign_new")
1742 ob = context.active_object
1743 if ob.mode == 'EDIT' or (ob.mode == 'WEIGHT_PAINT' and ob.type == 'MESH' and ob.data.use_paint_mask_vertex):
1744 if ob.vertex_groups.active:
1746 layout.operator("object.vertex_group_assign", text="Assign to Active Group")
1747 layout.operator("object.vertex_group_remove_from", text="Remove from Active Group").use_all_groups = False
1748 layout.operator("object.vertex_group_remove_from", text="Remove from All").use_all_groups = True
1751 if ob.vertex_groups.active:
1752 layout.operator_menu_enum("object.vertex_group_set_active", "group", text="Set Active Group")
1753 layout.operator("object.vertex_group_remove", text="Remove Active Group").all = False
1754 layout.operator("object.vertex_group_remove", text="Remove All Groups").all = True
1756 # ********** Weight paint menu **********
1759 class VIEW3D_MT_paint_weight(Menu):
1760 bl_label = "Weights"
1762 def draw(self, context):
1763 layout = self.layout
1765 layout.operator("ed.undo")
1766 layout.operator("ed.redo")
1767 layout.operator("ed.undo_history")
1771 layout.operator("paint.weight_from_bones", text="Assign Automatic From Bones").type = 'AUTOMATIC'
1772 layout.operator("paint.weight_from_bones", text="Assign From Bone Envelopes").type = 'ENVELOPES'
1776 layout.operator("object.vertex_group_normalize_all", text="Normalize All")
1777 layout.operator("object.vertex_group_normalize", text="Normalize")
1778 layout.operator("object.vertex_group_mirror", text="Mirror")
1779 layout.operator("object.vertex_group_invert", text="Invert")
1780 layout.operator("object.vertex_group_clean", text="Clean")
1781 layout.operator("object.vertex_group_quantize", text="Quantize")
1782 layout.operator("object.vertex_group_levels", text="Levels")
1783 layout.operator("object.vertex_group_smooth", text="Smooth")
1784 props = layout.operator("object.data_transfer", text="Transfer Weights")
1785 props.use_reverse_transfer = True
1786 props.data_type = 'VGROUP_WEIGHTS'
1787 layout.operator("object.vertex_group_limit_total", text="Limit Total")
1788 layout.operator("object.vertex_group_fix", text="Fix Deforms")
1792 layout.operator("paint.weight_set")
1794 # ********** Sculpt menu **********
1797 class VIEW3D_MT_sculpt(Menu):
1800 def draw(self, context):
1801 layout = self.layout
1803 toolsettings = context.tool_settings
1804 sculpt = toolsettings.sculpt
1806 layout.operator("ed.undo")
1807 layout.operator("ed.redo")
1811 layout.prop(sculpt, "use_symmetry_x")
1812 layout.prop(sculpt, "use_symmetry_y")
1813 layout.prop(sculpt, "use_symmetry_z")
1815 layout.prop(sculpt, "lock_x")
1816 layout.prop(sculpt, "lock_y")
1817 layout.prop(sculpt, "lock_z")
1820 layout.prop(sculpt, "use_threaded", text="Threaded Sculpt")
1821 layout.prop(sculpt, "show_low_resolution")
1822 layout.prop(sculpt, "show_brush")
1823 layout.prop(sculpt, "use_deform_only")
1824 layout.prop(sculpt, "show_diffuse_color")
1827 class VIEW3D_MT_hide_mask(Menu):
1828 bl_label = "Hide/Mask"
1830 def draw(self, context):
1831 layout = self.layout
1833 props = layout.operator("paint.hide_show", text="Show All")
1834 props.action = 'SHOW'
1837 props = layout.operator("paint.hide_show", text="Hide Bounding Box")
1838 props.action = 'HIDE'
1839 props.area = 'INSIDE'
1841 props = layout.operator("paint.hide_show", text="Show Bounding Box")
1842 props.action = 'SHOW'
1843 props.area = 'INSIDE'
1845 props = layout.operator("paint.hide_show", text="Hide Masked")
1846 props.area = 'MASKED'
1847 props.action = 'HIDE'
1851 props = layout.operator("paint.mask_flood_fill", text="Invert Mask")
1852 props.mode = 'INVERT'
1854 props = layout.operator("paint.mask_flood_fill", text="Fill Mask")
1855 props.mode = 'VALUE'
1858 props = layout.operator("paint.mask_flood_fill", text="Clear Mask")
1859 props.mode = 'VALUE'
1862 props = layout.operator("view3d.select_border", text="Box Mask")
1863 props = layout.operator("paint.mask_lasso_gesture", text="Lasso Mask")
1866 # ********** Particle menu **********
1869 class VIEW3D_MT_particle(Menu):
1870 bl_label = "Particle"
1872 def draw(self, context):
1873 layout = self.layout
1875 particle_edit = context.tool_settings.particle_edit
1877 layout.operator("ed.undo")
1878 layout.operator("ed.redo")
1879 layout.operator("ed.undo_history")
1883 layout.operator("particle.mirror")
1887 layout.operator("particle.remove_doubles")
1888 layout.operator("particle.delete")
1890 if particle_edit.select_mode == 'POINT':
1891 layout.operator("particle.subdivide")
1893 layout.operator("particle.rekey")
1894 layout.operator("particle.weight_set")
1898 layout.menu("VIEW3D_MT_particle_showhide")
1901 class VIEW3D_MT_particle_specials(Menu):
1902 bl_label = "Specials"
1904 def draw(self, context):
1905 layout = self.layout
1907 particle_edit = context.tool_settings.particle_edit
1909 layout.operator("particle.rekey")
1910 layout.operator("particle.delete")
1911 layout.operator("particle.remove_doubles")
1913 if particle_edit.select_mode == 'POINT':
1914 layout.operator("particle.subdivide")
1916 layout.operator("particle.weight_set")
1919 layout.operator("particle.mirror")
1921 if particle_edit.select_mode == 'POINT':
1923 layout.operator("particle.select_roots")
1924 layout.operator("particle.select_tips")
1928 layout.operator("particle.select_random")
1932 layout.operator("particle.select_more")
1933 layout.operator("particle.select_less")
1937 layout.operator("particle.select_all").action = 'TOGGLE'
1938 layout.operator("particle.select_linked")
1939 layout.operator("particle.select_all", text="Inverse").action = 'INVERT'
1942 class VIEW3D_MT_particle_showhide(ShowHideMenu, Menu):
1943 _operator_name = "particle"
1945 # ********** Pose Menu **********
1948 class VIEW3D_MT_pose(Menu):
1951 def draw(self, context):
1952 layout = self.layout
1954 layout.operator("ed.undo")
1955 layout.operator("ed.redo")
1956 layout.operator("ed.undo_history")
1960 layout.menu("VIEW3D_MT_transform_armature")
1962 layout.menu("VIEW3D_MT_pose_transform")
1963 layout.menu("VIEW3D_MT_pose_apply")
1965 layout.menu("VIEW3D_MT_snap")
1969 layout.menu("VIEW3D_MT_object_animation")
1973 layout.menu("VIEW3D_MT_pose_slide")
1974 layout.menu("VIEW3D_MT_pose_propagate")
1978 layout.operator("pose.copy")
1979 layout.operator("pose.paste").flipped = False
1980 layout.operator("pose.paste", text="Paste X-Flipped Pose").flipped = True
1984 layout.menu("VIEW3D_MT_pose_library")
1985 layout.menu("VIEW3D_MT_pose_motion")
1986 layout.menu("VIEW3D_MT_pose_group")
1990 layout.menu("VIEW3D_MT_object_parent")
1991 layout.menu("VIEW3D_MT_pose_ik")
1992 layout.menu("VIEW3D_MT_pose_constraints")
1996 layout.operator_context = 'EXEC_AREA'
1997 layout.operator("pose.autoside_names", text="AutoName Left/Right").axis = 'XAXIS'
1998 layout.operator("pose.autoside_names", text="AutoName Front/Back").axis = 'YAXIS'
1999 layout.operator("pose.autoside_names", text="AutoName Top/Bottom").axis = 'ZAXIS'
2001 layout.operator("pose.flip_names")
2003 layout.operator("pose.quaternions_flip")
2007 layout.operator_context = 'INVOKE_AREA'
2008 layout.operator("armature.armature_layers", text="Change Armature Layers...")
2009 layout.operator("pose.bone_layers", text="Change Bone Layers...")
2013 layout.menu("VIEW3D_MT_pose_showhide")
2014 layout.menu("VIEW3D_MT_bone_options_toggle", text="Bone Settings")
2017 class VIEW3D_MT_pose_transform(Menu):
2018 bl_label = "Clear Transform"
2020 def draw(self, context):
2021 layout = self.layout
2023 layout.operator("pose.transforms_clear", text="All")
2027 layout.operator("pose.loc_clear", text="Location")
2028 layout.operator("pose.rot_clear", text="Rotation")
2029 layout.operator("pose.scale_clear", text="Scale")
2033 layout.operator("pose.user_transforms_clear", text="Reset unkeyed")
2036 class VIEW3D_MT_pose_slide(Menu):
2037 bl_label = "In-Betweens"
2039 def draw(self, context):
2040 layout = self.layout
2042 layout.operator("pose.push")
2043 layout.operator("pose.relax")
2044 layout.operator("pose.breakdown")
2047 class VIEW3D_MT_pose_propagate(Menu):
2048 bl_label = "Propagate"
2050 def draw(self, context):
2051 layout = self.layout
2053 layout.operator("pose.propagate").mode = 'WHILE_HELD'
2057 layout.operator("pose.propagate", text="To Next Keyframe").mode = 'NEXT_KEY'
2058 layout.operator("pose.propagate", text="To Last Keyframe (Make Cyclic)").mode = 'LAST_KEY'
2062 layout.operator("pose.propagate", text="On Selected Keyframes").mode = 'SELECTED_KEYS'
2066 layout.operator("pose.propagate", text="On Selected Markers").mode = 'SELECTED_MARKERS'
2069 class VIEW3D_MT_pose_library(Menu):
2070 bl_label = "Pose Library"
2072 def draw(self, context):
2073 layout = self.layout
2075 layout.operator("poselib.browse_interactive", text="Browse Poses...")
2079 layout.operator("poselib.pose_add", text="Add Pose...")
2080 layout.operator("poselib.pose_rename", text="Rename Pose...")
2081 layout.operator("poselib.pose_remove", text="Remove Pose...")
2084 class VIEW3D_MT_pose_motion(Menu):
2085 bl_label = "Motion Paths"
2087 def draw(self, context):
2088 layout = self.layout
2090 layout.operator("pose.paths_calculate", text="Calculate")
2091 layout.operator("pose.paths_clear", text="Clear")
2094 class VIEW3D_MT_pose_group(Menu):
2095 bl_label = "Bone Groups"
2097 def draw(self, context):
2098 layout = self.layout
2100 pose = context.active_object.pose
2102 layout.operator_context = 'EXEC_AREA'
2103 layout.operator("pose.group_assign", text="Assign to New Group").type = 0
2104 if pose.bone_groups:
2105 active_group = pose.bone_groups.active_index + 1
2106 layout.operator("pose.group_assign", text="Assign to Group").type = active_group
2110 # layout.operator_context = 'INVOKE_AREA'
2111 layout.operator("pose.group_unassign")
2112 layout.operator("pose.group_remove")
2115 class VIEW3D_MT_pose_ik(Menu):
2116 bl_label = "Inverse Kinematics"
2118 def draw(self, context):
2119 layout = self.layout
2121 layout.operator("pose.ik_add")
2122 layout.operator("pose.ik_clear")
2125 class VIEW3D_MT_pose_constraints(Menu):
2126 bl_label = "Constraints"
2128 def draw(self, context):
2129 layout = self.layout
2131 layout.operator("pose.constraint_add_with_targets", text="Add (With Targets)...")
2132 layout.operator("pose.constraints_copy")
2133 layout.operator("pose.constraints_clear")
2136 class VIEW3D_MT_pose_showhide(ShowHideMenu, Menu):
2137 _operator_name = "pose"
2140 class VIEW3D_MT_pose_apply(Menu):
2143 def draw(self, context):
2144 layout = self.layout
2146 layout.operator("pose.armature_apply")
2147 layout.operator("pose.visual_transform_apply")
2150 class VIEW3D_MT_pose_specials(Menu):
2151 bl_label = "Specials"
2153 def draw(self, context):
2154 layout = self.layout
2156 layout.operator("paint.weight_from_bones", text="Assign Automatic from Bones").type = 'AUTOMATIC'
2157 layout.operator("paint.weight_from_bones", text="Assign from Bone Envelopes").type = 'ENVELOPES'
2161 layout.operator("pose.select_constraint_target")
2162 layout.operator("pose.flip_names")
2163 layout.operator("pose.paths_calculate")
2164 layout.operator("pose.paths_clear")
2165 layout.operator("pose.user_transforms_clear")
2166 layout.operator("pose.user_transforms_clear", text="Clear User Transforms (All)").only_selected = False
2167 layout.operator("pose.relax")
2171 layout.operator_menu_enum("pose.autoside_names", "axis")
2175 def draw(self, context):
2176 layout = self.layout
2181 "use_envelope_multiply",
2182 "use_inherit_rotation",
2183 "use_inherit_scale",
2186 if context.mode == 'EDIT_ARMATURE':
2187 bone_props = bpy.types.EditBone.bl_rna.properties
2188 data_path_iter = "selected_bones"
2190 options.append("lock")
2192 bone_props = bpy.types.Bone.bl_rna.properties
2193 data_path_iter = "selected_pose_bones"
2194 opt_suffix = "bone."
2197 props = layout.operator("wm.context_collection_boolean_set", text=bone_props[opt].name,
2198 text_ctxt=i18n_contexts.default)
2199 props.data_path_iter = data_path_iter
2200 props.data_path_item = opt_suffix + opt
2201 props.type = self.type
2204 class VIEW3D_MT_bone_options_toggle(Menu, BoneOptions):
2205 bl_label = "Toggle Bone Options"
2209 class VIEW3D_MT_bone_options_enable(Menu, BoneOptions):
2210 bl_label = "Enable Bone Options"
2214 class VIEW3D_MT_bone_options_disable(Menu, BoneOptions):
2215 bl_label = "Disable Bone Options"
2218 # ********** Edit Menus, suffix from ob.type **********
2221 class VIEW3D_MT_edit_mesh(Menu):
2224 def draw(self, context):
2225 layout = self.layout
2227 toolsettings = context.tool_settings
2229 layout.operator("ed.undo")
2230 layout.operator("ed.redo")
2231 layout.operator("ed.undo_history")
2235 layout.menu("VIEW3D_MT_transform")
2236 layout.menu("VIEW3D_MT_mirror")
2237 layout.menu("VIEW3D_MT_snap")
2241 layout.menu("VIEW3D_MT_uv_map", text="UV Unwrap...")
2245 layout.operator("mesh.duplicate_move")
2246 layout.menu("VIEW3D_MT_edit_mesh_extrude")
2247 layout.menu("VIEW3D_MT_edit_mesh_delete")
2251 layout.menu("VIEW3D_MT_edit_mesh_vertices")
2252 layout.menu("VIEW3D_MT_edit_mesh_edges")
2253 layout.menu("VIEW3D_MT_edit_mesh_faces")
2254 layout.menu("VIEW3D_MT_edit_mesh_normals")
2255 layout.menu("VIEW3D_MT_edit_mesh_clean")
2259 layout.operator("mesh.symmetrize")
2260 layout.operator("mesh.symmetry_snap")
2261 layout.operator("mesh.bisect")
2262 layout.operator_menu_enum("mesh.sort_elements", "type", text="Sort Elements...")
2266 layout.prop(toolsettings, "use_mesh_automerge")
2267 layout.prop_menu_enum(toolsettings, "proportional_edit")
2268 layout.prop_menu_enum(toolsettings, "proportional_edit_falloff")
2272 layout.menu("VIEW3D_MT_edit_mesh_showhide")
2275 class VIEW3D_MT_edit_mesh_specials(Menu):
2276 bl_label = "Specials"
2278 def draw(self, context):
2279 layout = self.layout
2281 layout.operator_context = 'INVOKE_REGION_WIN'
2283 layout.operator("mesh.subdivide", text="Subdivide").smoothness = 0.0
2284 layout.operator("mesh.subdivide", text="Subdivide Smooth").smoothness = 1.0
2288 layout.operator("mesh.merge", text="Merge...")
2289 layout.operator("mesh.remove_doubles")
2293 layout.operator("mesh.hide", text="Hide").unselected = False
2294 layout.operator("mesh.reveal", text="Reveal")
2295 layout.operator("mesh.select_all", text="Select Inverse").action = 'INVERT'
2299 layout.operator("mesh.flip_normals")
2300 layout.operator("mesh.vertices_smooth", text="Smooth")
2301 layout.operator("mesh.vertices_smooth_laplacian", text="Laplacian Smooth")
2305 layout.operator("mesh.inset")
2306 layout.operator("mesh.bevel", text="Bevel")
2307 layout.operator("mesh.bridge_edge_loops")
2311 layout.operator("mesh.faces_shade_smooth")
2312 layout.operator("mesh.faces_shade_flat")
2316 layout.operator("mesh.blend_from_shape")
2317 layout.operator("mesh.shape_propagate_to_all")
2318 layout.operator("mesh.shortest_path_select")
2319 layout.operator("mesh.sort_elements")
2320 layout.operator("mesh.symmetrize")
2321 layout.operator("mesh.symmetry_snap")
2324 class VIEW3D_MT_edit_mesh_select_mode(Menu):
2325 bl_label = "Mesh Select Mode"
2327 def draw(self, context):
2328 layout = self.layout
2330 layout.operator_context = 'INVOKE_REGION_WIN'
2331 layout.operator("mesh.select_mode", text="Vertex", icon='VERTEXSEL').type = 'VERT'
2332 layout.operator("mesh.select_mode", text="Edge", icon='EDGESEL').type = 'EDGE'
2333 layout.operator("mesh.select_mode", text="Face", icon='FACESEL').type = 'FACE'
2336 class VIEW3D_MT_edit_mesh_extrude(Menu):
2337 bl_label = "Extrude"
2340 'VERT': lambda layout:
2341 layout.operator("mesh.extrude_vertices_move", text="Vertices Only"),
2342 'EDGE': lambda layout:
2343 layout.operator("mesh.extrude_edges_move", text="Edges Only"),
2344 'FACE': lambda layout:
2345 layout.operator("mesh.extrude_faces_move", text="Individual Faces"),
2346 'REGION': lambda layout:
2347 layout.operator("view3d.edit_mesh_extrude_move_normal", text="Region"),
2348 'REGION_VERT_NORMAL': lambda layout:
2349 layout.operator("view3d.edit_mesh_extrude_move_shrink_fatten", text="Region (Vertex Normals)"),
2353 def extrude_options(context):
2354 mesh = context.object.data
2355 select_mode = context.tool_settings.mesh_select_mode
2358 if mesh.total_face_sel:
2359 menu += ['REGION', 'REGION_VERT_NORMAL', 'FACE']
2360 if mesh.total_edge_sel and (select_mode[0] or select_mode[1]):
2362 if mesh.total_vert_sel and select_mode[0]:
2365 # should never get here
2368 def draw(self, context):
2369 layout = self.layout
2370 layout.operator_context = 'INVOKE_REGION_WIN'
2372 for menu_id in self.extrude_options(context):
2373 self._extrude_funcs[menu_id](layout)
2376 class VIEW3D_MT_edit_mesh_vertices(Menu):
2377 bl_label = "Vertices"
2379 def draw(self, context):
2380 layout = self.layout
2381 layout.operator_context = 'INVOKE_REGION_WIN'
2383 layout.operator("mesh.merge")
2384 layout.operator("mesh.rip_move")
2385 layout.operator("mesh.rip_move_fill")
2386 layout.operator("mesh.rip_edge_move")
2387 layout.operator("mesh.split")
2388 layout.operator_menu_enum("mesh.separate", "type")
2389 layout.operator("mesh.vert_connect_path", text="Connect Vertex Path")
2390 layout.operator("mesh.vert_connect", text="Connect Vertices")
2391 layout.operator("transform.vert_slide", text="Slide")
2395 layout.operator("mesh.mark_sharp", text="Mark Sharp Edges").use_verts = True
2396 props = layout.operator("mesh.mark_sharp", text="Clear Sharp Edges")
2397 props.use_verts = True
2402 layout.operator("mesh.bevel").vertex_only = True
2403 layout.operator("mesh.convex_hull")
2404 layout.operator("mesh.vertices_smooth")
2405 layout.operator("mesh.remove_doubles")
2407 layout.operator("mesh.blend_from_shape")
2409 layout.operator("object.vertex_group_smooth")
2410 layout.operator("mesh.shape_propagate_to_all")
2414 layout.menu("VIEW3D_MT_vertex_group")
2415 layout.menu("VIEW3D_MT_hook")
2418 class VIEW3D_MT_edit_mesh_edges(Menu):
2421 def draw(self, context):
2422 layout = self.layout
2424 with_freestyle = bpy.app.build_options.freestyle
2426 layout.operator_context = 'INVOKE_REGION_WIN'
2428 layout.operator("mesh.edge_face_add")
2429 layout.operator("mesh.subdivide")
2430 layout.operator("mesh.unsubdivide")
2434 layout.operator("transform.edge_crease")
2435 layout.operator("transform.edge_bevelweight")
2439 layout.operator("mesh.mark_seam").clear = False
2440 layout.operator("mesh.mark_seam", text="Clear Seam").clear = True
2444 layout.operator("mesh.mark_sharp")
2445 layout.operator("mesh.mark_sharp", text="Clear Sharp").clear = True
2450 layout.operator("mesh.mark_freestyle_edge").clear = False
2451 layout.operator("mesh.mark_freestyle_edge", text="Clear Freestyle Edge").clear = True
2454 layout.operator("mesh.edge_rotate", text="Rotate Edge CW").use_ccw = False
2455 layout.operator("mesh.edge_rotate", text="Rotate Edge CCW").use_ccw = True
2459 layout.operator("mesh.bevel").vertex_only = False
2460 layout.operator("mesh.edge_split")
2461 layout.operator("mesh.bridge_edge_loops")
2465 layout.operator("transform.edge_slide")
2466 layout.operator("mesh.loop_multi_select", text="Edge Loops").ring = False
2467 layout.operator("mesh.loop_multi_select", text="Edge Rings").ring = True
2468 layout.operator("mesh.loop_to_region")
2469 layout.operator("mesh.region_to_loop")
2472 class VIEW3D_MT_edit_mesh_faces(Menu):
2474 bl_idname = "VIEW3D_MT_edit_mesh_faces"
2476 def draw(self, context):
2477 layout = self.layout
2479 with_freestyle = bpy.app.build_options.freestyle
2481 layout.operator_context = 'INVOKE_REGION_WIN'
2483 layout.operator("mesh.flip_normals")
2484 layout.operator("mesh.edge_face_add")
2485 layout.operator("mesh.fill")
2486 layout.operator("mesh.fill_grid")
2487 layout.operator("mesh.beautify_fill")
2488 layout.operator("mesh.inset")
2489 layout.operator("mesh.bevel").vertex_only = False
2490 layout.operator("mesh.solidify")
2491 layout.operator("mesh.intersect")
2492 layout.operator("mesh.intersect_boolean")
2493 layout.operator("mesh.wireframe")
2498 layout.operator("mesh.mark_freestyle_face").clear = False
2499 layout.operator("mesh.mark_freestyle_face", text="Clear Freestyle Face").clear = True
2502 layout.operator("mesh.poke")
2503 props = layout.operator("mesh.quads_convert_to_tris")
2504 props.quad_method = props.ngon_method = 'BEAUTY'
2505 layout.operator("mesh.tris_convert_to_quads")
2506 layout.operator("mesh.face_split_by_edges")
2510 layout.operator("mesh.faces_shade_smooth")
2511 layout.operator("mesh.faces_shade_flat")
2513 layout.operator("mesh.normals_make_consistent", text="Recalculate Normals").inside = False
2517 layout.operator("mesh.edge_rotate", text="Rotate Edge CW").use_ccw = False
2521 layout.operator("mesh.uvs_rotate")
2522 layout.operator("mesh.uvs_reverse")
2523 layout.operator("mesh.colors_rotate")
2524 layout.operator("mesh.colors_reverse")
2527 class VIEW3D_MT_edit_mesh_normals(Menu):
2528 bl_label = "Normals"
2530 def draw(self, context):
2531 layout = self.layout
2533 layout.operator("mesh.normals_make_consistent", text="Recalculate Outside").inside = False
2534 layout.operator("mesh.normals_make_consistent", text="Recalculate Inside").inside = True
2538 layout.operator("mesh.flip_normals")
2541 class VIEW3D_MT_edit_mesh_clean(Menu):
2542 bl_label = "Clean up"
2544 def draw(self, context):
2545 layout = self.layout
2547 layout.operator("mesh.delete_loose")
2551 layout.operator("mesh.dissolve_degenerate")
2552 layout.operator("mesh.dissolve_limited")
2553 layout.operator("mesh.face_make_planar")
2554 layout.operator("mesh.vert_connect_nonplanar")
2555 layout.operator("mesh.vert_connect_concave")
2556 layout.operator("mesh.fill_holes")
2559 class VIEW3D_MT_edit_mesh_delete(Menu):
2562 def draw(self, context):
2563 layout = self.layout
2565 layout.operator_enum("mesh.delete", "type")
2569 layout.operator("mesh.dissolve_verts")
2570 layout.operator("mesh.dissolve_edges")
2571 layout.operator("mesh.dissolve_faces")
2575 layout.operator("mesh.dissolve_limited")
2579 layout.operator("mesh.edge_collapse")
2580 layout.operator("mesh.delete_edgeloop", text="Edge Loops")
2583 class VIEW3D_MT_edit_mesh_showhide(ShowHideMenu, Menu):
2584 _operator_name = "mesh"
2587 class VIEW3D_MT_edit_gpencil_delete(Menu):
2590 def draw(self, context):
2591 layout = self.layout
2593 layout.operator_enum("gpencil.delete", "type")
2597 layout.operator("gpencil.dissolve")
2601 # draw_curve is used by VIEW3D_MT_edit_curve and VIEW3D_MT_edit_surface
2604 def draw_curve(self, context):
2605 layout = self.layout
2607 toolsettings = context.tool_settings
2609 layout.menu("VIEW3D_MT_transform")
2610 layout.menu("VIEW3D_MT_mirror")
2611 layout.menu("VIEW3D_MT_snap")
2615 layout.operator("curve.extrude_move")
2616 layout.operator("curve.spin")
2617 layout.operator("curve.duplicate_move")
2618 layout.operator("curve.split")
2619 layout.operator("curve.separate")
2620 layout.operator("curve.make_segment")
2621 layout.operator("curve.cyclic_toggle")
2622 layout.operator("curve.delete", text="Delete...")
2626 layout.menu("VIEW3D_MT_edit_curve_ctrlpoints")
2627 layout.menu("VIEW3D_MT_edit_curve_segments")
2631 layout.prop_menu_enum(toolsettings, "proportional_edit")
2632 layout.prop_menu_enum(toolsettings, "proportional_edit_falloff")
2636 layout.menu("VIEW3D_MT_edit_curve_showhide")
2639 class VIEW3D_MT_edit_curve(Menu):
2645 class VIEW3D_MT_edit_curve_ctrlpoints(Menu):
2646 bl_label = "Control Points"
2648 def draw(self, context):
2649 layout = self.layout
2651 edit_object = context.edit_object
2653 if edit_object.type == 'CURVE':
2654 layout.operator("transform.tilt")
2655 layout.operator("curve.tilt_clear")
2659 layout.operator_menu_enum("curve.handle_type_set", "type")
2660 layout.operator("curve.normals_make_consistent")
2664 layout.menu("VIEW3D_MT_hook")
2667 class VIEW3D_MT_edit_curve_segments(Menu):
2668 bl_label = "Segments"
2670 def draw(self, context):
2671 layout = self.layout
2673 layout.operator("curve.subdivide")
2674 layout.operator("curve.switch_direction")
2677 class VIEW3D_MT_edit_curve_specials(Menu):
2678 bl_label = "Specials"
2680 def draw(self, context):
2681 layout = self.layout
2683 layout.operator("curve.subdivide")
2684 layout.operator("curve.switch_direction")
2685 layout.operator("curve.spline_weight_set")
2686 layout.operator("curve.radius_set")
2687 layout.operator("curve.smooth")
2688 layout.operator("curve.smooth_weight")
2689 layout.operator("curve.smooth_radius")
2690 layout.operator("curve.smooth_tilt")
2693 class VIEW3D_MT_edit_curve_showhide(ShowHideMenu, Menu):
2694 _operator_name = "curve"
2697 class VIEW3D_MT_edit_surface(Menu):
2698 bl_label = "Surface"
2703 class VIEW3D_MT_edit_font(Menu):
2706 def draw(self, context):
2707 layout = self.layout
2709 layout.menu("VIEW3D_MT_edit_text_chars")
2713 layout.operator("font.style_toggle", text="Toggle Bold").style = 'BOLD'
2714 layout.operator("font.style_toggle", text="Toggle Italic").style = 'ITALIC'
2715 layout.operator("font.style_toggle", text="Toggle Underline").style = 'UNDERLINE'
2716 layout.operator("font.style_toggle", text="Toggle Small Caps").style = 'SMALL_CAPS'
2719 class VIEW3D_MT_edit_text_chars(Menu):
2720 bl_label = "Special Characters"
2722 def draw(self, context):
2723 layout = self.layout
2725 layout.operator("font.text_insert", text="Copyright").text = "\u00A9"
2726 layout.operator("font.text_insert", text="Registered Trademark").text = "\u00AE"
2730 layout.operator("font.text_insert", text="Degree Sign").text = "\u00B0"
2731 layout.operator("font.text_insert", text="Multiplication Sign").text = "\u00D7"
2732 layout.operator("font.text_insert", text="Circle").text = "\u008A"
2733 layout.operator("font.text_insert", text="Superscript 1").text = "\u00B9"
2734 layout.operator("font.text_insert", text="Superscript 2").text = "\u00B2"
2735 layout.operator("font.text_insert", text="Superscript 3").text = "\u00B3"
2736 layout.operator("font.text_insert", text="Double >>").text = "\u00BB"
2737 layout.operator("font.text_insert", text="Double <<").text = "\u00AB"
2738 layout.operator("font.text_insert", text="Promillage").text = "\u2030"
2742 layout.operator("font.text_insert", text="Dutch Florin").text = "\u00A4"
2743 layout.operator("font.text_insert", text="British Pound").text = "\u00A3"
2744 layout.operator("font.text_insert", text="Japanese Yen").text = "\u00A5"
2748 layout.operator("font.text_insert", text="German S").text = "\u00DF"
2749 layout.operator("font.text_insert", text="Spanish Question Mark").text = "\u00BF"
2750 layout.operator("font.text_insert", text="Spanish Exclamation Mark").text = "\u00A1"
2753 class VIEW3D_MT_edit_meta(Menu):
2754 bl_label = "Metaball"
2756 def draw(self, context):
2757 layout = self.layout
2759 toolsettings = context.tool_settings
2761 layout.operator("ed.undo")
2762 layout.operator("ed.redo")
2763 layout.operator("ed.undo_history")
2767 layout.menu("VIEW3D_MT_transform")
2768 layout.menu("VIEW3D_MT_mirror")
2769 layout.menu("VIEW3D_MT_snap")
2773 layout.operator("mball.delete_metaelems", text="Delete...")
2774 layout.operator("mball.duplicate_metaelems")
2778 layout.prop_menu_enum(toolsettings, "proportional_edit")
2779 layout.prop_menu_enum(toolsettings, "proportional_edit_falloff")
2783 layout.menu("VIEW3D_MT_edit_meta_showhide")
2786 class VIEW3D_MT_edit_meta_showhide(Menu):
2787 bl_label = "Show/Hide"
2789 def draw(self, context):
2790 layout = self.layout
2792 layout.operator("mball.reveal_metaelems", text="Show Hidden")
2793 layout.operator("mball.hide_metaelems", text="Hide Selected").unselected = False
2794 layout.operator("mball.hide_metaelems", text="Hide Unselected").unselected = True
2797 class VIEW3D_MT_edit_lattice(Menu):
2798 bl_label = "Lattice"
2800 def draw(self, context):
2801 layout = self.layout
2803 toolsettings = context.tool_settings
2805 layout.menu("VIEW3D_MT_transform")
2806 layout.menu("VIEW3D_MT_mirror")
2807 layout.menu("VIEW3D_MT_snap")
2808 layout.operator_menu_enum("lattice.flip", "axis")
2812 layout.operator("lattice.make_regular")
2816 layout.prop_menu_enum(toolsettings, "proportional_edit")
2817 layout.prop_menu_enum(toolsettings, "proportional_edit_falloff")
2820 class VIEW3D_MT_edit_armature(Menu):
2821 bl_label = "Armature"
2823 def draw(self, context):
2824 layout = self.layout
2826 edit_object = context.edit_object
2827 arm = edit_object.data
2829 layout.menu("VIEW3D_MT_transform_armature")
2830 layout.menu("VIEW3D_MT_mirror")
2831 layout.menu("VIEW3D_MT_snap")
2832 layout.menu("VIEW3D_MT_edit_armature_roll")
2836 layout.operator("armature.extrude_move")
2838 if arm.use_mirror_x:
2839 layout.operator("armature.extrude_forked")
2841 layout.operator("armature.duplicate_move")
2842 layout.operator("armature.merge")
2843 layout.operator("armature.fill")
2844 layout.operator("armature.delete")
2845 layout.operator("armature.split")
2846 layout.operator("armature.separate")
2850 layout.operator("armature.subdivide", text="Subdivide")
2851 layout.operator("armature.switch_direction", text="Switch Direction")
2855 layout.operator_context = 'EXEC_AREA'
2856 layout.operator("armature.symmetrize")
2857 layout.operator("armature.autoside_names", text="AutoName Left/Right").type = 'XAXIS'
2858 layout.operator("armature.autoside_names", text="AutoName Front/Back").type = 'YAXIS'
2859 layout.operator("armature.autoside_names", text="AutoName Top/Bottom").type = 'ZAXIS'
2860 layout.operator("armature.flip_names")
2864 layout.operator_context = 'INVOKE_DEFAULT'
2865 layout.operator("armature.armature_layers")
2866 layout.operator("armature.bone_layers")
2870 layout.menu("VIEW3D_MT_edit_armature_parent")
2874 layout.menu("VIEW3D_MT_bone_options_toggle", text="Bone Settings")
2877 class VIEW3D_MT_armature_specials(Menu):
2878 bl_label = "Specials"
2880 def draw(self, context):
2881 layout = self.layout
2883 layout.operator_context = 'INVOKE_REGION_WIN'
2885 layout.operator("armature.subdivide", text="Subdivide")
2886 layout.operator("armature.switch_direction", text="Switch Direction")
2890 layout.operator_context = 'EXEC_REGION_WIN'
2891 layout.operator("armature.autoside_names", text="AutoName Left/Right").type = 'XAXIS'
2892 layout.operator("armature.autoside_names", text="AutoName Front/Back").type = 'YAXIS'
2893 layout.operator("armature.autoside_names", text="AutoName Top/Bottom").type = 'ZAXIS'
2894 layout.operator("armature.flip_names", text="Flip Names")
2895 layout.operator("armature.symmetrize")
2898 class VIEW3D_MT_edit_armature_parent(Menu):
2901 def draw(self, context):
2902 layout = self.layout
2904 layout.operator("armature.parent_set", text="Make")
2905 layout.operator("armature.parent_clear", text="Clear")
2908 class VIEW3D_MT_edit_armature_roll(Menu):
2909 bl_label = "Bone Roll"
2911 def draw(self, context):
2912 layout = self.layout
2914 layout.operator_menu_enum("armature.calculate_roll", "type")
2918 layout.operator("transform.transform", text="Set Roll").mode = 'BONE_ROLL'
2921 class VIEW3D_MT_edit_armature_delete(Menu):
2924 def draw(self, context):
2925 layout = self.layout
2927 layout.operator("armature.delete", text="Delete Bones")
2931 layout.operator("armature.dissolve", text="Dissolve")
2934 # ********** GPencil Stroke Edit menu **********
2937 class VIEW3D_MT_edit_gpencil(Menu):
2938 bl_label = "GPencil"
2940 def draw(self, context):
2941 toolsettings = context.tool_settings
2943 layout = self.layout
2945 layout.operator("ed.undo")
2946 layout.operator("ed.redo")
2947 layout.operator("ed.undo_history")
2951 layout.operator("gpencil.brush_paint", text="Sculpt Strokes").wait_for_input = True
2952 layout.prop_menu_enum(toolsettings.gpencil_sculpt, "tool", text="Sculpt Brush")
2956 layout.menu("VIEW3D_MT_edit_gpencil_transform")
2957 layout.operator("transform.mirror", text="Mirror")
2958 layout.menu("GPENCIL_MT_snap")
2962 layout.menu("VIEW3D_MT_object_animation") # NOTE: provides keyingset access...
2966 layout.menu("VIEW3D_MT_edit_gpencil_delete")
2967 layout.operator("gpencil.duplicate_move", text="Duplicate")
2971 layout.operator("gpencil.copy", text="Copy")
2972 layout.operator("gpencil.paste", text="Paste")
2976 layout.prop_menu_enum(toolsettings, "proportional_edit")
2977 layout.prop_menu_enum(toolsettings, "proportional_edit_falloff")
2981 layout.operator("gpencil.reveal")
2982 layout.operator("gpencil.hide", text="Show Active Layer Only").unselected = True
2983 layout.operator("gpencil.hide", text="Hide Active Layer").unselected = False
2987 layout.operator_menu_enum("gpencil.move_to_layer", "layer", text="Move to Layer")
2988 layout.operator_menu_enum("gpencil.convert", "type", text="Convert to Geometry...")
2991 class VIEW3D_MT_edit_gpencil_transform(Menu):
2992 bl_label = "Transform"
2994 def draw(self, context):
2995 layout = self.layout
2997 layout.operator("transform.translate")
2998 layout.operator("transform.rotate")
2999 layout.operator("transform.resize", text="Scale")
3003 layout.operator("transform.bend", text="Bend")
3004 layout.operator("transform.shear", text="Shear")
3005 layout.operator("transform.tosphere", text="To Sphere")
3006 layout.operator("transform.transform", text="Shrink Fatten").mode = 'GPENCIL_SHRINKFATTEN'
3009 # ********** Panel **********
3012 class VIEW3D_PT_grease_pencil(GreasePencilDataPanel, Panel):
3013 bl_space_type = 'VIEW_3D'
3014 bl_region_type = 'UI'
3016 # NOTE: this is just a wrapper around the generic GP Panel
3019 class VIEW3D_PT_view3d_properties(Panel):
3020 bl_space_type = 'VIEW_3D'
3021 bl_region_type = 'UI'
3025 def poll(cls, context):
3026 view = context.space_data
3029 def draw(self, context):
3030 layout = self.layout
3032 view = context.space_data
3034 col = layout.column()
3035 col.active = bool(view.region_3d.view_perspective != 'CAMERA' or view.region_quadviews)
3036 col.prop(view, "lens")
3037 col.label(text="Lock to Object:")
3038 col.prop(view, "lock_object", text="")
3039 lock_object = view.lock_object
3041 if lock_object.type == 'ARMATURE':
3042 col.prop_search(view, "lock_bone", lock_object.data,
3043 "edit_bones" if lock_object.mode == 'EDIT'
3047 col.prop(view, "lock_cursor", text="Lock to Cursor")
3049 col = layout.column()
3050 col.prop(view, "lock_camera")
3052 col = layout.column(align=True)
3053 col.label(text="Clip:")
3054 col.prop(view, "clip_start", text="Start")
3055 col.prop(view, "clip_end", text="End")
3057 subcol = col.column(align=True)
3058 subcol.enabled = not view.lock_camera_and_layers
3059 subcol.label(text="Local Camera:")
3060 subcol.prop(view, "camera", text="")
3062 col = layout.column(align=True)
3063 col.prop(view, "use_render_border")
3064 col.active = view.region_3d.view_perspective != 'CAMERA'
3067 class VIEW3D_PT_view3d_cursor(Panel):
3068 bl_space_type = 'VIEW_3D'
3069 bl_region_type = 'UI'
3070 bl_label = "3D Cursor"
3073 def poll(cls, context):
3074 view = context.space_data
3075 return (view is not None)
3077 def draw(self, context):
3078 layout = self.layout
3080 view = context.space_data
3081 layout.column().prop(view, "cursor_location", text="Location")
3084 class VIEW3D_PT_view3d_name(Panel):
3085 bl_space_type = 'VIEW_3D'
3086 bl_region_type = 'UI'
3090 def poll(cls, context):
3091 return (context.space_data and context.active_object)
3093 def draw(self, context):
3094 layout = self.layout
3096 ob = context.active_object
3098 row.label(text="", icon='OBJECT_DATA')
3099 row.prop(ob, "name", text="")
3101 if ob.type == 'ARMATURE' and ob.mode in {'EDIT', 'POSE'}:
3102 bone = context.active_bone
3105 row.label(text="", icon='BONE_DATA')
3106 row.prop(bone, "name", text="")
3109 class VIEW3D_PT_view3d_display(Panel):
3110 bl_space_type = 'VIEW_3D'
3111 bl_region_type = 'UI'
3112 bl_label = "Display"
3113 bl_options = {'DEFAULT_CLOSED'}
3116 def poll(cls, context):
3117 view = context.space_data
3120 def draw(self, context):
3121 layout = self.layout
3123 view = context.space_data
3124 scene = context.scene
3126 col = layout.column()
3127 col.prop(view, "show_only_render")
3128 col.prop(view, "show_world")
3130 col = layout.column()
3131 display_all = not view.show_only_render
3132 col.active = display_all
3133 col.prop(view, "show_outline_selected")
3134 col.prop(view, "show_all_objects_origin")
3135 col.prop(view, "show_relationship_lines")
3137 col = layout.column()
3138 col.active = display_all
3139 split = col.split(percentage=0.55)
3140 split.prop(view, "show_floor", text="Grid Floor")
3142 row = split.row(align=True)
3143 row.prop(view, "show_axis_x", text="X", toggle=True)
3144 row.prop(view, "show_axis_y", text="Y", toggle=True)
3145 row.prop(view, "show_axis_z", text="Z", toggle=True)
3147 sub = col.column(align=True)
3148 sub.active = (display_all and view.show_floor)
3149 sub.prop(view, "grid_lines", text="Lines")
3150 sub.prop(view, "grid_scale", text="Scale")
3151 subsub = sub.column(align=True)
3152 subsub.active = scene.unit_settings.system == 'NONE'
3153 subsub.prop(view, "grid_subdivisions", text="Subdivisions")
3157 layout.operator("screen.region_quadview", text="Toggle Quad View")
3159 if view.region_quadviews:
3160 region = view.region_quadviews[2]
3161 col = layout.column()
3162 col.prop(region, "lock_rotation")
3164 row.enabled = region.lock_rotation
3165 row.prop(region, "show_sync_view")
3167 row.enabled = region.lock_rotation and region.show_sync_view
3168 row.prop(region, "use_box_clip")
3171 class VIEW3D_PT_view3d_stereo(Panel):
3172 bl_space_type = 'VIEW_3D'
3173 bl_region_type = 'UI'
3174 bl_label = "Stereoscopy"
3175 bl_options = {'DEFAULT_CLOSED'}
3178 def poll(cls, context):
3179 scene = context.scene
3181 multiview = scene.render.use_multiview
3182 return context.space_data and multiview
3184 def draw(self, context):
3185 layout = self.layout
3186 view = context.space_data
3188 basic_stereo = context.scene.render.views_format == 'STEREO_3D'
3190 col = layout.column()
3191 col.row().prop(view, "stereo_3d_camera", expand=True)
3193 col.label(text="Display:")
3195 row.active = basic_stereo
3196 row.prop(view, "show_stereo_3d_cameras")
3198 row.active = basic_stereo
3200 split.prop(view, "show_stereo_3d_convergence_plane")
3202 split.prop(view, "stereo_3d_convergence_plane_alpha", text="Alpha")
3203 split.active = view.show_stereo_3d_convergence_plane
3206 split.prop(view, "show_stereo_3d_volume")
3208 split.prop(view, "stereo_3d_volume_alpha", text="Alpha")
3211 class VIEW3D_PT_view3d_shading(Panel):
3212 bl_space_type = 'VIEW_3D'
3213 bl_region_type = 'UI'
3214 bl_label = "Shading"
3216 def draw(self, context):
3217 layout = self.layout
3219 view = context.space_data
3220 scene = context.scene
3221 gs = scene.game_settings
3222 obj = context.object
3224 col = layout.column()
3226 if not scene.render.use_shading_nodes:
3227 col.prop(gs, "material_mode", text="")
3229 if view.viewport_shade == 'SOLID':
3230 col.prop(view, "show_textured_solid")
3231 col.prop(view, "use_matcap")
3233 col.template_icon_view(view, "matcap_icon")
3234 if view.viewport_shade == 'TEXTURED' or context.mode == 'PAINT_TEXTURE':
3235 if scene.render.use_shading_nodes or gs.material_mode != 'GLSL':
3236 col.prop(view, "show_textured_shadeless")
3238 col.prop(view, "show_backface_culling")
3240 if view.viewport_shade not in {'BOUNDBOX', 'WIREFRAME'}:
3241 if obj and obj.mode == 'EDIT':
3242 col.prop(view, "show_occlude_wire")
3244 fx_settings = view.fx_settings
3246 if view.viewport_shade not in {'BOUNDBOX', 'WIREFRAME'}:
3248 sub.active = view.region_3d.view_perspective == 'CAMERA'
3249 sub.prop(fx_settings, "use_dof")
3250 col.prop(fx_settings, "use_ssao", text="Ambient Occlusion")
3251 if fx_settings.use_ssao:
3252 ssao_settings = fx_settings.ssao
3253 subcol = col.column(align=True)
3254 subcol.prop(ssao_settings, "factor")
3255 subcol.prop(ssao_settings, "distance_max")
3256 subcol.prop(ssao_settings, "attenuation")
3257 subcol.prop(ssao_settings, "samples")
3258 subcol.prop(ssao_settings, "color")
3261 class VIEW3D_PT_view3d_motion_tracking(Panel):
3262 bl_space_type = 'VIEW_3D'
3263 bl_region_type = 'UI'
3264 bl_label = "Motion Tracking"
3265 bl_options = {'DEFAULT_CLOSED'}
3268 def poll(cls, context):
3269 view = context.space_data
3272 def draw_header(self, context):
3273 view = context.space_data
3275 self.layout.prop(view, "show_reconstruction", text="")
3277 def draw(self, context):
3278 layout = self.layout
3280 view = context.space_data
3282 col = layout.column()
3283 col.active = view.show_reconstruction
3284 col.prop(view, "show_camera_path", text="Camera Path")
3285 col.prop(view, "show_bundle_names", text="3D Marker Names")
3286 col.label(text="Track Type and Size:")
3287 row = col.row(align=True)
3288 row.prop(view, "tracks_draw_type", text="")
3289 row.prop(view, "tracks_draw_size", text="")
3292 class VIEW3D_PT_view3d_meshdisplay(Panel):
3293 bl_space_type = 'VIEW_3D'
3294 bl_region_type = 'UI'
3295 bl_label = "Mesh Display"
3298 def poll(cls, context):
3299 # The active object check is needed because of local-mode
3300 return (context.active_object and (context.mode == 'EDIT_MESH'))
3302 def draw(self, context):
3303 layout = self.layout
3304 with_freestyle = bpy.app.build_options.freestyle
3306 mesh = context.active_object.data
3307 scene = context.scene
3309 split = layout.split()
3311 col = split.column()
3312 col.label(text="Overlays:")
3313 col.prop(mesh, "show_faces", text="Faces")
3314 col.prop(mesh, "show_edges", text="Edges")
3315 col.prop(mesh, "show_edge_crease", text="Creases")
3317 col.prop(mesh, "show_edge_seams", text="Seams")
3319 layout.prop(mesh, "show_weight")
3321 col = split.column()
3323 if not with_freestyle:
3324 col.prop(mesh, "show_edge_seams", text="Seams")
3325 col.prop(mesh, "show_edge_sharp", text="Sharp", text_ctxt=i18n_contexts.plural)
3326 col.prop(mesh, "show_edge_bevel_weight", text="Bevel")
3328 col.prop(mesh, "show_freestyle_edge_marks", text="Edge Marks")
3329 col.prop(mesh, "show_freestyle_face_marks", text="Face Marks")
3331 col = layout.column()
3334 col.label(text="Normals:")
3335 row = col.row(align=True)
3337 row.prop(mesh, "show_normal_vertex", text="", icon='VERTEXSEL')
3338 row.prop(mesh, "show_normal_loop", text="", icon='LOOPSEL')
3339 row.prop(mesh, "show_normal_face", text="", icon='FACESEL')
3341 sub = row.row(align=True)
3342 sub.active = mesh.show_normal_vertex or mesh.show_normal_face or mesh.show_normal_loop
3343 sub.prop(scene.tool_settings, "normal_size", text="Size")
3346 split = layout.split()
3347 col = split.column()
3348 col.label(text="Edge Info:")
3349 col.prop(mesh, "show_extra_edge_length", text="Length")
3350 col.prop(mesh, "show_extra_edge_angle", text="Angle")
3351 col = split.column()
3352 col.label(text="Face Info:")
3353 col.prop(mesh, "show_extra_face_area", text="Area")
3354 col.prop(mesh, "show_extra_face_angle", text="Angle")
3356 layout.prop(mesh, "show_extra_indices")
3359 class VIEW3D_PT_view3d_meshstatvis(Panel):
3360 bl_space_type = 'VIEW_3D'
3361 bl_region_type = 'UI'
3362 bl_label = "Mesh Analysis"
3365 def poll(cls, context):
3366 # The active object check is needed because of local-mode
3367 return (context.active_object and (context.mode == 'EDIT_MESH'))
3369 def draw_header(self, context):
3370 mesh = context.active_object.data
3372 self.layout.prop(mesh, "show_statvis", text="")
3374 def draw(self, context):
3375 layout = self.layout
3377 mesh = context.active_object.data
3378 statvis = context.tool_settings.statvis
3379 layout.active = mesh.show_statvis
3381 layout.prop(statvis, "type")
3382 statvis_type = statvis.type
3383 if statvis_type == 'OVERHANG':
3384 row = layout.row(align=True)
3385 row.prop(statvis, "overhang_min", text="")
3386 row.prop(statvis, "overhang_max", text="")
3387 layout.prop(statvis, "overhang_axis", expand=True)
3388 elif statvis_type == 'THICKNESS':
3389 row = layout.row(align=True)
3390 row.prop(statvis, "thickness_min", text="")
3391 row.prop(statvis, "thickness_max", text="")
3392 layout.prop(statvis, "thickness_samples")
3393 elif statvis_type == 'INTERSECT':
3395 elif statvis_type == 'DISTORT':
3396 row = layout.row(align=True)
3397 row.prop(statvis, "distort_min", text="")
3398 row.prop(statvis, "distort_max", text="")
3399 elif statvis_type == 'SHARP':
3400 row = layout.row(align=True)
3401 row.prop(statvis, "sharp_min", text="")
3402 row.prop(statvis, "sharp_max", text="")
3405 class VIEW3D_PT_view3d_curvedisplay(Panel):
3406 bl_space_type = 'VIEW_3D'
3407 bl_region_type = 'UI'
3408 bl_label = "Curve Display"
3411 def poll(cls, context):
3412 editmesh = context.mode == 'EDIT_CURVE'
3415 def draw(self, context):
3416 layout = self.layout
3418 curve = context.active_object.data
3420 col = layout.column()
3422 row.prop(curve, "show_handles", text="Handles")
3423 row.prop(curve, "show_normal_face", text="Normals")
3424 col.prop(context.scene.tool_settings, "normal_size", text="Normal Size")
3427 class VIEW3D_PT_background_image(Panel):
3428 bl_space_type = 'VIEW_3D'
3429 bl_region_type = 'UI'
3430 bl_label = "Background Images"
3431 bl_options = {'DEFAULT_CLOSED'}
3433 def draw_header(self, context):
3434 view = context.space_data
3436 self.layout.prop(view, "show_background_images", text="")
3438 def draw(self, context):
3439 layout = self.layout
3441 view = context.space_data
3442 use_multiview = context.scene.render.use_multiview
3444 col = layout.column()
3445 col.operator("view3d.background_image_add", text="Add Image")
3447 for i, bg in enumerate(view.background_images):
3448 layout.active = view.show_background_images
3450 row = box.row(align=True)
3451 row.prop(bg, "show_expanded", text="", emboss=False)
3452 if bg.source == 'IMAGE' and bg.image:
3453 row.prop(bg.image, "name", text="", emboss=False)
3454 elif bg.source == 'MOVIE_CLIP' and bg.clip:
3455 row.prop(bg.clip, "name", text="", emboss=False)
3457 row.label(text="Not Set")
3459 if bg.show_background_image:
3460 row.prop(bg, "show_background_image", text="", emboss=False, icon='RESTRICT_VIEW_OFF')
3462 row.prop(bg, "show_background_image", text="", emboss=False, icon='RESTRICT_VIEW_ON')
3464 row.operator("view3d.background_image_remove", text="", emboss=False, icon='X').index = i
3466 box.prop(bg, "view_axis", text="Axis")
3468 if bg.show_expanded: