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_enums("view3d.view_orbit", "type")
324 layout.operator_enums("view3d.view_pan", "type")
328 layout.operator("view3d.zoom", text="Zoom In").delta = 1
329 layout.operator("view3d.zoom", text="Zoom Out").delta = -1
333 layout.operator("view3d.fly")
336 class VIEW3D_MT_view_align(bpy.types.Menu):
337 bl_label = "Align View"
339 def draw(self, context):
342 layout.menu("VIEW3D_MT_view_align_selected")
346 layout.operator("view3d.view_all", text="Center Cursor and View All").center = True
347 layout.operator("view3d.camera_to_view", text="Align Active Camera to View")
348 layout.operator("view3d.view_selected")
349 layout.operator("view3d.view_center_cursor")
352 class VIEW3D_MT_view_align_selected(bpy.types.Menu):
353 bl_label = "Align View to Selected"
355 def draw(self, context):
358 props = layout.operator("view3d.viewnumpad", text="Top")
359 props.align_active = True
361 props = layout.operator("view3d.viewnumpad", text="Bottom")
362 props.align_active = True
363 props.type = 'BOTTOM'
364 props = layout.operator("view3d.viewnumpad", text="Front")
365 props.align_active = True
367 props = layout.operator("view3d.viewnumpad", text="Back")
368 props.align_active = True
370 props = layout.operator("view3d.viewnumpad", text="Right")
371 props.align_active = True
373 props = layout.operator("view3d.viewnumpad", text="Left")
374 props.align_active = True
378 class VIEW3D_MT_view_cameras(bpy.types.Menu):
381 def draw(self, context):
384 layout.operator("view3d.object_as_camera")
385 layout.operator("view3d.viewnumpad", text="Active Camera").type = 'CAMERA'
387 # ********** Select menus, suffix from context.mode **********
390 class VIEW3D_MT_select_object(bpy.types.Menu):
393 def draw(self, context):
396 layout.operator("view3d.select_border")
397 layout.operator("view3d.select_circle")
401 layout.operator("object.select_all", text="Select/Deselect All")
402 layout.operator("object.select_inverse", text="Inverse")
403 layout.operator("object.select_random", text="Random")
404 layout.operator("object.select_mirror", text="Mirror")
405 layout.operator("object.select_by_layer", text="Select All by Layer")
406 layout.operator_menu_enum("object.select_by_type", "type", text="Select All by Type...")
407 layout.operator("object.select_camera", text="Select Camera")
411 layout.operator_menu_enum("object.select_grouped", "type", text="Grouped")
412 layout.operator_menu_enum("object.select_linked", "type", text="Linked")
413 layout.operator("object.select_pattern", text="Select Pattern...")
416 class VIEW3D_MT_select_pose(bpy.types.Menu):
419 def draw(self, context):
422 layout.operator("view3d.select_border")
426 layout.operator("pose.select_all", text="Select/Deselect All")
427 layout.operator("pose.select_inverse", text="Inverse")
428 layout.operator("pose.select_constraint_target", text="Constraint Target")
429 layout.operator("pose.select_linked", text="Linked")
433 layout.operator("pose.select_hierarchy", text="Parent").direction = 'PARENT'
434 layout.operator("pose.select_hierarchy", text="Child").direction = 'CHILD'
438 props = layout.operator("pose.select_hierarchy", text="Extend Parent")
440 props.direction = 'PARENT'
442 props = layout.operator("pose.select_hierarchy", text="Extend Child")
444 props.direction = 'CHILD'
448 layout.operator_menu_enum("pose.select_grouped", "type", text="Grouped")
449 layout.operator("object.select_pattern", text="Select Pattern...")
452 class VIEW3D_MT_select_particle(bpy.types.Menu):
455 def draw(self, context):
458 layout.operator("view3d.select_border")
462 layout.operator("particle.select_all", text="Select/Deselect All")
463 layout.operator("particle.select_linked")
464 layout.operator("particle.select_inverse")
468 layout.operator("particle.select_more")
469 layout.operator("particle.select_less")
473 layout.operator("particle.select_roots", text="Roots")
474 layout.operator("particle.select_tips", text="Tips")
477 class VIEW3D_MT_select_edit_mesh(bpy.types.Menu):
480 def draw(self, context):
483 layout.operator("view3d.select_border")
484 layout.operator("view3d.select_circle")
488 layout.operator("mesh.select_all", text="Select/Deselect All")
489 layout.operator("mesh.select_inverse", text="Inverse")
493 layout.operator("mesh.select_random", text="Random")
494 layout.operator("mesh.select_nth", text="Every N Number of Verts")
495 layout.operator("mesh.edges_select_sharp", text="Sharp Edges")
496 layout.operator("mesh.faces_select_linked_flat", text="Linked Flat Faces")
497 layout.operator("mesh.faces_select_interior", text="Interior Faces")
498 layout.operator("mesh.select_axis", text="Side of Active")
502 layout.operator("mesh.select_by_number_vertices", text="Triangles").type = 'TRIANGLES'
503 layout.operator("mesh.select_by_number_vertices", text="Quads").type = 'QUADS'
504 if context.scene.tool_settings.mesh_select_mode[2] == False:
505 layout.operator("mesh.select_non_manifold", text="Non Manifold")
506 layout.operator("mesh.select_by_number_vertices", text="Loose Verts/Edges").type = 'OTHER'
507 layout.operator("mesh.select_similar", text="Similar")
511 layout.operator("mesh.select_less", text="Less")
512 layout.operator("mesh.select_more", text="More")
516 layout.operator("mesh.select_mirror", text="Mirror")
518 layout.operator("mesh.select_linked", text="Linked")
519 layout.operator("mesh.select_vertex_path", text="Vertex Path")
520 layout.operator("mesh.loop_multi_select", text="Edge Loop")
521 layout.operator("mesh.loop_multi_select", text="Edge Ring").ring = True
525 layout.operator("mesh.loop_to_region")
526 layout.operator("mesh.region_to_loop")
529 class VIEW3D_MT_select_edit_curve(bpy.types.Menu):
532 def draw(self, context):
535 layout.operator("view3d.select_border")
536 layout.operator("view3d.select_circle")
540 layout.operator("curve.select_all", text="Select/Deselect All")
541 layout.operator("curve.select_inverse")
542 layout.operator("curve.select_random")
543 layout.operator("curve.select_nth", text="Every Nth Number of Points")
547 layout.operator("curve.de_select_first")
548 layout.operator("curve.de_select_last")
549 layout.operator("curve.select_next")
550 layout.operator("curve.select_previous")
554 layout.operator("curve.select_more")
555 layout.operator("curve.select_less")
558 class VIEW3D_MT_select_edit_surface(bpy.types.Menu):
561 def draw(self, context):
564 layout.operator("view3d.select_border")
565 layout.operator("view3d.select_circle")
569 layout.operator("curve.select_all", text="Select/Deselect All")
570 layout.operator("curve.select_inverse")
571 layout.operator("curve.select_random")
572 layout.operator("curve.select_nth", text="Every Nth Number of Points")
576 layout.operator("curve.select_row")
580 layout.operator("curve.select_more")
581 layout.operator("curve.select_less")
584 class VIEW3D_MT_select_edit_metaball(bpy.types.Menu):
587 def draw(self, context):
590 layout.operator("view3d.select_border")
594 layout.operator("mball.select_all").action = 'TOGGLE'
595 layout.operator("mball.select_inverse_metaelems")
599 layout.operator("mball.select_random_metaelems")
602 class VIEW3D_MT_select_edit_lattice(bpy.types.Menu):
605 def draw(self, context):
608 layout.operator("view3d.select_border")
612 layout.operator("lattice.select_all", text="Select/Deselect All")
615 class VIEW3D_MT_select_edit_armature(bpy.types.Menu):
618 def draw(self, context):
621 layout.operator("view3d.select_border")
625 layout.operator("armature.select_all", text="Select/Deselect All")
626 layout.operator("armature.select_inverse", text="Inverse")
630 layout.operator("armature.select_hierarchy", text="Parent").direction = 'PARENT'
631 layout.operator("armature.select_hierarchy", text="Child").direction = 'CHILD'
635 props = layout.operator("armature.select_hierarchy", text="Extend Parent")
637 props.direction = 'PARENT'
639 props = layout.operator("armature.select_hierarchy", text="Extend Child")
641 props.direction = 'CHILD'
643 layout.operator("object.select_pattern", text="Select Pattern...")
646 class VIEW3D_MT_select_face(bpy.types.Menu): # XXX no matching enum
649 def draw(self, context):
653 # see view3d_select_faceselmenu
655 # ********** Object menu **********
658 class VIEW3D_MT_object(bpy.types.Menu):
659 bl_context = "objectmode"
662 def draw(self, context):
665 layout.operator("ed.undo")
666 layout.operator("ed.redo")
670 layout.menu("VIEW3D_MT_transform")
671 layout.menu("VIEW3D_MT_mirror")
672 layout.menu("VIEW3D_MT_object_clear")
673 layout.menu("VIEW3D_MT_object_apply")
674 layout.menu("VIEW3D_MT_snap")
678 layout.menu("VIEW3D_MT_object_animation")
682 layout.operator("object.duplicate_move")
683 layout.operator("object.duplicate_move_linked")
684 layout.operator("object.delete", text="Delete...")
685 layout.operator("object.proxy_make", text="Make Proxy...")
686 layout.menu("VIEW3D_MT_make_links", text="Make Links...")
687 layout.operator("object.make_dupli_face")
688 layout.operator_menu_enum("object.make_local", "type", text="Make Local...")
689 layout.menu("VIEW3D_MT_make_single_user")
693 layout.menu("VIEW3D_MT_object_parent")
694 layout.menu("VIEW3D_MT_object_track")
695 layout.menu("VIEW3D_MT_object_group")
696 layout.menu("VIEW3D_MT_object_constraints")
700 layout.menu("VIEW3D_MT_object_game")
704 layout.operator("object.join_uvs")
705 layout.operator("object.join")
709 layout.operator("object.move_to_layer", text="Move to Layer...")
710 layout.menu("VIEW3D_MT_object_showhide")
712 layout.operator_menu_enum("object.convert", "target")
715 class VIEW3D_MT_object_animation(bpy.types.Menu):
716 bl_context = "objectmode"
717 bl_label = "Animation"
719 def draw(self, context):
722 layout.operator("anim.keyframe_insert_menu", text="Insert Keyframe...")
723 layout.operator("anim.keyframe_delete_v3d", text="Delete Keyframe...")
724 layout.operator("anim.keying_set_active_set", text="Change Keying Set...")
727 class VIEW3D_MT_object_clear(bpy.types.Menu):
730 def draw(self, context):
733 layout.operator("object.location_clear", text="Location")
734 layout.operator("object.rotation_clear", text="Rotation")
735 layout.operator("object.scale_clear", text="Scale")
736 layout.operator("object.origin_clear", text="Origin")
739 class VIEW3D_MT_object_specials(bpy.types.Menu):
740 bl_label = "Specials"
743 def poll(cls, context):
744 # add more special types
745 return context.object
747 def draw(self, context):
751 if obj.type == 'CAMERA':
752 layout.operator_context = 'INVOKE_REGION_WIN'
754 props = layout.operator("wm.context_modal_mouse", text="Camera Lens Angle")
755 props.data_path_iter = "selected_editable_objects"
756 props.data_path_item = "data.lens"
757 props.input_scale = 0.1
759 if not obj.data.dof_object:
760 #layout.label(text="Test Has DOF obj");
761 props = layout.operator("wm.context_modal_mouse", text="DOF Distance")
762 props.data_path_iter = "selected_editable_objects"
763 props.data_path_item = "data.dof_distance"
764 props.input_scale = 0.02
766 if obj.type in ('CURVE', 'FONT'):
767 layout.operator_context = 'INVOKE_REGION_WIN'
769 props = layout.operator("wm.context_modal_mouse", text="Extrude Size")
770 props.data_path_iter = "selected_editable_objects"
771 props.data_path_item = "data.extrude"
772 props.input_scale = 0.01
774 props = layout.operator("wm.context_modal_mouse", text="Width Size")
775 props.data_path_iter = "selected_editable_objects"
776 props.data_path_item = "data.offset"
777 props.input_scale = 0.01
779 if obj.type == 'EMPTY':
780 layout.operator_context = 'INVOKE_REGION_WIN'
782 props = layout.operator("wm.context_modal_mouse", text="Empty Draw Size")
783 props.data_path_iter = "selected_editable_objects"
784 props.data_path_item = "empty_draw_size"
785 props.input_scale = 0.01
787 if obj.type == 'LAMP':
788 layout.operator_context = 'INVOKE_REGION_WIN'
790 props = layout.operator("wm.context_modal_mouse", text="Energy")
791 props.data_path_iter = "selected_editable_objects"
792 props.data_path_item = "data.energy"
794 if obj.data.type in ('SPOT', 'AREA', 'POINT'):
795 props = layout.operator("wm.context_modal_mouse", text="Falloff Distance")
796 props.data_path_iter = "selected_editable_objects"
797 props.data_path_item = "data.distance"
798 props.input_scale = 0.1
800 if obj.data.type == 'SPOT':
802 props = layout.operator("wm.context_modal_mouse", text="Spot Size")
803 props.data_path_iter = "selected_editable_objects"
804 props.data_path_item = "data.spot_size"
805 props.input_scale = 0.01
807 props = layout.operator("wm.context_modal_mouse", text="Spot Blend")
808 props.data_path_iter = "selected_editable_objects"
809 props.data_path_item = "data.spot_blend"
810 props.input_scale = -0.01
812 props = layout.operator("wm.context_modal_mouse", text="Clip Start")
813 props.data_path_iter = "selected_editable_objects"
814 props.data_path_item = "data.shadow_buffer_clip_start"
815 props.input_scale = 0.05
817 props = layout.operator("wm.context_modal_mouse", text="Clip End")
818 props.data_path_iter = "selected_editable_objects"
819 props.data_path_item = "data.shadow_buffer_clip_end"
820 props.input_scale = 0.05
824 props = layout.operator("object.isolate_type_render")
825 props = layout.operator("object.hide_render_clear_all")
828 class VIEW3D_MT_object_apply(bpy.types.Menu):
831 def draw(self, context):
834 layout.operator("object.location_apply", text="Location")
835 layout.operator("object.rotation_apply", text="Rotation")
836 layout.operator("object.scale_apply", text="Scale")
838 layout.operator("object.visual_transform_apply", text="Visual Transform")
839 layout.operator("object.duplicates_make_real")
842 class VIEW3D_MT_object_parent(bpy.types.Menu):
845 def draw(self, context):
848 layout.operator("object.parent_set", text="Set")
849 layout.operator("object.parent_clear", text="Clear")
852 class VIEW3D_MT_object_track(bpy.types.Menu):
855 def draw(self, context):
858 layout.operator("object.track_set", text="Set")
859 layout.operator("object.track_clear", text="Clear")
862 class VIEW3D_MT_object_group(bpy.types.Menu):
865 def draw(self, context):
868 layout.operator("group.create")
869 layout.operator("group.objects_remove")
873 layout.operator("group.objects_add_active")
874 layout.operator("group.objects_remove_active")
877 class VIEW3D_MT_object_constraints(bpy.types.Menu):
878 bl_label = "Constraints"
880 def draw(self, context):
883 layout.operator("object.constraint_add_with_targets")
884 layout.operator("object.constraints_copy")
885 layout.operator("object.constraints_clear")
888 class VIEW3D_MT_object_showhide(bpy.types.Menu):
889 bl_label = "Show/Hide"
891 def draw(self, context):
894 layout.operator("object.hide_view_clear", text="Show Hidden")
895 layout.operator("object.hide_view_set", text="Hide Selected")
896 layout.operator("object.hide_view_set", text="Hide Unselected").unselected = True
899 class VIEW3D_MT_make_single_user(bpy.types.Menu):
900 bl_label = "Make Single User"
902 def draw(self, context):
905 props = layout.operator("object.make_single_user", text="Object")
908 props = layout.operator("object.make_single_user", text="Object & Data")
909 props.object = props.obdata = True
911 props = layout.operator("object.make_single_user", text="Object & Data & Materials+Tex")
912 props.object = props.obdata = props.material = props.texture = True
914 props = layout.operator("object.make_single_user", text="Materials+Tex")
915 props.material = props.texture = True
917 props = layout.operator("object.make_single_user", text="Object Animation")
918 props.animation = True
921 class VIEW3D_MT_make_links(bpy.types.Menu):
922 bl_label = "Make Links"
924 def draw(self, context):
927 if(len(bpy.data.scenes) > 10):
928 layout.operator_context = 'INVOKE_DEFAULT'
929 layout.operator("object.make_links_scene", text="Objects to Scene...", icon='OUTLINER_OB_EMPTY')
930 layout.operator("object.make_links_scene", text="Markers to Scene...", icon='OUTLINER_OB_EMPTY')
932 layout.operator_menu_enum("object.make_links_scene", "scene", text="Objects to Scene...")
933 layout.operator_menu_enum("marker.make_links_scene", "scene", text="Markers to Scene...")
935 layout.operator_enums("object.make_links_data", "type") # inline
938 class VIEW3D_MT_object_game(bpy.types.Menu):
941 def draw(self, context):
944 layout.operator("object.logic_bricks_copy", text="Copy Logic Bricks")
948 layout.operator("object.game_property_copy", text="Replace Properties").operation = 'REPLACE'
949 layout.operator("object.game_property_copy", text="Merge Properties").operation = 'MERGE'
950 layout.operator_menu_enum("object.game_property_copy", "property", text="Copy Properties...")
954 layout.operator("object.game_property_clear")
957 # ********** Vertex paint menu **********
960 class VIEW3D_MT_paint_vertex(bpy.types.Menu):
963 def draw(self, context):
966 layout.operator("ed.undo")
967 layout.operator("ed.redo")
971 layout.operator("paint.vertex_color_set")
972 layout.operator("paint.vertex_color_dirt")
975 class VIEW3D_MT_hook(bpy.types.Menu):
978 def draw(self, context):
980 layout.operator_context = 'EXEC_AREA'
981 layout.operator("object.hook_add_newob")
982 layout.operator("object.hook_add_selob")
984 if [mod.type == 'HOOK' for mod in context.active_object.modifiers]:
986 layout.operator_menu_enum("object.hook_assign", "modifier")
987 layout.operator_menu_enum("object.hook_remove", "modifier")
989 layout.operator_menu_enum("object.hook_select", "modifier")
990 layout.operator_menu_enum("object.hook_reset", "modifier")
991 layout.operator_menu_enum("object.hook_recenter", "modifier")
994 class VIEW3D_MT_vertex_group(bpy.types.Menu):
995 bl_label = "Vertex Groups"
997 def draw(self, context):
999 layout.operator_context = 'EXEC_AREA'
1000 layout.operator("object.vertex_group_assign", text="Assign to New Group").new = True
1002 ob = context.active_object
1003 if ob.mode == 'EDIT':
1004 if ob.vertex_groups.active:
1006 layout.operator("object.vertex_group_assign", text="Assign to Active Group")
1007 layout.operator("object.vertex_group_remove_from", text="Remove from Active Group")
1008 layout.operator("object.vertex_group_remove_from", text="Remove from All").all = True
1011 if ob.vertex_groups.active:
1012 layout.operator_menu_enum("object.vertex_group_set_active", "group", text="Set Active Group")
1013 layout.operator("object.vertex_group_remove", text="Remove Active Group")
1014 layout.operator("object.vertex_group_remove", text="Remove All Groups").all = True
1016 # ********** Weight paint menu **********
1019 class VIEW3D_MT_paint_weight(bpy.types.Menu):
1020 bl_label = "Weights"
1022 def draw(self, context):
1023 layout = self.layout
1025 layout.operator("ed.undo")
1026 layout.operator("ed.redo")
1030 layout.operator("paint.weight_from_bones", text="Assign Automatic From Bones").type = 'AUTOMATIC'
1031 layout.operator("paint.weight_from_bones", text="Assign From Bone Envelopes").type = 'ENVELOPES'
1035 layout.operator("object.vertex_group_normalize_all", text="Normalize All")
1036 layout.operator("object.vertex_group_normalize", text="Normalize")
1037 layout.operator("object.vertex_group_invert", text="Invert")
1038 layout.operator("object.vertex_group_clean", text="Clean")
1039 layout.operator("object.vertex_group_levels", text="Levels")
1041 # ********** Sculpt menu **********
1044 class VIEW3D_MT_sculpt(bpy.types.Menu):
1047 def draw(self, context):
1048 layout = self.layout
1050 tool_settings = context.tool_settings
1051 sculpt = tool_settings.sculpt
1052 brush = tool_settings.sculpt.brush
1054 layout.operator("ed.undo")
1055 layout.operator("ed.redo")
1059 layout.prop(sculpt, "use_symmetry_x")
1060 layout.prop(sculpt, "use_symmetry_y")
1061 layout.prop(sculpt, "use_symmetry_z")
1063 layout.prop(sculpt, "lock_x")
1064 layout.prop(sculpt, "lock_y")
1065 layout.prop(sculpt, "lock_z")
1067 layout.operator_menu_enum("brush.curve_preset", "shape")
1070 sculpt_tool = brush.sculpt_tool
1072 if sculpt_tool != 'GRAB':
1073 layout.prop(brush, "use_airbrush")
1075 if sculpt_tool != 'LAYER':
1076 layout.prop(brush, "use_anchor")
1078 if sculpt_tool in ('DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'):
1079 layout.prop_menu_enum(brush, "direction")
1081 if sculpt_tool == 'LAYER':
1082 layout.prop(brush, "use_persistent")
1083 layout.operator("sculpt.set_persistent_base")
1086 layout.prop(sculpt, "use_threaded", text="Threaded Sculpt")
1087 layout.prop(sculpt, "show_brush")
1089 # TODO, make availabel from paint menu!
1090 layout.prop(tool_settings, "sculpt_paint_use_unified_size", text="Unify Size")
1091 layout.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Unify Strength")
1093 # ********** Particle menu **********
1096 class VIEW3D_MT_particle(bpy.types.Menu):
1097 bl_label = "Particle"
1099 def draw(self, context):
1100 layout = self.layout
1102 particle_edit = context.tool_settings.particle_edit
1104 layout.operator("ed.undo")
1105 layout.operator("ed.redo")
1109 layout.operator("particle.mirror")
1113 layout.operator("particle.remove_doubles")
1114 layout.operator("particle.delete")
1116 if particle_edit.select_mode == 'POINT':
1117 layout.operator("particle.subdivide")
1119 layout.operator("particle.rekey")
1120 layout.operator("particle.weight_set")
1124 layout.menu("VIEW3D_MT_particle_showhide")
1127 class VIEW3D_MT_particle_specials(bpy.types.Menu):
1128 bl_label = "Specials"
1130 def draw(self, context):
1131 layout = self.layout
1132 particle_edit = context.tool_settings.particle_edit
1134 layout.operator("particle.rekey")
1137 if particle_edit.select_mode == 'POINT':
1138 layout.operator("particle.subdivide")
1139 layout.operator("particle.select_roots")
1140 layout.operator("particle.select_tips")
1142 layout.operator("particle.remove_doubles")
1145 class VIEW3D_MT_particle_showhide(ShowHideMenu, bpy.types.Menu):
1146 _operator_name = "particle"
1148 # ********** Pose Menu **********
1151 class VIEW3D_MT_pose(bpy.types.Menu):
1154 def draw(self, context):
1155 layout = self.layout
1157 arm = context.active_object.data
1159 layout.operator("ed.undo")
1160 layout.operator("ed.redo")
1164 layout.menu("VIEW3D_MT_transform")
1165 layout.menu("VIEW3D_MT_snap")
1167 layout.menu("VIEW3D_MT_pose_transform")
1171 layout.operator("anim.keyframe_insert_menu", text="Insert Keyframe...")
1172 layout.operator("anim.keyframe_delete_v3d", text="Delete Keyframe...")
1173 layout.operator("anim.keying_set_active_set", text="Change Keying Set...")
1177 layout.operator("pose.relax")
1181 layout.menu("VIEW3D_MT_pose_apply")
1185 layout.operator("pose.copy")
1186 layout.operator("pose.paste")
1187 layout.operator("pose.paste", text="Paste X-Flipped Pose").flipped = True
1191 layout.menu("VIEW3D_MT_pose_pose")
1192 layout.menu("VIEW3D_MT_pose_motion")
1193 layout.menu("VIEW3D_MT_pose_group")
1197 layout.menu("VIEW3D_MT_object_parent")
1198 layout.menu("VIEW3D_MT_pose_ik")
1199 layout.menu("VIEW3D_MT_pose_constraints")
1203 layout.operator_context = 'EXEC_AREA'
1204 layout.operator("pose.autoside_names", text="AutoName Left/Right").axis = 'XAXIS'
1205 layout.operator("pose.autoside_names", text="AutoName Front/Back").axis = 'YAXIS'
1206 layout.operator("pose.autoside_names", text="AutoName Top/Bottom").axis = 'ZAXIS'
1208 layout.operator("pose.flip_names")
1210 layout.operator("pose.quaternions_flip")
1214 layout.operator_context = 'INVOKE_AREA'
1215 layout.operator("pose.armature_layers", text="Change Armature Layers...")
1216 layout.operator("pose.bone_layers", text="Change Bone Layers...")
1220 layout.menu("VIEW3D_MT_pose_showhide")
1221 layout.operator_menu_enum("pose.flags_set", 'mode', text="Bone Settings")
1224 class VIEW3D_MT_pose_transform(bpy.types.Menu):
1225 bl_label = "Clear Transform"
1227 def draw(self, context):
1228 layout = self.layout
1230 layout.label(text="User Transform")
1232 layout.operator("pose.loc_clear", text="Location")
1233 layout.operator("pose.rot_clear", text="Rotation")
1234 layout.operator("pose.scale_clear", text="Scale")
1236 layout.label(text="Origin")
1239 class VIEW3D_MT_pose_pose(bpy.types.Menu):
1240 bl_label = "Pose Library"
1242 def draw(self, context):
1243 layout = self.layout
1245 layout.operator("poselib.browse_interactive", text="Browse Poses...")
1249 layout.operator("poselib.pose_add", text="Add Pose...")
1250 layout.operator("poselib.pose_rename", text="Rename Pose...")
1251 layout.operator("poselib.pose_remove", text="Remove Pose...")
1254 class VIEW3D_MT_pose_motion(bpy.types.Menu):
1255 bl_label = "Motion Paths"
1257 def draw(self, context):
1258 layout = self.layout
1260 layout.operator("pose.paths_calculate", text="Calculate")
1261 layout.operator("pose.paths_clear", text="Clear")
1264 class VIEW3D_MT_pose_group(bpy.types.Menu):
1265 bl_label = "Bone Groups"
1267 def draw(self, context):
1268 layout = self.layout
1269 layout.operator("pose.group_add")
1270 layout.operator("pose.group_remove")
1274 layout.operator("pose.group_assign")
1275 layout.operator("pose.group_unassign")
1278 class VIEW3D_MT_pose_ik(bpy.types.Menu):
1279 bl_label = "Inverse Kinematics"
1281 def draw(self, context):
1282 layout = self.layout
1284 layout.operator("pose.ik_add")
1285 layout.operator("pose.ik_clear")
1288 class VIEW3D_MT_pose_constraints(bpy.types.Menu):
1289 bl_label = "Constraints"
1291 def draw(self, context):
1292 layout = self.layout
1294 layout.operator("pose.constraint_add_with_targets", text="Add (With Targets)...")
1295 layout.operator("pose.constraints_copy")
1296 layout.operator("pose.constraints_clear")
1299 class VIEW3D_MT_pose_showhide(ShowHideMenu, bpy.types.Menu):
1300 _operator_name = "pose"
1303 class VIEW3D_MT_pose_apply(bpy.types.Menu):
1306 def draw(self, context):
1307 layout = self.layout
1309 layout.operator("pose.armature_apply")
1310 layout.operator("pose.visual_transform_apply")
1313 # ********** Edit Menus, suffix from ob.type **********
1316 class VIEW3D_MT_edit_mesh(bpy.types.Menu):
1319 def draw(self, context):
1320 layout = self.layout
1322 settings = context.tool_settings
1324 layout.operator("ed.undo")
1325 layout.operator("ed.redo")
1329 layout.menu("VIEW3D_MT_transform")
1330 layout.menu("VIEW3D_MT_mirror")
1331 layout.menu("VIEW3D_MT_snap")
1335 layout.menu("VIEW3D_MT_uv_map", text="UV Unwrap...")
1339 layout.operator("view3d.edit_mesh_extrude_move_normal", text="Extrude Region")
1340 layout.operator("view3d.edit_mesh_extrude_individual_move", text="Extrude Individual")
1341 layout.operator("mesh.duplicate_move")
1342 layout.operator("mesh.delete", text="Delete...")
1346 layout.menu("VIEW3D_MT_edit_mesh_vertices")
1347 layout.menu("VIEW3D_MT_edit_mesh_edges")
1348 layout.menu("VIEW3D_MT_edit_mesh_faces")
1349 layout.menu("VIEW3D_MT_edit_mesh_normals")
1353 layout.prop(settings, "use_mesh_automerge")
1354 layout.prop_menu_enum(settings, "proportional_edit")
1355 layout.prop_menu_enum(settings, "proportional_edit_falloff")
1359 layout.menu("VIEW3D_MT_edit_mesh_showhide")
1362 class VIEW3D_MT_edit_mesh_specials(bpy.types.Menu):
1363 bl_label = "Specials"
1365 def draw(self, context):
1366 layout = self.layout
1368 layout.operator_context = 'INVOKE_REGION_WIN'
1370 layout.operator("mesh.subdivide", text="Subdivide")
1371 layout.operator("mesh.subdivide", text="Subdivide Smooth").smoothness = 1.0
1372 layout.operator("mesh.merge", text="Merge...")
1373 layout.operator("mesh.remove_doubles")
1374 layout.operator("mesh.hide", text="Hide")
1375 layout.operator("mesh.reveal", text="Reveal")
1376 layout.operator("mesh.select_inverse")
1377 layout.operator("mesh.flip_normals")
1378 layout.operator("mesh.vertices_smooth", text="Smooth")
1379 # layout.operator("mesh.bevel", text="Bevel")
1380 layout.operator("mesh.faces_shade_smooth")
1381 layout.operator("mesh.faces_shade_flat")
1382 layout.operator("mesh.blend_from_shape")
1383 layout.operator("mesh.shape_propagate_to_all")
1384 layout.operator("mesh.select_vertex_path")
1387 class VIEW3D_MT_edit_mesh_select_mode(bpy.types.Menu):
1388 bl_label = "Mesh Select Mode"
1390 def draw(self, context):
1391 layout = self.layout
1393 layout.operator_context = 'INVOKE_REGION_WIN'
1395 prop = layout.operator("wm.context_set_value", text="Vertex", icon='VERTEXSEL')
1396 prop.value = "(True, False, False)"
1397 prop.data_path = "tool_settings.mesh_select_mode"
1399 prop = layout.operator("wm.context_set_value", text="Edge", icon='EDGESEL')
1400 prop.value = "(False, True, False)"
1401 prop.data_path = "tool_settings.mesh_select_mode"
1403 prop = layout.operator("wm.context_set_value", text="Face", icon='FACESEL')
1404 prop.value = "(False, False, True)"
1405 prop.data_path = "tool_settings.mesh_select_mode"
1408 class VIEW3D_MT_edit_mesh_extrude(bpy.types.Menu):
1409 bl_label = "Extrude"
1411 _extrude_funcs = { \
1412 "VERT": lambda layout: layout.operator("mesh.extrude_vertices_move", text="Vertices Only"),
1413 "EDGE": lambda layout: layout.operator("mesh.extrude_edges_move", text="Edges Only"),
1414 "FACE": lambda layout: layout.operator("mesh.extrude_faces_move", text="Individual Faces"),
1415 "REGION": lambda layout: layout.operator("view3d.edit_mesh_extrude_move_normal", text="Region"),
1419 def extrude_options(context):
1420 mesh = context.object.data
1421 select_mode = context.tool_settings.mesh_select_mode
1424 if mesh.total_face_sel:
1425 menu += ["REGION", "FACE"]
1426 if mesh.total_edge_sel and (select_mode[0] or select_mode[1]):
1428 if mesh.total_vert_sel and select_mode[0]:
1431 # should never get here
1434 def draw(self, context):
1435 layout = self.layout
1436 layout.operator_context = 'INVOKE_REGION_WIN'
1438 for menu_id in self.extrude_options(context):
1439 self._extrude_funcs[menu_id](layout)
1442 class VIEW3D_OT_edit_mesh_extrude_individual_move(bpy.types.Operator):
1443 "Extrude individual elements and move"
1444 bl_label = "Extrude Individual and Move"
1445 bl_idname = "view3d.edit_mesh_extrude_individual_move"
1447 def execute(self, context):
1448 mesh = context.object.data
1449 select_mode = context.tool_settings.mesh_select_mode
1451 totface = mesh.total_face_sel
1452 totedge = mesh.total_edge_sel
1453 totvert = mesh.total_vert_sel
1455 if select_mode[2] and totface == 1:
1456 bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": 'NORMAL', "constraint_axis": (False, False, True)})
1457 elif select_mode[2] and totface > 1:
1458 bpy.ops.mesh.extrude_faces_move('INVOKE_REGION_WIN')
1459 elif select_mode[1] and totedge >= 1:
1460 bpy.ops.mesh.extrude_edges_move('INVOKE_REGION_WIN')
1462 bpy.ops.mesh.extrude_vertices_move('INVOKE_REGION_WIN')
1464 # ignore return from operators above because they are 'RUNNING_MODAL', and cause this one not to be freed. [#24671]
1467 def invoke(self, context, event):
1468 return self.execute(context)
1471 class VIEW3D_OT_edit_mesh_extrude_move(bpy.types.Operator):
1472 "Extrude and move along normals"
1473 bl_label = "Extrude and Move on Normals"
1474 bl_idname = "view3d.edit_mesh_extrude_move_normal"
1476 def execute(self, context):
1477 mesh = context.object.data
1479 totface = mesh.total_face_sel
1480 totedge = mesh.total_edge_sel
1481 totvert = mesh.total_vert_sel
1484 bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": 'NORMAL', "constraint_axis": (False, False, True)})
1486 bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": 'NORMAL', "constraint_axis": (True, True, False)})
1488 bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN')
1490 # ignore return from operators above because they are 'RUNNING_MODAL', and cause this one not to be freed. [#24671]
1493 def invoke(self, context, event):
1494 return self.execute(context)
1497 class VIEW3D_MT_edit_mesh_vertices(bpy.types.Menu):
1498 bl_label = "Vertices"
1500 def draw(self, context):
1501 layout = self.layout
1502 layout.operator_context = 'INVOKE_REGION_WIN'
1504 layout.operator("mesh.merge")
1505 layout.operator("mesh.rip_move")
1506 layout.operator("mesh.split")
1507 layout.operator("mesh.separate")
1511 layout.operator("mesh.vertices_smooth")
1512 layout.operator("mesh.remove_doubles")
1514 layout.operator("mesh.select_vertex_path")
1516 layout.operator("mesh.blend_from_shape")
1518 layout.operator("object.vertex_group_blend")
1519 layout.operator("mesh.shape_propagate_to_all")
1523 layout.menu("VIEW3D_MT_vertex_group")
1524 layout.menu("VIEW3D_MT_hook")
1527 class VIEW3D_MT_edit_mesh_edges(bpy.types.Menu):
1530 def draw(self, context):
1531 layout = self.layout
1532 layout.operator_context = 'INVOKE_REGION_WIN'
1534 layout.operator("mesh.edge_face_add")
1535 layout.operator("mesh.subdivide")
1539 layout.operator("mesh.mark_seam")
1540 layout.operator("mesh.mark_seam", text="Clear Seam").clear = True
1544 layout.operator("mesh.mark_sharp")
1545 layout.operator("mesh.mark_sharp", text="Clear Sharp").clear = True
1549 layout.operator("mesh.edge_rotate", text="Rotate Edge CW").direction = 'CW'
1550 layout.operator("mesh.edge_rotate", text="Rotate Edge CCW").direction = 'CCW'
1554 layout.operator("TRANSFORM_OT_edge_slide")
1555 layout.operator("TRANSFORM_OT_edge_crease")
1556 layout.operator("mesh.loop_multi_select", text="Edge Loop")
1558 # uiItemO(layout, "Loopcut", 0, "mesh.loop_cut"); // CutEdgeloop(em, 1);
1559 # uiItemO(layout, "Edge Slide", 0, "mesh.edge_slide"); // EdgeSlide(em, 0,0.0);
1561 layout.operator("mesh.loop_multi_select", text="Edge Ring").ring = True
1563 layout.operator("mesh.loop_to_region")
1564 layout.operator("mesh.region_to_loop")
1567 class VIEW3D_MT_edit_mesh_faces(bpy.types.Menu):
1569 bl_idname = "VIEW3D_MT_edit_mesh_faces"
1571 def draw(self, context):
1572 layout = self.layout
1573 layout.operator_context = 'INVOKE_REGION_WIN'
1575 layout.operator("mesh.flip_normals")
1576 # layout.operator("mesh.bevel")
1577 # layout.operator("mesh.bevel")
1578 layout.operator("mesh.edge_face_add")
1579 layout.operator("mesh.fill")
1580 layout.operator("mesh.beautify_fill")
1581 layout.operator("mesh.solidify")
1582 layout.operator("mesh.sort_faces")
1586 layout.operator("mesh.fgon_make")
1587 layout.operator("mesh.fgon_clear")
1591 layout.operator("mesh.quads_convert_to_tris")
1592 layout.operator("mesh.tris_convert_to_quads")
1593 layout.operator("mesh.edge_flip")
1597 layout.operator("mesh.faces_shade_smooth")
1598 layout.operator("mesh.faces_shade_flat")
1602 # uiItemO(layout, NULL, 0, "mesh.face_mode"); // mesh_set_face_flags(em, 1);
1603 # uiItemBooleanO(layout, NULL, 0, "mesh.face_mode", "clear", 1); // mesh_set_face_flags(em, 0);
1605 layout.operator("mesh.edge_rotate", text="Rotate Edge CW").direction = 'CW'
1609 layout.operator_menu_enum("mesh.uvs_rotate", "direction")
1610 layout.operator_menu_enum("mesh.uvs_mirror", "axis")
1611 layout.operator_menu_enum("mesh.colors_rotate", "direction")
1612 layout.operator_menu_enum("mesh.colors_mirror", "axis")
1615 class VIEW3D_MT_edit_mesh_normals(bpy.types.Menu):
1616 bl_label = "Normals"
1618 def draw(self, context):
1619 layout = self.layout
1621 layout.operator("mesh.normals_make_consistent", text="Recalculate Outside")
1622 layout.operator("mesh.normals_make_consistent", text="Recalculate Inside").inside = True
1626 layout.operator("mesh.flip_normals")
1629 class VIEW3D_MT_edit_mesh_showhide(ShowHideMenu, bpy.types.Menu):
1630 _operator_name = "mesh"
1633 # draw_curve is used by VIEW3D_MT_edit_curve and VIEW3D_MT_edit_surface
1636 def draw_curve(self, context):
1637 layout = self.layout
1639 settings = context.tool_settings
1641 layout.menu("VIEW3D_MT_transform")
1642 layout.menu("VIEW3D_MT_mirror")
1643 layout.menu("VIEW3D_MT_snap")
1647 layout.operator("curve.extrude")
1648 layout.operator("curve.duplicate")
1649 layout.operator("curve.separate")
1650 layout.operator("curve.make_segment")
1651 layout.operator("curve.cyclic_toggle")
1652 layout.operator("curve.delete", text="Delete...")
1656 layout.menu("VIEW3D_MT_edit_curve_ctrlpoints")
1657 layout.menu("VIEW3D_MT_edit_curve_segments")
1661 layout.prop_menu_enum(settings, "proportional_edit")
1662 layout.prop_menu_enum(settings, "proportional_edit_falloff")
1666 layout.menu("VIEW3D_MT_edit_curve_showhide")
1669 class VIEW3D_MT_edit_curve(bpy.types.Menu):
1675 class VIEW3D_MT_edit_curve_ctrlpoints(bpy.types.Menu):
1676 bl_label = "Control Points"
1678 def draw(self, context):
1679 layout = self.layout
1681 edit_object = context.edit_object
1683 if edit_object.type == 'CURVE':
1684 layout.operator("transform.transform", text="Tilt").mode = 'TILT'
1685 layout.operator("curve.tilt_clear")
1686 layout.operator("curve.separate")
1690 layout.operator_menu_enum("curve.handle_type_set", "type")
1694 layout.menu("VIEW3D_MT_hook")
1697 class VIEW3D_MT_edit_curve_segments(bpy.types.Menu):
1698 bl_label = "Segments"
1700 def draw(self, context):
1701 layout = self.layout
1703 layout.operator("curve.subdivide")
1704 layout.operator("curve.switch_direction")
1707 class VIEW3D_MT_edit_curve_specials(bpy.types.Menu):
1708 bl_label = "Specials"
1710 def draw(self, context):
1711 layout = self.layout
1713 layout.operator("curve.subdivide")
1714 layout.operator("curve.switch_direction")
1715 layout.operator("curve.spline_weight_set")
1716 layout.operator("curve.radius_set")
1717 layout.operator("curve.smooth")
1718 layout.operator("curve.smooth_radius")
1721 class VIEW3D_MT_edit_curve_showhide(ShowHideMenu, bpy.types.Menu):
1722 _operator_name = "curve"
1725 class VIEW3D_MT_edit_surface(bpy.types.Menu):
1726 bl_label = "Surface"
1731 class VIEW3D_MT_edit_font(bpy.types.Menu):
1734 def draw(self, context):
1735 layout = self.layout
1737 layout.operator("font.file_paste")
1741 layout.menu("VIEW3D_MT_edit_text_chars")
1745 layout.operator("font.style_toggle", text="Toggle Bold").style = 'BOLD'
1746 layout.operator("font.style_toggle", text="Toggle Italic").style = 'ITALIC'
1747 layout.operator("font.style_toggle", text="Toggle Underline").style = 'UNDERLINE'
1748 layout.operator("font.style_toggle", text="Toggle Small Caps").style = 'SMALL_CAPS'
1751 class VIEW3D_MT_edit_text_chars(bpy.types.Menu):
1752 bl_label = "Special Characters"
1754 def draw(self, context):
1755 layout = self.layout
1757 layout.operator("font.text_insert", text="Copyright|Alt C").text = b'\xC2\xA9'.decode()
1758 layout.operator("font.text_insert", text="Registered Trademark|Alt R").text = b'\xC2\xAE'.decode()
1762 layout.operator("font.text_insert", text="Degree Sign|Alt G").text = b'\xC2\xB0'.decode()
1763 layout.operator("font.text_insert", text="Multiplication Sign|Alt x").text = b'\xC3\x97'.decode()
1764 layout.operator("font.text_insert", text="Circle|Alt .").text = b'\xC2\x8A'.decode()
1765 layout.operator("font.text_insert", text="Superscript 1|Alt 1").text = b'\xC2\xB9'.decode()
1766 layout.operator("font.text_insert", text="Superscript 2|Alt 2").text = b'\xC2\xB2'.decode()
1767 layout.operator("font.text_insert", text="Superscript 3|Alt 3").text = b'\xC2\xB3'.decode()
1768 layout.operator("font.text_insert", text="Double >>|Alt >").text = b'\xC2\xBB'.decode()
1769 layout.operator("font.text_insert", text="Double <<|Alt <").text = b'\xC2\xAB'.decode()
1770 layout.operator("font.text_insert", text="Promillage|Alt %").text = b'\xE2\x80\xB0'.decode()
1774 layout.operator("font.text_insert", text="Dutch Florin|Alt F").text = b'\xC2\xA4'.decode()
1775 layout.operator("font.text_insert", text="British Pound|Alt L").text = b'\xC2\xA3'.decode()
1776 layout.operator("font.text_insert", text="Japanese Yen|Alt Y").text = b'\xC2\xA5'.decode()
1780 layout.operator("font.text_insert", text="German S|Alt S").text = b'\xC3\x9F'.decode()
1781 layout.operator("font.text_insert", text="Spanish Question Mark|Alt ?").text = b'\xC2\xBF'.decode()
1782 layout.operator("font.text_insert", text="Spanish Exclamation Mark|Alt !").text = b'\xC2\xA1'.decode()
1785 class VIEW3D_MT_edit_meta(bpy.types.Menu):
1786 bl_label = "Metaball"
1788 def draw(self, context):
1789 layout = self.layout
1791 settings = context.tool_settings
1793 layout.operator("ed.undo")
1794 layout.operator("ed.redo")
1798 layout.menu("VIEW3D_MT_transform")
1799 layout.menu("VIEW3D_MT_mirror")
1800 layout.menu("VIEW3D_MT_snap")
1804 layout.operator("mball.delete_metaelems", text="Delete...")
1805 layout.operator("mball.duplicate_metaelems")
1809 layout.prop_menu_enum(settings, "proportional_edit")
1810 layout.prop_menu_enum(settings, "proportional_edit_falloff")
1814 layout.menu("VIEW3D_MT_edit_meta_showhide")
1817 class VIEW3D_MT_edit_meta_showhide(bpy.types.Menu):
1818 bl_label = "Show/Hide"
1820 def draw(self, context):
1821 layout = self.layout
1823 layout.operator("mball.reveal_metaelems", text="Show Hidden")
1824 layout.operator("mball.hide_metaelems", text="Hide Selected")
1825 layout.operator("mball.hide_metaelems", text="Hide Unselected").unselected = True
1828 class VIEW3D_MT_edit_lattice(bpy.types.Menu):
1829 bl_label = "Lattice"
1831 def draw(self, context):
1832 layout = self.layout
1834 settings = context.tool_settings
1836 layout.menu("VIEW3D_MT_transform")
1837 layout.menu("VIEW3D_MT_mirror")
1838 layout.menu("VIEW3D_MT_snap")
1842 layout.operator("lattice.make_regular")
1846 layout.prop_menu_enum(settings, "proportional_edit")
1847 layout.prop_menu_enum(settings, "proportional_edit_falloff")
1850 class VIEW3D_MT_edit_armature(bpy.types.Menu):
1851 bl_label = "Armature"
1853 def draw(self, context):
1854 layout = self.layout
1856 edit_object = context.edit_object
1857 arm = edit_object.data
1859 layout.menu("VIEW3D_MT_transform")
1860 layout.menu("VIEW3D_MT_mirror")
1861 layout.menu("VIEW3D_MT_snap")
1862 layout.menu("VIEW3D_MT_edit_armature_roll")
1866 layout.operator("armature.extrude_move")
1868 if arm.use_mirror_x:
1869 layout.operator("armature.extrude_forked")
1871 layout.operator("armature.duplicate_move")
1872 layout.operator("armature.merge")
1873 layout.operator("armature.fill")
1874 layout.operator("armature.delete")
1875 layout.operator("armature.separate")
1879 layout.operator("armature.subdivide", text="Subdivide")
1880 layout.operator("armature.switch_direction", text="Switch Direction")
1884 layout.operator_context = 'EXEC_AREA'
1885 layout.operator("armature.autoside_names", text="AutoName Left/Right").type = 'XAXIS'
1886 layout.operator("armature.autoside_names", text="AutoName Front/Back").type = 'YAXIS'
1887 layout.operator("armature.autoside_names", text="AutoName Top/Bottom").type = 'ZAXIS'
1888 layout.operator("armature.flip_names")
1892 layout.operator_context = 'INVOKE_DEFAULT'
1893 layout.operator("armature.armature_layers")
1894 layout.operator("armature.bone_layers")
1898 layout.menu("VIEW3D_MT_edit_armature_parent")
1902 layout.operator_menu_enum("armature.flags_set", "mode", text="Bone Settings")
1905 class VIEW3D_MT_armature_specials(bpy.types.Menu):
1906 bl_label = "Specials"
1908 def draw(self, context):
1909 layout = self.layout
1911 layout.operator_context = 'INVOKE_REGION_WIN'
1913 layout.operator("armature.subdivide", text="Subdivide")
1914 layout.operator("armature.switch_direction", text="Switch Direction")
1918 layout.operator_context = 'EXEC_REGION_WIN'
1919 layout.operator("armature.autoside_names", text="AutoName Left/Right").type = 'XAXIS'
1920 layout.operator("armature.autoside_names", text="AutoName Front/Back").type = 'YAXIS'
1921 layout.operator("armature.autoside_names", text="AutoName Top/Bottom").type = 'ZAXIS'
1922 layout.operator("armature.flip_names", text="Flip Names")
1925 class VIEW3D_MT_edit_armature_parent(bpy.types.Menu):
1928 def draw(self, context):
1929 layout = self.layout
1931 layout.operator("armature.parent_set", text="Make")
1932 layout.operator("armature.parent_clear", text="Clear")
1935 class VIEW3D_MT_edit_armature_roll(bpy.types.Menu):
1936 bl_label = "Bone Roll"
1938 def draw(self, context):
1939 layout = self.layout
1941 layout.operator("armature.calculate_roll", text="Recalculate with Z-Axis Up").type = 'GLOBALUP'
1942 layout.operator("armature.calculate_roll", text="Recalculate with Z-Axis to Cursor").type = 'CURSOR'
1946 layout.operator("transform.transform", text="Set Roll").mode = 'BONE_ROLL'
1948 # ********** Panel **********
1951 class VIEW3D_PT_view3d_properties(bpy.types.Panel):
1952 bl_space_type = 'VIEW_3D'
1953 bl_region_type = 'UI'
1957 def poll(cls, context):
1958 view = context.space_data
1961 def draw(self, context):
1962 layout = self.layout
1964 view = context.space_data
1965 scene = context.scene
1967 col = layout.column()
1968 col.active = view.region_3d.view_perspective != 'CAMERA'
1969 col.prop(view, "lens")
1970 col.label(text="Lock to Object:")
1971 col.prop(view, "lock_object", text="")
1972 if view.lock_object and view.lock_object.type == 'ARMATURE':
1973 col.prop_search(view, "lock_bone", view.lock_object.data, "bones", text="")
1974 elif not view.lock_object:
1975 col.prop(view, "lock_cursor", text="Lock to Cursor")
1977 col = layout.column(align=True)
1978 col.label(text="Clip:")
1979 col.prop(view, "clip_start", text="Start")
1980 col.prop(view, "clip_end", text="End")
1982 subcol = col.column()
1983 subcol.enabled = not view.lock_camera_and_layers
1984 subcol.label(text="Local Camera:")
1985 subcol.prop(view, "camera", text="")
1987 layout.column().prop(view, "cursor_location")
1990 class VIEW3D_PT_view3d_name(bpy.types.Panel):
1991 bl_space_type = 'VIEW_3D'
1992 bl_region_type = 'UI'
1996 def poll(cls, context):
1997 return (context.space_data and context.active_object)
1999 def draw(self, context):
2000 layout = self.layout
2002 ob = context.active_object
2004 row.label(text="", icon='OBJECT_DATA')
2005 row.prop(ob, "name", text="")
2007 if ob.type == 'ARMATURE' and ob.mode in ('EDIT', 'POSE'):
2008 bone = context.active_bone
2011 row.label(text="", icon='BONE_DATA')
2012 row.prop(bone, "name", text="")
2015 class VIEW3D_PT_view3d_display(bpy.types.Panel):
2016 bl_space_type = 'VIEW_3D'
2017 bl_region_type = 'UI'
2018 bl_label = "Display"
2019 bl_options = {'DEFAULT_CLOSED'}
2022 def poll(cls, context):
2023 view = context.space_data
2026 def draw(self, context):
2027 layout = self.layout
2029 view = context.space_data
2030 scene = context.scene
2031 gs = scene.game_settings
2034 col = layout.column()
2035 col.prop(view, "show_only_render")
2037 col = layout.column()
2038 display_all = not view.show_only_render
2039 col.active = display_all
2040 col.prop(view, "show_outline_selected")
2041 col.prop(view, "show_all_objects_origin")
2042 col.prop(view, "show_relationship_lines")
2043 if ob and ob.type == 'MESH':
2045 col.prop(mesh, "show_all_edges")
2047 col = layout.column()
2048 col.active = display_all
2049 split = col.split(percentage=0.55)
2050 split.prop(view, "show_floor", text="Grid Floor")
2052 row = split.row(align=True)
2053 row.prop(view, "show_axis_x", text="X", toggle=True)
2054 row.prop(view, "show_axis_y", text="Y", toggle=True)
2055 row.prop(view, "show_axis_z", text="Z", toggle=True)
2057 sub = col.column(align=True)
2058 sub.active = (display_all and view.show_floor)
2059 sub.prop(view, "grid_lines", text="Lines")
2060 sub.prop(view, "grid_scale", text="Scale")
2061 subsub = sub.column(align=True)
2062 subsub.active = scene.unit_settings.system == 'NONE'
2063 subsub.prop(view, "grid_subdivisions", text="Subdivisions")
2065 col = layout.column()
2066 col.label(text="Shading:")
2067 col.prop(gs, "material_mode", text="")
2068 col.prop(view, "show_textured_solid")
2072 region = view.region_quadview
2074 layout.operator("screen.region_quadview", text="Toggle Quad View")
2077 col = layout.column()
2078 col.prop(region, "lock_rotation")
2080 row.enabled = region.lock_rotation
2081 row.prop(region, "show_sync_view")
2083 row.enabled = region.lock_rotation and region.show_sync_view
2084 row.prop(region, "use_box_clip")
2087 class VIEW3D_PT_view3d_meshdisplay(bpy.types.Panel):
2088 bl_space_type = 'VIEW_3D'
2089 bl_region_type = 'UI'
2090 bl_label = "Mesh Display"
2093 def poll(cls, context):
2094 # The active object check is needed because of localmode
2095 return (context.active_object and (context.mode == 'EDIT_MESH'))
2097 def draw(self, context):
2098 layout = self.layout
2100 mesh = context.active_object.data
2102 col = layout.column()
2103 col.label(text="Overlays:")
2104 col.prop(mesh, "show_edges", text="Edges")
2105 col.prop(mesh, "show_faces", text="Faces")
2106 col.prop(mesh, "show_edge_crease", text="Creases")
2107 col.prop(mesh, "show_edge_bevel_weight", text="Bevel Weights")
2108 col.prop(mesh, "show_edge_seams", text="Seams")
2109 col.prop(mesh, "show_edge_sharp", text="Sharp")
2112 col.label(text="Normals:")
2113 col.prop(mesh, "show_normal_face", text="Face")
2114 col.prop(mesh, "show_normal_vertex", text="Vertex")
2115 col.prop(context.scene.tool_settings, "normal_size", text="Normal Size")
2118 col.label(text="Numerics:")
2119 col.prop(mesh, "show_extra_edge_length")
2120 col.prop(mesh, "show_extra_face_angle")
2121 col.prop(mesh, "show_extra_face_area")
2124 class VIEW3D_PT_view3d_curvedisplay(bpy.types.Panel):
2125 bl_space_type = 'VIEW_3D'
2126 bl_region_type = 'UI'
2127 bl_label = "Curve Display"
2130 def poll(cls, context):
2131 editmesh = context.mode == 'EDIT_CURVE'
2134 def draw(self, context):
2135 layout = self.layout
2137 curve = context.active_object.data
2139 col = layout.column()
2140 col.label(text="Overlays:")
2141 col.prop(curve, "show_handles", text="Handles")
2142 col.prop(curve, "show_normal_face", text="Normals")
2143 col.prop(context.scene.tool_settings, "normal_size", text="Normal Size")
2146 class VIEW3D_PT_background_image(bpy.types.Panel):
2147 bl_space_type = 'VIEW_3D'
2148 bl_region_type = 'UI'
2149 bl_label = "Background Images"
2150 bl_options = {'DEFAULT_CLOSED'}
2153 def poll(cls, context):
2154 view = context.space_data
2155 # bg = context.space_data.background_image
2158 def draw_header(self, context):
2159 layout = self.layout
2160 view = context.space_data
2162 layout.prop(view, "show_background_images", text="")
2164 def draw(self, context):
2165 layout = self.layout
2167 view = context.space_data
2169 col = layout.column()
2170 col.operator("view3d.background_image_add", text="Add Image")
2172 for i, bg in enumerate(view.background_images):
2173 layout.active = view.show_background_images
2175 row = box.row(align=True)
2176 row.prop(bg, "show_expanded", text="", emboss=False)
2178 row.prop(bg.image, "name", text="", emboss=False)
2180 row.label(text="Not Set")
2181 row.operator("view3d.background_image_remove", text="", emboss=False, icon='X').index = i
2183 box.prop(bg, "view_axis", text="Axis")
2185 if bg.show_expanded:
2187 row.template_ID(bg, "image", open="image.open")
2189 box.template_image(bg, "image", bg.image_user, compact=True)
2191 box.prop(bg, "opacity", slider=True)
2192 if bg.view_axis != 'CAMERA':
2193 box.prop(bg, "size")
2194 row = box.row(align=True)
2195 row.prop(bg, "offset_x", text="X")
2196 row.prop(bg, "offset_y", text="Y")
2199 class VIEW3D_PT_transform_orientations(bpy.types.Panel):
2200 bl_space_type = 'VIEW_3D'
2201 bl_region_type = 'UI'
2202 bl_label = "Transform Orientations"
2203 bl_options = {'DEFAULT_CLOSED'}
2206 def poll(cls, context):
2207 view = context.space_data
2210 def draw(self, context):
2211 layout = self.layout
2213 view = context.space_data
2215 col = layout.column()
2217 col.prop(view, "transform_orientation")
2218 col.operator("transform.create_orientation", text="Create")
2220 orientation = view.current_orientation
2223 col.prop(orientation, "name")
2224 col.operator("transform.delete_orientation", text="Delete")
2227 class VIEW3D_PT_etch_a_ton(bpy.types.Panel):
2228 bl_space_type = 'VIEW_3D'
2229 bl_region_type = 'UI'
2230 bl_label = "Skeleton Sketching"
2231 bl_options = {'DEFAULT_CLOSED'}
2234 def poll(cls, context):
2235 scene = context.space_data
2236 ob = context.active_object
2237 return scene and ob and ob.type == 'ARMATURE' and ob.mode == 'EDIT'
2239 def draw_header(self, context):
2240 layout = self.layout
2241 toolsettings = context.scene.tool_settings
2243 layout.prop(toolsettings, "use_bone_sketching", text="")
2245 def draw(self, context):
2246 layout = self.layout
2247 toolsettings = context.scene.tool_settings
2249 col = layout.column()
2251 col.prop(toolsettings, "use_etch_quick")
2252 col.prop(toolsettings, "use_etch_overdraw")
2254 col.prop(toolsettings, "etch_convert_mode")
2256 if toolsettings.etch_convert_mode == 'LENGTH':
2257 col.prop(toolsettings, "etch_length_limit")
2258 elif toolsettings.etch_convert_mode == 'ADAPTIVE':
2259 col.prop(toolsettings, "etch_adaptive_limit")
2260 elif toolsettings.etch_convert_mode == 'FIXED':
2261 col.prop(toolsettings, "etch_subdivision_number")
2262 elif toolsettings.etch_convert_mode == 'RETARGET':
2263 col.prop(toolsettings, "etch_template")
2264 col.prop(toolsettings, "etch_roll_mode")
2265 col.prop(toolsettings, "use_etch_autoname")
2266 col.prop(toolsettings, "etch_number")
2267 col.prop(toolsettings, "etch_side")
2268 col.operator("sketch.convert", text="Convert")
2271 class VIEW3D_PT_context_properties(bpy.types.Panel):
2272 bl_space_type = 'VIEW_3D'
2273 bl_region_type = 'UI'
2274 bl_label = "Properties"
2275 bl_options = {'DEFAULT_CLOSED'}
2277 def _active_context_member(context):
2278 obj = context.object
2282 return "active_pose_bone"
2283 elif mode == 'EDIT' and obj.type == 'ARMATURE':
2284 return "active_bone"
2291 def poll(cls, context):
2292 member = cls._active_context_member(context)
2294 context_member = getattr(context, member)
2295 return context_member and context_member.keys()
2299 def draw(self, context):
2301 member = __class__._active_context_member(context)
2304 # Draw with no edit button
2305 rna_prop_ui.draw(self.layout, context, member, object, False)
2315 if __name__ == "__main__":