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_paint_common import UnifiedPaintPanel
25 class VIEW3D_HT_header(Header):
26 bl_space_type = 'VIEW_3D'
28 def draw(self, context):
31 view = context.space_data
32 mode_string = context.mode
33 edit_object = context.edit_object
34 obj = context.active_object
35 toolsettings = context.tool_settings
37 row = layout.row(align=True)
41 if context.area.show_menus:
42 sub = row.row(align=True)
44 sub.menu("VIEW3D_MT_view")
47 if mode_string not in {'EDIT_TEXT', 'SCULPT', 'PAINT_WEIGHT', 'PAINT_VERTEX', 'PAINT_TEXTURE'}:
48 sub.menu("VIEW3D_MT_select_%s" % mode_string.lower())
51 sub.menu("VIEW3D_MT_edit_%s" % edit_object.type.lower())
53 if mode_string not in {'PAINT_TEXTURE'}:
54 sub.menu("VIEW3D_MT_%s" % mode_string.lower())
55 if mode_string in {'SCULPT', 'PAINT_VERTEX', 'PAINT_WEIGHT', 'PAINT_TEXTURE'}:
56 sub.menu("VIEW3D_MT_brush")
57 if mode_string == 'SCULPT':
58 sub.menu("VIEW3D_MT_hide_mask")
60 sub.menu("VIEW3D_MT_object")
62 # Contains buttons like Mode, Pivot, Manipulator, Layer, Mesh Select Mode...
64 layout.template_header_3D()
69 if mode == 'PARTICLE_EDIT':
70 row.prop(toolsettings.particle_edit, "select_mode", text="", expand=True)
73 if view.viewport_shade not in {'BOUNDBOX', 'WIREFRAME'} and (mode == 'PARTICLE_EDIT' or (mode == 'EDIT' and obj.type == 'MESH')):
74 row.prop(view, "use_occlude_geometry", text="")
76 # Proportional editing
77 if mode in {'EDIT', 'PARTICLE_EDIT'}:
78 row = layout.row(align=True)
79 row.prop(toolsettings, "proportional_edit", text="", icon_only=True)
80 if toolsettings.proportional_edit != 'DISABLED':
81 row.prop(toolsettings, "proportional_edit_falloff", text="", icon_only=True)
82 elif mode == 'OBJECT':
83 row = layout.row(align=True)
84 row.prop(toolsettings, "use_proportional_edit_objects", text="", icon_only=True)
85 if toolsettings.use_proportional_edit_objects:
86 row.prop(toolsettings, "proportional_edit_falloff", text="", icon_only=True)
89 if not obj or mode not in {'SCULPT', 'VERTEX_PAINT', 'WEIGHT_PAINT', 'TEXTURE_PAINT'}:
90 snap_element = toolsettings.snap_element
91 row = layout.row(align=True)
92 row.prop(toolsettings, "use_snap", text="")
93 row.prop(toolsettings, "snap_element", text="", icon_only=True)
94 if snap_element != 'INCREMENT':
95 row.prop(toolsettings, "snap_target", text="")
97 if mode in {'OBJECT', 'POSE'} and snap_element != 'VOLUME':
98 row.prop(toolsettings, "use_snap_align_rotation", text="")
100 row.prop(toolsettings, "use_snap_self", text="")
102 if snap_element == 'VOLUME':
103 row.prop(toolsettings, "use_snap_peel_object", text="")
104 elif snap_element == 'FACE':
105 row.prop(toolsettings, "use_snap_project", text="")
108 row = layout.row(align=True)
109 row.operator("render.opengl", text="", icon='RENDER_STILL')
110 props = row.operator("render.opengl", text="", icon='RENDER_ANIMATION')
111 props.animation = True
114 if obj and mode == 'POSE':
115 row = layout.row(align=True)
116 row.operator("pose.copy", text="", icon='COPYDOWN')
117 row.operator("pose.paste", text="", icon='PASTEDOWN')
118 props = row.operator("pose.paste", text="", icon='PASTEFLIPDOWN')
122 # ********** Menu **********
124 # ********** Utilities **********
127 class ShowHideMenu():
128 bl_label = "Show/Hide"
131 def draw(self, context):
134 layout.operator("%s.reveal" % self._operator_name, text="Show Hidden")
135 layout.operator("%s.hide" % self._operator_name, text="Hide Selected").unselected = False
136 layout.operator("%s.hide" % self._operator_name, text="Hide Unselected").unselected = True
139 # Standard transforms which apply to all cases
140 # NOTE: this doesn't seem to be able to be used directly
141 class VIEW3D_MT_transform_base(Menu):
142 bl_label = "Transform"
144 # TODO: get rid of the custom text strings?
145 def draw(self, context):
148 layout.operator("transform.translate", text="Grab/Move")
149 # TODO: sub-menu for grab per axis
150 layout.operator("transform.rotate", text="Rotate")
151 # TODO: sub-menu for rot per axis
152 layout.operator("transform.resize", text="Scale")
153 # TODO: sub-menu for scale per axis
157 layout.operator("transform.tosphere", text="To Sphere")
158 layout.operator("transform.shear", text="Shear")
159 layout.operator("transform.warp", text="Warp")
160 layout.operator("transform.push_pull", text="Push/Pull")
163 # Generic transform menu - geometry types
164 class VIEW3D_MT_transform(VIEW3D_MT_transform_base):
165 def draw(self, context):
167 VIEW3D_MT_transform_base.draw(self, context)
171 layout.operator("transform.shrink_fatten", text="Shrink Fatten")
175 layout.operator("transform.translate", text="Move Texture Space").texture_space = True
176 layout.operator("transform.resize", text="Scale Texture Space").texture_space = True
179 # Object-specific extensions to Transform menu
180 class VIEW3D_MT_transform_object(VIEW3D_MT_transform_base):
181 def draw(self, context):
185 VIEW3D_MT_transform_base.draw(self, context)
187 # object-specific option follow...
190 layout.operator("transform.translate", text="Move Texture Space").texture_space = True
191 layout.operator("transform.resize", text="Scale Texture Space").texture_space = True
195 layout.operator_context = 'EXEC_REGION_WIN'
196 layout.operator("transform.transform", text="Align to Transform Orientation").mode = 'ALIGN' # XXX see alignmenu() in edit.c of b2.4x to get this working
200 layout.operator_context = 'EXEC_AREA'
202 layout.operator("object.origin_set", text="Geometry to Origin").type = 'GEOMETRY_ORIGIN'
203 layout.operator("object.origin_set", text="Origin to Geometry").type = 'ORIGIN_GEOMETRY'
204 layout.operator("object.origin_set", text="Origin to 3D Cursor").type = 'ORIGIN_CURSOR'
208 layout.operator("object.randomize_transform")
209 layout.operator("object.align")
213 layout.operator("object.anim_transforms_to_deltas")
216 # Armature EditMode extensions to Transform menu
217 class VIEW3D_MT_transform_armature(VIEW3D_MT_transform_base):
218 def draw(self, context):
222 VIEW3D_MT_transform_base.draw(self, context)
224 # armature specific extensions follow...
228 if (obj.type == 'ARMATURE' and obj.mode in {'EDIT', 'POSE'} and
229 obj.data.draw_type in {'BBONE', 'ENVELOPE'}):
230 layout.operator("transform.transform", text="Scale Envelope/BBone").mode = 'BONE_SIZE'
232 if context.edit_object and context.edit_object.type == 'ARMATURE':
233 layout.operator("armature.align")
236 class VIEW3D_MT_mirror(Menu):
239 def draw(self, context):
242 layout.operator("transform.mirror", text="Interactive Mirror")
246 layout.operator_context = 'INVOKE_REGION_WIN'
248 props = layout.operator("transform.mirror", text="X Global")
249 props.constraint_axis = (True, False, False)
250 props.constraint_orientation = 'GLOBAL'
251 props = layout.operator("transform.mirror", text="Y Global")
252 props.constraint_axis = (False, True, False)
253 props.constraint_orientation = 'GLOBAL'
254 props = layout.operator("transform.mirror", text="Z Global")
255 props.constraint_axis = (False, False, True)
256 props.constraint_orientation = 'GLOBAL'
258 if context.edit_object:
261 props = layout.operator("transform.mirror", text="X Local")
262 props.constraint_axis = (True, False, False)
263 props.constraint_orientation = 'LOCAL'
264 props = layout.operator("transform.mirror", text="Y Local")
265 props.constraint_axis = (False, True, False)
266 props.constraint_orientation = 'LOCAL'
267 props = layout.operator("transform.mirror", text="Z Local")
268 props.constraint_axis = (False, False, True)
269 props.constraint_orientation = 'LOCAL'
271 layout.operator("object.vertex_group_mirror")
274 class VIEW3D_MT_snap(Menu):
277 def draw(self, context):
280 layout.operator("view3d.snap_selected_to_grid", text="Selection to Grid")
281 layout.operator("view3d.snap_selected_to_cursor", text="Selection to Cursor")
285 layout.operator("view3d.snap_cursor_to_selected", text="Cursor to Selected")
286 layout.operator("view3d.snap_cursor_to_center", text="Cursor to Center")
287 layout.operator("view3d.snap_cursor_to_grid", text="Cursor to Grid")
288 layout.operator("view3d.snap_cursor_to_active", text="Cursor to Active")
291 class VIEW3D_MT_uv_map(Menu):
292 bl_label = "UV Mapping"
294 def draw(self, context):
297 layout.operator("uv.unwrap")
299 layout.operator_context = 'INVOKE_DEFAULT'
300 layout.operator("uv.smart_project")
301 layout.operator("uv.lightmap_pack")
302 layout.operator("uv.follow_active_quads")
306 layout.operator_context = 'EXEC_REGION_WIN'
307 layout.operator("uv.cube_project")
308 layout.operator("uv.cylinder_project")
309 layout.operator("uv.sphere_project")
313 layout.operator_context = 'EXEC_REGION_WIN'
314 layout.operator("uv.project_from_view").scale_to_bounds = False
315 layout.operator("uv.project_from_view", text="Project from View (Bounds)").scale_to_bounds = True
319 layout.operator("uv.reset")
322 # ********** View menus **********
325 class VIEW3D_MT_view(Menu):
328 def draw(self, context):
331 layout.operator("view3d.properties", icon='MENU_PANEL')
332 layout.operator("view3d.toolshelf", icon='MENU_PANEL')
336 layout.operator("view3d.viewnumpad", text="Camera").type = 'CAMERA'
337 layout.operator("view3d.viewnumpad", text="Top").type = 'TOP'
338 layout.operator("view3d.viewnumpad", text="Bottom").type = 'BOTTOM'
339 layout.operator("view3d.viewnumpad", text="Front").type = 'FRONT'
340 layout.operator("view3d.viewnumpad", text="Back").type = 'BACK'
341 layout.operator("view3d.viewnumpad", text="Right").type = 'RIGHT'
342 layout.operator("view3d.viewnumpad", text="Left").type = 'LEFT'
344 layout.menu("VIEW3D_MT_view_cameras", text="Cameras")
348 layout.operator("view3d.view_persportho")
352 layout.menu("VIEW3D_MT_view_navigation")
353 layout.menu("VIEW3D_MT_view_align")
357 layout.operator_context = 'INVOKE_REGION_WIN'
359 layout.operator("view3d.clip_border", text="Clipping Border...")
360 layout.operator("view3d.zoom_border", text="Zoom Border...")
361 layout.operator("view3d.render_border", text="Render Border...")
365 layout.operator("view3d.layers", text="Show All Layers").nr = 0
369 layout.operator("view3d.localview", text="View Global/Local")
370 layout.operator("view3d.view_selected")
371 layout.operator("view3d.view_all")
375 layout.operator("screen.animation_play", text="Playback Animation")
379 layout.operator("screen.area_dupli")
380 layout.operator("screen.region_quadview")
381 layout.operator("screen.screen_full_area")
384 class VIEW3D_MT_view_navigation(Menu):
385 bl_label = "Navigation"
387 def draw(self, context):
390 layout.operator_enum("view3d.view_orbit", "type")
394 layout.operator_enum("view3d.view_pan", "type")
398 layout.operator("view3d.zoom", text="Zoom In").delta = 1
399 layout.operator("view3d.zoom", text="Zoom Out").delta = -1
400 layout.operator("view3d.zoom_camera_1_to_1", text="Zoom Camera 1:1")
404 layout.operator("view3d.fly")
407 class VIEW3D_MT_view_align(Menu):
408 bl_label = "Align View"
410 def draw(self, context):
413 layout.menu("VIEW3D_MT_view_align_selected")
417 layout.operator("view3d.view_all", text="Center Cursor and View All").center = True
418 layout.operator("view3d.camera_to_view", text="Align Active Camera to View")
419 layout.operator("view3d.camera_to_view_selected", text="Align Active Camera to Selected")
420 layout.operator("view3d.view_selected")
421 layout.operator("view3d.view_center_cursor")
425 layout.operator("view3d.view_lock_to_active")
426 layout.operator("view3d.view_lock_clear")
429 class VIEW3D_MT_view_align_selected(Menu):
430 bl_label = "Align View to Selected"
432 def draw(self, context):
435 props = layout.operator("view3d.viewnumpad", text="Top")
436 props.align_active = True
439 props = layout.operator("view3d.viewnumpad", text="Bottom")
440 props.align_active = True
441 props.type = 'BOTTOM'
443 props = layout.operator("view3d.viewnumpad", text="Front")
444 props.align_active = True
447 props = layout.operator("view3d.viewnumpad", text="Back")
448 props.align_active = True
451 props = layout.operator("view3d.viewnumpad", text="Right")
452 props.align_active = True
455 props = layout.operator("view3d.viewnumpad", text="Left")
456 props.align_active = True
460 class VIEW3D_MT_view_cameras(Menu):
463 def draw(self, context):
466 layout.operator("view3d.object_as_camera")
467 layout.operator("view3d.viewnumpad", text="Active Camera").type = 'CAMERA'
469 # ********** Select menus, suffix from context.mode **********
472 class VIEW3D_MT_select_object(Menu):
475 def draw(self, context):
478 layout.operator("view3d.select_border")
479 layout.operator("view3d.select_circle")
483 layout.operator("object.select_all").action = 'TOGGLE'
484 layout.operator("object.select_all", text="Inverse").action = 'INVERT'
485 layout.operator("object.select_random", text="Random")
486 layout.operator("object.select_mirror", text="Mirror")
487 layout.operator("object.select_by_layer", text="Select All by Layer")
488 layout.operator_menu_enum("object.select_by_type", "type", text="Select All by Type...")
489 layout.operator("object.select_camera", text="Select Camera")
493 layout.operator_menu_enum("object.select_grouped", "type", text="Grouped")
494 layout.operator_menu_enum("object.select_linked", "type", text="Linked")
495 layout.operator("object.select_pattern", text="Select Pattern...")
498 class VIEW3D_MT_select_pose(Menu):
501 def draw(self, context):
504 layout.operator("view3d.select_border")
508 layout.operator("pose.select_all").action = 'TOGGLE'
509 layout.operator("pose.select_all", text="Inverse").action = 'INVERT'
510 layout.operator("pose.select_flip_active", text="Flip Active")
511 layout.operator("pose.select_constraint_target", text="Constraint Target")
512 layout.operator("pose.select_linked", text="Linked")
516 layout.operator("pose.select_hierarchy", text="Parent").direction = 'PARENT'
517 layout.operator("pose.select_hierarchy", text="Child").direction = 'CHILD'
521 props = layout.operator("pose.select_hierarchy", text="Extend Parent")
523 props.direction = 'PARENT'
525 props = layout.operator("pose.select_hierarchy", text="Extend Child")
527 props.direction = 'CHILD'
531 layout.operator_menu_enum("pose.select_grouped", "type", text="Grouped")
532 layout.operator("object.select_pattern", text="Select Pattern...")
535 class VIEW3D_MT_select_particle(Menu):
538 def draw(self, context):
541 layout.operator("view3d.select_border")
545 layout.operator("particle.select_all").action = 'TOGGLE'
546 layout.operator("particle.select_linked")
547 layout.operator("particle.select_all", text="Inverse").action = 'INVERT'
551 layout.operator("particle.select_more")
552 layout.operator("particle.select_less")
556 layout.operator("particle.select_roots", text="Roots")
557 layout.operator("particle.select_tips", text="Tips")
560 class VIEW3D_MT_select_edit_mesh(Menu):
563 def draw(self, context):
566 layout.operator("view3d.select_border")
567 layout.operator("view3d.select_circle")
571 layout.operator("mesh.select_all").action = 'TOGGLE'
572 layout.operator("mesh.select_all", text="Inverse").action = 'INVERT'
576 layout.operator("mesh.select_random", text="Random")
577 layout.operator("mesh.select_nth")
578 layout.operator("mesh.edges_select_sharp", text="Sharp Edges")
579 layout.operator("mesh.faces_select_linked_flat", text="Linked Flat Faces")
580 layout.operator("mesh.select_interior_faces", text="Interior Faces")
581 layout.operator("mesh.select_axis", text="Side of Active")
585 layout.operator("mesh.select_face_by_sides")
586 if context.scene.tool_settings.mesh_select_mode[2] is False:
587 layout.operator("mesh.select_non_manifold", text="Non Manifold")
588 layout.operator("mesh.select_loose_verts", text="Loose Verts/Edges")
589 layout.operator_menu_enum("mesh.select_similar", "type", text="Similar")
593 layout.operator("mesh.select_less", text="Less")
594 layout.operator("mesh.select_more", text="More")
598 layout.operator("mesh.select_mirror", text="Mirror")
600 layout.operator("mesh.select_linked", text="Linked")
601 layout.operator("mesh.select_vertex_path", text="Vertex Path")
602 layout.operator("mesh.loop_multi_select", text="Edge Loop").ring = False
603 layout.operator("mesh.loop_multi_select", text="Edge Ring").ring = True
607 layout.operator("mesh.loop_to_region")
608 layout.operator("mesh.region_to_loop")
611 class VIEW3D_MT_select_edit_curve(Menu):
614 def draw(self, context):
617 layout.operator("view3d.select_border")
618 layout.operator("view3d.select_circle")
622 layout.operator("curve.select_all").action = 'TOGGLE'
623 layout.operator("curve.select_all", text="Inverse").action = 'INVERT'
624 layout.operator("curve.select_random")
625 layout.operator("curve.select_nth", text="Every Nth Number of Points")
626 layout.operator("curve.select_linked", text="Select Linked")
630 layout.operator("curve.de_select_first")
631 layout.operator("curve.de_select_last")
632 layout.operator("curve.select_next")
633 layout.operator("curve.select_previous")
637 layout.operator("curve.select_more")
638 layout.operator("curve.select_less")
641 class VIEW3D_MT_select_edit_surface(Menu):
644 def draw(self, context):
647 layout.operator("view3d.select_border")
648 layout.operator("view3d.select_circle")
652 layout.operator("curve.select_all").action = 'TOGGLE'
653 layout.operator("curve.select_all", text="Inverse").action = 'INVERT'
654 layout.operator("curve.select_random")
655 layout.operator("curve.select_nth", text="Every Nth Number of Points")
656 layout.operator("curve.select_linked", text="Select Linked")
660 layout.operator("curve.select_row")
664 layout.operator("curve.select_more")
665 layout.operator("curve.select_less")
668 class VIEW3D_MT_select_edit_metaball(Menu):
671 def draw(self, context):
674 layout.operator("view3d.select_border")
678 layout.operator("mball.select_all").action = 'TOGGLE'
679 layout.operator("mball.select_all", text="Inverse").action = 'INVERT'
683 layout.operator("mball.select_random_metaelems")
686 class VIEW3D_MT_select_edit_lattice(Menu):
689 def draw(self, context):
692 layout.operator("view3d.select_border")
696 layout.operator("lattice.select_all").action = 'TOGGLE'
697 layout.operator("lattice.select_all", text="Inverse").action = 'INVERT'
700 class VIEW3D_MT_select_edit_armature(Menu):
703 def draw(self, context):
706 layout.operator("view3d.select_border")
710 layout.operator("armature.select_all").action = 'TOGGLE'
711 layout.operator("armature.select_all", text="Inverse").action = 'INVERT'
715 layout.operator("armature.select_hierarchy", text="Parent").direction = 'PARENT'
716 layout.operator("armature.select_hierarchy", text="Child").direction = 'CHILD'
720 props = layout.operator("armature.select_hierarchy", text="Extend Parent")
722 props.direction = 'PARENT'
724 props = layout.operator("armature.select_hierarchy", text="Extend Child")
726 props.direction = 'CHILD'
728 layout.operator_menu_enum("armature.select_similar", "type", text="Similar")
729 layout.operator("object.select_pattern", text="Select Pattern...")
732 class VIEW3D_MT_select_face(Menu): # XXX no matching enum
735 def draw(self, context):
736 # layout = self.layout
739 # see view3d_select_faceselmenu
742 # ********** Object menu **********
745 class VIEW3D_MT_object(Menu):
746 bl_context = "objectmode"
749 def draw(self, context):
752 layout.operator("ed.undo")
753 layout.operator("ed.redo")
754 layout.operator("ed.undo_history")
758 layout.menu("VIEW3D_MT_transform_object")
759 layout.menu("VIEW3D_MT_mirror")
760 layout.menu("VIEW3D_MT_object_clear")
761 layout.menu("VIEW3D_MT_object_apply")
762 layout.menu("VIEW3D_MT_snap")
766 layout.menu("VIEW3D_MT_object_animation")
770 layout.operator("object.duplicate_move")
771 layout.operator("object.duplicate_move_linked")
772 layout.operator("object.delete", text="Delete...")
773 layout.operator("object.proxy_make", text="Make Proxy...")
774 layout.menu("VIEW3D_MT_make_links", text="Make Links...")
775 layout.operator("object.make_dupli_face")
776 layout.operator_menu_enum("object.make_local", "type", text="Make Local...")
777 layout.menu("VIEW3D_MT_make_single_user")
781 layout.menu("VIEW3D_MT_object_parent")
782 layout.menu("VIEW3D_MT_object_track")
783 layout.menu("VIEW3D_MT_object_group")
784 layout.menu("VIEW3D_MT_object_constraints")
788 layout.menu("VIEW3D_MT_object_quick_effects")
792 layout.menu("VIEW3D_MT_object_game")
796 layout.operator("object.join")
800 layout.operator("object.move_to_layer", text="Move to Layer...")
801 layout.menu("VIEW3D_MT_object_showhide")
803 layout.operator_menu_enum("object.convert", "target")
806 class VIEW3D_MT_object_animation(Menu):
807 bl_label = "Animation"
809 def draw(self, context):
812 layout.operator("anim.keyframe_insert_menu", text="Insert Keyframe...")
813 layout.operator("anim.keyframe_delete_v3d", text="Delete Keyframes...")
814 layout.operator("anim.keyframe_clear_v3d", text="Clear Keyframes...")
815 layout.operator("anim.keying_set_active_set", text="Change Keying Set...")
819 layout.operator("nla.bake", text="Bake Action...")
822 class VIEW3D_MT_object_clear(Menu):
825 def draw(self, context):
828 layout.operator("object.location_clear", text="Location")
829 layout.operator("object.rotation_clear", text="Rotation")
830 layout.operator("object.scale_clear", text="Scale")
831 layout.operator("object.origin_clear", text="Origin")
834 class VIEW3D_MT_object_specials(Menu):
835 bl_label = "Specials"
838 def poll(cls, context):
839 # add more special types
840 return context.object
842 def draw(self, context):
846 if obj.type == 'CAMERA':
847 layout.operator_context = 'INVOKE_REGION_WIN'
849 if obj.data.type == 'PERSP':
850 props = layout.operator("wm.context_modal_mouse", text="Camera Lens Angle")
851 props.data_path_iter = "selected_editable_objects"
852 props.data_path_item = "data.lens"
853 props.input_scale = 0.1
854 if obj.data.lens_unit == 'MILLIMETERS':
855 props.header_text = "Camera Lens Angle: %.1fmm"
857 props.header_text = "Camera Lens Angle: %.1f\u00B0"
860 props = layout.operator("wm.context_modal_mouse", text="Camera Lens Scale")
861 props.data_path_iter = "selected_editable_objects"
862 props.data_path_item = "data.ortho_scale"
863 props.input_scale = 0.01
864 props.header_text = "Camera Lens Scale: %.3f"
866 if not obj.data.dof_object:
867 #layout.label(text="Test Has DOF obj");
868 props = layout.operator("wm.context_modal_mouse", text="DOF Distance")
869 props.data_path_iter = "selected_editable_objects"
870 props.data_path_item = "data.dof_distance"
871 props.input_scale = 0.02
872 props.header_text = "DOF Distance: %.3f"
874 if obj.type in {'CURVE', 'FONT'}:
875 layout.operator_context = 'INVOKE_REGION_WIN'
877 props = layout.operator("wm.context_modal_mouse", text="Extrude Size")
878 props.data_path_iter = "selected_editable_objects"
879 props.data_path_item = "data.extrude"
880 props.input_scale = 0.01
881 props.header_text = "Extrude Size: %.3f"
883 props = layout.operator("wm.context_modal_mouse", text="Width Size")
884 props.data_path_iter = "selected_editable_objects"
885 props.data_path_item = "data.offset"
886 props.input_scale = 0.01
887 props.header_text = "Width Size: %.3f"
889 if obj.type == 'EMPTY':
890 layout.operator_context = 'INVOKE_REGION_WIN'
892 props = layout.operator("wm.context_modal_mouse", text="Empty Draw Size")
893 props.data_path_iter = "selected_editable_objects"
894 props.data_path_item = "empty_draw_size"
895 props.input_scale = 0.01
896 props.header_text = "Empty Draw Size: %.3f"
898 if obj.type == 'LAMP':
899 layout.operator_context = 'INVOKE_REGION_WIN'
901 props = layout.operator("wm.context_modal_mouse", text="Energy")
902 props.data_path_iter = "selected_editable_objects"
903 props.data_path_item = "data.energy"
904 props.header_text = "Lamp Energy: %.3f"
906 if obj.data.type in {'SPOT', 'AREA', 'POINT'}:
907 props = layout.operator("wm.context_modal_mouse", text="Falloff Distance")
908 props.data_path_iter = "selected_editable_objects"
909 props.data_path_item = "data.distance"
910 props.input_scale = 0.1
911 props.header_text = "Lamp Falloff Distance: %.1f"
913 if obj.data.type == 'SPOT':
915 props = layout.operator("wm.context_modal_mouse", text="Spot Size")
916 props.data_path_iter = "selected_editable_objects"
917 props.data_path_item = "data.spot_size"
918 props.input_scale = 0.01
919 props.header_text = "Spot Size: %.2f"
921 props = layout.operator("wm.context_modal_mouse", text="Spot Blend")
922 props.data_path_iter = "selected_editable_objects"
923 props.data_path_item = "data.spot_blend"
924 props.input_scale = -0.01
925 props.header_text = "Spot Blend: %.2f"
927 props = layout.operator("wm.context_modal_mouse", text="Clip Start")
928 props.data_path_iter = "selected_editable_objects"
929 props.data_path_item = "data.shadow_buffer_clip_start"
930 props.input_scale = 0.05
931 props.header_text = "Clip Start: %.2f"
933 props = layout.operator("wm.context_modal_mouse", text="Clip End")
934 props.data_path_iter = "selected_editable_objects"
935 props.data_path_item = "data.shadow_buffer_clip_end"
936 props.input_scale = 0.05
937 props.header_text = "Clip End: %.2f"
941 props = layout.operator("object.isolate_type_render")
942 props = layout.operator("object.hide_render_clear_all")
945 class VIEW3D_MT_object_apply(Menu):
948 def draw(self, context):
951 props = layout.operator("object.transform_apply", text="Location")
952 props.location, props.rotation, props.scale = True, False, False
954 props = layout.operator("object.transform_apply", text="Rotation")
955 props.location, props.rotation, props.scale = False, True, False
957 props = layout.operator("object.transform_apply", text="Scale")
958 props.location, props.rotation, props.scale = False, False, True
959 props = layout.operator("object.transform_apply", text="Rotation & Scale")
960 props.location, props.rotation, props.scale = False, True, True
964 layout.operator("object.visual_transform_apply", text="Visual Transform")
965 layout.operator("object.duplicates_make_real")
968 class VIEW3D_MT_object_parent(Menu):
971 def draw(self, context):
974 layout.operator_enum("object.parent_set", "type")
976 layout.operator_enum("object.parent_clear", "type")
979 class VIEW3D_MT_object_track(Menu):
982 def draw(self, context):
985 layout.operator_enum("object.track_set", "type")
987 layout.operator_enum("object.track_clear", "type")
990 class VIEW3D_MT_object_group(Menu):
993 def draw(self, context):
996 layout.operator("group.create")
997 # layout.operator_menu_enum("group.objects_remove", "group") # BUGGY
998 layout.operator("group.objects_remove")
999 layout.operator("group.objects_remove_all")
1003 layout.operator("group.objects_add_active")
1004 layout.operator("group.objects_remove_active")
1007 class VIEW3D_MT_object_constraints(Menu):
1008 bl_label = "Constraints"
1010 def draw(self, context):
1011 layout = self.layout
1013 layout.operator("object.constraint_add_with_targets")
1014 layout.operator("object.constraints_copy")
1015 layout.operator("object.constraints_clear")
1018 class VIEW3D_MT_object_quick_effects(Menu):
1019 bl_label = "Quick Effects"
1021 def draw(self, context):
1022 layout = self.layout
1024 layout.operator("object.quick_fur")
1025 layout.operator("object.quick_explode")
1026 layout.operator("object.quick_smoke")
1027 layout.operator("object.quick_fluid")
1030 class VIEW3D_MT_object_showhide(Menu):
1031 bl_label = "Show/Hide"
1033 def draw(self, context):
1034 layout = self.layout
1036 layout.operator("object.hide_view_clear", text="Show Hidden")
1037 layout.operator("object.hide_view_set", text="Hide Selected").unselected = False
1038 layout.operator("object.hide_view_set", text="Hide Unselected").unselected = True
1041 class VIEW3D_MT_make_single_user(Menu):
1042 bl_label = "Make Single User"
1044 def draw(self, context):
1045 layout = self.layout
1047 props = layout.operator("object.make_single_user", text="Object")
1050 props = layout.operator("object.make_single_user", text="Object & Data")
1051 props.object = props.obdata = True
1053 props = layout.operator("object.make_single_user", text="Object & Data & Materials+Tex")
1054 props.object = props.obdata = props.material = props.texture = True
1056 props = layout.operator("object.make_single_user", text="Materials+Tex")
1057 props.material = props.texture = True
1059 props = layout.operator("object.make_single_user", text="Object Animation")
1060 props.animation = True
1063 class VIEW3D_MT_make_links(Menu):
1064 bl_label = "Make Links"
1066 def draw(self, context):
1067 layout = self.layout
1069 if(len(bpy.data.scenes) > 10):
1070 layout.operator_context = 'INVOKE_DEFAULT'
1071 layout.operator("object.make_links_scene", text="Objects to Scene...", icon='OUTLINER_OB_EMPTY')
1073 layout.operator_menu_enum("object.make_links_scene", "scene", text="Objects to Scene...")
1075 layout.operator_enum("object.make_links_data", "type") # inline
1077 layout.operator("object.join_uvs") # stupid place to add this!
1080 class VIEW3D_MT_object_game(Menu):
1083 def draw(self, context):
1084 layout = self.layout
1086 layout.operator("object.logic_bricks_copy", text="Copy Logic Bricks")
1087 layout.operator("object.game_physics_copy", text="Copy Physics Properties")
1091 layout.operator("object.game_property_copy", text="Replace Properties").operation = 'REPLACE'
1092 layout.operator("object.game_property_copy", text="Merge Properties").operation = 'MERGE'
1093 layout.operator_menu_enum("object.game_property_copy", "property", text="Copy Properties...")
1097 layout.operator("object.game_property_clear")
1100 # ********** Brush menu **********
1101 class VIEW3D_MT_brush(Menu):
1104 def draw(self, context):
1105 layout = self.layout
1107 settings = UnifiedPaintPanel.paint_settings(context)
1108 brush = settings.brush
1110 ups = context.tool_settings.unified_paint_settings
1111 layout.prop(ups, "use_unified_size", text="Unified Size")
1112 layout.prop(ups, "use_unified_strength", text="Unified Strength")
1116 layout.menu("VIEW3D_MT_brush_paint_modes")
1119 if context.sculpt_object:
1120 layout.operator("brush.reset")
1121 layout.prop_menu_enum(brush, "sculpt_tool")
1122 elif context.image_paint_object:
1123 layout.prop_menu_enum(brush, "image_tool")
1124 elif context.vertex_paint_object or context.weight_paint_object:
1125 layout.prop_menu_enum(brush, "vertex_tool")
1127 # skip if no active brush
1131 # TODO: still missing a lot of brush options here
1134 if context.sculpt_object:
1136 sculpt_tool = brush.sculpt_tool
1139 layout.operator_menu_enum("brush.curve_preset", "shape", text="Curve Preset")
1142 if sculpt_tool != 'GRAB':
1143 layout.prop_menu_enum(brush, "stroke_method")
1145 if sculpt_tool in {'DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'}:
1146 layout.prop_menu_enum(brush, "direction")
1148 if sculpt_tool == 'LAYER':
1149 layout.prop(brush, "use_persistent")
1150 layout.operator("sculpt.set_persistent_base")
1153 class VIEW3D_MT_brush_paint_modes(Menu):
1154 bl_label = "Enabled Modes"
1156 def draw(self, context):
1157 layout = self.layout
1159 settings = UnifiedPaintPanel.paint_settings(context)
1160 brush = settings.brush
1162 layout.prop(brush, "use_paint_sculpt", text="Sculpt")
1163 layout.prop(brush, "use_paint_vertex", text="Vertex Paint")
1164 layout.prop(brush, "use_paint_weight", text="Weight Paint")
1165 layout.prop(brush, "use_paint_image", text="Texture Paint")
1167 # ********** Vertex paint menu **********
1170 class VIEW3D_MT_paint_vertex(Menu):
1173 def draw(self, context):
1174 layout = self.layout
1176 layout.operator("ed.undo")
1177 layout.operator("ed.redo")
1181 layout.operator("paint.vertex_color_set")
1182 layout.operator("paint.vertex_color_dirt")
1185 class VIEW3D_MT_hook(Menu):
1188 def draw(self, context):
1189 layout = self.layout
1190 layout.operator_context = 'EXEC_AREA'
1191 layout.operator("object.hook_add_newob")
1192 layout.operator("object.hook_add_selob").use_bone = False
1193 layout.operator("object.hook_add_selob", text="Hook to Selected Object Bone").use_bone = True
1195 if [mod.type == 'HOOK' for mod in context.active_object.modifiers]:
1197 layout.operator_menu_enum("object.hook_assign", "modifier")
1198 layout.operator_menu_enum("object.hook_remove", "modifier")
1200 layout.operator_menu_enum("object.hook_select", "modifier")
1201 layout.operator_menu_enum("object.hook_reset", "modifier")
1202 layout.operator_menu_enum("object.hook_recenter", "modifier")
1205 class VIEW3D_MT_vertex_group(Menu):
1206 bl_label = "Vertex Groups"
1208 def draw(self, context):
1209 layout = self.layout
1211 layout.operator_context = 'EXEC_AREA'
1212 layout.operator("object.vertex_group_assign", text="Assign to New Group").new = True
1214 ob = context.active_object
1215 if ob.mode == 'EDIT' or (ob.mode == 'WEIGHT_PAINT' and ob.type == 'MESH' and ob.data.use_paint_mask_vertex):
1216 if ob.vertex_groups.active:
1218 layout.operator("object.vertex_group_assign", text="Assign to Active Group").new = False
1219 layout.operator("object.vertex_group_remove_from", text="Remove from Active Group").all = False
1220 layout.operator("object.vertex_group_remove_from", text="Remove from All").all = True
1223 if ob.vertex_groups.active:
1224 layout.operator_menu_enum("object.vertex_group_set_active", "group", text="Set Active Group")
1225 layout.operator("object.vertex_group_remove", text="Remove Active Group").all = False
1226 layout.operator("object.vertex_group_remove", text="Remove All Groups").all = True
1228 # ********** Weight paint menu **********
1231 class VIEW3D_MT_paint_weight(Menu):
1232 bl_label = "Weights"
1234 def draw(self, context):
1235 layout = self.layout
1237 layout.operator("ed.undo")
1238 layout.operator("ed.redo")
1239 layout.operator("ed.undo_history")
1243 layout.operator("paint.weight_from_bones", text="Assign Automatic From Bones").type = 'AUTOMATIC'
1244 layout.operator("paint.weight_from_bones", text="Assign From Bone Envelopes").type = 'ENVELOPES'
1248 layout.operator("object.vertex_group_normalize_all", text="Normalize All")
1249 layout.operator("object.vertex_group_normalize", text="Normalize")
1250 layout.operator("object.vertex_group_mirror", text="Mirror")
1251 layout.operator("object.vertex_group_invert", text="Invert")
1252 layout.operator("object.vertex_group_clean", text="Clean")
1253 layout.operator("object.vertex_group_levels", text="Levels")
1254 layout.operator("object.vertex_group_blend", text="Blend")
1255 layout.operator("object.vertex_group_transfer_weight", text="Transfer Weights")
1256 layout.operator("object.vertex_group_limit_total", text="Limit Total")
1257 layout.operator("object.vertex_group_fix", text="Fix Deforms")
1261 layout.operator("paint.weight_set")
1263 # ********** Sculpt menu **********
1266 class VIEW3D_MT_sculpt(Menu):
1269 def draw(self, context):
1270 layout = self.layout
1272 toolsettings = context.tool_settings
1273 sculpt = toolsettings.sculpt
1275 layout.operator("ed.undo")
1276 layout.operator("ed.redo")
1280 layout.prop(sculpt, "use_symmetry_x")
1281 layout.prop(sculpt, "use_symmetry_y")
1282 layout.prop(sculpt, "use_symmetry_z")
1284 layout.prop(sculpt, "lock_x")
1285 layout.prop(sculpt, "lock_y")
1286 layout.prop(sculpt, "lock_z")
1289 layout.prop(sculpt, "use_threaded", text="Threaded Sculpt")
1290 layout.prop(sculpt, "show_low_resolution")
1291 layout.prop(sculpt, "show_brush")
1292 layout.prop(sculpt, "use_deform_only")
1293 layout.prop(sculpt, "show_diffuse_color")
1296 class VIEW3D_MT_hide_mask(Menu):
1297 bl_label = "Hide/Mask"
1299 def draw(self, context):
1300 layout = self.layout
1302 op = layout.operator("paint.hide_show", text="Show All")
1306 op = layout.operator("paint.hide_show", text="Hide Bounding Box")
1310 op = layout.operator("paint.hide_show", text="Show Bounding Box")
1314 op = layout.operator("paint.hide_show", text="Hide Masked")
1320 op = layout.operator("paint.mask_flood_fill", text="Invert Mask")
1323 op = layout.operator("paint.mask_flood_fill", text="Fill Mask")
1327 op = layout.operator("paint.mask_flood_fill", text="Clear Mask")
1332 # ********** Particle menu **********
1335 class VIEW3D_MT_particle(Menu):
1336 bl_label = "Particle"
1338 def draw(self, context):
1339 layout = self.layout
1341 particle_edit = context.tool_settings.particle_edit
1343 layout.operator("ed.undo")
1344 layout.operator("ed.redo")
1345 layout.operator("ed.undo_history")
1349 layout.operator("particle.mirror")
1353 layout.operator("particle.remove_doubles")
1354 layout.operator("particle.delete")
1356 if particle_edit.select_mode == 'POINT':
1357 layout.operator("particle.subdivide")
1359 layout.operator("particle.rekey")
1360 layout.operator("particle.weight_set")
1364 layout.menu("VIEW3D_MT_particle_showhide")
1367 class VIEW3D_MT_particle_specials(Menu):
1368 bl_label = "Specials"
1370 def draw(self, context):
1371 layout = self.layout
1373 particle_edit = context.tool_settings.particle_edit
1375 layout.operator("particle.rekey")
1378 if particle_edit.select_mode == 'POINT':
1379 layout.operator("particle.subdivide")
1380 layout.operator("particle.select_roots")
1381 layout.operator("particle.select_tips")
1383 layout.operator("particle.remove_doubles")
1386 class VIEW3D_MT_particle_showhide(ShowHideMenu, Menu):
1387 _operator_name = "particle"
1389 # ********** Pose Menu **********
1392 class VIEW3D_MT_pose(Menu):
1395 def draw(self, context):
1396 layout = self.layout
1398 layout.operator("ed.undo")
1399 layout.operator("ed.redo")
1400 layout.operator("ed.undo_history")
1404 layout.menu("VIEW3D_MT_transform_armature")
1406 layout.menu("VIEW3D_MT_pose_transform")
1407 layout.menu("VIEW3D_MT_pose_apply")
1409 layout.menu("VIEW3D_MT_snap")
1413 layout.menu("VIEW3D_MT_object_animation")
1417 layout.menu("VIEW3D_MT_pose_slide")
1418 layout.menu("VIEW3D_MT_pose_propagate")
1422 layout.operator("pose.copy")
1423 layout.operator("pose.paste")
1424 layout.operator("pose.paste", text="Paste X-Flipped Pose").flipped = True
1428 layout.menu("VIEW3D_MT_pose_library")
1429 layout.menu("VIEW3D_MT_pose_motion")
1430 layout.menu("VIEW3D_MT_pose_group")
1434 layout.menu("VIEW3D_MT_object_parent")
1435 layout.menu("VIEW3D_MT_pose_ik")
1436 layout.menu("VIEW3D_MT_pose_constraints")
1440 layout.operator_context = 'EXEC_AREA'
1441 layout.operator("pose.autoside_names", text="AutoName Left/Right").axis = 'XAXIS'
1442 layout.operator("pose.autoside_names", text="AutoName Front/Back").axis = 'YAXIS'
1443 layout.operator("pose.autoside_names", text="AutoName Top/Bottom").axis = 'ZAXIS'
1445 layout.operator("pose.flip_names")
1447 layout.operator("pose.quaternions_flip")
1451 layout.operator_context = 'INVOKE_AREA'
1452 layout.operator("pose.armature_layers", text="Change Armature Layers...")
1453 layout.operator("pose.bone_layers", text="Change Bone Layers...")
1457 layout.menu("VIEW3D_MT_pose_showhide")
1458 layout.menu("VIEW3D_MT_bone_options_toggle", text="Bone Settings")
1461 class VIEW3D_MT_pose_transform(Menu):
1462 bl_label = "Clear Transform"
1464 def draw(self, context):
1465 layout = self.layout
1467 layout.operator("pose.transforms_clear", text="All")
1471 layout.operator("pose.loc_clear", text="Location")
1472 layout.operator("pose.rot_clear", text="Rotation")
1473 layout.operator("pose.scale_clear", text="Scale")
1477 layout.operator("pose.user_transforms_clear", text="Reset unkeyed")
1480 class VIEW3D_MT_pose_slide(Menu):
1481 bl_label = "In-Betweens"
1483 def draw(self, context):
1484 layout = self.layout
1486 layout.operator("pose.push")
1487 layout.operator("pose.relax")
1488 layout.operator("pose.breakdown")
1491 class VIEW3D_MT_pose_propagate(Menu):
1492 bl_label = "Propagate"
1494 def draw(self, context):
1495 layout = self.layout
1497 layout.operator("pose.propagate").mode = 'WHILE_HELD'
1501 layout.operator("pose.propagate", text="To Next Keyframe").mode = 'NEXT_KEY'
1502 layout.operator("pose.propagate", text="To Last Keyframe (Make Cyclic)").mode = 'LAST_KEY'
1506 layout.operator("pose.propagate", text="On Selected Markers").mode = 'SELECTED_MARKERS'
1509 class VIEW3D_MT_pose_library(Menu):
1510 bl_label = "Pose Library"
1512 def draw(self, context):
1513 layout = self.layout
1515 layout.operator("poselib.browse_interactive", text="Browse Poses...")
1519 layout.operator("poselib.pose_add", text="Add Pose...")
1520 layout.operator("poselib.pose_rename", text="Rename Pose...")
1521 layout.operator("poselib.pose_remove", text="Remove Pose...")
1524 class VIEW3D_MT_pose_motion(Menu):
1525 bl_label = "Motion Paths"
1527 def draw(self, context):
1528 layout = self.layout
1530 layout.operator("pose.paths_calculate", text="Calculate")
1531 layout.operator("pose.paths_clear", text="Clear")
1534 class VIEW3D_MT_pose_group(Menu):
1535 bl_label = "Bone Groups"
1537 def draw(self, context):
1538 layout = self.layout
1540 pose = context.active_object.pose
1542 layout.operator_context = 'EXEC_AREA'
1543 layout.operator("pose.group_assign", text="Assign to New Group").type = 0
1544 if pose.bone_groups:
1545 active_group = pose.bone_groups.active_index + 1
1546 layout.operator("pose.group_assign", text="Assign to Group").type = active_group
1550 #layout.operator_context = 'INVOKE_AREA'
1551 layout.operator("pose.group_unassign")
1552 layout.operator("pose.group_remove")
1555 class VIEW3D_MT_pose_ik(Menu):
1556 bl_label = "Inverse Kinematics"
1558 def draw(self, context):
1559 layout = self.layout
1561 layout.operator("pose.ik_add")
1562 layout.operator("pose.ik_clear")
1565 class VIEW3D_MT_pose_constraints(Menu):
1566 bl_label = "Constraints"
1568 def draw(self, context):
1569 layout = self.layout
1571 layout.operator("pose.constraint_add_with_targets", text="Add (With Targets)...")
1572 layout.operator("pose.constraints_copy")
1573 layout.operator("pose.constraints_clear")
1576 class VIEW3D_MT_pose_showhide(ShowHideMenu, Menu):
1577 _operator_name = "pose"
1580 class VIEW3D_MT_pose_apply(Menu):
1583 def draw(self, context):
1584 layout = self.layout
1586 layout.operator("pose.armature_apply")
1587 layout.operator("pose.visual_transform_apply")
1590 class VIEW3D_MT_pose_specials(Menu):
1591 bl_label = "Specials"
1593 def draw(self, context):
1594 layout = self.layout
1595 layout.operator("pose.select_constraint_target")
1596 layout.operator("pose.flip_names")
1597 layout.operator("pose.paths_calculate")
1598 layout.operator("pose.paths_clear")
1599 layout.operator("pose.user_transforms_clear")
1600 layout.operator("pose.user_transforms_clear", text="Clear User Transforms (All)").only_selected = False
1601 layout.operator("pose.relax")
1605 layout.operator_menu_enum("pose.autoside_names", "axis")
1609 def draw(self, context):
1610 layout = self.layout
1615 "use_envelope_multiply",
1616 "use_inherit_rotation",
1617 "use_inherit_scale",
1620 if context.mode == 'EDIT_ARMATURE':
1621 bone_props = bpy.types.EditBone.bl_rna.properties
1622 data_path_iter = "selected_bones"
1624 options.append("lock")
1626 bone_props = bpy.types.Bone.bl_rna.properties
1627 data_path_iter = "selected_pose_bones"
1628 opt_suffix = "bone."
1631 props = layout.operator("wm.context_collection_boolean_set", text=bone_props[opt].name)
1632 props.data_path_iter = data_path_iter
1633 props.data_path_item = opt_suffix + opt
1634 props.type = self.type
1637 class VIEW3D_MT_bone_options_toggle(Menu, BoneOptions):
1638 bl_label = "Toggle Bone Options"
1642 class VIEW3D_MT_bone_options_enable(Menu, BoneOptions):
1643 bl_label = "Enable Bone Options"
1647 class VIEW3D_MT_bone_options_disable(Menu, BoneOptions):
1648 bl_label = "Disable Bone Options"
1651 # ********** Edit Menus, suffix from ob.type **********
1654 class VIEW3D_MT_edit_mesh(Menu):
1657 def draw(self, context):
1658 layout = self.layout
1660 toolsettings = context.tool_settings
1662 layout.operator("ed.undo")
1663 layout.operator("ed.redo")
1664 layout.operator("ed.undo_history")
1668 layout.menu("VIEW3D_MT_transform")
1669 layout.menu("VIEW3D_MT_mirror")
1670 layout.menu("VIEW3D_MT_snap")
1674 layout.menu("VIEW3D_MT_uv_map", text="UV Unwrap...")
1677 layout.operator("mesh.symmetrize")
1678 layout.operator("view3d.edit_mesh_extrude_move_normal", text="Extrude Region")
1679 layout.operator("view3d.edit_mesh_extrude_individual_move", text="Extrude Individual")
1680 layout.operator("mesh.duplicate_move")
1681 layout.menu("VIEW3D_MT_edit_mesh_delete")
1682 layout.menu("VIEW3D_MT_edit_mesh_dissolve")
1686 layout.menu("VIEW3D_MT_edit_mesh_vertices")
1687 layout.menu("VIEW3D_MT_edit_mesh_edges")
1688 layout.menu("VIEW3D_MT_edit_mesh_faces")
1689 layout.menu("VIEW3D_MT_edit_mesh_normals")
1693 layout.prop(toolsettings, "use_mesh_automerge")
1694 layout.prop_menu_enum(toolsettings, "proportional_edit")
1695 layout.prop_menu_enum(toolsettings, "proportional_edit_falloff")
1699 layout.menu("VIEW3D_MT_edit_mesh_showhide")
1702 class VIEW3D_MT_edit_mesh_specials(Menu):
1703 bl_label = "Specials"
1705 def draw(self, context):
1706 layout = self.layout
1708 layout.operator_context = 'INVOKE_REGION_WIN'
1710 layout.operator("mesh.subdivide", text="Subdivide").smoothness = 0.0
1711 layout.operator("mesh.subdivide", text="Subdivide Smooth").smoothness = 1.0
1712 layout.operator("mesh.merge", text="Merge...")
1713 layout.operator("mesh.remove_doubles")
1714 layout.operator("mesh.hide", text="Hide").unselected = False
1715 layout.operator("mesh.reveal", text="Reveal")
1716 layout.operator("mesh.select_all", text="Select Inverse").action = 'INVERT'
1717 layout.operator("mesh.flip_normals")
1718 layout.operator("mesh.vertices_smooth", text="Smooth")
1719 layout.operator("mesh.vertices_smooth_laplacian", text="Laplacian Smooth")
1720 layout.operator("mesh.inset")
1721 layout.operator("mesh.bevel", text="Bevel")
1722 layout.operator("mesh.bridge_edge_loops")
1723 layout.operator("mesh.faces_shade_smooth")
1724 layout.operator("mesh.faces_shade_flat")
1725 layout.operator("mesh.blend_from_shape")
1726 layout.operator("mesh.shape_propagate_to_all")
1727 layout.operator("mesh.select_vertex_path")
1728 layout.operator("mesh.sort_elements")
1729 layout.operator("mesh.symmetrize")
1732 class VIEW3D_MT_edit_mesh_select_mode(Menu):
1733 bl_label = "Mesh Select Mode"
1735 def draw(self, context):
1736 layout = self.layout
1738 layout.operator_context = 'INVOKE_REGION_WIN'
1739 layout.operator("mesh.select_mode", text="Vertex", icon='VERTEXSEL').type = 'VERT'
1740 layout.operator("mesh.select_mode", text="Edge", icon='EDGESEL').type = 'EDGE'
1741 layout.operator("mesh.select_mode", text="Face", icon='FACESEL').type = 'FACE'
1744 class VIEW3D_MT_edit_mesh_extrude(Menu):
1745 bl_label = "Extrude"
1748 'VERT': lambda layout: layout.operator("mesh.extrude_vertices_move", text="Vertices Only"),
1749 'EDGE': lambda layout: layout.operator("mesh.extrude_edges_move", text="Edges Only"),
1750 'FACE': lambda layout: layout.operator("mesh.extrude_faces_move", text="Individual Faces"),
1751 'REGION': lambda layout: layout.operator("view3d.edit_mesh_extrude_move_normal", text="Region"),
1755 def extrude_options(context):
1756 mesh = context.object.data
1757 select_mode = context.tool_settings.mesh_select_mode
1760 if mesh.total_face_sel:
1761 menu += ['REGION', 'FACE']
1762 if mesh.total_edge_sel and (select_mode[0] or select_mode[1]):
1764 if mesh.total_vert_sel and select_mode[0]:
1767 # should never get here
1770 def draw(self, context):
1771 layout = self.layout
1772 layout.operator_context = 'INVOKE_REGION_WIN'
1774 for menu_id in self.extrude_options(context):
1775 self._extrude_funcs[menu_id](layout)
1778 class VIEW3D_MT_edit_mesh_vertices(Menu):
1779 bl_label = "Vertices"
1781 def draw(self, context):
1782 layout = self.layout
1783 layout.operator_context = 'INVOKE_REGION_WIN'
1785 layout.operator("mesh.merge")
1786 layout.operator("mesh.rip_move")
1787 layout.operator("mesh.rip_move_fill")
1788 layout.operator("mesh.split")
1789 layout.operator_menu_enum("mesh.separate", "type")
1790 layout.operator("mesh.vert_connect")
1791 layout.operator("mesh.vert_slide")
1795 layout.operator("mesh.vertices_smooth")
1796 layout.operator("mesh.remove_doubles")
1797 layout.operator("mesh.sort_elements", text="Sort Vertices").elements = {'VERT'}
1799 layout.operator("mesh.select_vertex_path")
1801 layout.operator("mesh.blend_from_shape")
1803 layout.operator("object.vertex_group_blend")
1804 layout.operator("mesh.shape_propagate_to_all")
1808 layout.menu("VIEW3D_MT_vertex_group")
1809 layout.menu("VIEW3D_MT_hook")
1812 class VIEW3D_MT_edit_mesh_edges(Menu):
1815 def draw(self, context):
1816 layout = self.layout
1818 layout.operator_context = 'INVOKE_REGION_WIN'
1820 layout.operator("mesh.edge_face_add")
1821 layout.operator("mesh.subdivide")
1822 layout.operator("mesh.unsubdivide")
1826 layout.operator("transform.edge_crease")
1827 layout.operator("transform.edge_bevelweight")
1831 layout.operator("mesh.mark_seam").clear = False
1832 layout.operator("mesh.mark_seam", text="Clear Seam").clear = True
1836 layout.operator("mesh.mark_sharp").clear = False
1837 layout.operator("mesh.mark_sharp", text="Clear Sharp").clear = True
1841 layout.operator("mesh.mark_freestyle_edge").clear = False
1842 layout.operator("mesh.mark_freestyle_edge", text="Clear Freestyle Edge").clear = True
1846 layout.operator("mesh.edge_rotate", text="Rotate Edge CW").direction = 'CW'
1847 layout.operator("mesh.edge_rotate", text="Rotate Edge CCW").direction = 'CCW'
1851 layout.operator("mesh.bevel")
1852 layout.operator("mesh.edge_split")
1853 layout.operator("mesh.bridge_edge_loops")
1854 layout.operator("mesh.sort_elements", text="Sort Edges").elements = {'EDGE'}
1858 layout.operator("transform.edge_slide")
1859 layout.operator("mesh.loop_multi_select", text="Edge Loop").ring = False
1860 layout.operator("mesh.loop_multi_select", text="Edge Ring").ring = True
1861 layout.operator("mesh.loop_to_region")
1862 layout.operator("mesh.region_to_loop")
1865 class VIEW3D_MT_edit_mesh_faces(Menu):
1867 bl_idname = "VIEW3D_MT_edit_mesh_faces"
1869 def draw(self, context):
1870 layout = self.layout
1872 layout.operator_context = 'INVOKE_REGION_WIN'
1874 layout.operator("mesh.flip_normals")
1875 layout.operator("mesh.edge_face_add")
1876 layout.operator("mesh.fill")
1877 layout.operator("mesh.beautify_fill")
1878 layout.operator("mesh.inset")
1879 layout.operator("mesh.bevel")
1880 layout.operator("mesh.solidify")
1881 layout.operator("mesh.wireframe")
1882 layout.operator("mesh.sort_elements", text="Sort Faces").elements = {'FACE'}
1886 layout.operator("mesh.mark_freestyle_face").clear = False
1887 layout.operator("mesh.mark_freestyle_face", text="Clear Freestyle Face").clear = True
1891 layout.operator("mesh.quads_convert_to_tris")
1892 layout.operator("mesh.tris_convert_to_quads")
1896 layout.operator("mesh.faces_shade_smooth")
1897 layout.operator("mesh.faces_shade_flat")
1901 layout.operator("mesh.edge_rotate", text="Rotate Edge CW").direction = 'CW'
1905 layout.operator_menu_enum("mesh.uvs_rotate", "direction")
1906 layout.operator("mesh.uvs_reverse")
1907 layout.operator_menu_enum("mesh.colors_rotate", "direction")
1908 layout.operator("mesh.colors_reverse")
1911 class VIEW3D_MT_edit_mesh_normals(Menu):
1912 bl_label = "Normals"
1914 def draw(self, context):
1915 layout = self.layout
1917 layout.operator("mesh.normals_make_consistent", text="Recalculate Outside").inside = False
1918 layout.operator("mesh.normals_make_consistent", text="Recalculate Inside").inside = True
1922 layout.operator("mesh.flip_normals")
1925 class VIEW3D_MT_edit_mesh_delete(Menu):
1928 def draw(self, context):
1929 layout = self.layout
1931 layout.operator_enum("mesh.delete", "type")
1935 layout.operator("mesh.dissolve")
1936 layout.operator("mesh.edge_collapse")
1937 layout.operator("mesh.delete_edgeloop", text="Edge Loop")
1940 class VIEW3D_MT_edit_mesh_dissolve(Menu):
1941 bl_label = "Dissolve"
1943 def draw(self, context):
1944 layout = self.layout
1946 layout.operator("mesh.dissolve")
1950 layout.operator("mesh.dissolve_limited")
1953 class VIEW3D_MT_edit_mesh_showhide(ShowHideMenu, Menu):
1954 _operator_name = "mesh"
1957 # draw_curve is used by VIEW3D_MT_edit_curve and VIEW3D_MT_edit_surface
1960 def draw_curve(self, context):
1961 layout = self.layout
1963 toolsettings = context.tool_settings
1965 layout.menu("VIEW3D_MT_transform")
1966 layout.menu("VIEW3D_MT_mirror")
1967 layout.menu("VIEW3D_MT_snap")
1971 layout.operator("curve.extrude_move")
1972 layout.operator("curve.duplicate_move")
1973 layout.operator("curve.separate")
1974 layout.operator("curve.make_segment")
1975 layout.operator("curve.cyclic_toggle")
1976 layout.operator("curve.delete", text="Delete...")
1980 layout.menu("VIEW3D_MT_edit_curve_ctrlpoints")
1981 layout.menu("VIEW3D_MT_edit_curve_segments")
1985 layout.prop_menu_enum(toolsettings, "proportional_edit")
1986 layout.prop_menu_enum(toolsettings, "proportional_edit_falloff")
1990 layout.menu("VIEW3D_MT_edit_curve_showhide")
1993 class VIEW3D_MT_edit_curve(Menu):
1999 class VIEW3D_MT_edit_curve_ctrlpoints(Menu):
2000 bl_label = "Control Points"
2002 def draw(self, context):
2003 layout = self.layout
2005 edit_object = context.edit_object
2007 if edit_object.type == 'CURVE':
2008 layout.operator("transform.tilt")
2009 layout.operator("curve.tilt_clear")
2010 layout.operator("curve.separate")
2014 layout.operator_menu_enum("curve.handle_type_set", "type")
2018 layout.menu("VIEW3D_MT_hook")
2021 class VIEW3D_MT_edit_curve_segments(Menu):
2022 bl_label = "Segments"
2024 def draw(self, context):
2025 layout = self.layout
2027 layout.operator("curve.subdivide")
2028 layout.operator("curve.switch_direction")
2031 class VIEW3D_MT_edit_curve_specials(Menu):
2032 bl_label = "Specials"
2034 def draw(self, context):
2035 layout = self.layout
2037 layout.operator("curve.subdivide")
2038 layout.operator("curve.switch_direction")
2039 layout.operator("curve.spline_weight_set")
2040 layout.operator("curve.radius_set")
2041 layout.operator("curve.smooth")
2042 layout.operator("curve.smooth_radius")
2045 class VIEW3D_MT_edit_curve_showhide(ShowHideMenu, Menu):
2046 _operator_name = "curve"
2049 class VIEW3D_MT_edit_surface(Menu):
2050 bl_label = "Surface"
2055 class VIEW3D_MT_edit_font(Menu):
2058 def draw(self, context):
2059 layout = self.layout
2061 layout.operator("font.file_paste")
2065 layout.menu("VIEW3D_MT_edit_text_chars")
2069 layout.operator("font.style_toggle", text="Toggle Bold").style = 'BOLD'
2070 layout.operator("font.style_toggle", text="Toggle Italic").style = 'ITALIC'
2071 layout.operator("font.style_toggle", text="Toggle Underline").style = 'UNDERLINE'
2072 layout.operator("font.style_toggle", text="Toggle Small Caps").style = 'SMALL_CAPS'
2075 class VIEW3D_MT_edit_text_chars(Menu):
2076 bl_label = "Special Characters"
2078 def draw(self, context):
2079 layout = self.layout
2081 layout.operator("font.text_insert", text="Copyright|Alt C").text = "\u00A9"
2082 layout.operator("font.text_insert", text="Registered Trademark|Alt R").text = "\u00AE"
2086 layout.operator("font.text_insert", text="Degree Sign|Alt G").text = "\u00B0"
2087 layout.operator("font.text_insert", text="Multiplication Sign|Alt x").text = "\u00D7"
2088 layout.operator("font.text_insert", text="Circle|Alt .").text = "\u008A"
2089 layout.operator("font.text_insert", text="Superscript 1|Alt 1").text = "\u00B9"
2090 layout.operator("font.text_insert", text="Superscript 2|Alt 2").text = "\u00B2"
2091 layout.operator("font.text_insert", text="Superscript 3|Alt 3").text = "\u00B3"
2092 layout.operator("font.text_insert", text="Double >>|Alt >").text = "\u00BB"
2093 layout.operator("font.text_insert", text="Double <<|Alt <").text = "\u00AB"
2094 layout.operator("font.text_insert", text="Promillage|Alt %").text = "\u2030"
2098 layout.operator("font.text_insert", text="Dutch Florin|Alt F").text = "\u00A4"
2099 layout.operator("font.text_insert", text="British Pound|Alt L").text = "\u00A3"
2100 layout.operator("font.text_insert", text="Japanese Yen|Alt Y").text = "\u00A5"
2104 layout.operator("font.text_insert", text="German S|Alt S").text = "\u00DF"
2105 layout.operator("font.text_insert", text="Spanish Question Mark|Alt ?").text = "\u00BF"
2106 layout.operator("font.text_insert", text="Spanish Exclamation Mark|Alt !").text = "\u00A1"
2109 class VIEW3D_MT_edit_meta(Menu):
2110 bl_label = "Metaball"
2112 def draw(self, context):
2113 layout = self.layout
2115 toolsettings = context.tool_settings
2117 layout.operator("ed.undo")
2118 layout.operator("ed.redo")
2119 layout.operator("ed.undo_history")
2123 layout.menu("VIEW3D_MT_transform")
2124 layout.menu("VIEW3D_MT_mirror")
2125 layout.menu("VIEW3D_MT_snap")
2129 layout.operator("mball.delete_metaelems", text="Delete...")
2130 layout.operator("mball.duplicate_metaelems")
2134 layout.prop_menu_enum(toolsettings, "proportional_edit")
2135 layout.prop_menu_enum(toolsettings, "proportional_edit_falloff")
2139 layout.menu("VIEW3D_MT_edit_meta_showhide")
2142 class VIEW3D_MT_edit_meta_showhide(Menu):
2143 bl_label = "Show/Hide"
2145 def draw(self, context):
2146 layout = self.layout
2148 layout.operator("mball.reveal_metaelems", text="Show Hidden")
2149 layout.operator("mball.hide_metaelems", text="Hide Selected").unselected = False
2150 layout.operator("mball.hide_metaelems", text="Hide Unselected").unselected = True
2153 class VIEW3D_MT_edit_lattice(Menu):
2154 bl_label = "Lattice"
2156 def draw(self, context):
2157 layout = self.layout
2159 toolsettings = context.tool_settings
2161 layout.menu("VIEW3D_MT_transform")
2162 layout.menu("VIEW3D_MT_mirror")
2163 layout.menu("VIEW3D_MT_snap")
2164 layout.operator_menu_enum("lattice.flip", "axis")
2168 layout.operator("lattice.make_regular")
2172 layout.prop_menu_enum(toolsettings, "proportional_edit")
2173 layout.prop_menu_enum(toolsettings, "proportional_edit_falloff")
2176 class VIEW3D_MT_edit_armature(Menu):
2177 bl_label = "Armature"
2179 def draw(self, context):
2180 layout = self.layout
2182 edit_object = context.edit_object
2183 arm = edit_object.data
2185 layout.menu("VIEW3D_MT_transform_armature")
2186 layout.menu("VIEW3D_MT_mirror")
2187 layout.menu("VIEW3D_MT_snap")
2188 layout.menu("VIEW3D_MT_edit_armature_roll")
2192 layout.operator("armature.extrude_move")
2194 if arm.use_mirror_x:
2195 layout.operator("armature.extrude_forked")
2197 layout.operator("armature.duplicate_move")
2198 layout.operator("armature.merge")
2199 layout.operator("armature.fill")
2200 layout.operator("armature.delete")
2201 layout.operator("armature.separate")
2205 layout.operator("armature.subdivide", text="Subdivide")
2206 layout.operator("armature.switch_direction", text="Switch Direction")
2210 layout.operator_context = 'EXEC_AREA'
2211 layout.operator("armature.autoside_names", text="AutoName Left/Right").type = 'XAXIS'
2212 layout.operator("armature.autoside_names", text="AutoName Front/Back").type = 'YAXIS'
2213 layout.operator("armature.autoside_names", text="AutoName Top/Bottom").type = 'ZAXIS'
2214 layout.operator("armature.flip_names")
2218 layout.operator_context = 'INVOKE_DEFAULT'
2219 layout.operator("armature.armature_layers")
2220 layout.operator("armature.bone_layers")
2224 layout.menu("VIEW3D_MT_edit_armature_parent")
2228 layout.menu("VIEW3D_MT_bone_options_toggle", text="Bone Settings")
2231 class VIEW3D_MT_armature_specials(Menu):
2232 bl_label = "Specials"
2234 def draw(self, context):
2235 layout = self.layout
2237 layout.operator_context = 'INVOKE_REGION_WIN'
2239 layout.operator("armature.subdivide", text="Subdivide")
2240 layout.operator("armature.switch_direction", text="Switch Direction")
2244 layout.operator_context = 'EXEC_REGION_WIN'
2245 layout.operator("armature.autoside_names", text="AutoName Left/Right").type = 'XAXIS'
2246 layout.operator("armature.autoside_names", text="AutoName Front/Back").type = 'YAXIS'
2247 layout.operator("armature.autoside_names", text="AutoName Top/Bottom").type = 'ZAXIS'
2248 layout.operator("armature.flip_names", text="Flip Names")
2251 class VIEW3D_MT_edit_armature_parent(Menu):
2254 def draw(self, context):
2255 layout = self.layout
2257 layout.operator("armature.parent_set", text="Make")
2258 layout.operator("armature.parent_clear", text="Clear")
2261 class VIEW3D_MT_edit_armature_roll(Menu):
2262 bl_label = "Bone Roll"
2264 def draw(self, context):
2265 layout = self.layout
2267 layout.operator_menu_enum("armature.calculate_roll", "type")
2271 layout.operator("transform.transform", text="Set Roll").mode = 'BONE_ROLL'
2273 # ********** Panel **********
2276 class VIEW3D_PT_view3d_properties(Panel):
2277 bl_space_type = 'VIEW_3D'
2278 bl_region_type = 'UI'
2282 def poll(cls, context):
2283 view = context.space_data
2286 def draw(self, context):
2287 layout = self.layout
2289 view = context.space_data
2291 col = layout.column()
2292 col.active = bool(view.region_3d.view_perspective != 'CAMERA' or
2293 view.region_quadview)
2294 col.prop(view, "lens")
2295 col.label(text="Lock to Object:")
2296 col.prop(view, "lock_object", text="")
2297 lock_object = view.lock_object
2299 if lock_object.type == 'ARMATURE':
2300 col.prop_search(view, "lock_bone", lock_object.data,
2301 "edit_bones" if lock_object.mode == 'EDIT'
2305 col.prop(view, "lock_cursor", text="Lock to Cursor")
2307 col = layout.column()
2308 col.prop(view, "lock_camera")
2310 col = layout.column(align=True)
2311 col.label(text="Clip:")
2312 col.prop(view, "clip_start", text="Start")
2313 col.prop(view, "clip_end", text="End")
2315 subcol = col.column()
2316 subcol.enabled = not view.lock_camera_and_layers
2317 subcol.label(text="Local Camera:")
2318 subcol.prop(view, "camera", text="")
2320 col = layout.column(align=True)
2321 col.prop(view, "use_render_border")
2324 class VIEW3D_PT_view3d_cursor(Panel):
2325 bl_space_type = 'VIEW_3D'
2326 bl_region_type = 'UI'
2327 bl_label = "3D Cursor"
2330 def poll(cls, context):
2331 view = context.space_data
2332 return (view is not None)
2334 def draw(self, context):
2335 layout = self.layout
2337 view = context.space_data
2338 layout.column().prop(view, "cursor_location", text="Location")
2341 class VIEW3D_PT_view3d_name(Panel):
2342 bl_space_type = 'VIEW_3D'
2343 bl_region_type = 'UI'
2347 def poll(cls, context):
2348 return (context.space_data and context.active_object)
2350 def draw(self, context):
2351 layout = self.layout
2353 ob = context.active_object
2355 row.label(text="", icon='OBJECT_DATA')
2356 row.prop(ob, "name", text="")
2358 if ob.type == 'ARMATURE' and ob.mode in {'EDIT', 'POSE'}:
2359 bone = context.active_bone
2362 row.label(text="", icon='BONE_DATA')
2363 row.prop(bone, "name", text="")
2366 class VIEW3D_PT_view3d_display(Panel):
2367 bl_space_type = 'VIEW_3D'
2368 bl_region_type = 'UI'
2369 bl_label = "Display"
2370 bl_options = {'DEFAULT_CLOSED'}
2373 def poll(cls, context):
2374 view = context.space_data
2377 def draw(self, context):
2378 layout = self.layout
2380 view = context.space_data
2381 scene = context.scene
2382 gs = scene.game_settings
2385 col = layout.column()
2386 col.prop(view, "show_only_render")
2388 col = layout.column()
2389 display_all = not view.show_only_render
2390 col.active = display_all
2391 col.prop(view, "show_outline_selected")
2392 col.prop(view, "show_all_objects_origin")
2393 col.prop(view, "show_relationship_lines")
2394 if ob and ob.type == 'MESH':
2396 col.prop(mesh, "show_all_edges")
2398 col = layout.column()
2399 col.active = display_all
2400 split = col.split(percentage=0.55)
2401 split.prop(view, "show_floor", text="Grid Floor")
2403 row = split.row(align=True)
2404 row.prop(view, "show_axis_x", text="X", toggle=True)
2405 row.prop(view, "show_axis_y", text="Y", toggle=True)
2406 row.prop(view, "show_axis_z", text="Z", toggle=True)
2408 sub = col.column(align=True)
2409 sub.active = (display_all and view.show_floor)
2410 sub.prop(view, "grid_lines", text="Lines")
2411 sub.prop(view, "grid_scale", text="Scale")
2412 subsub = sub.column(align=True)
2413 subsub.active = scene.unit_settings.system == 'NONE'
2414 subsub.prop(view, "grid_subdivisions", text="Subdivisions")
2416 if not scene.render.use_shading_nodes:
2417 col = layout.column()
2418 col.label(text="Shading:")
2419 col.prop(gs, "material_mode", text="")
2420 col.prop(view, "show_textured_solid")
2422 col.prop(view, "show_backface_culling")
2426 region = view.region_quadview
2428 layout.operator("screen.region_quadview", text="Toggle Quad View")
2431 col = layout.column()
2432 col.prop(region, "lock_rotation")
2434 row.enabled = region.lock_rotation
2435 row.prop(region, "show_sync_view")
2437 row.enabled = region.lock_rotation and region.show_sync_view
2438 row.prop(region, "use_box_clip")
2441 class VIEW3D_PT_view3d_motion_tracking(Panel):
2442 bl_space_type = 'VIEW_3D'
2443 bl_region_type = 'UI'
2444 bl_label = "Motion Tracking"
2445 bl_options = {'DEFAULT_CLOSED'}
2448 def poll(cls, context):
2449 view = context.space_data
2452 def draw_header(self, context):
2453 view = context.space_data
2455 self.layout.prop(view, "show_reconstruction", text="")
2457 def draw(self, context):
2458 layout = self.layout
2460 view = context.space_data
2462 col = layout.column()
2463 col.active = view.show_reconstruction
2464 col.prop(view, "show_bundle_names")
2465 col.prop(view, "show_camera_path")
2466 col.label(text="Tracks:")
2467 col.prop(view, "tracks_draw_type", text="")
2468 col.prop(view, "tracks_draw_size", text="Size")
2471 class VIEW3D_PT_view3d_meshdisplay(Panel):
2472 bl_space_type = 'VIEW_3D'
2473 bl_region_type = 'UI'
2474 bl_label = "Mesh Display"
2477 def poll(cls, context):
2478 # The active object check is needed because of local-mode
2479 return (context.active_object and (context.mode == 'EDIT_MESH'))
2481 def draw(self, context):
2482 layout = self.layout
2484 mesh = context.active_object.data
2486 col = layout.column()
2487 col.label(text="Overlays:")
2488 col.prop(mesh, "show_edges", text="Edges")
2489 col.prop(mesh, "show_faces", text="Faces")
2490 col.prop(mesh, "show_edge_crease", text="Creases")
2491 col.prop(mesh, "show_edge_bevel_weight", text="Bevel Weights")
2492 col.prop(mesh, "show_edge_seams", text="Seams")
2493 col.prop(mesh, "show_edge_sharp", text="Sharp")
2494 col.prop(mesh, "show_freestyle_edge_marks", text="Freestyle Edge Marks")
2495 col.prop(mesh, "show_freestyle_face_marks", text="Freestyle Face Marks")
2498 col.label(text="Normals:")
2500 sub = row.row(align=True)
2501 sub.prop(mesh, "show_normal_vertex", text="", icon='VERTEXSEL')
2502 sub.prop(mesh, "show_normal_face", text="", icon='FACESEL')
2503 row.prop(context.scene.tool_settings, "normal_size", text="Size")
2506 col.label(text="Numerics:")
2507 col.prop(mesh, "show_extra_edge_length")
2508 col.prop(mesh, "show_extra_face_angle")
2509 col.prop(mesh, "show_extra_face_area")
2511 col.prop(mesh, "show_extra_indices")
2514 class VIEW3D_PT_view3d_curvedisplay(Panel):
2515 bl_space_type = 'VIEW_3D'
2516 bl_region_type = 'UI'
2517 bl_label = "Curve Display"
2520 def poll(cls, context):
2521 editmesh = context.mode == 'EDIT_CURVE'
2524 def draw(self, context):
2525 layout = self.layout
2527 curve = context.active_object.data
2529 col = layout.column()
2530 col.label(text="Overlays:")
2531 col.prop(curve, "show_handles", text="Handles")
2532 col.prop(curve, "show_normal_face", text="Normals")
2533 col.prop(context.scene.tool_settings, "normal_size", text="Normal Size")
2536 class VIEW3D_PT_background_image(Panel):
2537 bl_space_type = 'VIEW_3D'
2538 bl_region_type = 'UI'
2539 bl_label = "Background Images"
2540 bl_options = {'DEFAULT_CLOSED'}
2542 def draw_header(self, context):
2543 view = context.space_data
2545 self.layout.prop(view, "show_background_images", text="")
2547 def draw(self, context):
2548 layout = self.layout
2550 view = context.space_data
2552 col = layout.column()
2553 col.operator("view3d.background_image_add", text="Add Image")
2555 for i, bg in enumerate(view.background_images):
2556 layout.active = view.show_background_images
2558 row = box.row(align=True)
2559 row.prop(bg, "show_expanded", text="", emboss=False)
2560 if bg.source == 'IMAGE' and bg.image:
2561 row.prop(bg.image, "name", text="", emboss=False)
2562 elif bg.source == 'MOVIE_CLIP' and bg.clip:
2563 row.prop(bg.clip, "name", text="", emboss=False)
2565 row.label(text="Not Set")
2567 if bg.show_background_image:
2568 row.prop(bg, "show_background_image", text="", emboss=False, icon='RESTRICT_VIEW_OFF')
2570 row.prop(bg, "show_background_image", text="", emboss=False, icon='RESTRICT_VIEW_ON')
2572 row.operator("view3d.background_image_remove", text="", emboss=False, icon='X').index = i
2574 box.prop(bg, "view_axis", text="Axis")
2576 if bg.show_expanded:
2578 row.prop(bg, "source", expand=True)
2581 if bg.source == 'IMAGE':
2583 row.template_ID(bg, "image", open="image.open")
2584 if bg.image is not None:
2585 box.template_image(bg, "image", bg.image_user, compact=True)
2588 elif bg.source == 'MOVIE_CLIP':
2589 box.prop(bg, "use_camera_clip")
2591 column = box.column()
2592 column.active = not bg.use_camera_clip
2593 column.template_ID(bg, "clip", open="clip.open")
2596 column.template_movieclip(bg, "clip", compact=True)
2598 if bg.use_camera_clip or bg.clip:
2601 column = box.column()
2602 column.active = has_bg
2603 column.prop(bg.clip_user, "proxy_render_size", text="")
2604 column.prop(bg.clip_user, "use_render_undistorted")
2608 col.prop(bg, "opacity", slider=True)
2611 rowsub.prop(bg, "draw_depth", expand=True)
2613 if bg.view_axis in {'CAMERA', 'ALL'}:
2615 rowsub.prop(bg, "frame_method", expand=True)
2617 row = col.row(align=True)
2618 row.prop(bg, "offset_x", text="X")
2619 row.prop(bg, "offset_y", text="Y")
2621 if bg.view_axis != 'CAMERA':
2622 col.prop(bg, "size")
2625 class VIEW3D_PT_transform_orientations(Panel):
2626 bl_space_type = 'VIEW_3D'
2627 bl_region_type = 'UI'
2628 bl_label = "Transform Orientations"
2629 bl_options = {'DEFAULT_CLOSED'}
2632 def poll(cls, context):
2633 view = context.space_data
2636 def draw(self, context):
2637 layout = self.layout
2639 view = context.space_data
2640 orientation = view.current_orientation
2642 row = layout.row(align=True)
2643 row.prop(view, "transform_orientation", text="")
2644 row.operator("transform.create_orientation", text="", icon='ZOOMIN')
2647 row = layout.row(align=True)
2648 row.prop(orientation, "name", text="")
2649 row.operator("transform.delete_orientation", text="", icon="X")
2652 class VIEW3D_PT_etch_a_ton(Panel):
2653 bl_space_type = 'VIEW_3D'
2654 bl_region_type = 'UI'
2655 bl_label = "Skeleton Sketching"
2656 bl_options = {'DEFAULT_CLOSED'}
2659 def poll(cls, context):
2660 scene = context.space_data
2661 ob = context.active_object
2662 return scene and ob and ob.type == 'ARMATURE' and ob.mode == 'EDIT'
2664 def draw_header(self, context):
2665 layout = self.layout
2666 toolsettings = context.scene.tool_settings
2668 layout.prop(toolsettings, "use_bone_sketching", text="")
2670 def draw(self, context):
2671 layout = self.layout
2673 toolsettings = context.scene.tool_settings
2675 col = layout.column()
2677 col.prop(toolsettings, "use_etch_quick")
2678 col.prop(toolsettings, "use_etch_overdraw")
2680 col.prop(toolsettings, "etch_convert_mode")
2682 if toolsettings.etch_convert_mode == 'LENGTH':
2683 col.prop(toolsettings, "etch_length_limit")
2684 elif toolsettings.etch_convert_mode == 'ADAPTIVE':
2685 col.prop(toolsettings, "etch_adaptive_limit")
2686 elif toolsettings.etch_convert_mode == 'FIXED':
2687 col.prop(toolsettings, "etch_subdivision_number")
2688 elif toolsettings.etch_convert_mode == 'RETARGET':
2689 col.prop(toolsettings, "etch_template")
2690 col.prop(toolsettings, "etch_roll_mode")
2691 col.prop(toolsettings, "use_etch_autoname")
2692 col.prop(toolsettings, "etch_number")
2693 col.prop(toolsettings, "etch_side")
2695 col.operator("sketch.convert", text="Convert")
2698 class VIEW3D_PT_context_properties(Panel):
2699 bl_space_type = 'VIEW_3D'
2700 bl_region_type = 'UI'
2701 bl_label = "Properties"
2702 bl_options = {'DEFAULT_CLOSED'}
2704 def _active_context_member(context):
2705 obj = context.object
2709 return "active_pose_bone"
2710 elif mode == 'EDIT' and obj.type == 'ARMATURE':
2711 return "active_bone"
2718 def poll(cls, context):
2719 member = cls._active_context_member(context)
2721 context_member = getattr(context, member)
2722 return context_member and context_member.keys()
2726 def draw(self, context):
2728 member = VIEW3D_PT_context_properties._active_context_member(context)
2731 # Draw with no edit button
2732 rna_prop_ui.draw(self.layout, context, member, object, False)
2736 bpy.utils.register_module(__name__)
2740 bpy.utils.unregister_module(__name__)
2742 if __name__ == "__main__":
2745 if __name__ == "__main__": # only for live edit.
2746 bpy.utils.register_module(__name__)