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, Operator, Panel
24 class VIEW3D_HT_header(Header):
25 bl_space_type = 'VIEW_3D'
27 def draw(self, context):
30 view = context.space_data
31 mode_string = context.mode
32 edit_object = context.edit_object
33 obj = context.active_object
34 toolsettings = context.tool_settings
36 row = layout.row(align=True)
40 if context.area.show_menus:
41 sub = row.row(align=True)
43 sub.menu("VIEW3D_MT_view")
46 if mode_string not in {'EDIT_TEXT', 'SCULPT', 'PAINT_WEIGHT', 'PAINT_VERTEX', 'PAINT_TEXTURE'}:
47 sub.menu("VIEW3D_MT_select_%s" % mode_string.lower())
50 sub.menu("VIEW3D_MT_edit_%s" % edit_object.type.lower())
52 if mode_string not in {'PAINT_TEXTURE'}:
53 sub.menu("VIEW3D_MT_%s" % mode_string.lower())
55 sub.menu("VIEW3D_MT_object")
58 # Contains buttons like Mode, Pivot, Manipulator, Layer, Mesh Select Mode...
59 row.template_header_3D()
63 if obj.mode == 'PARTICLE_EDIT':
64 row.prop(toolsettings.particle_edit, "select_mode", text="", expand=True)
67 if view.viewport_shade in {'SOLID', 'SHADED', 'TEXTURED'} and (obj.mode == 'PARTICLE_EDIT' or (obj.mode == 'EDIT' and obj.type == 'MESH')):
68 row.prop(view, "use_occlude_geometry", text="")
70 # Proportional editing
71 if obj.mode in {'EDIT', 'PARTICLE_EDIT'}:
72 row = layout.row(align=True)
73 row.prop(toolsettings, "proportional_edit", text="", icon_only=True)
74 if toolsettings.proportional_edit != 'DISABLED':
75 row.prop(toolsettings, "proportional_edit_falloff", text="", icon_only=True)
76 elif obj.mode == 'OBJECT':
77 row = layout.row(align=True)
78 row.prop(toolsettings, "use_proportional_edit_objects", text="", icon_only=True)
79 if toolsettings.use_proportional_edit_objects:
80 row.prop(toolsettings, "proportional_edit_falloff", text="", icon_only=True)
83 snap_element = toolsettings.snap_element
84 row = layout.row(align=True)
85 row.prop(toolsettings, "use_snap", text="")
86 row.prop(toolsettings, "snap_element", text="", icon_only=True)
87 if snap_element != 'INCREMENT':
88 row.prop(toolsettings, "snap_target", text="")
90 if obj.mode == 'OBJECT':
91 row.prop(toolsettings, "use_snap_align_rotation", text="")
92 elif obj.mode == 'EDIT':
93 row.prop(toolsettings, "use_snap_self", text="")
95 if snap_element == 'VOLUME':
96 row.prop(toolsettings, "use_snap_peel_object", text="")
97 elif snap_element == 'FACE':
98 row.prop(toolsettings, "use_snap_project", text="")
101 row = layout.row(align=True)
102 row.operator("render.opengl", text="", icon='RENDER_STILL')
103 props = row.operator("render.opengl", text="", icon='RENDER_ANIMATION')
104 props.animation = True
107 if obj and obj.mode == 'POSE':
108 row = layout.row(align=True)
109 row.operator("pose.copy", text="", icon='COPYDOWN')
110 row.operator("pose.paste", text="", icon='PASTEDOWN')
111 props = row.operator("pose.paste", text="", icon='PASTEFLIPDOWN')
115 # ********** Menu **********
117 # ********** Utilities **********
120 class ShowHideMenu():
121 bl_label = "Show/Hide"
124 def draw(self, context):
127 layout.operator("%s.reveal" % self._operator_name, text="Show Hidden")
128 layout.operator("%s.hide" % self._operator_name, text="Hide Selected")
129 layout.operator("%s.hide" % self._operator_name, text="Hide Unselected").unselected = True
132 class VIEW3D_MT_transform(Menu):
133 bl_label = "Transform"
135 # TODO: get rid of the custom text strings?
136 def draw(self, context):
139 layout.operator("transform.translate", text="Grab/Move")
140 # TODO: sub-menu for grab per axis
141 layout.operator("transform.rotate", text="Rotate")
142 # TODO: sub-menu for rot per axis
143 layout.operator("transform.resize", text="Scale")
144 # TODO: sub-menu for scale per axis
148 layout.operator("transform.tosphere", text="To Sphere")
149 layout.operator("transform.shear", text="Shear")
150 layout.operator("transform.warp", text="Warp")
151 layout.operator("transform.push_pull", text="Push/Pull")
155 layout.operator("transform.translate", text="Move Texture Space").texture_space = True
156 layout.operator("transform.resize", text="Scale Texture Space").texture_space = True
161 if obj.type == 'ARMATURE' and obj.mode in {'EDIT', 'POSE'} and obj.data.draw_type in {'BBONE', 'ENVELOPE'}:
162 layout.operator("transform.transform", text="Scale Envelope/BBone").mode = 'BONE_SIZE'
164 if context.edit_object and context.edit_object.type == 'ARMATURE':
165 layout.operator("armature.align")
167 layout.operator_context = 'EXEC_REGION_WIN'
168 layout.operator("transform.transform", text="Align to Transform Orientation").mode = 'ALIGN' # XXX see alignmenu() in edit.c of b2.4x to get this working
172 layout.operator_context = 'EXEC_AREA'
174 layout.operator("object.origin_set", text="Geometry to Origin").type = 'GEOMETRY_ORIGIN'
175 layout.operator("object.origin_set", text="Origin to Geometry").type = 'ORIGIN_GEOMETRY'
176 layout.operator("object.origin_set", text="Origin to 3D Cursor").type = 'ORIGIN_CURSOR'
180 layout.operator("object.randomize_transform")
181 layout.operator("object.align")
185 layout.operator("object.anim_transforms_to_deltas")
188 class VIEW3D_MT_mirror(Menu):
191 def draw(self, context):
194 layout.operator("transform.mirror", text="Interactive Mirror")
198 layout.operator_context = 'INVOKE_REGION_WIN'
200 props = layout.operator("transform.mirror", text="X Global")
201 props.constraint_axis = (True, False, False)
202 props.constraint_orientation = 'GLOBAL'
203 props = layout.operator("transform.mirror", text="Y Global")
204 props.constraint_axis = (False, True, False)
205 props.constraint_orientation = 'GLOBAL'
206 props = layout.operator("transform.mirror", text="Z Global")
207 props.constraint_axis = (False, False, True)
208 props.constraint_orientation = 'GLOBAL'
210 if context.edit_object:
213 props = layout.operator("transform.mirror", text="X Local")
214 props.constraint_axis = (True, False, False)
215 props.constraint_orientation = 'LOCAL'
216 props = layout.operator("transform.mirror", text="Y Local")
217 props.constraint_axis = (False, True, False)
218 props.constraint_orientation = 'LOCAL'
219 props = layout.operator("transform.mirror", text="Z Local")
220 props.constraint_axis = (False, False, True)
221 props.constraint_orientation = 'LOCAL'
223 layout.operator("object.vertex_group_mirror")
226 class VIEW3D_MT_snap(Menu):
229 def draw(self, context):
232 layout.operator("view3d.snap_selected_to_grid", text="Selection to Grid")
233 layout.operator("view3d.snap_selected_to_cursor", text="Selection to Cursor")
237 layout.operator("view3d.snap_cursor_to_selected", text="Cursor to Selected")
238 layout.operator("view3d.snap_cursor_to_center", text="Cursor to Center")
239 layout.operator("view3d.snap_cursor_to_grid", text="Cursor to Grid")
240 layout.operator("view3d.snap_cursor_to_active", text="Cursor to Active")
243 class VIEW3D_MT_uv_map(Menu):
244 bl_label = "UV Mapping"
246 def draw(self, context):
249 layout.operator("uv.unwrap")
251 layout.operator_context = 'INVOKE_DEFAULT'
252 layout.operator("uv.smart_project")
253 layout.operator("uv.lightmap_pack")
254 layout.operator("uv.follow_active_quads")
258 layout.operator_context = 'EXEC_DEFAULT'
259 layout.operator("uv.cube_project")
260 layout.operator("uv.cylinder_project")
261 layout.operator("uv.sphere_project")
265 layout.operator("uv.project_from_view")
266 layout.operator("uv.project_from_view", text="Project from View (Bounds)").scale_to_bounds = True
270 layout.operator("uv.reset")
273 # ********** View menus **********
276 class VIEW3D_MT_view(Menu):
279 def draw(self, context):
282 layout.operator("view3d.properties", icon='MENU_PANEL')
283 layout.operator("view3d.toolshelf", icon='MENU_PANEL')
287 layout.operator("view3d.viewnumpad", text="Camera").type = 'CAMERA'
288 layout.operator("view3d.viewnumpad", text="Top").type = 'TOP'
289 layout.operator("view3d.viewnumpad", text="Bottom").type = 'BOTTOM'
290 layout.operator("view3d.viewnumpad", text="Front").type = 'FRONT'
291 layout.operator("view3d.viewnumpad", text="Back").type = 'BACK'
292 layout.operator("view3d.viewnumpad", text="Right").type = 'RIGHT'
293 layout.operator("view3d.viewnumpad", text="Left").type = 'LEFT'
295 layout.menu("VIEW3D_MT_view_cameras", text="Cameras")
299 layout.operator("view3d.view_persportho")
303 layout.menu("VIEW3D_MT_view_navigation")
304 layout.menu("VIEW3D_MT_view_align")
308 layout.operator_context = 'INVOKE_REGION_WIN'
310 layout.operator("view3d.clip_border", text="Clipping Border...")
311 layout.operator("view3d.zoom_border", text="Zoom Border...")
315 layout.operator("view3d.layers", text="Show All Layers").nr = 0
319 layout.operator("view3d.localview", text="View Global/Local")
320 layout.operator("view3d.view_selected")
321 layout.operator("view3d.view_all")
325 layout.operator("screen.animation_play", text="Playback Animation")
329 layout.operator("screen.area_dupli")
330 layout.operator("screen.region_quadview")
331 layout.operator("screen.screen_full_area")
334 class VIEW3D_MT_view_navigation(Menu):
335 bl_label = "Navigation"
337 def draw(self, context):
340 layout.operator_enum("view3d.view_orbit", "type")
344 layout.operator_enum("view3d.view_pan", "type")
348 layout.operator("view3d.zoom", text="Zoom In").delta = 1
349 layout.operator("view3d.zoom", text="Zoom Out").delta = -1
350 layout.operator("view3d.zoom_camera_1_to_1", text="Zoom Camera 1:1")
354 layout.operator("view3d.fly")
357 class VIEW3D_MT_view_align(Menu):
358 bl_label = "Align View"
360 def draw(self, context):
363 layout.menu("VIEW3D_MT_view_align_selected")
367 layout.operator("view3d.view_all", text="Center Cursor and View All").center = True
368 layout.operator("view3d.camera_to_view", text="Align Active Camera to View")
369 layout.operator("view3d.view_selected")
370 layout.operator("view3d.view_center_cursor")
373 class VIEW3D_MT_view_align_selected(Menu):
374 bl_label = "Align View to Selected"
376 def draw(self, context):
379 props = layout.operator("view3d.viewnumpad", text="Top")
380 props.align_active = True
382 props = layout.operator("view3d.viewnumpad", text="Bottom")
383 props.align_active = True
384 props.type = 'BOTTOM'
385 props = layout.operator("view3d.viewnumpad", text="Front")
386 props.align_active = True
388 props = layout.operator("view3d.viewnumpad", text="Back")
389 props.align_active = True
391 props = layout.operator("view3d.viewnumpad", text="Right")
392 props.align_active = True
394 props = layout.operator("view3d.viewnumpad", text="Left")
395 props.align_active = True
399 class VIEW3D_MT_view_cameras(Menu):
402 def draw(self, context):
405 layout.operator("view3d.object_as_camera")
406 layout.operator("view3d.viewnumpad", text="Active Camera").type = 'CAMERA'
408 # ********** Select menus, suffix from context.mode **********
411 class VIEW3D_MT_select_object(Menu):
414 def draw(self, context):
417 layout.operator("view3d.select_border")
418 layout.operator("view3d.select_circle")
422 layout.operator("object.select_all", text="Select/Deselect All")
423 layout.operator("object.select_inverse", text="Inverse")
424 layout.operator("object.select_random", text="Random")
425 layout.operator("object.select_mirror", text="Mirror")
426 layout.operator("object.select_by_layer", text="Select All by Layer")
427 layout.operator_menu_enum("object.select_by_type", "type", text="Select All by Type...")
428 layout.operator("object.select_camera", text="Select Camera")
432 layout.operator_menu_enum("object.select_grouped", "type", text="Grouped")
433 layout.operator_menu_enum("object.select_linked", "type", text="Linked")
434 layout.operator("object.select_pattern", text="Select Pattern...")
437 class VIEW3D_MT_select_pose(Menu):
440 def draw(self, context):
443 layout.operator("view3d.select_border")
447 layout.operator("pose.select_all", text="Select/Deselect All")
448 layout.operator("pose.select_inverse", text="Inverse")
449 layout.operator("pose.select_flip_active", text="Flip Active")
450 layout.operator("pose.select_constraint_target", text="Constraint Target")
451 layout.operator("pose.select_linked", text="Linked")
455 layout.operator("pose.select_hierarchy", text="Parent").direction = 'PARENT'
456 layout.operator("pose.select_hierarchy", text="Child").direction = 'CHILD'
460 props = layout.operator("pose.select_hierarchy", text="Extend Parent")
462 props.direction = 'PARENT'
464 props = layout.operator("pose.select_hierarchy", text="Extend Child")
466 props.direction = 'CHILD'
470 layout.operator_menu_enum("pose.select_grouped", "type", text="Grouped")
471 layout.operator("object.select_pattern", text="Select Pattern...")
474 class VIEW3D_MT_select_particle(Menu):
477 def draw(self, context):
480 layout.operator("view3d.select_border")
484 layout.operator("particle.select_all", text="Select/Deselect All")
485 layout.operator("particle.select_linked")
486 layout.operator("particle.select_inverse")
490 layout.operator("particle.select_more")
491 layout.operator("particle.select_less")
495 layout.operator("particle.select_roots", text="Roots")
496 layout.operator("particle.select_tips", text="Tips")
499 class VIEW3D_MT_select_edit_mesh(Menu):
502 def draw(self, context):
505 layout.operator("view3d.select_border")
506 layout.operator("view3d.select_circle")
510 layout.operator("mesh.select_all", text="Select/Deselect All")
511 layout.operator("mesh.select_inverse", text="Inverse")
515 layout.operator("mesh.select_random", text="Random")
516 layout.operator("mesh.select_nth", text="Every N Number of Verts")
517 layout.operator("mesh.edges_select_sharp", text="Sharp Edges")
518 layout.operator("mesh.faces_select_linked_flat", text="Linked Flat Faces")
519 layout.operator("mesh.faces_select_interior", text="Interior Faces")
520 layout.operator("mesh.select_axis", text="Side of Active")
524 layout.operator("mesh.select_by_number_vertices", text = "By Number of Verts")
525 if context.scene.tool_settings.mesh_select_mode[2] == False:
526 layout.operator("mesh.select_non_manifold", text="Non Manifold")
527 layout.operator("mesh.select_loose_verts", text = "Loose Verts/Edges")
528 layout.operator("mesh.select_similar", text="Similar")
532 layout.operator("mesh.select_less", text="Less")
533 layout.operator("mesh.select_more", text="More")
537 layout.operator("mesh.select_mirror", text="Mirror")
539 layout.operator("mesh.select_linked", text="Linked")
540 layout.operator("mesh.select_vertex_path", text="Vertex Path")
541 layout.operator("mesh.loop_multi_select", text="Edge Loop")
542 layout.operator("mesh.loop_multi_select", text="Edge Ring").ring = True
546 layout.operator("mesh.loop_to_region")
547 layout.operator("mesh.region_to_loop")
550 class VIEW3D_MT_select_edit_curve(Menu):
553 def draw(self, context):
556 layout.operator("view3d.select_border")
557 layout.operator("view3d.select_circle")
561 layout.operator("curve.select_all", text="Select/Deselect All")
562 layout.operator("curve.select_inverse")
563 layout.operator("curve.select_random")
564 layout.operator("curve.select_nth", text="Every Nth Number of Points")
568 layout.operator("curve.de_select_first")
569 layout.operator("curve.de_select_last")
570 layout.operator("curve.select_next")
571 layout.operator("curve.select_previous")
575 layout.operator("curve.select_more")
576 layout.operator("curve.select_less")
579 class VIEW3D_MT_select_edit_surface(Menu):
582 def draw(self, context):
585 layout.operator("view3d.select_border")
586 layout.operator("view3d.select_circle")
590 layout.operator("curve.select_all", text="Select/Deselect All")
591 layout.operator("curve.select_inverse")
592 layout.operator("curve.select_random")
593 layout.operator("curve.select_nth", text="Every Nth Number of Points")
597 layout.operator("curve.select_row")
601 layout.operator("curve.select_more")
602 layout.operator("curve.select_less")
605 class VIEW3D_MT_select_edit_metaball(Menu):
608 def draw(self, context):
611 layout.operator("view3d.select_border")
615 layout.operator("mball.select_all").action = 'TOGGLE'
616 layout.operator("mball.select_inverse_metaelems")
620 layout.operator("mball.select_random_metaelems")
623 class VIEW3D_MT_select_edit_lattice(Menu):
626 def draw(self, context):
629 layout.operator("view3d.select_border")
633 layout.operator("lattice.select_all", text="Select/Deselect All")
636 class VIEW3D_MT_select_edit_armature(Menu):
639 def draw(self, context):
642 layout.operator("view3d.select_border")
646 layout.operator("armature.select_all", text="Select/Deselect All")
647 layout.operator("armature.select_inverse", text="Inverse")
651 layout.operator("armature.select_hierarchy", text="Parent").direction = 'PARENT'
652 layout.operator("armature.select_hierarchy", text="Child").direction = 'CHILD'
656 props = layout.operator("armature.select_hierarchy", text="Extend Parent")
658 props.direction = 'PARENT'
660 props = layout.operator("armature.select_hierarchy", text="Extend Child")
662 props.direction = 'CHILD'
664 layout.operator("object.select_pattern", text="Select Pattern...")
667 class VIEW3D_MT_select_face(Menu): # XXX no matching enum
670 def draw(self, context):
671 # layout = self.layout
674 # see view3d_select_faceselmenu
677 # ********** Object menu **********
680 class VIEW3D_MT_object(Menu):
681 bl_context = "objectmode"
684 def draw(self, context):
687 layout.operator("ed.undo")
688 layout.operator("ed.redo")
689 layout.operator("ed.undo_history")
693 layout.menu("VIEW3D_MT_transform")
694 layout.menu("VIEW3D_MT_mirror")
695 layout.menu("VIEW3D_MT_object_clear")
696 layout.menu("VIEW3D_MT_object_apply")
697 layout.menu("VIEW3D_MT_snap")
701 layout.menu("VIEW3D_MT_object_animation")
705 layout.operator("object.duplicate_move")
706 layout.operator("object.duplicate_move_linked")
707 layout.operator("object.delete", text="Delete...")
708 layout.operator("object.proxy_make", text="Make Proxy...")
709 layout.menu("VIEW3D_MT_make_links", text="Make Links...")
710 layout.operator("object.make_dupli_face")
711 layout.operator_menu_enum("object.make_local", "type", text="Make Local...")
712 layout.menu("VIEW3D_MT_make_single_user")
716 layout.menu("VIEW3D_MT_object_parent")
717 layout.menu("VIEW3D_MT_object_track")
718 layout.menu("VIEW3D_MT_object_group")
719 layout.menu("VIEW3D_MT_object_constraints")
723 layout.menu("VIEW3D_MT_object_game")
727 layout.operator("object.join_uvs")
728 layout.operator("object.join")
732 layout.operator("object.move_to_layer", text="Move to Layer...")
733 layout.menu("VIEW3D_MT_object_showhide")
735 layout.operator_menu_enum("object.convert", "target")
738 class VIEW3D_MT_object_animation(Menu):
739 bl_label = "Animation"
741 def draw(self, context):
744 layout.operator("anim.keyframe_insert_menu", text="Insert Keyframe...")
745 layout.operator("anim.keyframe_delete_v3d", text="Delete Keyframe...")
746 layout.operator("anim.keying_set_active_set", text="Change Keying Set...")
749 class VIEW3D_MT_object_clear(Menu):
752 def draw(self, context):
755 layout.operator("object.location_clear", text="Location")
756 layout.operator("object.rotation_clear", text="Rotation")
757 layout.operator("object.scale_clear", text="Scale")
758 layout.operator("object.origin_clear", text="Origin")
761 class VIEW3D_MT_object_specials(Menu):
762 bl_label = "Specials"
765 def poll(cls, context):
766 # add more special types
767 return context.object
769 def draw(self, context):
773 if obj.type == 'CAMERA':
774 layout.operator_context = 'INVOKE_REGION_WIN'
776 if obj.data.type == 'PERSP':
777 props = layout.operator("wm.context_modal_mouse", text="Camera Lens Angle")
778 props.data_path_iter = "selected_editable_objects"
779 props.data_path_item = "data.lens"
780 props.input_scale = 0.1
782 props = layout.operator("wm.context_modal_mouse", text="Camera Lens Scale")
783 props.data_path_iter = "selected_editable_objects"
784 props.data_path_item = "data.ortho_scale"
785 props.input_scale = 0.01
787 if not obj.data.dof_object:
788 #layout.label(text="Test Has DOF obj");
789 props = layout.operator("wm.context_modal_mouse", text="DOF Distance")
790 props.data_path_iter = "selected_editable_objects"
791 props.data_path_item = "data.dof_distance"
792 props.input_scale = 0.02
794 if obj.type in {'CURVE', 'FONT'}:
795 layout.operator_context = 'INVOKE_REGION_WIN'
797 props = layout.operator("wm.context_modal_mouse", text="Extrude Size")
798 props.data_path_iter = "selected_editable_objects"
799 props.data_path_item = "data.extrude"
800 props.input_scale = 0.01
802 props = layout.operator("wm.context_modal_mouse", text="Width Size")
803 props.data_path_iter = "selected_editable_objects"
804 props.data_path_item = "data.offset"
805 props.input_scale = 0.01
807 if obj.type == 'EMPTY':
808 layout.operator_context = 'INVOKE_REGION_WIN'
810 props = layout.operator("wm.context_modal_mouse", text="Empty Draw Size")
811 props.data_path_iter = "selected_editable_objects"
812 props.data_path_item = "empty_draw_size"
813 props.input_scale = 0.01
815 if obj.type == 'LAMP':
816 layout.operator_context = 'INVOKE_REGION_WIN'
818 props = layout.operator("wm.context_modal_mouse", text="Energy")
819 props.data_path_iter = "selected_editable_objects"
820 props.data_path_item = "data.energy"
822 if obj.data.type in {'SPOT', 'AREA', 'POINT'}:
823 props = layout.operator("wm.context_modal_mouse", text="Falloff Distance")
824 props.data_path_iter = "selected_editable_objects"
825 props.data_path_item = "data.distance"
826 props.input_scale = 0.1
828 if obj.data.type == 'SPOT':
830 props = layout.operator("wm.context_modal_mouse", text="Spot Size")
831 props.data_path_iter = "selected_editable_objects"
832 props.data_path_item = "data.spot_size"
833 props.input_scale = 0.01
835 props = layout.operator("wm.context_modal_mouse", text="Spot Blend")
836 props.data_path_iter = "selected_editable_objects"
837 props.data_path_item = "data.spot_blend"
838 props.input_scale = -0.01
840 props = layout.operator("wm.context_modal_mouse", text="Clip Start")
841 props.data_path_iter = "selected_editable_objects"
842 props.data_path_item = "data.shadow_buffer_clip_start"
843 props.input_scale = 0.05
845 props = layout.operator("wm.context_modal_mouse", text="Clip End")
846 props.data_path_iter = "selected_editable_objects"
847 props.data_path_item = "data.shadow_buffer_clip_end"
848 props.input_scale = 0.05
852 props = layout.operator("object.isolate_type_render")
853 props = layout.operator("object.hide_render_clear_all")
856 class VIEW3D_MT_object_apply(Menu):
859 def draw(self, context):
862 layout.operator("object.transform_apply", text="Location").location = True
863 layout.operator("object.transform_apply", text="Rotation").rotation = True
864 layout.operator("object.transform_apply", text="Scale").scale = True
865 props = layout.operator("object.transform_apply", text="Rotation & Scale")
867 props.rotation = True
871 layout.operator("object.visual_transform_apply", text="Visual Transform")
872 layout.operator("object.duplicates_make_real")
875 class VIEW3D_MT_object_parent(Menu):
878 def draw(self, context):
881 layout.operator("object.parent_set", text="Set")
882 layout.operator("object.parent_clear", text="Clear")
885 class VIEW3D_MT_object_track(Menu):
888 def draw(self, context):
891 layout.operator("object.track_set", text="Set")
892 layout.operator("object.track_clear", text="Clear")
895 class VIEW3D_MT_object_group(Menu):
898 def draw(self, context):
901 layout.operator("group.create")
902 layout.operator("group.objects_remove")
906 layout.operator("group.objects_add_active")
907 layout.operator("group.objects_remove_active")
910 class VIEW3D_MT_object_constraints(Menu):
911 bl_label = "Constraints"
913 def draw(self, context):
916 layout.operator("object.constraint_add_with_targets")
917 layout.operator("object.constraints_copy")
918 layout.operator("object.constraints_clear")
921 class VIEW3D_MT_object_showhide(Menu):
922 bl_label = "Show/Hide"
924 def draw(self, context):
927 layout.operator("object.hide_view_clear", text="Show Hidden")
928 layout.operator("object.hide_view_set", text="Hide Selected")
929 layout.operator("object.hide_view_set", text="Hide Unselected").unselected = True
932 class VIEW3D_MT_make_single_user(Menu):
933 bl_label = "Make Single User"
935 def draw(self, context):
938 props = layout.operator("object.make_single_user", text="Object")
941 props = layout.operator("object.make_single_user", text="Object & Data")
942 props.object = props.obdata = True
944 props = layout.operator("object.make_single_user", text="Object & Data & Materials+Tex")
945 props.object = props.obdata = props.material = props.texture = True
947 props = layout.operator("object.make_single_user", text="Materials+Tex")
948 props.material = props.texture = True
950 props = layout.operator("object.make_single_user", text="Object Animation")
951 props.animation = True
954 class VIEW3D_MT_make_links(Menu):
955 bl_label = "Make Links"
957 def draw(self, context):
960 if(len(bpy.data.scenes) > 10):
961 layout.operator_context = 'INVOKE_DEFAULT'
962 layout.operator("object.make_links_scene", text="Objects to Scene...", icon='OUTLINER_OB_EMPTY')
963 layout.operator("object.make_links_scene", text="Markers to Scene...", icon='OUTLINER_OB_EMPTY')
965 layout.operator_menu_enum("object.make_links_scene", "scene", text="Objects to Scene...")
966 layout.operator_menu_enum("marker.make_links_scene", "scene", text="Markers to Scene...")
968 layout.operator_enum("object.make_links_data", "type") # inline
971 class VIEW3D_MT_object_game(Menu):
974 def draw(self, context):
977 layout.operator("object.logic_bricks_copy", text="Copy Logic Bricks")
981 layout.operator("object.game_property_copy", text="Replace Properties").operation = 'REPLACE'
982 layout.operator("object.game_property_copy", text="Merge Properties").operation = 'MERGE'
983 layout.operator_menu_enum("object.game_property_copy", "property", text="Copy Properties...")
987 layout.operator("object.game_property_clear")
990 # ********** Vertex paint menu **********
993 class VIEW3D_MT_paint_vertex(Menu):
996 def draw(self, context):
999 layout.operator("ed.undo")
1000 layout.operator("ed.redo")
1004 layout.operator("paint.vertex_color_set")
1005 layout.operator("paint.vertex_color_dirt")
1008 class VIEW3D_MT_hook(Menu):
1011 def draw(self, context):
1012 layout = self.layout
1013 layout.operator_context = 'EXEC_AREA'
1014 layout.operator("object.hook_add_newob")
1015 layout.operator("object.hook_add_selob")
1017 if [mod.type == 'HOOK' for mod in context.active_object.modifiers]:
1019 layout.operator_menu_enum("object.hook_assign", "modifier")
1020 layout.operator_menu_enum("object.hook_remove", "modifier")
1022 layout.operator_menu_enum("object.hook_select", "modifier")
1023 layout.operator_menu_enum("object.hook_reset", "modifier")
1024 layout.operator_menu_enum("object.hook_recenter", "modifier")
1027 class VIEW3D_MT_vertex_group(Menu):
1028 bl_label = "Vertex Groups"
1030 def draw(self, context):
1031 layout = self.layout
1032 layout.operator_context = 'EXEC_AREA'
1033 layout.operator("object.vertex_group_assign", text="Assign to New Group").new = True
1035 ob = context.active_object
1036 if ob.mode == 'EDIT':
1037 if ob.vertex_groups.active:
1039 layout.operator("object.vertex_group_assign", text="Assign to Active Group")
1040 layout.operator("object.vertex_group_remove_from", text="Remove from Active Group")
1041 layout.operator("object.vertex_group_remove_from", text="Remove from All").all = True
1044 if ob.vertex_groups.active:
1045 layout.operator_menu_enum("object.vertex_group_set_active", "group", text="Set Active Group")
1046 layout.operator("object.vertex_group_remove", text="Remove Active Group")
1047 layout.operator("object.vertex_group_remove", text="Remove All Groups").all = True
1049 # ********** Weight paint menu **********
1052 class VIEW3D_MT_paint_weight(Menu):
1053 bl_label = "Weights"
1055 def draw(self, context):
1056 layout = self.layout
1058 layout.operator("ed.undo")
1059 layout.operator("ed.redo")
1060 layout.operator("ed.undo_history")
1064 layout.operator("paint.weight_from_bones", text="Assign Automatic From Bones").type = 'AUTOMATIC'
1065 layout.operator("paint.weight_from_bones", text="Assign From Bone Envelopes").type = 'ENVELOPES'
1069 layout.operator("object.vertex_group_normalize_all", text="Normalize All")
1070 layout.operator("object.vertex_group_normalize", text="Normalize")
1071 layout.operator("object.vertex_group_invert", text="Invert")
1072 layout.operator("object.vertex_group_clean", text="Clean")
1073 layout.operator("object.vertex_group_levels", text="Levels")
1077 layout.operator("paint.weight_set")
1079 # ********** Sculpt menu **********
1082 class VIEW3D_MT_sculpt(Menu):
1085 def draw(self, context):
1086 layout = self.layout
1088 tool_settings = context.tool_settings
1089 sculpt = tool_settings.sculpt
1090 brush = tool_settings.sculpt.brush
1092 layout.operator("ed.undo")
1093 layout.operator("ed.redo")
1097 layout.prop(sculpt, "use_symmetry_x")
1098 layout.prop(sculpt, "use_symmetry_y")
1099 layout.prop(sculpt, "use_symmetry_z")
1101 layout.prop(sculpt, "lock_x")
1102 layout.prop(sculpt, "lock_y")
1103 layout.prop(sculpt, "lock_z")
1105 layout.operator_menu_enum("brush.curve_preset", "shape")
1108 if brush is not None: # unlikely but can happen
1109 sculpt_tool = brush.sculpt_tool
1111 if sculpt_tool != 'GRAB':
1112 layout.prop_menu_enum(brush, "stroke_method")
1114 if sculpt_tool in {'DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'}:
1115 layout.prop_menu_enum(brush, "direction")
1117 if sculpt_tool == 'LAYER':
1118 layout.prop(brush, "use_persistent")
1119 layout.operator("sculpt.set_persistent_base")
1122 layout.prop(sculpt, "use_threaded", text="Threaded Sculpt")
1123 layout.prop(sculpt, "show_brush")
1125 # TODO, make availabel from paint menu!
1126 layout.prop(tool_settings, "sculpt_paint_use_unified_size", text="Unify Size")
1127 layout.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Unify Strength")
1129 # ********** Particle menu **********
1132 class VIEW3D_MT_particle(Menu):
1133 bl_label = "Particle"
1135 def draw(self, context):
1136 layout = self.layout
1138 particle_edit = context.tool_settings.particle_edit
1140 layout.operator("ed.undo")
1141 layout.operator("ed.redo")
1142 layout.operator("ed.undo_history")
1146 layout.operator("particle.mirror")
1150 layout.operator("particle.remove_doubles")
1151 layout.operator("particle.delete")
1153 if particle_edit.select_mode == 'POINT':
1154 layout.operator("particle.subdivide")
1156 layout.operator("particle.rekey")
1157 layout.operator("particle.weight_set")
1161 layout.menu("VIEW3D_MT_particle_showhide")
1164 class VIEW3D_MT_particle_specials(Menu):
1165 bl_label = "Specials"
1167 def draw(self, context):
1168 layout = self.layout
1169 particle_edit = context.tool_settings.particle_edit
1171 layout.operator("particle.rekey")
1174 if particle_edit.select_mode == 'POINT':
1175 layout.operator("particle.subdivide")
1176 layout.operator("particle.select_roots")
1177 layout.operator("particle.select_tips")
1179 layout.operator("particle.remove_doubles")
1182 class VIEW3D_MT_particle_showhide(ShowHideMenu, Menu):
1183 _operator_name = "particle"
1185 # ********** Pose Menu **********
1188 class VIEW3D_MT_pose(Menu):
1191 def draw(self, context):
1192 layout = self.layout
1194 layout.operator("ed.undo")
1195 layout.operator("ed.redo")
1196 layout.operator("ed.undo_history")
1200 layout.menu("VIEW3D_MT_transform")
1202 layout.menu("VIEW3D_MT_pose_transform")
1203 layout.menu("VIEW3D_MT_pose_apply")
1205 layout.menu("VIEW3D_MT_snap")
1209 layout.menu("VIEW3D_MT_object_animation")
1213 layout.menu("VIEW3D_MT_pose_slide")
1214 layout.menu("VIEW3D_MT_pose_propagate")
1218 layout.operator("pose.copy")
1219 layout.operator("pose.paste")
1220 layout.operator("pose.paste", text="Paste X-Flipped Pose").flipped = True
1224 layout.menu("VIEW3D_MT_pose_library")
1225 layout.menu("VIEW3D_MT_pose_motion")
1226 layout.menu("VIEW3D_MT_pose_group")
1230 layout.menu("VIEW3D_MT_object_parent")
1231 layout.menu("VIEW3D_MT_pose_ik")
1232 layout.menu("VIEW3D_MT_pose_constraints")
1236 layout.operator_context = 'EXEC_AREA'
1237 layout.operator("pose.autoside_names", text="AutoName Left/Right").axis = 'XAXIS'
1238 layout.operator("pose.autoside_names", text="AutoName Front/Back").axis = 'YAXIS'
1239 layout.operator("pose.autoside_names", text="AutoName Top/Bottom").axis = 'ZAXIS'
1241 layout.operator("pose.flip_names")
1243 layout.operator("pose.quaternions_flip")
1247 layout.operator_context = 'INVOKE_AREA'
1248 layout.operator("pose.armature_layers", text="Change Armature Layers...")
1249 layout.operator("pose.bone_layers", text="Change Bone Layers...")
1253 layout.menu("VIEW3D_MT_pose_showhide")
1254 layout.menu("VIEW3D_MT_bone_options_toggle", text="Bone Settings")
1257 class VIEW3D_MT_pose_transform(Menu):
1258 bl_label = "Clear Transform"
1260 def draw(self, context):
1261 layout = self.layout
1263 layout.operator("pose.transforms_clear", text="All")
1267 layout.operator("pose.loc_clear", text="Location")
1268 layout.operator("pose.rot_clear", text="Rotation")
1269 layout.operator("pose.scale_clear", text="Scale")
1273 layout.operator("pose.user_transforms_clear", text="Reset unkeyed")
1275 class VIEW3D_MT_pose_slide(Menu):
1276 bl_label = "In-Betweens"
1278 def draw(self, context):
1279 layout = self.layout
1281 layout.operator("pose.push")
1282 layout.operator("pose.relax")
1283 layout.operator("pose.breakdown")
1286 class VIEW3D_MT_pose_propagate(Menu):
1287 bl_label = "Propagate"
1289 def draw(self, context):
1290 layout = self.layout
1292 layout.operator("pose.propagate")
1296 layout.operator("pose.propagate", text="To Next Keyframe").mode = 'NEXT_KEY'
1297 layout.operator("pose.propagate", text="To Last Keyframe (Make Cyclic)").mode = 'LAST_KEY'
1301 layout.operator("pose.propagate", text="On Selected Markers").mode = 'SELECTED_MARKERS'
1304 class VIEW3D_MT_pose_library(Menu):
1305 bl_label = "Pose Library"
1307 def draw(self, context):
1308 layout = self.layout
1310 layout.operator("poselib.browse_interactive", text="Browse Poses...")
1314 layout.operator("poselib.pose_add", text="Add Pose...")
1315 layout.operator("poselib.pose_rename", text="Rename Pose...")
1316 layout.operator("poselib.pose_remove", text="Remove Pose...")
1319 class VIEW3D_MT_pose_motion(Menu):
1320 bl_label = "Motion Paths"
1322 def draw(self, context):
1323 layout = self.layout
1325 layout.operator("pose.paths_calculate", text="Calculate")
1326 layout.operator("pose.paths_clear", text="Clear")
1329 class VIEW3D_MT_pose_group(Menu):
1330 bl_label = "Bone Groups"
1332 def draw(self, context):
1333 layout = self.layout
1334 layout.operator("pose.group_add")
1335 layout.operator("pose.group_remove")
1339 layout.operator("pose.group_assign")
1340 layout.operator("pose.group_unassign")
1343 class VIEW3D_MT_pose_ik(Menu):
1344 bl_label = "Inverse Kinematics"
1346 def draw(self, context):
1347 layout = self.layout
1349 layout.operator("pose.ik_add")
1350 layout.operator("pose.ik_clear")
1353 class VIEW3D_MT_pose_constraints(Menu):
1354 bl_label = "Constraints"
1356 def draw(self, context):
1357 layout = self.layout
1359 layout.operator("pose.constraint_add_with_targets", text="Add (With Targets)...")
1360 layout.operator("pose.constraints_copy")
1361 layout.operator("pose.constraints_clear")
1364 class VIEW3D_MT_pose_showhide(ShowHideMenu, Menu):
1365 _operator_name = "pose"
1368 class VIEW3D_MT_pose_apply(Menu):
1371 def draw(self, context):
1372 layout = self.layout
1374 layout.operator("pose.armature_apply")
1375 layout.operator("pose.visual_transform_apply")
1379 def draw(self, context):
1380 layout = self.layout
1385 "use_envelope_multiply",
1386 "use_inherit_rotation",
1387 "use_inherit_scale",
1390 if context.mode == 'EDIT_ARMATURE':
1391 bone_props = bpy.types.EditBone.bl_rna.properties
1392 data_path_iter = "selected_bones"
1394 options.append("lock")
1396 bone_props = bpy.types.Bone.bl_rna.properties
1397 data_path_iter = "selected_pose_bones"
1398 opt_suffix = "bone."
1401 props = layout.operator("wm.context_collection_boolean_set", text=bone_props[opt].name)
1402 props.data_path_iter = data_path_iter
1403 props.data_path_item = opt_suffix + opt
1404 props.type = self.type
1407 class VIEW3D_MT_bone_options_toggle(Menu, BoneOptions):
1408 bl_label = "Toggle Bone Options"
1412 class VIEW3D_MT_bone_options_enable(Menu, BoneOptions):
1413 bl_label = "Enable Bone Options"
1417 class VIEW3D_MT_bone_options_disable(Menu, BoneOptions):
1418 bl_label = "Disable Bone Options"
1421 # ********** Edit Menus, suffix from ob.type **********
1424 class VIEW3D_MT_edit_mesh(Menu):
1427 def draw(self, context):
1428 layout = self.layout
1430 settings = context.tool_settings
1432 layout.operator("ed.undo")
1433 layout.operator("ed.redo")
1434 layout.operator("ed.undo_history")
1438 layout.menu("VIEW3D_MT_transform")
1439 layout.menu("VIEW3D_MT_mirror")
1440 layout.menu("VIEW3D_MT_snap")
1444 layout.menu("VIEW3D_MT_uv_map", text="UV Unwrap...")
1448 layout.operator("view3d.edit_mesh_extrude_move_normal", text="Extrude Region")
1449 layout.operator("view3d.edit_mesh_extrude_individual_move", text="Extrude Individual")
1450 layout.operator("mesh.duplicate_move")
1451 layout.operator("mesh.delete", text="Delete...")
1455 layout.menu("VIEW3D_MT_edit_mesh_vertices")
1456 layout.menu("VIEW3D_MT_edit_mesh_edges")
1457 layout.menu("VIEW3D_MT_edit_mesh_faces")
1458 layout.menu("VIEW3D_MT_edit_mesh_normals")
1462 layout.prop(settings, "use_mesh_automerge")
1463 layout.prop_menu_enum(settings, "proportional_edit")
1464 layout.prop_menu_enum(settings, "proportional_edit_falloff")
1468 layout.menu("VIEW3D_MT_edit_mesh_showhide")
1471 class VIEW3D_MT_edit_mesh_specials(Menu):
1472 bl_label = "Specials"
1474 def draw(self, context):
1475 layout = self.layout
1477 layout.operator_context = 'INVOKE_REGION_WIN'
1479 layout.operator("mesh.subdivide", text="Subdivide")
1480 layout.operator("mesh.merge", text="Merge...")
1481 layout.operator("mesh.remove_doubles")
1482 layout.operator("mesh.hide", text="Hide")
1483 layout.operator("mesh.reveal", text="Reveal")
1484 layout.operator("mesh.select_inverse")
1485 layout.operator("mesh.flip_normals")
1486 layout.operator("mesh.vertices_smooth", text="Smooth")
1487 layout.operator("mesh.bevel", text="Bevel")
1488 layout.operator("mesh.faces_shade_smooth")
1489 layout.operator("mesh.faces_shade_flat")
1490 layout.operator("mesh.blend_from_shape")
1491 layout.operator("mesh.shape_propagate_to_all")
1492 layout.operator("mesh.select_vertex_path")
1495 class VIEW3D_MT_edit_mesh_select_mode(Menu):
1496 bl_label = "Mesh Select Mode"
1498 def draw(self, context):
1499 layout = self.layout
1501 layout.operator_context = 'INVOKE_REGION_WIN'
1503 prop = layout.operator("wm.context_set_value", text="Vertex", icon='VERTEXSEL')
1504 prop.value = "(True, False, False)"
1505 prop.data_path = "tool_settings.mesh_select_mode"
1507 prop = layout.operator("wm.context_set_value", text="Edge", icon='EDGESEL')
1508 prop.value = "(False, True, False)"
1509 prop.data_path = "tool_settings.mesh_select_mode"
1511 prop = layout.operator("wm.context_set_value", text="Face", icon='FACESEL')
1512 prop.value = "(False, False, True)"
1513 prop.data_path = "tool_settings.mesh_select_mode"
1516 class VIEW3D_MT_edit_mesh_extrude(Menu):
1517 bl_label = "Extrude"
1519 _extrude_funcs = { \
1520 "VERT": lambda layout: layout.operator("mesh.extrude_vertices_move", text="Vertices Only"),
1521 "EDGE": lambda layout: layout.operator("mesh.extrude_edges_move", text="Edges Only"),
1522 "FACE": lambda layout: layout.operator("mesh.extrude_faces_move", text="Individual Faces"),
1523 "REGION": lambda layout: layout.operator("view3d.edit_mesh_extrude_move_normal", text="Region"),
1527 def extrude_options(context):
1528 mesh = context.object.data
1529 select_mode = context.tool_settings.mesh_select_mode
1532 if mesh.total_face_sel:
1533 menu += ["REGION", "FACE"]
1534 if mesh.total_edge_sel and (select_mode[0] or select_mode[1]):
1536 if mesh.total_vert_sel and select_mode[0]:
1539 # should never get here
1542 def draw(self, context):
1543 layout = self.layout
1544 layout.operator_context = 'INVOKE_REGION_WIN'
1546 for menu_id in self.extrude_options(context):
1547 self._extrude_funcs[menu_id](layout)
1550 class VIEW3D_OT_edit_mesh_extrude_individual_move(Operator):
1551 "Extrude individual elements and move"
1552 bl_label = "Extrude Individual and Move"
1553 bl_idname = "view3d.edit_mesh_extrude_individual_move"
1555 def execute(self, context):
1556 mesh = context.object.data
1557 select_mode = context.tool_settings.mesh_select_mode
1559 totface = mesh.total_face_sel
1560 totedge = mesh.total_edge_sel
1561 # totvert = mesh.total_vert_sel
1563 if select_mode[2] and totface == 1:
1564 bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": 'NORMAL', "constraint_axis": (False, False, True)})
1565 elif select_mode[2] and totface > 1:
1566 bpy.ops.mesh.extrude_faces_move('INVOKE_REGION_WIN')
1567 elif select_mode[1] and totedge >= 1:
1568 bpy.ops.mesh.extrude_edges_move('INVOKE_REGION_WIN')
1570 bpy.ops.mesh.extrude_vertices_move('INVOKE_REGION_WIN')
1572 # ignore return from operators above because they are 'RUNNING_MODAL', and cause this one not to be freed. [#24671]
1575 def invoke(self, context, event):
1576 return self.execute(context)
1579 class VIEW3D_OT_edit_mesh_extrude_move(Operator):
1580 "Extrude and move along normals"
1581 bl_label = "Extrude and Move on Normals"
1582 bl_idname = "view3d.edit_mesh_extrude_move_normal"
1584 def execute(self, context):
1585 mesh = context.object.data
1587 totface = mesh.total_face_sel
1588 totedge = mesh.total_edge_sel
1589 # totvert = mesh.total_vert_sel
1592 bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": 'NORMAL', "constraint_axis": (False, False, True)})
1594 bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": 'NORMAL', "constraint_axis": (True, True, False)})
1596 bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN')
1598 # ignore return from operators above because they are 'RUNNING_MODAL', and cause this one not to be freed. [#24671]
1601 def invoke(self, context, event):
1602 return self.execute(context)
1605 class VIEW3D_MT_edit_mesh_vertices(Menu):
1606 bl_label = "Vertices"
1608 def draw(self, context):
1609 layout = self.layout
1610 layout.operator_context = 'INVOKE_REGION_WIN'
1612 layout.operator("mesh.merge")
1613 layout.operator("mesh.rip_move")
1614 layout.operator("mesh.split")
1615 layout.operator("mesh.separate")
1619 layout.operator("mesh.vertices_smooth")
1620 layout.operator("mesh.remove_doubles")
1621 layout.operator("mesh.vertices_sort")
1622 layout.operator("mesh.vertices_randomize")
1624 layout.operator("mesh.select_vertex_path")
1626 layout.operator("mesh.blend_from_shape")
1628 layout.operator("object.vertex_group_blend")
1629 layout.operator("mesh.shape_propagate_to_all")
1633 layout.menu("VIEW3D_MT_vertex_group")
1634 layout.menu("VIEW3D_MT_hook")
1637 class VIEW3D_MT_edit_mesh_edges(Menu):
1640 def draw(self, context):
1641 layout = self.layout
1642 layout.operator_context = 'INVOKE_REGION_WIN'
1644 layout.operator("mesh.edge_face_add")
1645 layout.operator("mesh.subdivide")
1649 layout.operator("mesh.mark_seam")
1650 layout.operator("mesh.mark_seam", text="Clear Seam").clear = True
1654 layout.operator("mesh.mark_sharp")
1655 layout.operator("mesh.mark_sharp", text="Clear Sharp").clear = True
1659 layout.operator("mesh.edge_rotate", text="Rotate Edge CW").direction = 'CW'
1660 layout.operator("mesh.edge_rotate", text="Rotate Edge CCW").direction = 'CCW'
1664 layout.operator("mesh.bridge_edge_loops", text="Bridge Two Edge Loops")
1668 layout.operator("TRANSFORM_OT_edge_slide")
1669 layout.operator("TRANSFORM_OT_edge_crease")
1670 layout.operator("mesh.loop_multi_select", text="Edge Loop")
1672 # uiItemO(layout, "Loopcut", 0, "mesh.loop_cut"); // CutEdgeloop(em, 1);
1673 # uiItemO(layout, "Edge Slide", 0, "mesh.edge_slide"); // EdgeSlide(em, 0,0.0);
1675 layout.operator("mesh.loop_multi_select", text="Edge Ring").ring = True
1677 layout.operator("mesh.loop_to_region")
1678 layout.operator("mesh.region_to_loop")
1681 class VIEW3D_MT_edit_mesh_faces(Menu):
1683 bl_idname = "VIEW3D_MT_edit_mesh_faces"
1685 def draw(self, context):
1686 layout = self.layout
1687 layout.operator_context = 'INVOKE_REGION_WIN'
1689 layout.operator("mesh.flip_normals")
1690 # layout.operator("mesh.bevel")
1691 # layout.operator("mesh.bevel")
1692 layout.operator("mesh.edge_face_add")
1693 layout.operator("mesh.fill")
1694 layout.operator("mesh.beautify_fill")
1695 layout.operator("mesh.solidify")
1696 layout.operator("mesh.sort_faces")
1700 layout.operator("mesh.fgon_make")
1701 layout.operator("mesh.fgon_clear")
1705 layout.operator("mesh.quads_convert_to_tris")
1706 layout.operator("mesh.tris_convert_to_quads")
1707 layout.operator("mesh.edge_flip")
1711 layout.operator("mesh.faces_shade_smooth")
1712 layout.operator("mesh.faces_shade_flat")
1716 # uiItemO(layout, NULL, 0, "mesh.face_mode"); // mesh_set_face_flags(em, 1);
1717 # uiItemBooleanO(layout, NULL, 0, "mesh.face_mode", "clear", 1); // mesh_set_face_flags(em, 0);
1719 layout.operator("mesh.edge_rotate", text="Rotate Edge CW").direction = 'CW'
1723 layout.operator_menu_enum("mesh.uvs_rotate", "direction")
1724 layout.operator_menu_enum("mesh.uvs_mirror", "axis")
1725 layout.operator_menu_enum("mesh.colors_rotate", "direction")
1726 layout.operator_menu_enum("mesh.colors_mirror", "axis")
1729 class VIEW3D_MT_edit_mesh_normals(Menu):
1730 bl_label = "Normals"
1732 def draw(self, context):
1733 layout = self.layout
1735 layout.operator("mesh.normals_make_consistent", text="Recalculate Outside")
1736 layout.operator("mesh.normals_make_consistent", text="Recalculate Inside").inside = True
1740 layout.operator("mesh.flip_normals")
1743 class VIEW3D_MT_edit_mesh_showhide(ShowHideMenu, Menu):
1744 _operator_name = "mesh"
1747 # draw_curve is used by VIEW3D_MT_edit_curve and VIEW3D_MT_edit_surface
1750 def draw_curve(self, context):
1751 layout = self.layout
1753 settings = context.tool_settings
1755 layout.menu("VIEW3D_MT_transform")
1756 layout.menu("VIEW3D_MT_mirror")
1757 layout.menu("VIEW3D_MT_snap")
1761 layout.operator("curve.extrude")
1762 layout.operator("curve.duplicate")
1763 layout.operator("curve.separate")
1764 layout.operator("curve.make_segment")
1765 layout.operator("curve.cyclic_toggle")
1766 layout.operator("curve.delete", text="Delete...")
1770 layout.menu("VIEW3D_MT_edit_curve_ctrlpoints")
1771 layout.menu("VIEW3D_MT_edit_curve_segments")
1775 layout.prop_menu_enum(settings, "proportional_edit")
1776 layout.prop_menu_enum(settings, "proportional_edit_falloff")
1780 layout.menu("VIEW3D_MT_edit_curve_showhide")
1783 class VIEW3D_MT_edit_curve(Menu):
1789 class VIEW3D_MT_edit_curve_ctrlpoints(Menu):
1790 bl_label = "Control Points"
1792 def draw(self, context):
1793 layout = self.layout
1795 edit_object = context.edit_object
1797 if edit_object.type == 'CURVE':
1798 layout.operator("transform.transform", text="Tilt").mode = 'TILT'
1799 layout.operator("curve.tilt_clear")
1800 layout.operator("curve.separate")
1804 layout.operator_menu_enum("curve.handle_type_set", "type")
1808 layout.menu("VIEW3D_MT_hook")
1811 class VIEW3D_MT_edit_curve_segments(Menu):
1812 bl_label = "Segments"
1814 def draw(self, context):
1815 layout = self.layout
1817 layout.operator("curve.subdivide")
1818 layout.operator("curve.switch_direction")
1821 class VIEW3D_MT_edit_curve_specials(Menu):
1822 bl_label = "Specials"
1824 def draw(self, context):
1825 layout = self.layout
1827 layout.operator("curve.subdivide")
1828 layout.operator("curve.switch_direction")
1829 layout.operator("curve.spline_weight_set")
1830 layout.operator("curve.radius_set")
1831 layout.operator("curve.smooth")
1832 layout.operator("curve.smooth_radius")
1835 class VIEW3D_MT_edit_curve_showhide(ShowHideMenu, Menu):
1836 _operator_name = "curve"
1839 class VIEW3D_MT_edit_surface(Menu):
1840 bl_label = "Surface"
1845 class VIEW3D_MT_edit_font(Menu):
1848 def draw(self, context):
1849 layout = self.layout
1851 layout.operator("font.file_paste")
1855 layout.menu("VIEW3D_MT_edit_text_chars")
1859 layout.operator("font.style_toggle", text="Toggle Bold").style = 'BOLD'
1860 layout.operator("font.style_toggle", text="Toggle Italic").style = 'ITALIC'
1861 layout.operator("font.style_toggle", text="Toggle Underline").style = 'UNDERLINE'
1862 layout.operator("font.style_toggle", text="Toggle Small Caps").style = 'SMALL_CAPS'
1865 class VIEW3D_MT_edit_text_chars(Menu):
1866 bl_label = "Special Characters"
1868 def draw(self, context):
1869 layout = self.layout
1871 layout.operator("font.text_insert", text="Copyright|Alt C").text = b'\xC2\xA9'.decode()
1872 layout.operator("font.text_insert", text="Registered Trademark|Alt R").text = b'\xC2\xAE'.decode()
1876 layout.operator("font.text_insert", text="Degree Sign|Alt G").text = b'\xC2\xB0'.decode()
1877 layout.operator("font.text_insert", text="Multiplication Sign|Alt x").text = b'\xC3\x97'.decode()
1878 layout.operator("font.text_insert", text="Circle|Alt .").text = b'\xC2\x8A'.decode()
1879 layout.operator("font.text_insert", text="Superscript 1|Alt 1").text = b'\xC2\xB9'.decode()
1880 layout.operator("font.text_insert", text="Superscript 2|Alt 2").text = b'\xC2\xB2'.decode()
1881 layout.operator("font.text_insert", text="Superscript 3|Alt 3").text = b'\xC2\xB3'.decode()
1882 layout.operator("font.text_insert", text="Double >>|Alt >").text = b'\xC2\xBB'.decode()
1883 layout.operator("font.text_insert", text="Double <<|Alt <").text = b'\xC2\xAB'.decode()
1884 layout.operator("font.text_insert", text="Promillage|Alt %").text = b'\xE2\x80\xB0'.decode()
1888 layout.operator("font.text_insert", text="Dutch Florin|Alt F").text = b'\xC2\xA4'.decode()
1889 layout.operator("font.text_insert", text="British Pound|Alt L").text = b'\xC2\xA3'.decode()
1890 layout.operator("font.text_insert", text="Japanese Yen|Alt Y").text = b'\xC2\xA5'.decode()
1894 layout.operator("font.text_insert", text="German S|Alt S").text = b'\xC3\x9F'.decode()
1895 layout.operator("font.text_insert", text="Spanish Question Mark|Alt ?").text = b'\xC2\xBF'.decode()
1896 layout.operator("font.text_insert", text="Spanish Exclamation Mark|Alt !").text = b'\xC2\xA1'.decode()
1899 class VIEW3D_MT_edit_meta(Menu):
1900 bl_label = "Metaball"
1902 def draw(self, context):
1903 layout = self.layout
1905 settings = context.tool_settings
1907 layout.operator("ed.undo")
1908 layout.operator("ed.redo")
1909 layout.operator("ed.undo_history")
1913 layout.menu("VIEW3D_MT_transform")
1914 layout.menu("VIEW3D_MT_mirror")
1915 layout.menu("VIEW3D_MT_snap")
1919 layout.operator("mball.delete_metaelems", text="Delete...")
1920 layout.operator("mball.duplicate_metaelems")
1924 layout.prop_menu_enum(settings, "proportional_edit")
1925 layout.prop_menu_enum(settings, "proportional_edit_falloff")
1929 layout.menu("VIEW3D_MT_edit_meta_showhide")
1932 class VIEW3D_MT_edit_meta_showhide(Menu):
1933 bl_label = "Show/Hide"
1935 def draw(self, context):
1936 layout = self.layout
1938 layout.operator("mball.reveal_metaelems", text="Show Hidden")
1939 layout.operator("mball.hide_metaelems", text="Hide Selected")
1940 layout.operator("mball.hide_metaelems", text="Hide Unselected").unselected = True
1943 class VIEW3D_MT_edit_lattice(Menu):
1944 bl_label = "Lattice"
1946 def draw(self, context):
1947 layout = self.layout
1949 settings = context.tool_settings
1951 layout.menu("VIEW3D_MT_transform")
1952 layout.menu("VIEW3D_MT_mirror")
1953 layout.menu("VIEW3D_MT_snap")
1957 layout.operator("lattice.make_regular")
1961 layout.prop_menu_enum(settings, "proportional_edit")
1962 layout.prop_menu_enum(settings, "proportional_edit_falloff")
1965 class VIEW3D_MT_edit_armature(Menu):
1966 bl_label = "Armature"
1968 def draw(self, context):
1969 layout = self.layout
1971 edit_object = context.edit_object
1972 arm = edit_object.data
1974 layout.menu("VIEW3D_MT_transform")
1975 layout.menu("VIEW3D_MT_mirror")
1976 layout.menu("VIEW3D_MT_snap")
1977 layout.menu("VIEW3D_MT_edit_armature_roll")
1981 layout.operator("armature.extrude_move")
1983 if arm.use_mirror_x:
1984 layout.operator("armature.extrude_forked")
1986 layout.operator("armature.duplicate_move")
1987 layout.operator("armature.merge")
1988 layout.operator("armature.fill")
1989 layout.operator("armature.delete")
1990 layout.operator("armature.separate")
1994 layout.operator("armature.subdivide", text="Subdivide")
1995 layout.operator("armature.switch_direction", text="Switch Direction")
1999 layout.operator_context = 'EXEC_AREA'
2000 layout.operator("armature.autoside_names", text="AutoName Left/Right").type = 'XAXIS'
2001 layout.operator("armature.autoside_names", text="AutoName Front/Back").type = 'YAXIS'
2002 layout.operator("armature.autoside_names", text="AutoName Top/Bottom").type = 'ZAXIS'
2003 layout.operator("armature.flip_names")
2007 layout.operator_context = 'INVOKE_DEFAULT'
2008 layout.operator("armature.armature_layers")
2009 layout.operator("armature.bone_layers")
2013 layout.menu("VIEW3D_MT_edit_armature_parent")
2017 layout.menu("VIEW3D_MT_bone_options_toggle", text="Bone Settings")
2020 class VIEW3D_MT_armature_specials(Menu):
2021 bl_label = "Specials"
2023 def draw(self, context):
2024 layout = self.layout
2026 layout.operator_context = 'INVOKE_REGION_WIN'
2028 layout.operator("armature.subdivide", text="Subdivide")
2029 layout.operator("armature.switch_direction", text="Switch Direction")
2033 layout.operator_context = 'EXEC_REGION_WIN'
2034 layout.operator("armature.autoside_names", text="AutoName Left/Right").type = 'XAXIS'
2035 layout.operator("armature.autoside_names", text="AutoName Front/Back").type = 'YAXIS'
2036 layout.operator("armature.autoside_names", text="AutoName Top/Bottom").type = 'ZAXIS'
2037 layout.operator("armature.flip_names", text="Flip Names")
2040 class VIEW3D_MT_edit_armature_parent(Menu):
2043 def draw(self, context):
2044 layout = self.layout
2046 layout.operator("armature.parent_set", text="Make")
2047 layout.operator("armature.parent_clear", text="Clear")
2050 class VIEW3D_MT_edit_armature_roll(Menu):
2051 bl_label = "Bone Roll"
2053 def draw(self, context):
2054 layout = self.layout
2056 layout.operator_menu_enum("armature.calculate_roll", "type")
2060 layout.operator("transform.transform", text="Set Roll").mode = 'BONE_ROLL'
2062 # ********** Panel **********
2065 class VIEW3D_PT_view3d_properties(Panel):
2066 bl_space_type = 'VIEW_3D'
2067 bl_region_type = 'UI'
2071 def poll(cls, context):
2072 view = context.space_data
2075 def draw(self, context):
2076 layout = self.layout
2078 view = context.space_data
2080 col = layout.column()
2081 col.active = view.region_3d.view_perspective != 'CAMERA'
2082 col.prop(view, "lens")
2083 col.label(text="Lock to Object:")
2084 col.prop(view, "lock_object", text="")
2085 lock_object = view.lock_object
2087 if lock_object.type == 'ARMATURE':
2088 col.prop_search(view, "lock_bone", lock_object.data, "edit_bones" if lock_object.mode == 'EDIT' else "bones", text="")
2090 col.prop(view, "lock_cursor", text="Lock to Cursor")
2092 col = layout.column()
2093 col.prop(view, "lock_camera")
2095 col = layout.column(align=True)
2096 col.label(text="Clip:")
2097 col.prop(view, "clip_start", text="Start")
2098 col.prop(view, "clip_end", text="End")
2100 subcol = col.column()
2101 subcol.enabled = not view.lock_camera_and_layers
2102 subcol.label(text="Local Camera:")
2103 subcol.prop(view, "camera", text="")
2105 layout.column().prop(view, "cursor_location")
2108 class VIEW3D_PT_view3d_name(Panel):
2109 bl_space_type = 'VIEW_3D'
2110 bl_region_type = 'UI'
2114 def poll(cls, context):
2115 return (context.space_data and context.active_object)
2117 def draw(self, context):
2118 layout = self.layout
2120 ob = context.active_object
2122 row.label(text="", icon='OBJECT_DATA')
2123 row.prop(ob, "name", text="")
2125 if ob.type == 'ARMATURE' and ob.mode in {'EDIT', 'POSE'}:
2126 bone = context.active_bone
2129 row.label(text="", icon='BONE_DATA')
2130 row.prop(bone, "name", text="")
2133 class VIEW3D_PT_view3d_display(Panel):
2134 bl_space_type = 'VIEW_3D'
2135 bl_region_type = 'UI'
2136 bl_label = "Display"
2137 bl_options = {'DEFAULT_CLOSED'}
2140 def poll(cls, context):
2141 view = context.space_data
2144 def draw(self, context):
2145 layout = self.layout
2147 view = context.space_data
2148 scene = context.scene
2149 gs = scene.game_settings
2152 col = layout.column()
2153 col.prop(view, "show_only_render")
2155 col = layout.column()
2156 display_all = not view.show_only_render
2157 col.active = display_all
2158 col.prop(view, "show_outline_selected")
2159 col.prop(view, "show_all_objects_origin")
2160 col.prop(view, "show_relationship_lines")
2161 if ob and ob.type == 'MESH':
2163 col.prop(mesh, "show_all_edges")
2165 col = layout.column()
2166 col.active = display_all
2167 split = col.split(percentage=0.55)
2168 split.prop(view, "show_floor", text="Grid Floor")
2170 row = split.row(align=True)
2171 row.prop(view, "show_axis_x", text="X", toggle=True)
2172 row.prop(view, "show_axis_y", text="Y", toggle=True)
2173 row.prop(view, "show_axis_z", text="Z", toggle=True)
2175 sub = col.column(align=True)
2176 sub.active = (display_all and view.show_floor)
2177 sub.prop(view, "grid_lines", text="Lines")
2178 sub.prop(view, "grid_scale", text="Scale")
2179 subsub = sub.column(align=True)
2180 subsub.active = scene.unit_settings.system == 'NONE'
2181 subsub.prop(view, "grid_subdivisions", text="Subdivisions")
2183 col = layout.column()
2184 col.label(text="Shading:")
2185 col.prop(gs, "material_mode", text="")
2186 col.prop(view, "show_textured_solid")
2190 region = view.region_quadview
2192 layout.operator("screen.region_quadview", text="Toggle Quad View")
2195 col = layout.column()
2196 col.prop(region, "lock_rotation")
2198 row.enabled = region.lock_rotation
2199 row.prop(region, "show_sync_view")
2201 row.enabled = region.lock_rotation and region.show_sync_view
2202 row.prop(region, "use_box_clip")
2205 class VIEW3D_PT_view3d_meshdisplay(Panel):
2206 bl_space_type = 'VIEW_3D'
2207 bl_region_type = 'UI'
2208 bl_label = "Mesh Display"
2211 def poll(cls, context):
2212 # The active object check is needed because of localmode
2213 return (context.active_object and (context.mode == 'EDIT_MESH'))
2215 def draw(self, context):
2216 layout = self.layout
2218 mesh = context.active_object.data
2220 col = layout.column()
2221 col.label(text="Overlays:")
2222 col.prop(mesh, "show_edges", text="Edges")
2223 col.prop(mesh, "show_faces", text="Faces")
2224 col.prop(mesh, "show_edge_crease", text="Creases")
2225 col.prop(mesh, "show_edge_bevel_weight", text="Bevel Weights")
2226 col.prop(mesh, "show_edge_seams", text="Seams")
2227 col.prop(mesh, "show_edge_sharp", text="Sharp")
2230 col.label(text="Normals:")
2231 col.prop(mesh, "show_normal_face", text="Face")
2232 col.prop(mesh, "show_normal_vertex", text="Vertex")
2233 col.prop(context.scene.tool_settings, "normal_size", text="Normal Size")
2236 col.label(text="Numerics:")
2237 col.prop(mesh, "show_extra_edge_length")
2238 col.prop(mesh, "show_extra_face_angle")
2239 col.prop(mesh, "show_extra_face_area")
2242 class VIEW3D_PT_view3d_curvedisplay(Panel):
2243 bl_space_type = 'VIEW_3D'
2244 bl_region_type = 'UI'
2245 bl_label = "Curve Display"
2248 def poll(cls, context):
2249 editmesh = context.mode == 'EDIT_CURVE'
2252 def draw(self, context):
2253 layout = self.layout
2255 curve = context.active_object.data
2257 col = layout.column()
2258 col.label(text="Overlays:")
2259 col.prop(curve, "show_handles", text="Handles")
2260 col.prop(curve, "show_normal_face", text="Normals")
2261 col.prop(context.scene.tool_settings, "normal_size", text="Normal Size")
2264 class VIEW3D_PT_background_image(Panel):
2265 bl_space_type = 'VIEW_3D'
2266 bl_region_type = 'UI'
2267 bl_label = "Background Images"
2268 bl_options = {'DEFAULT_CLOSED'}
2271 def poll(cls, context):
2272 view = context.space_data
2273 # bg = context.space_data.background_image
2276 def draw_header(self, context):
2277 layout = self.layout
2278 view = context.space_data
2280 layout.prop(view, "show_background_images", text="")
2282 def draw(self, context):
2283 layout = self.layout
2285 view = context.space_data
2287 col = layout.column()
2288 col.operator("view3d.background_image_add", text="Add Image")
2290 for i, bg in enumerate(view.background_images):
2291 layout.active = view.show_background_images
2293 row = box.row(align=True)
2294 row.prop(bg, "show_expanded", text="", emboss=False)
2296 row.prop(bg.image, "name", text="", emboss=False)
2298 row.label(text="Not Set")
2299 row.operator("view3d.background_image_remove", text="", emboss=False, icon='X').index = i
2301 box.prop(bg, "view_axis", text="Axis")
2303 if bg.show_expanded:
2305 row.template_ID(bg, "image", open="image.open")
2307 box.template_image(bg, "image", bg.image_user, compact=True)
2309 box.prop(bg, "opacity", slider=True)
2310 if bg.view_axis != 'CAMERA':
2311 box.prop(bg, "size")
2312 row = box.row(align=True)
2313 row.prop(bg, "offset_x", text="X")
2314 row.prop(bg, "offset_y", text="Y")
2317 class VIEW3D_PT_transform_orientations(Panel):
2318 bl_space_type = 'VIEW_3D'
2319 bl_region_type = 'UI'
2320 bl_label = "Transform Orientations"
2321 bl_options = {'DEFAULT_CLOSED'}
2324 def poll(cls, context):
2325 view = context.space_data
2328 def draw(self, context):
2329 layout = self.layout
2331 view = context.space_data
2333 col = layout.column()
2335 col.prop(view, "transform_orientation")
2336 col.operator("transform.create_orientation", text="Create")
2338 orientation = view.current_orientation
2341 col.prop(orientation, "name")
2342 col.operator("transform.delete_orientation", text="Delete")
2345 class VIEW3D_PT_etch_a_ton(Panel):
2346 bl_space_type = 'VIEW_3D'
2347 bl_region_type = 'UI'
2348 bl_label = "Skeleton Sketching"
2349 bl_options = {'DEFAULT_CLOSED'}
2352 def poll(cls, context):
2353 scene = context.space_data
2354 ob = context.active_object
2355 return scene and ob and ob.type == 'ARMATURE' and ob.mode == 'EDIT'
2357 def draw_header(self, context):
2358 layout = self.layout
2359 toolsettings = context.scene.tool_settings
2361 layout.prop(toolsettings, "use_bone_sketching", text="")
2363 def draw(self, context):
2364 layout = self.layout
2365 toolsettings = context.scene.tool_settings
2367 col = layout.column()
2369 col.prop(toolsettings, "use_etch_quick")
2370 col.prop(toolsettings, "use_etch_overdraw")
2372 col.prop(toolsettings, "etch_convert_mode")
2374 if toolsettings.etch_convert_mode == 'LENGTH':
2375 col.prop(toolsettings, "etch_length_limit")
2376 elif toolsettings.etch_convert_mode == 'ADAPTIVE':
2377 col.prop(toolsettings, "etch_adaptive_limit")
2378 elif toolsettings.etch_convert_mode == 'FIXED':
2379 col.prop(toolsettings, "etch_subdivision_number")
2380 elif toolsettings.etch_convert_mode == 'RETARGET':
2381 col.prop(toolsettings, "etch_template")
2382 col.prop(toolsettings, "etch_roll_mode")
2383 col.prop(toolsettings, "use_etch_autoname")
2384 col.prop(toolsettings, "etch_number")
2385 col.prop(toolsettings, "etch_side")
2387 col.operator("sketch.convert", text="Convert")
2390 class VIEW3D_PT_context_properties(Panel):
2391 bl_space_type = 'VIEW_3D'
2392 bl_region_type = 'UI'
2393 bl_label = "Properties"
2394 bl_options = {'DEFAULT_CLOSED'}
2396 def _active_context_member(context):
2397 obj = context.object
2401 return "active_pose_bone"
2402 elif mode == 'EDIT' and obj.type == 'ARMATURE':
2403 return "active_bone"
2410 def poll(cls, context):
2411 member = cls._active_context_member(context)
2413 context_member = getattr(context, member)
2414 return context_member and context_member.keys()
2418 def draw(self, context):
2420 member = VIEW3D_PT_context_properties._active_context_member(context)
2423 # Draw with no edit button
2424 rna_prop_ui.draw(self.layout, context, member, object, False)
2428 bpy.utils.register_module(__name__)
2432 bpy.utils.unregister_module(__name__)
2434 if __name__ == "__main__":
2437 if __name__ == "__main__": # only for live edit.
2438 bpy.utils.register_module(__name__)