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 #####
23 class VIEW3D_HT_header(bpy.types.Header):
24 bl_space_type = 'VIEW_3D'
26 def draw(self, context):
29 view = context.space_data
30 mode_string = context.mode
31 edit_object = context.edit_object
32 obj = context.active_object
33 toolsettings = context.tool_settings
35 row = layout.row(align=True)
39 if context.area.show_menus:
40 sub = row.row(align=True)
42 sub.menu("VIEW3D_MT_view")
45 if mode_string not in {'EDIT_TEXT', 'SCULPT', 'PAINT_WEIGHT', 'PAINT_VERTEX', 'PAINT_TEXTURE'}:
46 sub.menu("VIEW3D_MT_select_%s" % mode_string.lower())
49 sub.menu("VIEW3D_MT_edit_%s" % edit_object.type.lower())
51 if mode_string not in {'PAINT_TEXTURE'}:
52 sub.menu("VIEW3D_MT_%s" % mode_string.lower())
54 sub.menu("VIEW3D_MT_object")
57 row.template_header_3D()
59 # do in C for now since these buttons cant be both toggle AND exclusive.
61 if obj and obj.mode == 'EDIT' and obj.type == 'MESH':
62 row_sub = row.row(align=True)
63 row_sub.prop(toolsettings, "mesh_select_mode", text="", index=0, icon='VERTEXSEL')
64 row_sub.prop(toolsettings, "mesh_select_mode", text="", index=1, icon='EDGESEL')
65 row_sub.prop(toolsettings, "mesh_select_mode", text="", index=2, icon='FACESEL')
70 if obj.mode == 'PARTICLE_EDIT':
71 row.prop(toolsettings.particle_edit, "select_mode", text="", expand=True, toggle=True)
74 if view.viewport_shade in {'SOLID', 'SHADED', 'TEXTURED'} and (obj.mode == 'PARTICLE_EDIT' or (obj.mode == 'EDIT' and obj.type == 'MESH')):
75 row.prop(view, "use_occlude_geometry", text="")
77 # Proportional editing
78 if obj.mode in {'EDIT', 'PARTICLE_EDIT'}:
79 row = layout.row(align=True)
80 row.prop(toolsettings, "proportional_edit", text="", icon_only=True)
81 if toolsettings.proportional_edit != 'DISABLED':
82 row.prop(toolsettings, "proportional_edit_falloff", text="", icon_only=True)
83 elif obj.mode == 'OBJECT':
84 row = layout.row(align=True)
85 row.prop(toolsettings, "use_proportional_edit_objects", text="", icon_only=True)
86 if toolsettings.use_proportional_edit_objects:
87 row.prop(toolsettings, "proportional_edit_falloff", text="", icon_only=True)
90 row = layout.row(align=True)
91 row.prop(toolsettings, "use_snap", text="")
92 row.prop(toolsettings, "snap_element", text="", icon_only=True)
93 if toolsettings.snap_element != 'INCREMENT':
94 row.prop(toolsettings, "snap_target", text="")
95 if obj and obj.mode == 'OBJECT':
96 row.prop(toolsettings, "use_snap_align_rotation", text="")
97 if toolsettings.snap_element == 'VOLUME':
98 row.prop(toolsettings, "use_snap_peel_object", text="")
99 elif toolsettings.snap_element == 'FACE':
100 row.prop(toolsettings, "use_snap_project", text="")
103 row = layout.row(align=True)
104 row.operator("render.opengl", text="", icon='RENDER_STILL')
105 props = row.operator("render.opengl", text="", icon='RENDER_ANIMATION')
106 props.animation = True
109 if obj and obj.mode == 'POSE':
110 row = layout.row(align=True)
111 row.operator("pose.copy", text="", icon='COPYDOWN')
112 row.operator("pose.paste", text="", icon='PASTEDOWN')
113 props = row.operator("pose.paste", text="", icon='PASTEFLIPDOWN')
117 # ********** Menu **********
119 # ********** Utilities **********
122 class ShowHideMenu():
123 bl_label = "Show/Hide"
126 def draw(self, context):
129 layout.operator("%s.reveal" % self._operator_name, text="Show Hidden")
130 layout.operator("%s.hide" % self._operator_name, text="Hide Selected")
131 layout.operator("%s.hide" % self._operator_name, text="Hide Unselected").unselected = True
134 class VIEW3D_MT_transform(bpy.types.Menu):
135 bl_label = "Transform"
137 # TODO: get rid of the custom text strings?
138 def draw(self, context):
141 layout.operator("transform.translate", text="Grab/Move")
142 # TODO: sub-menu for grab per axis
143 layout.operator("transform.rotate", text="Rotate")
144 # TODO: sub-menu for rot per axis
145 layout.operator("transform.resize", text="Scale")
146 # TODO: sub-menu for scale per axis
150 layout.operator("transform.tosphere", text="To Sphere")
151 layout.operator("transform.shear", text="Shear")
152 layout.operator("transform.warp", text="Warp")
153 layout.operator("transform.push_pull", text="Push/Pull")
157 layout.operator("transform.translate", text="Move Texture Space").texture_space = True
158 layout.operator("transform.resize", text="Scale Texture Space").texture_space = True
163 if obj.type == 'ARMATURE' and obj.mode in {'EDIT', 'POSE'} and obj.data.draw_type in {'BBONE', 'ENVELOPE'}:
164 layout.operator("transform.transform", text="Scale Envelope/BBone").mode = 'BONE_SIZE'
166 if context.edit_object and context.edit_object.type == 'ARMATURE':
167 layout.operator("armature.align")
169 layout.operator_context = 'EXEC_REGION_WIN'
170 layout.operator("transform.transform", text="Align to Transform Orientation").mode = 'ALIGN' # XXX see alignmenu() in edit.c of b2.4x to get this working
174 layout.operator_context = 'EXEC_AREA'
176 layout.operator("object.origin_set", text="Geometry to Origin").type = 'GEOMETRY_ORIGIN'
177 layout.operator("object.origin_set", text="Origin to Geometry").type = 'ORIGIN_GEOMETRY'
178 layout.operator("object.origin_set", text="Origin to 3D Cursor").type = 'ORIGIN_CURSOR'
181 class VIEW3D_MT_mirror(bpy.types.Menu):
184 def draw(self, context):
187 layout.operator("transform.mirror", text="Interactive Mirror")
191 layout.operator_context = 'INVOKE_REGION_WIN'
193 props = layout.operator("transform.mirror", text="X Global")
194 props.constraint_axis = (True, False, False)
195 props.constraint_orientation = 'GLOBAL'
196 props = layout.operator("transform.mirror", text="Y Global")
197 props.constraint_axis = (False, True, False)
198 props.constraint_orientation = 'GLOBAL'
199 props = layout.operator("transform.mirror", text="Z Global")
200 props.constraint_axis = (False, False, True)
201 props.constraint_orientation = 'GLOBAL'
203 if context.edit_object:
206 props = layout.operator("transform.mirror", text="X Local")
207 props.constraint_axis = (True, False, False)
208 props.constraint_orientation = 'LOCAL'
209 props = layout.operator("transform.mirror", text="Y Local")
210 props.constraint_axis = (False, True, False)
211 props.constraint_orientation = 'LOCAL'
212 props = layout.operator("transform.mirror", text="Z Local")
213 props.constraint_axis = (False, False, True)
214 props.constraint_orientation = 'LOCAL'
216 layout.operator("object.vertex_group_mirror")
219 class VIEW3D_MT_snap(bpy.types.Menu):
222 def draw(self, context):
225 layout.operator("view3d.snap_selected_to_grid", text="Selection to Grid")
226 layout.operator("view3d.snap_selected_to_cursor", text="Selection to Cursor")
230 layout.operator("view3d.snap_cursor_to_selected", text="Cursor to Selected")
231 layout.operator("view3d.snap_cursor_to_center", text="Cursor to Center")
232 layout.operator("view3d.snap_cursor_to_grid", text="Cursor to Grid")
233 layout.operator("view3d.snap_cursor_to_active", text="Cursor to Active")
236 class VIEW3D_MT_uv_map(bpy.types.Menu):
237 bl_label = "UV Mapping"
239 def draw(self, context):
242 layout.operator("uv.unwrap")
243 layout.operator("uv.cube_project")
244 layout.operator("uv.cylinder_project")
245 layout.operator("uv.sphere_project")
246 layout.operator("uv.project_from_view")
247 layout.operator("uv.project_from_view", text="Project from View (Bounds)").scale_to_bounds = True
251 layout.operator("uv.reset")
253 # ********** View menus **********
256 class VIEW3D_MT_view(bpy.types.Menu):
259 def draw(self, context):
262 layout.operator("view3d.properties", icon='MENU_PANEL')
263 layout.operator("view3d.toolshelf", icon='MENU_PANEL')
267 layout.operator("view3d.viewnumpad", text="Camera").type = 'CAMERA'
268 layout.operator("view3d.viewnumpad", text="Top").type = 'TOP'
269 layout.operator("view3d.viewnumpad", text="Bottom").type = 'BOTTOM'
270 layout.operator("view3d.viewnumpad", text="Front").type = 'FRONT'
271 layout.operator("view3d.viewnumpad", text="Back").type = 'BACK'
272 layout.operator("view3d.viewnumpad", text="Right").type = 'RIGHT'
273 layout.operator("view3d.viewnumpad", text="Left").type = 'LEFT'
275 layout.menu("VIEW3D_MT_view_cameras", text="Cameras")
279 layout.operator("view3d.view_persportho")
283 layout.menu("VIEW3D_MT_view_navigation")
284 layout.menu("VIEW3D_MT_view_align")
288 layout.operator_context = 'INVOKE_REGION_WIN'
290 layout.operator("view3d.clip_border", text="Clipping Border...")
291 layout.operator("view3d.zoom_border", text="Zoom Border...")
295 layout.operator("view3d.layers", text="Show All Layers").nr = 0
299 layout.operator("view3d.localview", text="View Global/Local")
300 layout.operator("view3d.view_selected")
301 layout.operator("view3d.view_all")
305 layout.operator("screen.animation_play", text="Playback Animation")
309 layout.operator("screen.area_dupli")
310 layout.operator("screen.region_quadview")
311 layout.operator("screen.screen_full_area")
314 class VIEW3D_MT_view_navigation(bpy.types.Menu):
315 bl_label = "Navigation"
317 def draw(self, context):
320 layout.operator_enum("view3d.view_orbit", "type")
324 layout.operator_enum("view3d.view_pan", "type")
328 layout.operator("view3d.zoom", text="Zoom In").delta = 1
329 layout.operator("view3d.zoom", text="Zoom Out").delta = -1
330 layout.operator("view3d.zoom_camera_1_to_1", text="Zoom Camera 1:1")
334 layout.operator("view3d.fly")
337 class VIEW3D_MT_view_align(bpy.types.Menu):
338 bl_label = "Align View"
340 def draw(self, context):
343 layout.menu("VIEW3D_MT_view_align_selected")
347 layout.operator("view3d.view_all", text="Center Cursor and View All").center = True
348 layout.operator("view3d.camera_to_view", text="Align Active Camera to View")
349 layout.operator("view3d.view_selected")
350 layout.operator("view3d.view_center_cursor")
353 class VIEW3D_MT_view_align_selected(bpy.types.Menu):
354 bl_label = "Align View to Selected"
356 def draw(self, context):
359 props = layout.operator("view3d.viewnumpad", text="Top")
360 props.align_active = True
362 props = layout.operator("view3d.viewnumpad", text="Bottom")
363 props.align_active = True
364 props.type = 'BOTTOM'
365 props = layout.operator("view3d.viewnumpad", text="Front")
366 props.align_active = True
368 props = layout.operator("view3d.viewnumpad", text="Back")
369 props.align_active = True
371 props = layout.operator("view3d.viewnumpad", text="Right")
372 props.align_active = True
374 props = layout.operator("view3d.viewnumpad", text="Left")
375 props.align_active = True
379 class VIEW3D_MT_view_cameras(bpy.types.Menu):
382 def draw(self, context):
385 layout.operator("view3d.object_as_camera")
386 layout.operator("view3d.viewnumpad", text="Active Camera").type = 'CAMERA'
388 # ********** Select menus, suffix from context.mode **********
391 class VIEW3D_MT_select_object(bpy.types.Menu):
394 def draw(self, context):
397 layout.operator("view3d.select_border")
398 layout.operator("view3d.select_circle")
402 layout.operator("object.select_all", text="Select/Deselect All")
403 layout.operator("object.select_inverse", text="Inverse")
404 layout.operator("object.select_random", text="Random")
405 layout.operator("object.select_mirror", text="Mirror")
406 layout.operator("object.select_by_layer", text="Select All by Layer")
407 layout.operator_menu_enum("object.select_by_type", "type", text="Select All by Type...")
408 layout.operator("object.select_camera", text="Select Camera")
412 layout.operator_menu_enum("object.select_grouped", "type", text="Grouped")
413 layout.operator_menu_enum("object.select_linked", "type", text="Linked")
414 layout.operator("object.select_pattern", text="Select Pattern...")
417 class VIEW3D_MT_select_pose(bpy.types.Menu):
420 def draw(self, context):
423 layout.operator("view3d.select_border")
427 layout.operator("pose.select_all", text="Select/Deselect All")
428 layout.operator("pose.select_inverse", text="Inverse")
429 layout.operator("pose.select_flip_active", text="Flip Active")
430 layout.operator("pose.select_constraint_target", text="Constraint Target")
431 layout.operator("pose.select_linked", text="Linked")
435 layout.operator("pose.select_hierarchy", text="Parent").direction = 'PARENT'
436 layout.operator("pose.select_hierarchy", text="Child").direction = 'CHILD'
440 props = layout.operator("pose.select_hierarchy", text="Extend Parent")
442 props.direction = 'PARENT'
444 props = layout.operator("pose.select_hierarchy", text="Extend Child")
446 props.direction = 'CHILD'
450 layout.operator_menu_enum("pose.select_grouped", "type", text="Grouped")
451 layout.operator("object.select_pattern", text="Select Pattern...")
454 class VIEW3D_MT_select_particle(bpy.types.Menu):
457 def draw(self, context):
460 layout.operator("view3d.select_border")
464 layout.operator("particle.select_all", text="Select/Deselect All")
465 layout.operator("particle.select_linked")
466 layout.operator("particle.select_inverse")
470 layout.operator("particle.select_more")
471 layout.operator("particle.select_less")
475 layout.operator("particle.select_roots", text="Roots")
476 layout.operator("particle.select_tips", text="Tips")
479 class VIEW3D_MT_select_edit_mesh(bpy.types.Menu):
482 def draw(self, context):
485 layout.operator("view3d.select_border")
486 layout.operator("view3d.select_circle")
490 layout.operator("mesh.select_all", text="Select/Deselect All")
491 layout.operator("mesh.select_inverse", text="Inverse")
495 layout.operator("mesh.select_random", text="Random")
496 layout.operator("mesh.select_nth", text="Every N Number of Verts")
497 layout.operator("mesh.edges_select_sharp", text="Sharp Edges")
498 layout.operator("mesh.faces_select_linked_flat", text="Linked Flat Faces")
499 layout.operator("mesh.faces_select_interior", text="Interior Faces")
500 layout.operator("mesh.select_axis", text="Side of Active")
504 layout.operator("mesh.select_by_number_vertices", text="Triangles").type = 'TRIANGLES'
505 layout.operator("mesh.select_by_number_vertices", text="Quads").type = 'QUADS'
506 if context.scene.tool_settings.mesh_select_mode[2] == False:
507 layout.operator("mesh.select_non_manifold", text="Non Manifold")
508 layout.operator("mesh.select_by_number_vertices", text="Loose Verts/Edges").type = 'OTHER'
509 layout.operator("mesh.select_similar", text="Similar")
513 layout.operator("mesh.select_less", text="Less")
514 layout.operator("mesh.select_more", text="More")
518 layout.operator("mesh.select_mirror", text="Mirror")
520 layout.operator("mesh.select_linked", text="Linked")
521 layout.operator("mesh.select_vertex_path", text="Vertex Path")
522 layout.operator("mesh.loop_multi_select", text="Edge Loop")
523 layout.operator("mesh.loop_multi_select", text="Edge Ring").ring = True
527 layout.operator("mesh.loop_to_region")
528 layout.operator("mesh.region_to_loop")
531 class VIEW3D_MT_select_edit_curve(bpy.types.Menu):
534 def draw(self, context):
537 layout.operator("view3d.select_border")
538 layout.operator("view3d.select_circle")
542 layout.operator("curve.select_all", text="Select/Deselect All")
543 layout.operator("curve.select_inverse")
544 layout.operator("curve.select_random")
545 layout.operator("curve.select_nth", text="Every Nth Number of Points")
549 layout.operator("curve.de_select_first")
550 layout.operator("curve.de_select_last")
551 layout.operator("curve.select_next")
552 layout.operator("curve.select_previous")
556 layout.operator("curve.select_more")
557 layout.operator("curve.select_less")
560 class VIEW3D_MT_select_edit_surface(bpy.types.Menu):
563 def draw(self, context):
566 layout.operator("view3d.select_border")
567 layout.operator("view3d.select_circle")
571 layout.operator("curve.select_all", text="Select/Deselect All")
572 layout.operator("curve.select_inverse")
573 layout.operator("curve.select_random")
574 layout.operator("curve.select_nth", text="Every Nth Number of Points")
578 layout.operator("curve.select_row")
582 layout.operator("curve.select_more")
583 layout.operator("curve.select_less")
586 class VIEW3D_MT_select_edit_metaball(bpy.types.Menu):
589 def draw(self, context):
592 layout.operator("view3d.select_border")
596 layout.operator("mball.select_all").action = 'TOGGLE'
597 layout.operator("mball.select_inverse_metaelems")
601 layout.operator("mball.select_random_metaelems")
604 class VIEW3D_MT_select_edit_lattice(bpy.types.Menu):
607 def draw(self, context):
610 layout.operator("view3d.select_border")
614 layout.operator("lattice.select_all", text="Select/Deselect All")
617 class VIEW3D_MT_select_edit_armature(bpy.types.Menu):
620 def draw(self, context):
623 layout.operator("view3d.select_border")
627 layout.operator("armature.select_all", text="Select/Deselect All")
628 layout.operator("armature.select_inverse", text="Inverse")
632 layout.operator("armature.select_hierarchy", text="Parent").direction = 'PARENT'
633 layout.operator("armature.select_hierarchy", text="Child").direction = 'CHILD'
637 props = layout.operator("armature.select_hierarchy", text="Extend Parent")
639 props.direction = 'PARENT'
641 props = layout.operator("armature.select_hierarchy", text="Extend Child")
643 props.direction = 'CHILD'
645 layout.operator("object.select_pattern", text="Select Pattern...")
648 class VIEW3D_MT_select_face(bpy.types.Menu): # XXX no matching enum
651 def draw(self, context):
652 # layout = self.layout
655 # see view3d_select_faceselmenu
658 # ********** Object menu **********
661 class VIEW3D_MT_object(bpy.types.Menu):
662 bl_context = "objectmode"
665 def draw(self, context):
668 layout.operator("ed.undo")
669 layout.operator("ed.redo")
673 layout.menu("VIEW3D_MT_transform")
674 layout.menu("VIEW3D_MT_mirror")
675 layout.menu("VIEW3D_MT_object_clear")
676 layout.menu("VIEW3D_MT_object_apply")
677 layout.menu("VIEW3D_MT_snap")
681 layout.menu("VIEW3D_MT_object_animation")
685 layout.operator("object.duplicate_move")
686 layout.operator("object.duplicate_move_linked")
687 layout.operator("object.delete", text="Delete...")
688 layout.operator("object.proxy_make", text="Make Proxy...")
689 layout.menu("VIEW3D_MT_make_links", text="Make Links...")
690 layout.operator("object.make_dupli_face")
691 layout.operator_menu_enum("object.make_local", "type", text="Make Local...")
692 layout.menu("VIEW3D_MT_make_single_user")
696 layout.menu("VIEW3D_MT_object_parent")
697 layout.menu("VIEW3D_MT_object_track")
698 layout.menu("VIEW3D_MT_object_group")
699 layout.menu("VIEW3D_MT_object_constraints")
703 layout.menu("VIEW3D_MT_object_game")
707 layout.operator("object.join_uvs")
708 layout.operator("object.join")
712 layout.operator("object.move_to_layer", text="Move to Layer...")
713 layout.menu("VIEW3D_MT_object_showhide")
715 layout.operator_menu_enum("object.convert", "target")
718 class VIEW3D_MT_object_animation(bpy.types.Menu):
719 bl_label = "Animation"
721 def draw(self, context):
724 layout.operator("anim.keyframe_insert_menu", text="Insert Keyframe...")
725 layout.operator("anim.keyframe_delete_v3d", text="Delete Keyframe...")
726 layout.operator("anim.keying_set_active_set", text="Change Keying Set...")
729 class VIEW3D_MT_object_clear(bpy.types.Menu):
732 def draw(self, context):
735 layout.operator("object.location_clear", text="Location")
736 layout.operator("object.rotation_clear", text="Rotation")
737 layout.operator("object.scale_clear", text="Scale")
738 layout.operator("object.origin_clear", text="Origin")
741 class VIEW3D_MT_object_specials(bpy.types.Menu):
742 bl_label = "Specials"
745 def poll(cls, context):
746 # add more special types
747 return context.object
749 def draw(self, context):
753 if obj.type == 'CAMERA':
754 layout.operator_context = 'INVOKE_REGION_WIN'
756 props = layout.operator("wm.context_modal_mouse", text="Camera Lens Angle")
757 props.data_path_iter = "selected_editable_objects"
758 props.data_path_item = "data.lens"
759 props.input_scale = 0.1
761 if not obj.data.dof_object:
762 #layout.label(text="Test Has DOF obj");
763 props = layout.operator("wm.context_modal_mouse", text="DOF Distance")
764 props.data_path_iter = "selected_editable_objects"
765 props.data_path_item = "data.dof_distance"
766 props.input_scale = 0.02
768 if obj.type in {'CURVE', 'FONT'}:
769 layout.operator_context = 'INVOKE_REGION_WIN'
771 props = layout.operator("wm.context_modal_mouse", text="Extrude Size")
772 props.data_path_iter = "selected_editable_objects"
773 props.data_path_item = "data.extrude"
774 props.input_scale = 0.01
776 props = layout.operator("wm.context_modal_mouse", text="Width Size")
777 props.data_path_iter = "selected_editable_objects"
778 props.data_path_item = "data.offset"
779 props.input_scale = 0.01
781 if obj.type == 'EMPTY':
782 layout.operator_context = 'INVOKE_REGION_WIN'
784 props = layout.operator("wm.context_modal_mouse", text="Empty Draw Size")
785 props.data_path_iter = "selected_editable_objects"
786 props.data_path_item = "empty_draw_size"
787 props.input_scale = 0.01
789 if obj.type == 'LAMP':
790 layout.operator_context = 'INVOKE_REGION_WIN'
792 props = layout.operator("wm.context_modal_mouse", text="Energy")
793 props.data_path_iter = "selected_editable_objects"
794 props.data_path_item = "data.energy"
796 if obj.data.type in {'SPOT', 'AREA', 'POINT'}:
797 props = layout.operator("wm.context_modal_mouse", text="Falloff Distance")
798 props.data_path_iter = "selected_editable_objects"
799 props.data_path_item = "data.distance"
800 props.input_scale = 0.1
802 if obj.data.type == 'SPOT':
804 props = layout.operator("wm.context_modal_mouse", text="Spot Size")
805 props.data_path_iter = "selected_editable_objects"
806 props.data_path_item = "data.spot_size"
807 props.input_scale = 0.01
809 props = layout.operator("wm.context_modal_mouse", text="Spot Blend")
810 props.data_path_iter = "selected_editable_objects"
811 props.data_path_item = "data.spot_blend"
812 props.input_scale = -0.01
814 props = layout.operator("wm.context_modal_mouse", text="Clip Start")
815 props.data_path_iter = "selected_editable_objects"
816 props.data_path_item = "data.shadow_buffer_clip_start"
817 props.input_scale = 0.05
819 props = layout.operator("wm.context_modal_mouse", text="Clip End")
820 props.data_path_iter = "selected_editable_objects"
821 props.data_path_item = "data.shadow_buffer_clip_end"
822 props.input_scale = 0.05
826 props = layout.operator("object.isolate_type_render")
827 props = layout.operator("object.hide_render_clear_all")
830 class VIEW3D_MT_object_apply(bpy.types.Menu):
833 def draw(self, context):
836 layout.operator("object.location_apply", text="Location")
837 layout.operator("object.rotation_apply", text="Rotation")
838 layout.operator("object.scale_apply", text="Scale")
840 layout.operator("object.visual_transform_apply", text="Visual Transform")
841 layout.operator("object.duplicates_make_real")
844 class VIEW3D_MT_object_parent(bpy.types.Menu):
847 def draw(self, context):
850 layout.operator("object.parent_set", text="Set")
851 layout.operator("object.parent_clear", text="Clear")
854 class VIEW3D_MT_object_track(bpy.types.Menu):
857 def draw(self, context):
860 layout.operator("object.track_set", text="Set")
861 layout.operator("object.track_clear", text="Clear")
864 class VIEW3D_MT_object_group(bpy.types.Menu):
867 def draw(self, context):
870 layout.operator("group.create")
871 layout.operator("group.objects_remove")
875 layout.operator("group.objects_add_active")
876 layout.operator("group.objects_remove_active")
879 class VIEW3D_MT_object_constraints(bpy.types.Menu):
880 bl_label = "Constraints"
882 def draw(self, context):
885 layout.operator("object.constraint_add_with_targets")
886 layout.operator("object.constraints_copy")
887 layout.operator("object.constraints_clear")
890 class VIEW3D_MT_object_showhide(bpy.types.Menu):
891 bl_label = "Show/Hide"
893 def draw(self, context):
896 layout.operator("object.hide_view_clear", text="Show Hidden")
897 layout.operator("object.hide_view_set", text="Hide Selected")
898 layout.operator("object.hide_view_set", text="Hide Unselected").unselected = True
901 class VIEW3D_MT_make_single_user(bpy.types.Menu):
902 bl_label = "Make Single User"
904 def draw(self, context):
907 props = layout.operator("object.make_single_user", text="Object")
910 props = layout.operator("object.make_single_user", text="Object & Data")
911 props.object = props.obdata = True
913 props = layout.operator("object.make_single_user", text="Object & Data & Materials+Tex")
914 props.object = props.obdata = props.material = props.texture = True
916 props = layout.operator("object.make_single_user", text="Materials+Tex")
917 props.material = props.texture = True
919 props = layout.operator("object.make_single_user", text="Object Animation")
920 props.animation = True
923 class VIEW3D_MT_make_links(bpy.types.Menu):
924 bl_label = "Make Links"
926 def draw(self, context):
929 if(len(bpy.data.scenes) > 10):
930 layout.operator_context = 'INVOKE_DEFAULT'
931 layout.operator("object.make_links_scene", text="Objects to Scene...", icon='OUTLINER_OB_EMPTY')
932 layout.operator("object.make_links_scene", text="Markers to Scene...", icon='OUTLINER_OB_EMPTY')
934 layout.operator_menu_enum("object.make_links_scene", "scene", text="Objects to Scene...")
935 layout.operator_menu_enum("marker.make_links_scene", "scene", text="Markers to Scene...")
937 layout.operator_enum("object.make_links_data", "type") # inline
940 class VIEW3D_MT_object_game(bpy.types.Menu):
943 def draw(self, context):
946 layout.operator("object.logic_bricks_copy", text="Copy Logic Bricks")
950 layout.operator("object.game_property_copy", text="Replace Properties").operation = 'REPLACE'
951 layout.operator("object.game_property_copy", text="Merge Properties").operation = 'MERGE'
952 layout.operator_menu_enum("object.game_property_copy", "property", text="Copy Properties...")
956 layout.operator("object.game_property_clear")
959 # ********** Vertex paint menu **********
962 class VIEW3D_MT_paint_vertex(bpy.types.Menu):
965 def draw(self, context):
968 layout.operator("ed.undo")
969 layout.operator("ed.redo")
973 layout.operator("paint.vertex_color_set")
974 layout.operator("paint.vertex_color_dirt")
977 class VIEW3D_MT_hook(bpy.types.Menu):
980 def draw(self, context):
982 layout.operator_context = 'EXEC_AREA'
983 layout.operator("object.hook_add_newob")
984 layout.operator("object.hook_add_selob")
986 if [mod.type == 'HOOK' for mod in context.active_object.modifiers]:
988 layout.operator_menu_enum("object.hook_assign", "modifier")
989 layout.operator_menu_enum("object.hook_remove", "modifier")
991 layout.operator_menu_enum("object.hook_select", "modifier")
992 layout.operator_menu_enum("object.hook_reset", "modifier")
993 layout.operator_menu_enum("object.hook_recenter", "modifier")
996 class VIEW3D_MT_vertex_group(bpy.types.Menu):
997 bl_label = "Vertex Groups"
999 def draw(self, context):
1000 layout = self.layout
1001 layout.operator_context = 'EXEC_AREA'
1002 layout.operator("object.vertex_group_assign", text="Assign to New Group").new = True
1004 ob = context.active_object
1005 if ob.mode == 'EDIT':
1006 if ob.vertex_groups.active:
1008 layout.operator("object.vertex_group_assign", text="Assign to Active Group")
1009 layout.operator("object.vertex_group_remove_from", text="Remove from Active Group")
1010 layout.operator("object.vertex_group_remove_from", text="Remove from All").all = True
1013 if ob.vertex_groups.active:
1014 layout.operator_menu_enum("object.vertex_group_set_active", "group", text="Set Active Group")
1015 layout.operator("object.vertex_group_remove", text="Remove Active Group")
1016 layout.operator("object.vertex_group_remove", text="Remove All Groups").all = True
1018 # ********** Weight paint menu **********
1021 class VIEW3D_MT_paint_weight(bpy.types.Menu):
1022 bl_label = "Weights"
1024 def draw(self, context):
1025 layout = self.layout
1027 layout.operator("ed.undo")
1028 layout.operator("ed.redo")
1032 layout.operator("paint.weight_from_bones", text="Assign Automatic From Bones").type = 'AUTOMATIC'
1033 layout.operator("paint.weight_from_bones", text="Assign From Bone Envelopes").type = 'ENVELOPES'
1037 layout.operator("object.vertex_group_normalize_all", text="Normalize All")
1038 layout.operator("object.vertex_group_normalize", text="Normalize")
1039 layout.operator("object.vertex_group_invert", text="Invert")
1040 layout.operator("object.vertex_group_clean", text="Clean")
1041 layout.operator("object.vertex_group_levels", text="Levels")
1043 # ********** Sculpt menu **********
1046 class VIEW3D_MT_sculpt(bpy.types.Menu):
1049 def draw(self, context):
1050 layout = self.layout
1052 tool_settings = context.tool_settings
1053 sculpt = tool_settings.sculpt
1054 brush = tool_settings.sculpt.brush
1056 layout.operator("ed.undo")
1057 layout.operator("ed.redo")
1061 layout.prop(sculpt, "use_symmetry_x")
1062 layout.prop(sculpt, "use_symmetry_y")
1063 layout.prop(sculpt, "use_symmetry_z")
1065 layout.prop(sculpt, "lock_x")
1066 layout.prop(sculpt, "lock_y")
1067 layout.prop(sculpt, "lock_z")
1069 layout.operator_menu_enum("brush.curve_preset", "shape")
1072 sculpt_tool = brush.sculpt_tool
1074 if sculpt_tool != 'GRAB':
1075 layout.prop_menu_enum(brush, "stroke_method")
1077 if sculpt_tool in {'DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'}:
1078 layout.prop_menu_enum(brush, "direction")
1080 if sculpt_tool == 'LAYER':
1081 layout.prop(brush, "use_persistent")
1082 layout.operator("sculpt.set_persistent_base")
1085 layout.prop(sculpt, "use_threaded", text="Threaded Sculpt")
1086 layout.prop(sculpt, "show_brush")
1088 # TODO, make availabel from paint menu!
1089 layout.prop(tool_settings, "sculpt_paint_use_unified_size", text="Unify Size")
1090 layout.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Unify Strength")
1092 # ********** Particle menu **********
1095 class VIEW3D_MT_particle(bpy.types.Menu):
1096 bl_label = "Particle"
1098 def draw(self, context):
1099 layout = self.layout
1101 particle_edit = context.tool_settings.particle_edit
1103 layout.operator("ed.undo")
1104 layout.operator("ed.redo")
1108 layout.operator("particle.mirror")
1112 layout.operator("particle.remove_doubles")
1113 layout.operator("particle.delete")
1115 if particle_edit.select_mode == 'POINT':
1116 layout.operator("particle.subdivide")
1118 layout.operator("particle.rekey")
1119 layout.operator("particle.weight_set")
1123 layout.menu("VIEW3D_MT_particle_showhide")
1126 class VIEW3D_MT_particle_specials(bpy.types.Menu):
1127 bl_label = "Specials"
1129 def draw(self, context):
1130 layout = self.layout
1131 particle_edit = context.tool_settings.particle_edit
1133 layout.operator("particle.rekey")
1136 if particle_edit.select_mode == 'POINT':
1137 layout.operator("particle.subdivide")
1138 layout.operator("particle.select_roots")
1139 layout.operator("particle.select_tips")
1141 layout.operator("particle.remove_doubles")
1144 class VIEW3D_MT_particle_showhide(ShowHideMenu, bpy.types.Menu):
1145 _operator_name = "particle"
1147 # ********** Pose Menu **********
1150 class VIEW3D_MT_pose(bpy.types.Menu):
1153 def draw(self, context):
1154 layout = self.layout
1156 layout.operator("ed.undo")
1157 layout.operator("ed.redo")
1161 layout.menu("VIEW3D_MT_transform")
1163 layout.menu("VIEW3D_MT_pose_transform")
1164 layout.menu("VIEW3D_MT_pose_apply")
1166 layout.menu("VIEW3D_MT_snap")
1170 layout.menu("VIEW3D_MT_object_animation")
1174 layout.menu("VIEW3D_MT_pose_slide")
1175 layout.menu("VIEW3D_MT_pose_propagate")
1179 layout.operator("pose.copy")
1180 layout.operator("pose.paste")
1181 layout.operator("pose.paste", text="Paste X-Flipped Pose").flipped = True
1185 layout.menu("VIEW3D_MT_pose_library")
1186 layout.menu("VIEW3D_MT_pose_motion")
1187 layout.menu("VIEW3D_MT_pose_group")
1191 layout.menu("VIEW3D_MT_object_parent")
1192 layout.menu("VIEW3D_MT_pose_ik")
1193 layout.menu("VIEW3D_MT_pose_constraints")
1197 layout.operator_context = 'EXEC_AREA'
1198 layout.operator("pose.autoside_names", text="AutoName Left/Right").axis = 'XAXIS'
1199 layout.operator("pose.autoside_names", text="AutoName Front/Back").axis = 'YAXIS'
1200 layout.operator("pose.autoside_names", text="AutoName Top/Bottom").axis = 'ZAXIS'
1202 layout.operator("pose.flip_names")
1204 layout.operator("pose.quaternions_flip")
1208 layout.operator_context = 'INVOKE_AREA'
1209 layout.operator("pose.armature_layers", text="Change Armature Layers...")
1210 layout.operator("pose.bone_layers", text="Change Bone Layers...")
1214 layout.menu("VIEW3D_MT_pose_showhide")
1215 layout.operator_menu_enum("pose.flags_set", 'mode', text="Bone Settings")
1218 class VIEW3D_MT_pose_transform(bpy.types.Menu):
1219 bl_label = "Clear Transform"
1221 def draw(self, context):
1222 layout = self.layout
1224 layout.operator("pose.transforms_clear", text="All")
1226 layout.operator("pose.loc_clear", text="Location")
1227 layout.operator("pose.rot_clear", text="Rotation")
1228 layout.operator("pose.scale_clear", text="Scale")
1230 layout.label(text="Origin")
1233 class VIEW3D_MT_pose_slide(bpy.types.Menu):
1234 bl_label = "In-Betweens"
1236 def draw(self, context):
1237 layout = self.layout
1239 layout.operator("pose.push")
1240 layout.operator("pose.relax")
1241 layout.operator("pose.breakdown")
1244 class VIEW3D_MT_pose_propagate(bpy.types.Menu):
1245 bl_label = "Propagate"
1247 def draw(self, context):
1248 layout = self.layout
1250 layout.operator("pose.propagate")
1251 layout.operator("pose.propagate", text="To Next Keyframe").mode = 'NEXT_KEY'
1254 class VIEW3D_MT_pose_library(bpy.types.Menu):
1255 bl_label = "Pose Library"
1257 def draw(self, context):
1258 layout = self.layout
1260 layout.operator("poselib.browse_interactive", text="Browse Poses...")
1264 layout.operator("poselib.pose_add", text="Add Pose...")
1265 layout.operator("poselib.pose_rename", text="Rename Pose...")
1266 layout.operator("poselib.pose_remove", text="Remove Pose...")
1269 class VIEW3D_MT_pose_motion(bpy.types.Menu):
1270 bl_label = "Motion Paths"
1272 def draw(self, context):
1273 layout = self.layout
1275 layout.operator("pose.paths_calculate", text="Calculate")
1276 layout.operator("pose.paths_clear", text="Clear")
1279 class VIEW3D_MT_pose_group(bpy.types.Menu):
1280 bl_label = "Bone Groups"
1282 def draw(self, context):
1283 layout = self.layout
1284 layout.operator("pose.group_add")
1285 layout.operator("pose.group_remove")
1289 layout.operator("pose.group_assign")
1290 layout.operator("pose.group_unassign")
1293 class VIEW3D_MT_pose_ik(bpy.types.Menu):
1294 bl_label = "Inverse Kinematics"
1296 def draw(self, context):
1297 layout = self.layout
1299 layout.operator("pose.ik_add")
1300 layout.operator("pose.ik_clear")
1303 class VIEW3D_MT_pose_constraints(bpy.types.Menu):
1304 bl_label = "Constraints"
1306 def draw(self, context):
1307 layout = self.layout
1309 layout.operator("pose.constraint_add_with_targets", text="Add (With Targets)...")
1310 layout.operator("pose.constraints_copy")
1311 layout.operator("pose.constraints_clear")
1314 class VIEW3D_MT_pose_showhide(ShowHideMenu, bpy.types.Menu):
1315 _operator_name = "pose"
1318 class VIEW3D_MT_pose_apply(bpy.types.Menu):
1321 def draw(self, context):
1322 layout = self.layout
1324 layout.operator("pose.armature_apply")
1325 layout.operator("pose.visual_transform_apply")
1328 # ********** Edit Menus, suffix from ob.type **********
1331 class VIEW3D_MT_edit_mesh(bpy.types.Menu):
1334 def draw(self, context):
1335 layout = self.layout
1337 settings = context.tool_settings
1339 layout.operator("ed.undo")
1340 layout.operator("ed.redo")
1344 layout.menu("VIEW3D_MT_transform")
1345 layout.menu("VIEW3D_MT_mirror")
1346 layout.menu("VIEW3D_MT_snap")
1350 layout.menu("VIEW3D_MT_uv_map", text="UV Unwrap...")
1354 layout.operator("view3d.edit_mesh_extrude_move_normal", text="Extrude Region")
1355 layout.operator("view3d.edit_mesh_extrude_individual_move", text="Extrude Individual")
1356 layout.operator("mesh.duplicate_move")
1357 layout.operator("mesh.delete", text="Delete...")
1361 layout.menu("VIEW3D_MT_edit_mesh_vertices")
1362 layout.menu("VIEW3D_MT_edit_mesh_edges")
1363 layout.menu("VIEW3D_MT_edit_mesh_faces")
1364 layout.menu("VIEW3D_MT_edit_mesh_normals")
1368 layout.prop(settings, "use_mesh_automerge")
1369 layout.prop_menu_enum(settings, "proportional_edit")
1370 layout.prop_menu_enum(settings, "proportional_edit_falloff")
1374 layout.menu("VIEW3D_MT_edit_mesh_showhide")
1377 class VIEW3D_MT_edit_mesh_specials(bpy.types.Menu):
1378 bl_label = "Specials"
1380 def draw(self, context):
1381 layout = self.layout
1383 layout.operator_context = 'INVOKE_REGION_WIN'
1385 layout.operator("mesh.subdivide", text="Subdivide")
1386 layout.operator("mesh.subdivide", text="Subdivide Smooth").smoothness = 1.0
1387 layout.operator("mesh.merge", text="Merge...")
1388 layout.operator("mesh.remove_doubles")
1389 layout.operator("mesh.hide", text="Hide")
1390 layout.operator("mesh.reveal", text="Reveal")
1391 layout.operator("mesh.select_inverse")
1392 layout.operator("mesh.flip_normals")
1393 layout.operator("mesh.vertices_smooth", text="Smooth")
1394 # layout.operator("mesh.bevel", text="Bevel")
1395 layout.operator("mesh.faces_shade_smooth")
1396 layout.operator("mesh.faces_shade_flat")
1397 layout.operator("mesh.blend_from_shape")
1398 layout.operator("mesh.shape_propagate_to_all")
1399 layout.operator("mesh.select_vertex_path")
1402 class VIEW3D_MT_edit_mesh_select_mode(bpy.types.Menu):
1403 bl_label = "Mesh Select Mode"
1405 def draw(self, context):
1406 layout = self.layout
1408 layout.operator_context = 'INVOKE_REGION_WIN'
1410 prop = layout.operator("wm.context_set_value", text="Vertex", icon='VERTEXSEL')
1411 prop.value = "(True, False, False)"
1412 prop.data_path = "tool_settings.mesh_select_mode"
1414 prop = layout.operator("wm.context_set_value", text="Edge", icon='EDGESEL')
1415 prop.value = "(False, True, False)"
1416 prop.data_path = "tool_settings.mesh_select_mode"
1418 prop = layout.operator("wm.context_set_value", text="Face", icon='FACESEL')
1419 prop.value = "(False, False, True)"
1420 prop.data_path = "tool_settings.mesh_select_mode"
1423 class VIEW3D_MT_edit_mesh_extrude(bpy.types.Menu):
1424 bl_label = "Extrude"
1426 _extrude_funcs = { \
1427 "VERT": lambda layout: layout.operator("mesh.extrude_vertices_move", text="Vertices Only"),
1428 "EDGE": lambda layout: layout.operator("mesh.extrude_edges_move", text="Edges Only"),
1429 "FACE": lambda layout: layout.operator("mesh.extrude_faces_move", text="Individual Faces"),
1430 "REGION": lambda layout: layout.operator("view3d.edit_mesh_extrude_move_normal", text="Region"),
1434 def extrude_options(context):
1435 mesh = context.object.data
1436 select_mode = context.tool_settings.mesh_select_mode
1439 if mesh.total_face_sel:
1440 menu += ["REGION", "FACE"]
1441 if mesh.total_edge_sel and (select_mode[0] or select_mode[1]):
1443 if mesh.total_vert_sel and select_mode[0]:
1446 # should never get here
1449 def draw(self, context):
1450 layout = self.layout
1451 layout.operator_context = 'INVOKE_REGION_WIN'
1453 for menu_id in self.extrude_options(context):
1454 self._extrude_funcs[menu_id](layout)
1457 class VIEW3D_OT_edit_mesh_extrude_individual_move(bpy.types.Operator):
1458 "Extrude individual elements and move"
1459 bl_label = "Extrude Individual and Move"
1460 bl_idname = "view3d.edit_mesh_extrude_individual_move"
1462 def execute(self, context):
1463 mesh = context.object.data
1464 select_mode = context.tool_settings.mesh_select_mode
1466 totface = mesh.total_face_sel
1467 totedge = mesh.total_edge_sel
1468 # totvert = mesh.total_vert_sel
1470 if select_mode[2] and totface == 1:
1471 bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": 'NORMAL', "constraint_axis": (False, False, True)})
1472 elif select_mode[2] and totface > 1:
1473 bpy.ops.mesh.extrude_faces_move('INVOKE_REGION_WIN')
1474 elif select_mode[1] and totedge >= 1:
1475 bpy.ops.mesh.extrude_edges_move('INVOKE_REGION_WIN')
1477 bpy.ops.mesh.extrude_vertices_move('INVOKE_REGION_WIN')
1479 # ignore return from operators above because they are 'RUNNING_MODAL', and cause this one not to be freed. [#24671]
1482 def invoke(self, context, event):
1483 return self.execute(context)
1486 class VIEW3D_OT_edit_mesh_extrude_move(bpy.types.Operator):
1487 "Extrude and move along normals"
1488 bl_label = "Extrude and Move on Normals"
1489 bl_idname = "view3d.edit_mesh_extrude_move_normal"
1491 def execute(self, context):
1492 mesh = context.object.data
1494 totface = mesh.total_face_sel
1495 totedge = mesh.total_edge_sel
1496 # totvert = mesh.total_vert_sel
1499 bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": 'NORMAL', "constraint_axis": (False, False, True)})
1501 bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": 'NORMAL', "constraint_axis": (True, True, False)})
1503 bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN')
1505 # ignore return from operators above because they are 'RUNNING_MODAL', and cause this one not to be freed. [#24671]
1508 def invoke(self, context, event):
1509 return self.execute(context)
1512 class VIEW3D_MT_edit_mesh_vertices(bpy.types.Menu):
1513 bl_label = "Vertices"
1515 def draw(self, context):
1516 layout = self.layout
1517 layout.operator_context = 'INVOKE_REGION_WIN'
1519 layout.operator("mesh.merge")
1520 layout.operator("mesh.rip_move")
1521 layout.operator("mesh.split")
1522 layout.operator("mesh.separate")
1526 layout.operator("mesh.vertices_smooth")
1527 layout.operator("mesh.remove_doubles")
1528 layout.operator("mesh.vertices_sort")
1529 layout.operator("mesh.vertices_randomize")
1531 layout.operator("mesh.select_vertex_path")
1533 layout.operator("mesh.blend_from_shape")
1535 layout.operator("object.vertex_group_blend")
1536 layout.operator("mesh.shape_propagate_to_all")
1540 layout.menu("VIEW3D_MT_vertex_group")
1541 layout.menu("VIEW3D_MT_hook")
1544 class VIEW3D_MT_edit_mesh_edges(bpy.types.Menu):
1547 def draw(self, context):
1548 layout = self.layout
1549 layout.operator_context = 'INVOKE_REGION_WIN'
1551 layout.operator("mesh.edge_face_add")
1552 layout.operator("mesh.subdivide")
1556 layout.operator("mesh.mark_seam")
1557 layout.operator("mesh.mark_seam", text="Clear Seam").clear = True
1561 layout.operator("mesh.mark_sharp")
1562 layout.operator("mesh.mark_sharp", text="Clear Sharp").clear = True
1566 layout.operator("mesh.edge_rotate", text="Rotate Edge CW").direction = 'CW'
1567 layout.operator("mesh.edge_rotate", text="Rotate Edge CCW").direction = 'CCW'
1571 layout.operator("TRANSFORM_OT_edge_slide")
1572 layout.operator("TRANSFORM_OT_edge_crease")
1573 layout.operator("mesh.loop_multi_select", text="Edge Loop")
1575 # uiItemO(layout, "Loopcut", 0, "mesh.loop_cut"); // CutEdgeloop(em, 1);
1576 # uiItemO(layout, "Edge Slide", 0, "mesh.edge_slide"); // EdgeSlide(em, 0,0.0);
1578 layout.operator("mesh.loop_multi_select", text="Edge Ring").ring = True
1580 layout.operator("mesh.loop_to_region")
1581 layout.operator("mesh.region_to_loop")
1584 class VIEW3D_MT_edit_mesh_faces(bpy.types.Menu):
1586 bl_idname = "VIEW3D_MT_edit_mesh_faces"
1588 def draw(self, context):
1589 layout = self.layout
1590 layout.operator_context = 'INVOKE_REGION_WIN'
1592 layout.operator("mesh.flip_normals")
1593 # layout.operator("mesh.bevel")
1594 # layout.operator("mesh.bevel")
1595 layout.operator("mesh.edge_face_add")
1596 layout.operator("mesh.fill")
1597 layout.operator("mesh.beautify_fill")
1598 layout.operator("mesh.solidify")
1599 layout.operator("mesh.sort_faces")
1603 layout.operator("mesh.fgon_make")
1604 layout.operator("mesh.fgon_clear")
1608 layout.operator("mesh.quads_convert_to_tris")
1609 layout.operator("mesh.tris_convert_to_quads")
1610 layout.operator("mesh.edge_flip")
1614 layout.operator("mesh.faces_shade_smooth")
1615 layout.operator("mesh.faces_shade_flat")
1619 # uiItemO(layout, NULL, 0, "mesh.face_mode"); // mesh_set_face_flags(em, 1);
1620 # uiItemBooleanO(layout, NULL, 0, "mesh.face_mode", "clear", 1); // mesh_set_face_flags(em, 0);
1622 layout.operator("mesh.edge_rotate", text="Rotate Edge CW").direction = 'CW'
1626 layout.operator_menu_enum("mesh.uvs_rotate", "direction")
1627 layout.operator_menu_enum("mesh.uvs_mirror", "axis")
1628 layout.operator_menu_enum("mesh.colors_rotate", "direction")
1629 layout.operator_menu_enum("mesh.colors_mirror", "axis")
1632 class VIEW3D_MT_edit_mesh_normals(bpy.types.Menu):
1633 bl_label = "Normals"
1635 def draw(self, context):
1636 layout = self.layout
1638 layout.operator("mesh.normals_make_consistent", text="Recalculate Outside")
1639 layout.operator("mesh.normals_make_consistent", text="Recalculate Inside").inside = True
1643 layout.operator("mesh.flip_normals")
1646 class VIEW3D_MT_edit_mesh_showhide(ShowHideMenu, bpy.types.Menu):
1647 _operator_name = "mesh"
1650 # draw_curve is used by VIEW3D_MT_edit_curve and VIEW3D_MT_edit_surface
1653 def draw_curve(self, context):
1654 layout = self.layout
1656 settings = context.tool_settings
1658 layout.menu("VIEW3D_MT_transform")
1659 layout.menu("VIEW3D_MT_mirror")
1660 layout.menu("VIEW3D_MT_snap")
1664 layout.operator("curve.extrude")
1665 layout.operator("curve.duplicate")
1666 layout.operator("curve.separate")
1667 layout.operator("curve.make_segment")
1668 layout.operator("curve.cyclic_toggle")
1669 layout.operator("curve.delete", text="Delete...")
1673 layout.menu("VIEW3D_MT_edit_curve_ctrlpoints")
1674 layout.menu("VIEW3D_MT_edit_curve_segments")
1678 layout.prop_menu_enum(settings, "proportional_edit")
1679 layout.prop_menu_enum(settings, "proportional_edit_falloff")
1683 layout.menu("VIEW3D_MT_edit_curve_showhide")
1686 class VIEW3D_MT_edit_curve(bpy.types.Menu):
1692 class VIEW3D_MT_edit_curve_ctrlpoints(bpy.types.Menu):
1693 bl_label = "Control Points"
1695 def draw(self, context):
1696 layout = self.layout
1698 edit_object = context.edit_object
1700 if edit_object.type == 'CURVE':
1701 layout.operator("transform.transform", text="Tilt").mode = 'TILT'
1702 layout.operator("curve.tilt_clear")
1703 layout.operator("curve.separate")
1707 layout.operator_menu_enum("curve.handle_type_set", "type")
1711 layout.menu("VIEW3D_MT_hook")
1714 class VIEW3D_MT_edit_curve_segments(bpy.types.Menu):
1715 bl_label = "Segments"
1717 def draw(self, context):
1718 layout = self.layout
1720 layout.operator("curve.subdivide")
1721 layout.operator("curve.switch_direction")
1724 class VIEW3D_MT_edit_curve_specials(bpy.types.Menu):
1725 bl_label = "Specials"
1727 def draw(self, context):
1728 layout = self.layout
1730 layout.operator("curve.subdivide")
1731 layout.operator("curve.switch_direction")
1732 layout.operator("curve.spline_weight_set")
1733 layout.operator("curve.radius_set")
1734 layout.operator("curve.smooth")
1735 layout.operator("curve.smooth_radius")
1738 class VIEW3D_MT_edit_curve_showhide(ShowHideMenu, bpy.types.Menu):
1739 _operator_name = "curve"
1742 class VIEW3D_MT_edit_surface(bpy.types.Menu):
1743 bl_label = "Surface"
1748 class VIEW3D_MT_edit_font(bpy.types.Menu):
1751 def draw(self, context):
1752 layout = self.layout
1754 layout.operator("font.file_paste")
1758 layout.menu("VIEW3D_MT_edit_text_chars")
1762 layout.operator("font.style_toggle", text="Toggle Bold").style = 'BOLD'
1763 layout.operator("font.style_toggle", text="Toggle Italic").style = 'ITALIC'
1764 layout.operator("font.style_toggle", text="Toggle Underline").style = 'UNDERLINE'
1765 layout.operator("font.style_toggle", text="Toggle Small Caps").style = 'SMALL_CAPS'
1768 class VIEW3D_MT_edit_text_chars(bpy.types.Menu):
1769 bl_label = "Special Characters"
1771 def draw(self, context):
1772 layout = self.layout
1774 layout.operator("font.text_insert", text="Copyright|Alt C").text = b'\xC2\xA9'.decode()
1775 layout.operator("font.text_insert", text="Registered Trademark|Alt R").text = b'\xC2\xAE'.decode()
1779 layout.operator("font.text_insert", text="Degree Sign|Alt G").text = b'\xC2\xB0'.decode()
1780 layout.operator("font.text_insert", text="Multiplication Sign|Alt x").text = b'\xC3\x97'.decode()
1781 layout.operator("font.text_insert", text="Circle|Alt .").text = b'\xC2\x8A'.decode()
1782 layout.operator("font.text_insert", text="Superscript 1|Alt 1").text = b'\xC2\xB9'.decode()
1783 layout.operator("font.text_insert", text="Superscript 2|Alt 2").text = b'\xC2\xB2'.decode()
1784 layout.operator("font.text_insert", text="Superscript 3|Alt 3").text = b'\xC2\xB3'.decode()
1785 layout.operator("font.text_insert", text="Double >>|Alt >").text = b'\xC2\xBB'.decode()
1786 layout.operator("font.text_insert", text="Double <<|Alt <").text = b'\xC2\xAB'.decode()
1787 layout.operator("font.text_insert", text="Promillage|Alt %").text = b'\xE2\x80\xB0'.decode()
1791 layout.operator("font.text_insert", text="Dutch Florin|Alt F").text = b'\xC2\xA4'.decode()
1792 layout.operator("font.text_insert", text="British Pound|Alt L").text = b'\xC2\xA3'.decode()
1793 layout.operator("font.text_insert", text="Japanese Yen|Alt Y").text = b'\xC2\xA5'.decode()
1797 layout.operator("font.text_insert", text="German S|Alt S").text = b'\xC3\x9F'.decode()
1798 layout.operator("font.text_insert", text="Spanish Question Mark|Alt ?").text = b'\xC2\xBF'.decode()
1799 layout.operator("font.text_insert", text="Spanish Exclamation Mark|Alt !").text = b'\xC2\xA1'.decode()
1802 class VIEW3D_MT_edit_meta(bpy.types.Menu):
1803 bl_label = "Metaball"
1805 def draw(self, context):
1806 layout = self.layout
1808 settings = context.tool_settings
1810 layout.operator("ed.undo")
1811 layout.operator("ed.redo")
1815 layout.menu("VIEW3D_MT_transform")
1816 layout.menu("VIEW3D_MT_mirror")
1817 layout.menu("VIEW3D_MT_snap")
1821 layout.operator("mball.delete_metaelems", text="Delete...")
1822 layout.operator("mball.duplicate_metaelems")
1826 layout.prop_menu_enum(settings, "proportional_edit")
1827 layout.prop_menu_enum(settings, "proportional_edit_falloff")
1831 layout.menu("VIEW3D_MT_edit_meta_showhide")
1834 class VIEW3D_MT_edit_meta_showhide(bpy.types.Menu):
1835 bl_label = "Show/Hide"
1837 def draw(self, context):
1838 layout = self.layout
1840 layout.operator("mball.reveal_metaelems", text="Show Hidden")
1841 layout.operator("mball.hide_metaelems", text="Hide Selected")
1842 layout.operator("mball.hide_metaelems", text="Hide Unselected").unselected = True
1845 class VIEW3D_MT_edit_lattice(bpy.types.Menu):
1846 bl_label = "Lattice"
1848 def draw(self, context):
1849 layout = self.layout
1851 settings = context.tool_settings
1853 layout.menu("VIEW3D_MT_transform")
1854 layout.menu("VIEW3D_MT_mirror")
1855 layout.menu("VIEW3D_MT_snap")
1859 layout.operator("lattice.make_regular")
1863 layout.prop_menu_enum(settings, "proportional_edit")
1864 layout.prop_menu_enum(settings, "proportional_edit_falloff")
1867 class VIEW3D_MT_edit_armature(bpy.types.Menu):
1868 bl_label = "Armature"
1870 def draw(self, context):
1871 layout = self.layout
1873 edit_object = context.edit_object
1874 arm = edit_object.data
1876 layout.menu("VIEW3D_MT_transform")
1877 layout.menu("VIEW3D_MT_mirror")
1878 layout.menu("VIEW3D_MT_snap")
1879 layout.menu("VIEW3D_MT_edit_armature_roll")
1883 layout.operator("armature.extrude_move")
1885 if arm.use_mirror_x:
1886 layout.operator("armature.extrude_forked")
1888 layout.operator("armature.duplicate_move")
1889 layout.operator("armature.merge")
1890 layout.operator("armature.fill")
1891 layout.operator("armature.delete")
1892 layout.operator("armature.separate")
1896 layout.operator("armature.subdivide", text="Subdivide")
1897 layout.operator("armature.switch_direction", text="Switch Direction")
1901 layout.operator_context = 'EXEC_AREA'
1902 layout.operator("armature.autoside_names", text="AutoName Left/Right").type = 'XAXIS'
1903 layout.operator("armature.autoside_names", text="AutoName Front/Back").type = 'YAXIS'
1904 layout.operator("armature.autoside_names", text="AutoName Top/Bottom").type = 'ZAXIS'
1905 layout.operator("armature.flip_names")
1909 layout.operator_context = 'INVOKE_DEFAULT'
1910 layout.operator("armature.armature_layers")
1911 layout.operator("armature.bone_layers")
1915 layout.menu("VIEW3D_MT_edit_armature_parent")
1919 layout.operator_menu_enum("armature.flags_set", "mode", text="Bone Settings")
1922 class VIEW3D_MT_armature_specials(bpy.types.Menu):
1923 bl_label = "Specials"
1925 def draw(self, context):
1926 layout = self.layout
1928 layout.operator_context = 'INVOKE_REGION_WIN'
1930 layout.operator("armature.subdivide", text="Subdivide")
1931 layout.operator("armature.switch_direction", text="Switch Direction")
1935 layout.operator_context = 'EXEC_REGION_WIN'
1936 layout.operator("armature.autoside_names", text="AutoName Left/Right").type = 'XAXIS'
1937 layout.operator("armature.autoside_names", text="AutoName Front/Back").type = 'YAXIS'
1938 layout.operator("armature.autoside_names", text="AutoName Top/Bottom").type = 'ZAXIS'
1939 layout.operator("armature.flip_names", text="Flip Names")
1942 class VIEW3D_MT_edit_armature_parent(bpy.types.Menu):
1945 def draw(self, context):
1946 layout = self.layout
1948 layout.operator("armature.parent_set", text="Make")
1949 layout.operator("armature.parent_clear", text="Clear")
1952 class VIEW3D_MT_edit_armature_roll(bpy.types.Menu):
1953 bl_label = "Bone Roll"
1955 def draw(self, context):
1956 layout = self.layout
1958 layout.operator_menu_enum("armature.calculate_roll", "type")
1962 layout.operator("transform.transform", text="Set Roll").mode = 'BONE_ROLL'
1964 # ********** Panel **********
1967 class VIEW3D_PT_view3d_properties(bpy.types.Panel):
1968 bl_space_type = 'VIEW_3D'
1969 bl_region_type = 'UI'
1973 def poll(cls, context):
1974 view = context.space_data
1977 def draw(self, context):
1978 layout = self.layout
1980 view = context.space_data
1982 col = layout.column()
1983 col.active = view.region_3d.view_perspective != 'CAMERA'
1984 col.prop(view, "lens")
1985 col.label(text="Lock to Object:")
1986 col.prop(view, "lock_object", text="")
1987 if view.lock_object and view.lock_object.type == 'ARMATURE':
1988 col.prop_search(view, "lock_bone", view.lock_object.data, "bones", text="")
1989 elif not view.lock_object:
1990 col.prop(view, "lock_cursor", text="Lock to Cursor")
1992 col = layout.column(align=True)
1993 col.label(text="Clip:")
1994 col.prop(view, "clip_start", text="Start")
1995 col.prop(view, "clip_end", text="End")
1997 subcol = col.column()
1998 subcol.enabled = not view.lock_camera_and_layers
1999 subcol.label(text="Local Camera:")
2000 subcol.prop(view, "camera", text="")
2002 layout.column().prop(view, "cursor_location")
2005 class VIEW3D_PT_view3d_name(bpy.types.Panel):
2006 bl_space_type = 'VIEW_3D'
2007 bl_region_type = 'UI'
2011 def poll(cls, context):
2012 return (context.space_data and context.active_object)
2014 def draw(self, context):
2015 layout = self.layout
2017 ob = context.active_object
2019 row.label(text="", icon='OBJECT_DATA')
2020 row.prop(ob, "name", text="")
2022 if ob.type == 'ARMATURE' and ob.mode in {'EDIT', 'POSE'}:
2023 bone = context.active_bone
2026 row.label(text="", icon='BONE_DATA')
2027 row.prop(bone, "name", text="")
2030 class VIEW3D_PT_view3d_display(bpy.types.Panel):
2031 bl_space_type = 'VIEW_3D'
2032 bl_region_type = 'UI'
2033 bl_label = "Display"
2034 bl_options = {'DEFAULT_CLOSED'}
2037 def poll(cls, context):
2038 view = context.space_data
2041 def draw(self, context):
2042 layout = self.layout
2044 view = context.space_data
2045 scene = context.scene
2046 gs = scene.game_settings
2049 col = layout.column()
2050 col.prop(view, "show_only_render")
2052 col = layout.column()
2053 display_all = not view.show_only_render
2054 col.active = display_all
2055 col.prop(view, "show_outline_selected")
2056 col.prop(view, "show_all_objects_origin")
2057 col.prop(view, "show_relationship_lines")
2058 if ob and ob.type == 'MESH':
2060 col.prop(mesh, "show_all_edges")
2062 col = layout.column()
2063 col.active = display_all
2064 split = col.split(percentage=0.55)
2065 split.prop(view, "show_floor", text="Grid Floor")
2067 row = split.row(align=True)
2068 row.prop(view, "show_axis_x", text="X", toggle=True)
2069 row.prop(view, "show_axis_y", text="Y", toggle=True)
2070 row.prop(view, "show_axis_z", text="Z", toggle=True)
2072 sub = col.column(align=True)
2073 sub.active = (display_all and view.show_floor)
2074 sub.prop(view, "grid_lines", text="Lines")
2075 sub.prop(view, "grid_scale", text="Scale")
2076 subsub = sub.column(align=True)
2077 subsub.active = scene.unit_settings.system == 'NONE'
2078 subsub.prop(view, "grid_subdivisions", text="Subdivisions")
2080 col = layout.column()
2081 col.label(text="Shading:")
2082 col.prop(gs, "material_mode", text="")
2083 col.prop(view, "show_textured_solid")
2087 region = view.region_quadview
2089 layout.operator("screen.region_quadview", text="Toggle Quad View")
2092 col = layout.column()
2093 col.prop(region, "lock_rotation")
2095 row.enabled = region.lock_rotation
2096 row.prop(region, "show_sync_view")
2098 row.enabled = region.lock_rotation and region.show_sync_view
2099 row.prop(region, "use_box_clip")
2102 class VIEW3D_PT_view3d_meshdisplay(bpy.types.Panel):
2103 bl_space_type = 'VIEW_3D'
2104 bl_region_type = 'UI'
2105 bl_label = "Mesh Display"
2108 def poll(cls, context):
2109 # The active object check is needed because of localmode
2110 return (context.active_object and (context.mode == 'EDIT_MESH'))
2112 def draw(self, context):
2113 layout = self.layout
2115 mesh = context.active_object.data
2117 col = layout.column()
2118 col.label(text="Overlays:")
2119 col.prop(mesh, "show_edges", text="Edges")
2120 col.prop(mesh, "show_faces", text="Faces")
2121 col.prop(mesh, "show_edge_crease", text="Creases")
2122 col.prop(mesh, "show_edge_bevel_weight", text="Bevel Weights")
2123 col.prop(mesh, "show_edge_seams", text="Seams")
2124 col.prop(mesh, "show_edge_sharp", text="Sharp")
2127 col.label(text="Normals:")
2128 col.prop(mesh, "show_normal_face", text="Face")
2129 col.prop(mesh, "show_normal_vertex", text="Vertex")
2130 col.prop(context.scene.tool_settings, "normal_size", text="Normal Size")
2133 col.label(text="Numerics:")
2134 col.prop(mesh, "show_extra_edge_length")
2135 col.prop(mesh, "show_extra_face_angle")
2136 col.prop(mesh, "show_extra_face_area")
2139 class VIEW3D_PT_view3d_curvedisplay(bpy.types.Panel):
2140 bl_space_type = 'VIEW_3D'
2141 bl_region_type = 'UI'
2142 bl_label = "Curve Display"
2145 def poll(cls, context):
2146 editmesh = context.mode == 'EDIT_CURVE'
2149 def draw(self, context):
2150 layout = self.layout
2152 curve = context.active_object.data
2154 col = layout.column()
2155 col.label(text="Overlays:")
2156 col.prop(curve, "show_handles", text="Handles")
2157 col.prop(curve, "show_normal_face", text="Normals")
2158 col.prop(context.scene.tool_settings, "normal_size", text="Normal Size")
2161 class VIEW3D_PT_background_image(bpy.types.Panel):
2162 bl_space_type = 'VIEW_3D'
2163 bl_region_type = 'UI'
2164 bl_label = "Background Images"
2165 bl_options = {'DEFAULT_CLOSED'}
2168 def poll(cls, context):
2169 view = context.space_data
2170 # bg = context.space_data.background_image
2173 def draw_header(self, context):
2174 layout = self.layout
2175 view = context.space_data
2177 layout.prop(view, "show_background_images", text="")
2179 def draw(self, context):
2180 layout = self.layout
2182 view = context.space_data
2184 col = layout.column()
2185 col.operator("view3d.background_image_add", text="Add Image")
2187 for i, bg in enumerate(view.background_images):
2188 layout.active = view.show_background_images
2190 row = box.row(align=True)
2191 row.prop(bg, "show_expanded", text="", emboss=False)
2193 row.prop(bg.image, "name", text="", emboss=False)
2195 row.label(text="Not Set")
2196 row.operator("view3d.background_image_remove", text="", emboss=False, icon='X').index = i
2198 box.prop(bg, "view_axis", text="Axis")
2200 if bg.show_expanded:
2202 row.template_ID(bg, "image", open="image.open")
2204 box.template_image(bg, "image", bg.image_user, compact=True)
2206 box.prop(bg, "opacity", slider=True)
2207 if bg.view_axis != 'CAMERA':
2208 box.prop(bg, "size")
2209 row = box.row(align=True)
2210 row.prop(bg, "offset_x", text="X")
2211 row.prop(bg, "offset_y", text="Y")
2214 class VIEW3D_PT_transform_orientations(bpy.types.Panel):
2215 bl_space_type = 'VIEW_3D'
2216 bl_region_type = 'UI'
2217 bl_label = "Transform Orientations"
2218 bl_options = {'DEFAULT_CLOSED'}
2221 def poll(cls, context):
2222 view = context.space_data
2225 def draw(self, context):
2226 layout = self.layout
2228 view = context.space_data
2230 col = layout.column()
2232 col.prop(view, "transform_orientation")
2233 col.operator("transform.create_orientation", text="Create")
2235 orientation = view.current_orientation
2238 col.prop(orientation, "name")
2239 col.operator("transform.delete_orientation", text="Delete")
2242 class VIEW3D_PT_etch_a_ton(bpy.types.Panel):
2243 bl_space_type = 'VIEW_3D'
2244 bl_region_type = 'UI'
2245 bl_label = "Skeleton Sketching"
2246 bl_options = {'DEFAULT_CLOSED'}
2249 def poll(cls, context):
2250 scene = context.space_data
2251 ob = context.active_object
2252 return scene and ob and ob.type == 'ARMATURE' and ob.mode == 'EDIT'
2254 def draw_header(self, context):
2255 layout = self.layout
2256 toolsettings = context.scene.tool_settings
2258 layout.prop(toolsettings, "use_bone_sketching", text="")
2260 def draw(self, context):
2261 layout = self.layout
2262 toolsettings = context.scene.tool_settings
2264 col = layout.column()
2266 col.prop(toolsettings, "use_etch_quick")
2267 col.prop(toolsettings, "use_etch_overdraw")
2269 col.prop(toolsettings, "etch_convert_mode")
2271 if toolsettings.etch_convert_mode == 'LENGTH':
2272 col.prop(toolsettings, "etch_length_limit")
2273 elif toolsettings.etch_convert_mode == 'ADAPTIVE':
2274 col.prop(toolsettings, "etch_adaptive_limit")
2275 elif toolsettings.etch_convert_mode == 'FIXED':
2276 col.prop(toolsettings, "etch_subdivision_number")
2277 elif toolsettings.etch_convert_mode == 'RETARGET':
2278 col.prop(toolsettings, "etch_template")
2279 col.prop(toolsettings, "etch_roll_mode")
2280 col.prop(toolsettings, "use_etch_autoname")
2281 col.prop(toolsettings, "etch_number")
2282 col.prop(toolsettings, "etch_side")
2283 col.operator("sketch.convert", text="Convert")
2286 class VIEW3D_PT_context_properties(bpy.types.Panel):
2287 bl_space_type = 'VIEW_3D'
2288 bl_region_type = 'UI'
2289 bl_label = "Properties"
2290 bl_options = {'DEFAULT_CLOSED'}
2292 def _active_context_member(context):
2293 obj = context.object
2297 return "active_pose_bone"
2298 elif mode == 'EDIT' and obj.type == 'ARMATURE':
2299 return "active_bone"
2306 def poll(cls, context):
2307 member = cls._active_context_member(context)
2309 context_member = getattr(context, member)
2310 return context_member and context_member.keys()
2314 def draw(self, context):
2316 member = __class__._active_context_member(context)
2319 # Draw with no edit button
2320 rna_prop_ui.draw(self.layout, context, member, object, False)
2324 bpy.utils.register_module(__name__)
2328 bpy.utils.unregister_module(__name__)
2330 if __name__ == "__main__":