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'
182 layout.operator("object.randomize_transform")
183 layout.operator("object.align")
186 class VIEW3D_MT_mirror(bpy.types.Menu):
189 def draw(self, context):
192 layout.operator("transform.mirror", text="Interactive Mirror")
196 layout.operator_context = 'INVOKE_REGION_WIN'
198 props = layout.operator("transform.mirror", text="X Global")
199 props.constraint_axis = (True, False, False)
200 props.constraint_orientation = 'GLOBAL'
201 props = layout.operator("transform.mirror", text="Y Global")
202 props.constraint_axis = (False, True, False)
203 props.constraint_orientation = 'GLOBAL'
204 props = layout.operator("transform.mirror", text="Z Global")
205 props.constraint_axis = (False, False, True)
206 props.constraint_orientation = 'GLOBAL'
208 if context.edit_object:
211 props = layout.operator("transform.mirror", text="X Local")
212 props.constraint_axis = (True, False, False)
213 props.constraint_orientation = 'LOCAL'
214 props = layout.operator("transform.mirror", text="Y Local")
215 props.constraint_axis = (False, True, False)
216 props.constraint_orientation = 'LOCAL'
217 props = layout.operator("transform.mirror", text="Z Local")
218 props.constraint_axis = (False, False, True)
219 props.constraint_orientation = 'LOCAL'
221 layout.operator("object.vertex_group_mirror")
224 class VIEW3D_MT_snap(bpy.types.Menu):
227 def draw(self, context):
230 layout.operator("view3d.snap_selected_to_grid", text="Selection to Grid")
231 layout.operator("view3d.snap_selected_to_cursor", text="Selection to Cursor")
235 layout.operator("view3d.snap_cursor_to_selected", text="Cursor to Selected")
236 layout.operator("view3d.snap_cursor_to_center", text="Cursor to Center")
237 layout.operator("view3d.snap_cursor_to_grid", text="Cursor to Grid")
238 layout.operator("view3d.snap_cursor_to_active", text="Cursor to Active")
241 class VIEW3D_MT_uv_map(bpy.types.Menu):
242 bl_label = "UV Mapping"
244 def draw(self, context):
247 layout.operator("uv.unwrap")
249 layout.operator_context = 'INVOKE_DEFAULT'
250 layout.operator("uv.smart_project")
251 layout.operator("uv.lightmap_pack")
252 layout.operator("uv.follow_active_quads")
256 layout.operator_context = 'EXEC_DEFAULT'
257 layout.operator("uv.cube_project")
258 layout.operator("uv.cylinder_project")
259 layout.operator("uv.sphere_project")
263 layout.operator("uv.project_from_view")
264 layout.operator("uv.project_from_view", text="Project from View (Bounds)").scale_to_bounds = True
268 layout.operator("uv.reset")
271 # ********** View menus **********
274 class VIEW3D_MT_view(bpy.types.Menu):
277 def draw(self, context):
280 layout.operator("view3d.properties", icon='MENU_PANEL')
281 layout.operator("view3d.toolshelf", icon='MENU_PANEL')
285 layout.operator("view3d.viewnumpad", text="Camera").type = 'CAMERA'
286 layout.operator("view3d.viewnumpad", text="Top").type = 'TOP'
287 layout.operator("view3d.viewnumpad", text="Bottom").type = 'BOTTOM'
288 layout.operator("view3d.viewnumpad", text="Front").type = 'FRONT'
289 layout.operator("view3d.viewnumpad", text="Back").type = 'BACK'
290 layout.operator("view3d.viewnumpad", text="Right").type = 'RIGHT'
291 layout.operator("view3d.viewnumpad", text="Left").type = 'LEFT'
293 layout.menu("VIEW3D_MT_view_cameras", text="Cameras")
297 layout.operator("view3d.view_persportho")
301 layout.menu("VIEW3D_MT_view_navigation")
302 layout.menu("VIEW3D_MT_view_align")
306 layout.operator_context = 'INVOKE_REGION_WIN'
308 layout.operator("view3d.clip_border", text="Clipping Border...")
309 layout.operator("view3d.zoom_border", text="Zoom Border...")
313 layout.operator("view3d.layers", text="Show All Layers").nr = 0
317 layout.operator("view3d.localview", text="View Global/Local")
318 layout.operator("view3d.view_selected")
319 layout.operator("view3d.view_all")
323 layout.operator("screen.animation_play", text="Playback Animation")
327 layout.operator("screen.area_dupli")
328 layout.operator("screen.region_quadview")
329 layout.operator("screen.screen_full_area")
332 class VIEW3D_MT_view_navigation(bpy.types.Menu):
333 bl_label = "Navigation"
335 def draw(self, context):
338 layout.operator_enum("view3d.view_orbit", "type")
342 layout.operator_enum("view3d.view_pan", "type")
346 layout.operator("view3d.zoom", text="Zoom In").delta = 1
347 layout.operator("view3d.zoom", text="Zoom Out").delta = -1
348 layout.operator("view3d.zoom_camera_1_to_1", text="Zoom Camera 1:1")
352 layout.operator("view3d.fly")
355 class VIEW3D_MT_ndof_settings(bpy.types.Menu):
356 bl_label = "3D Mouse Settings"
358 def draw(self, context):
360 input_prefs = context.user_preferences.inputs
363 layout.prop(input_prefs, "ndof_sensitivity")
365 if context.space_data.type == 'VIEW_3D':
367 layout.prop(input_prefs, "ndof_show_guide")
370 layout.prop(input_prefs, "ndof_fly_helicopter", icon='NDOF_FLY')
371 layout.prop(input_prefs, "ndof_lock_horizon", icon='NDOF_DOM')
374 class VIEW3D_MT_view_align(bpy.types.Menu):
375 bl_label = "Align View"
377 def draw(self, context):
380 layout.menu("VIEW3D_MT_view_align_selected")
384 layout.operator("view3d.view_all", text="Center Cursor and View All").center = True
385 layout.operator("view3d.camera_to_view", text="Align Active Camera to View")
386 layout.operator("view3d.view_selected")
387 layout.operator("view3d.view_center_cursor")
390 class VIEW3D_MT_view_align_selected(bpy.types.Menu):
391 bl_label = "Align View to Selected"
393 def draw(self, context):
396 props = layout.operator("view3d.viewnumpad", text="Top")
397 props.align_active = True
399 props = layout.operator("view3d.viewnumpad", text="Bottom")
400 props.align_active = True
401 props.type = 'BOTTOM'
402 props = layout.operator("view3d.viewnumpad", text="Front")
403 props.align_active = True
405 props = layout.operator("view3d.viewnumpad", text="Back")
406 props.align_active = True
408 props = layout.operator("view3d.viewnumpad", text="Right")
409 props.align_active = True
411 props = layout.operator("view3d.viewnumpad", text="Left")
412 props.align_active = True
416 class VIEW3D_MT_view_cameras(bpy.types.Menu):
419 def draw(self, context):
422 layout.operator("view3d.object_as_camera")
423 layout.operator("view3d.viewnumpad", text="Active Camera").type = 'CAMERA'
425 # ********** Select menus, suffix from context.mode **********
428 class VIEW3D_MT_select_object(bpy.types.Menu):
431 def draw(self, context):
434 layout.operator("view3d.select_border")
435 layout.operator("view3d.select_circle")
439 layout.operator("object.select_all", text="Select/Deselect All")
440 layout.operator("object.select_inverse", text="Inverse")
441 layout.operator("object.select_random", text="Random")
442 layout.operator("object.select_mirror", text="Mirror")
443 layout.operator("object.select_by_layer", text="Select All by Layer")
444 layout.operator_menu_enum("object.select_by_type", "type", text="Select All by Type...")
445 layout.operator("object.select_camera", text="Select Camera")
449 layout.operator_menu_enum("object.select_grouped", "type", text="Grouped")
450 layout.operator_menu_enum("object.select_linked", "type", text="Linked")
451 layout.operator("object.select_pattern", text="Select Pattern...")
454 class VIEW3D_MT_select_pose(bpy.types.Menu):
457 def draw(self, context):
460 layout.operator("view3d.select_border")
464 layout.operator("pose.select_all", text="Select/Deselect All")
465 layout.operator("pose.select_inverse", text="Inverse")
466 layout.operator("pose.select_flip_active", text="Flip Active")
467 layout.operator("pose.select_constraint_target", text="Constraint Target")
468 layout.operator("pose.select_linked", text="Linked")
472 layout.operator("pose.select_hierarchy", text="Parent").direction = 'PARENT'
473 layout.operator("pose.select_hierarchy", text="Child").direction = 'CHILD'
477 props = layout.operator("pose.select_hierarchy", text="Extend Parent")
479 props.direction = 'PARENT'
481 props = layout.operator("pose.select_hierarchy", text="Extend Child")
483 props.direction = 'CHILD'
487 layout.operator_menu_enum("pose.select_grouped", "type", text="Grouped")
488 layout.operator("object.select_pattern", text="Select Pattern...")
491 class VIEW3D_MT_select_particle(bpy.types.Menu):
494 def draw(self, context):
497 layout.operator("view3d.select_border")
501 layout.operator("particle.select_all", text="Select/Deselect All")
502 layout.operator("particle.select_linked")
503 layout.operator("particle.select_inverse")
507 layout.operator("particle.select_more")
508 layout.operator("particle.select_less")
512 layout.operator("particle.select_roots", text="Roots")
513 layout.operator("particle.select_tips", text="Tips")
516 class VIEW3D_MT_select_edit_mesh(bpy.types.Menu):
519 def draw(self, context):
522 layout.operator("view3d.select_border")
523 layout.operator("view3d.select_circle")
527 layout.operator("mesh.select_all", text="Select/Deselect All")
528 layout.operator("mesh.select_inverse", text="Inverse")
532 layout.operator("mesh.select_random", text="Random")
533 layout.operator("mesh.select_nth", text="Every N Number of Verts")
534 layout.operator("mesh.edges_select_sharp", text="Sharp Edges")
535 layout.operator("mesh.faces_select_linked_flat", text="Linked Flat Faces")
536 layout.operator("mesh.faces_select_interior", text="Interior Faces")
537 layout.operator("mesh.select_axis", text="Side of Active")
541 layout.operator("mesh.select_by_number_vertices", text="Triangles").type = 'TRIANGLES'
542 layout.operator("mesh.select_by_number_vertices", text="Quads").type = 'QUADS'
543 if context.scene.tool_settings.mesh_select_mode[2] == False:
544 layout.operator("mesh.select_non_manifold", text="Non Manifold")
545 layout.operator("mesh.select_by_number_vertices", text="Loose Verts/Edges").type = 'OTHER'
546 layout.operator("mesh.select_similar", text="Similar")
550 layout.operator("mesh.select_less", text="Less")
551 layout.operator("mesh.select_more", text="More")
555 layout.operator("mesh.select_mirror", text="Mirror")
557 layout.operator("mesh.select_linked", text="Linked")
558 layout.operator("mesh.select_vertex_path", text="Vertex Path")
559 layout.operator("mesh.loop_multi_select", text="Edge Loop")
560 layout.operator("mesh.loop_multi_select", text="Edge Ring").ring = True
564 layout.operator("mesh.loop_to_region")
565 layout.operator("mesh.region_to_loop")
568 class VIEW3D_MT_select_edit_curve(bpy.types.Menu):
571 def draw(self, context):
574 layout.operator("view3d.select_border")
575 layout.operator("view3d.select_circle")
579 layout.operator("curve.select_all", text="Select/Deselect All")
580 layout.operator("curve.select_inverse")
581 layout.operator("curve.select_random")
582 layout.operator("curve.select_nth", text="Every Nth Number of Points")
586 layout.operator("curve.de_select_first")
587 layout.operator("curve.de_select_last")
588 layout.operator("curve.select_next")
589 layout.operator("curve.select_previous")
593 layout.operator("curve.select_more")
594 layout.operator("curve.select_less")
597 class VIEW3D_MT_select_edit_surface(bpy.types.Menu):
600 def draw(self, context):
603 layout.operator("view3d.select_border")
604 layout.operator("view3d.select_circle")
608 layout.operator("curve.select_all", text="Select/Deselect All")
609 layout.operator("curve.select_inverse")
610 layout.operator("curve.select_random")
611 layout.operator("curve.select_nth", text="Every Nth Number of Points")
615 layout.operator("curve.select_row")
619 layout.operator("curve.select_more")
620 layout.operator("curve.select_less")
623 class VIEW3D_MT_select_edit_metaball(bpy.types.Menu):
626 def draw(self, context):
629 layout.operator("view3d.select_border")
633 layout.operator("mball.select_all").action = 'TOGGLE'
634 layout.operator("mball.select_inverse_metaelems")
638 layout.operator("mball.select_random_metaelems")
641 class VIEW3D_MT_select_edit_lattice(bpy.types.Menu):
644 def draw(self, context):
647 layout.operator("view3d.select_border")
651 layout.operator("lattice.select_all", text="Select/Deselect All")
654 class VIEW3D_MT_select_edit_armature(bpy.types.Menu):
657 def draw(self, context):
660 layout.operator("view3d.select_border")
664 layout.operator("armature.select_all", text="Select/Deselect All")
665 layout.operator("armature.select_inverse", text="Inverse")
669 layout.operator("armature.select_hierarchy", text="Parent").direction = 'PARENT'
670 layout.operator("armature.select_hierarchy", text="Child").direction = 'CHILD'
674 props = layout.operator("armature.select_hierarchy", text="Extend Parent")
676 props.direction = 'PARENT'
678 props = layout.operator("armature.select_hierarchy", text="Extend Child")
680 props.direction = 'CHILD'
682 layout.operator("object.select_pattern", text="Select Pattern...")
685 class VIEW3D_MT_select_face(bpy.types.Menu): # XXX no matching enum
688 def draw(self, context):
689 # layout = self.layout
692 # see view3d_select_faceselmenu
695 # ********** Object menu **********
698 class VIEW3D_MT_object(bpy.types.Menu):
699 bl_context = "objectmode"
702 def draw(self, context):
705 layout.operator("ed.undo")
706 layout.operator("ed.redo")
707 layout.operator("ed.undo_history")
711 layout.menu("VIEW3D_MT_transform")
712 layout.menu("VIEW3D_MT_mirror")
713 layout.menu("VIEW3D_MT_object_clear")
714 layout.menu("VIEW3D_MT_object_apply")
715 layout.menu("VIEW3D_MT_snap")
719 layout.menu("VIEW3D_MT_object_animation")
723 layout.operator("object.duplicate_move")
724 layout.operator("object.duplicate_move_linked")
725 layout.operator("object.delete", text="Delete...")
726 layout.operator("object.proxy_make", text="Make Proxy...")
727 layout.menu("VIEW3D_MT_make_links", text="Make Links...")
728 layout.operator("object.make_dupli_face")
729 layout.operator_menu_enum("object.make_local", "type", text="Make Local...")
730 layout.menu("VIEW3D_MT_make_single_user")
734 layout.menu("VIEW3D_MT_object_parent")
735 layout.menu("VIEW3D_MT_object_track")
736 layout.menu("VIEW3D_MT_object_group")
737 layout.menu("VIEW3D_MT_object_constraints")
741 layout.menu("VIEW3D_MT_object_game")
745 layout.operator("object.join_uvs")
746 layout.operator("object.join")
750 layout.operator("object.move_to_layer", text="Move to Layer...")
751 layout.menu("VIEW3D_MT_object_showhide")
753 layout.operator_menu_enum("object.convert", "target")
756 class VIEW3D_MT_object_animation(bpy.types.Menu):
757 bl_label = "Animation"
759 def draw(self, context):
762 layout.operator("anim.keyframe_insert_menu", text="Insert Keyframe...")
763 layout.operator("anim.keyframe_delete_v3d", text="Delete Keyframe...")
764 layout.operator("anim.keying_set_active_set", text="Change Keying Set...")
767 class VIEW3D_MT_object_clear(bpy.types.Menu):
770 def draw(self, context):
773 layout.operator("object.location_clear", text="Location")
774 layout.operator("object.rotation_clear", text="Rotation")
775 layout.operator("object.scale_clear", text="Scale")
776 layout.operator("object.origin_clear", text="Origin")
779 class VIEW3D_MT_object_specials(bpy.types.Menu):
780 bl_label = "Specials"
783 def poll(cls, context):
784 # add more special types
785 return context.object
787 def draw(self, context):
791 if obj.type == 'CAMERA':
792 layout.operator_context = 'INVOKE_REGION_WIN'
794 props = layout.operator("wm.context_modal_mouse", text="Camera Lens Angle")
795 props.data_path_iter = "selected_editable_objects"
796 props.data_path_item = "data.lens"
797 props.input_scale = 0.1
799 if not obj.data.dof_object:
800 #layout.label(text="Test Has DOF obj");
801 props = layout.operator("wm.context_modal_mouse", text="DOF Distance")
802 props.data_path_iter = "selected_editable_objects"
803 props.data_path_item = "data.dof_distance"
804 props.input_scale = 0.02
806 if obj.type in {'CURVE', 'FONT'}:
807 layout.operator_context = 'INVOKE_REGION_WIN'
809 props = layout.operator("wm.context_modal_mouse", text="Extrude Size")
810 props.data_path_iter = "selected_editable_objects"
811 props.data_path_item = "data.extrude"
812 props.input_scale = 0.01
814 props = layout.operator("wm.context_modal_mouse", text="Width Size")
815 props.data_path_iter = "selected_editable_objects"
816 props.data_path_item = "data.offset"
817 props.input_scale = 0.01
819 if obj.type == 'EMPTY':
820 layout.operator_context = 'INVOKE_REGION_WIN'
822 props = layout.operator("wm.context_modal_mouse", text="Empty Draw Size")
823 props.data_path_iter = "selected_editable_objects"
824 props.data_path_item = "empty_draw_size"
825 props.input_scale = 0.01
827 if obj.type == 'LAMP':
828 layout.operator_context = 'INVOKE_REGION_WIN'
830 props = layout.operator("wm.context_modal_mouse", text="Energy")
831 props.data_path_iter = "selected_editable_objects"
832 props.data_path_item = "data.energy"
834 if obj.data.type in {'SPOT', 'AREA', 'POINT'}:
835 props = layout.operator("wm.context_modal_mouse", text="Falloff Distance")
836 props.data_path_iter = "selected_editable_objects"
837 props.data_path_item = "data.distance"
838 props.input_scale = 0.1
840 if obj.data.type == 'SPOT':
842 props = layout.operator("wm.context_modal_mouse", text="Spot Size")
843 props.data_path_iter = "selected_editable_objects"
844 props.data_path_item = "data.spot_size"
845 props.input_scale = 0.01
847 props = layout.operator("wm.context_modal_mouse", text="Spot Blend")
848 props.data_path_iter = "selected_editable_objects"
849 props.data_path_item = "data.spot_blend"
850 props.input_scale = -0.01
852 props = layout.operator("wm.context_modal_mouse", text="Clip Start")
853 props.data_path_iter = "selected_editable_objects"
854 props.data_path_item = "data.shadow_buffer_clip_start"
855 props.input_scale = 0.05
857 props = layout.operator("wm.context_modal_mouse", text="Clip End")
858 props.data_path_iter = "selected_editable_objects"
859 props.data_path_item = "data.shadow_buffer_clip_end"
860 props.input_scale = 0.05
864 props = layout.operator("object.isolate_type_render")
865 props = layout.operator("object.hide_render_clear_all")
868 class VIEW3D_MT_object_apply(bpy.types.Menu):
871 def draw(self, context):
874 layout.operator("object.transform_apply", text="Location").location = True
875 layout.operator("object.transform_apply", text="Rotation").rotation = True
876 layout.operator("object.transform_apply", text="Scale").scale = True
877 props = layout.operator("object.transform_apply", text="Rotation & Scale")
879 props.rotation = True
883 layout.operator("object.visual_transform_apply", text="Visual Transform")
884 layout.operator("object.duplicates_make_real")
887 class VIEW3D_MT_object_parent(bpy.types.Menu):
890 def draw(self, context):
893 layout.operator("object.parent_set", text="Set")
894 layout.operator("object.parent_clear", text="Clear")
897 class VIEW3D_MT_object_track(bpy.types.Menu):
900 def draw(self, context):
903 layout.operator("object.track_set", text="Set")
904 layout.operator("object.track_clear", text="Clear")
907 class VIEW3D_MT_object_group(bpy.types.Menu):
910 def draw(self, context):
913 layout.operator("group.create")
914 layout.operator("group.objects_remove")
918 layout.operator("group.objects_add_active")
919 layout.operator("group.objects_remove_active")
922 class VIEW3D_MT_object_constraints(bpy.types.Menu):
923 bl_label = "Constraints"
925 def draw(self, context):
928 layout.operator("object.constraint_add_with_targets")
929 layout.operator("object.constraints_copy")
930 layout.operator("object.constraints_clear")
933 class VIEW3D_MT_object_showhide(bpy.types.Menu):
934 bl_label = "Show/Hide"
936 def draw(self, context):
939 layout.operator("object.hide_view_clear", text="Show Hidden")
940 layout.operator("object.hide_view_set", text="Hide Selected")
941 layout.operator("object.hide_view_set", text="Hide Unselected").unselected = True
944 class VIEW3D_MT_make_single_user(bpy.types.Menu):
945 bl_label = "Make Single User"
947 def draw(self, context):
950 props = layout.operator("object.make_single_user", text="Object")
953 props = layout.operator("object.make_single_user", text="Object & Data")
954 props.object = props.obdata = True
956 props = layout.operator("object.make_single_user", text="Object & Data & Materials+Tex")
957 props.object = props.obdata = props.material = props.texture = True
959 props = layout.operator("object.make_single_user", text="Materials+Tex")
960 props.material = props.texture = True
962 props = layout.operator("object.make_single_user", text="Object Animation")
963 props.animation = True
966 class VIEW3D_MT_make_links(bpy.types.Menu):
967 bl_label = "Make Links"
969 def draw(self, context):
972 if(len(bpy.data.scenes) > 10):
973 layout.operator_context = 'INVOKE_DEFAULT'
974 layout.operator("object.make_links_scene", text="Objects to Scene...", icon='OUTLINER_OB_EMPTY')
975 layout.operator("object.make_links_scene", text="Markers to Scene...", icon='OUTLINER_OB_EMPTY')
977 layout.operator_menu_enum("object.make_links_scene", "scene", text="Objects to Scene...")
978 layout.operator_menu_enum("marker.make_links_scene", "scene", text="Markers to Scene...")
980 layout.operator_enum("object.make_links_data", "type") # inline
983 class VIEW3D_MT_object_game(bpy.types.Menu):
986 def draw(self, context):
989 layout.operator("object.logic_bricks_copy", text="Copy Logic Bricks")
993 layout.operator("object.game_property_copy", text="Replace Properties").operation = 'REPLACE'
994 layout.operator("object.game_property_copy", text="Merge Properties").operation = 'MERGE'
995 layout.operator_menu_enum("object.game_property_copy", "property", text="Copy Properties...")
999 layout.operator("object.game_property_clear")
1002 # ********** Vertex paint menu **********
1005 class VIEW3D_MT_paint_vertex(bpy.types.Menu):
1008 def draw(self, context):
1009 layout = self.layout
1011 layout.operator("ed.undo")
1012 layout.operator("ed.redo")
1016 layout.operator("paint.vertex_color_set")
1017 layout.operator("paint.vertex_color_dirt")
1020 class VIEW3D_MT_hook(bpy.types.Menu):
1023 def draw(self, context):
1024 layout = self.layout
1025 layout.operator_context = 'EXEC_AREA'
1026 layout.operator("object.hook_add_newob")
1027 layout.operator("object.hook_add_selob")
1029 if [mod.type == 'HOOK' for mod in context.active_object.modifiers]:
1031 layout.operator_menu_enum("object.hook_assign", "modifier")
1032 layout.operator_menu_enum("object.hook_remove", "modifier")
1034 layout.operator_menu_enum("object.hook_select", "modifier")
1035 layout.operator_menu_enum("object.hook_reset", "modifier")
1036 layout.operator_menu_enum("object.hook_recenter", "modifier")
1039 class VIEW3D_MT_vertex_group(bpy.types.Menu):
1040 bl_label = "Vertex Groups"
1042 def draw(self, context):
1043 layout = self.layout
1044 layout.operator_context = 'EXEC_AREA'
1045 layout.operator("object.vertex_group_assign", text="Assign to New Group").new = True
1047 ob = context.active_object
1048 if ob.mode == 'EDIT':
1049 if ob.vertex_groups.active:
1051 layout.operator("object.vertex_group_assign", text="Assign to Active Group")
1052 layout.operator("object.vertex_group_remove_from", text="Remove from Active Group")
1053 layout.operator("object.vertex_group_remove_from", text="Remove from All").all = True
1056 if ob.vertex_groups.active:
1057 layout.operator_menu_enum("object.vertex_group_set_active", "group", text="Set Active Group")
1058 layout.operator("object.vertex_group_remove", text="Remove Active Group")
1059 layout.operator("object.vertex_group_remove", text="Remove All Groups").all = True
1061 # ********** Weight paint menu **********
1064 class VIEW3D_MT_paint_weight(bpy.types.Menu):
1065 bl_label = "Weights"
1067 def draw(self, context):
1068 layout = self.layout
1070 layout.operator("ed.undo")
1071 layout.operator("ed.redo")
1072 layout.operator("ed.undo_history")
1076 layout.operator("paint.weight_from_bones", text="Assign Automatic From Bones").type = 'AUTOMATIC'
1077 layout.operator("paint.weight_from_bones", text="Assign From Bone Envelopes").type = 'ENVELOPES'
1081 layout.operator("object.vertex_group_normalize_all", text="Normalize All")
1082 layout.operator("object.vertex_group_normalize", text="Normalize")
1083 layout.operator("object.vertex_group_invert", text="Invert")
1084 layout.operator("object.vertex_group_clean", text="Clean")
1085 layout.operator("object.vertex_group_levels", text="Levels")
1089 layout.operator("paint.weight_set")
1091 # ********** Sculpt menu **********
1094 class VIEW3D_MT_sculpt(bpy.types.Menu):
1097 def draw(self, context):
1098 layout = self.layout
1100 tool_settings = context.tool_settings
1101 sculpt = tool_settings.sculpt
1102 brush = tool_settings.sculpt.brush
1104 layout.operator("ed.undo")
1105 layout.operator("ed.redo")
1109 layout.prop(sculpt, "use_symmetry_x")
1110 layout.prop(sculpt, "use_symmetry_y")
1111 layout.prop(sculpt, "use_symmetry_z")
1113 layout.prop(sculpt, "lock_x")
1114 layout.prop(sculpt, "lock_y")
1115 layout.prop(sculpt, "lock_z")
1117 layout.operator_menu_enum("brush.curve_preset", "shape")
1120 sculpt_tool = brush.sculpt_tool
1122 if sculpt_tool != 'GRAB':
1123 layout.prop_menu_enum(brush, "stroke_method")
1125 if sculpt_tool in {'DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'}:
1126 layout.prop_menu_enum(brush, "direction")
1128 if sculpt_tool == 'LAYER':
1129 layout.prop(brush, "use_persistent")
1130 layout.operator("sculpt.set_persistent_base")
1133 layout.prop(sculpt, "use_threaded", text="Threaded Sculpt")
1134 layout.prop(sculpt, "show_brush")
1136 # TODO, make availabel from paint menu!
1137 layout.prop(tool_settings, "sculpt_paint_use_unified_size", text="Unify Size")
1138 layout.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Unify Strength")
1140 # ********** Particle menu **********
1143 class VIEW3D_MT_particle(bpy.types.Menu):
1144 bl_label = "Particle"
1146 def draw(self, context):
1147 layout = self.layout
1149 particle_edit = context.tool_settings.particle_edit
1151 layout.operator("ed.undo")
1152 layout.operator("ed.redo")
1153 layout.operator("ed.undo_history")
1157 layout.operator("particle.mirror")
1161 layout.operator("particle.remove_doubles")
1162 layout.operator("particle.delete")
1164 if particle_edit.select_mode == 'POINT':
1165 layout.operator("particle.subdivide")
1167 layout.operator("particle.rekey")
1168 layout.operator("particle.weight_set")
1172 layout.menu("VIEW3D_MT_particle_showhide")
1175 class VIEW3D_MT_particle_specials(bpy.types.Menu):
1176 bl_label = "Specials"
1178 def draw(self, context):
1179 layout = self.layout
1180 particle_edit = context.tool_settings.particle_edit
1182 layout.operator("particle.rekey")
1185 if particle_edit.select_mode == 'POINT':
1186 layout.operator("particle.subdivide")
1187 layout.operator("particle.select_roots")
1188 layout.operator("particle.select_tips")
1190 layout.operator("particle.remove_doubles")
1193 class VIEW3D_MT_particle_showhide(ShowHideMenu, bpy.types.Menu):
1194 _operator_name = "particle"
1196 # ********** Pose Menu **********
1199 class VIEW3D_MT_pose(bpy.types.Menu):
1202 def draw(self, context):
1203 layout = self.layout
1205 layout.operator("ed.undo")
1206 layout.operator("ed.redo")
1207 layout.operator("ed.undo_history")
1211 layout.menu("VIEW3D_MT_transform")
1213 layout.menu("VIEW3D_MT_pose_transform")
1214 layout.menu("VIEW3D_MT_pose_apply")
1216 layout.menu("VIEW3D_MT_snap")
1220 layout.menu("VIEW3D_MT_object_animation")
1224 layout.menu("VIEW3D_MT_pose_slide")
1225 layout.menu("VIEW3D_MT_pose_propagate")
1229 layout.operator("pose.copy")
1230 layout.operator("pose.paste")
1231 layout.operator("pose.paste", text="Paste X-Flipped Pose").flipped = True
1235 layout.menu("VIEW3D_MT_pose_library")
1236 layout.menu("VIEW3D_MT_pose_motion")
1237 layout.menu("VIEW3D_MT_pose_group")
1241 layout.menu("VIEW3D_MT_object_parent")
1242 layout.menu("VIEW3D_MT_pose_ik")
1243 layout.menu("VIEW3D_MT_pose_constraints")
1247 layout.operator_context = 'EXEC_AREA'
1248 layout.operator("pose.autoside_names", text="AutoName Left/Right").axis = 'XAXIS'
1249 layout.operator("pose.autoside_names", text="AutoName Front/Back").axis = 'YAXIS'
1250 layout.operator("pose.autoside_names", text="AutoName Top/Bottom").axis = 'ZAXIS'
1252 layout.operator("pose.flip_names")
1254 layout.operator("pose.quaternions_flip")
1258 layout.operator_context = 'INVOKE_AREA'
1259 layout.operator("pose.armature_layers", text="Change Armature Layers...")
1260 layout.operator("pose.bone_layers", text="Change Bone Layers...")
1264 layout.menu("VIEW3D_MT_pose_showhide")
1265 layout.operator_menu_enum("pose.flags_set", 'mode', text="Bone Settings")
1268 class VIEW3D_MT_pose_transform(bpy.types.Menu):
1269 bl_label = "Clear Transform"
1271 def draw(self, context):
1272 layout = self.layout
1274 layout.operator("pose.transforms_clear", text="All")
1276 layout.operator("pose.loc_clear", text="Location")
1277 layout.operator("pose.rot_clear", text="Rotation")
1278 layout.operator("pose.scale_clear", text="Scale")
1280 layout.label(text="Origin")
1283 class VIEW3D_MT_pose_slide(bpy.types.Menu):
1284 bl_label = "In-Betweens"
1286 def draw(self, context):
1287 layout = self.layout
1289 layout.operator("pose.push")
1290 layout.operator("pose.relax")
1291 layout.operator("pose.breakdown")
1294 class VIEW3D_MT_pose_propagate(bpy.types.Menu):
1295 bl_label = "Propagate"
1297 def draw(self, context):
1298 layout = self.layout
1300 layout.operator("pose.propagate")
1304 layout.operator("pose.propagate", text="To Next Keyframe").mode = 'NEXT_KEY'
1305 layout.operator("pose.propagate", text="To Last Keyframe (Make Cyclic)").mode = 'LAST_KEY'
1309 layout.operator("pose.propagate", text="On Selected Markers").mode = 'SELECTED_MARKERS'
1312 class VIEW3D_MT_pose_library(bpy.types.Menu):
1313 bl_label = "Pose Library"
1315 def draw(self, context):
1316 layout = self.layout
1318 layout.operator("poselib.browse_interactive", text="Browse Poses...")
1322 layout.operator("poselib.pose_add", text="Add Pose...")
1323 layout.operator("poselib.pose_rename", text="Rename Pose...")
1324 layout.operator("poselib.pose_remove", text="Remove Pose...")
1327 class VIEW3D_MT_pose_motion(bpy.types.Menu):
1328 bl_label = "Motion Paths"
1330 def draw(self, context):
1331 layout = self.layout
1333 layout.operator("pose.paths_calculate", text="Calculate")
1334 layout.operator("pose.paths_clear", text="Clear")
1337 class VIEW3D_MT_pose_group(bpy.types.Menu):
1338 bl_label = "Bone Groups"
1340 def draw(self, context):
1341 layout = self.layout
1342 layout.operator("pose.group_add")
1343 layout.operator("pose.group_remove")
1347 layout.operator("pose.group_assign")
1348 layout.operator("pose.group_unassign")
1351 class VIEW3D_MT_pose_ik(bpy.types.Menu):
1352 bl_label = "Inverse Kinematics"
1354 def draw(self, context):
1355 layout = self.layout
1357 layout.operator("pose.ik_add")
1358 layout.operator("pose.ik_clear")
1361 class VIEW3D_MT_pose_constraints(bpy.types.Menu):
1362 bl_label = "Constraints"
1364 def draw(self, context):
1365 layout = self.layout
1367 layout.operator("pose.constraint_add_with_targets", text="Add (With Targets)...")
1368 layout.operator("pose.constraints_copy")
1369 layout.operator("pose.constraints_clear")
1372 class VIEW3D_MT_pose_showhide(ShowHideMenu, bpy.types.Menu):
1373 _operator_name = "pose"
1376 class VIEW3D_MT_pose_apply(bpy.types.Menu):
1379 def draw(self, context):
1380 layout = self.layout
1382 layout.operator("pose.armature_apply")
1383 layout.operator("pose.visual_transform_apply")
1386 # ********** Edit Menus, suffix from ob.type **********
1389 class VIEW3D_MT_edit_mesh(bpy.types.Menu):
1392 def draw(self, context):
1393 layout = self.layout
1395 settings = context.tool_settings
1397 layout.operator("ed.undo")
1398 layout.operator("ed.redo")
1399 layout.operator("ed.undo_history")
1403 layout.menu("VIEW3D_MT_transform")
1404 layout.menu("VIEW3D_MT_mirror")
1405 layout.menu("VIEW3D_MT_snap")
1409 layout.menu("VIEW3D_MT_uv_map", text="UV Unwrap...")
1413 layout.operator("view3d.edit_mesh_extrude_move_normal", text="Extrude Region")
1414 layout.operator("view3d.edit_mesh_extrude_individual_move", text="Extrude Individual")
1415 layout.operator("mesh.duplicate_move")
1416 layout.operator("mesh.delete", text="Delete...")
1420 layout.menu("VIEW3D_MT_edit_mesh_vertices")
1421 layout.menu("VIEW3D_MT_edit_mesh_edges")
1422 layout.menu("VIEW3D_MT_edit_mesh_faces")
1423 layout.menu("VIEW3D_MT_edit_mesh_normals")
1427 layout.prop(settings, "use_mesh_automerge")
1428 layout.prop_menu_enum(settings, "proportional_edit")
1429 layout.prop_menu_enum(settings, "proportional_edit_falloff")
1433 layout.menu("VIEW3D_MT_edit_mesh_showhide")
1436 class VIEW3D_MT_edit_mesh_specials(bpy.types.Menu):
1437 bl_label = "Specials"
1439 def draw(self, context):
1440 layout = self.layout
1442 layout.operator_context = 'INVOKE_REGION_WIN'
1444 layout.operator("mesh.subdivide", text="Subdivide")
1445 layout.operator("mesh.subdivide", text="Subdivide Smooth").smoothness = 1.0
1446 layout.operator("mesh.merge", text="Merge...")
1447 layout.operator("mesh.remove_doubles")
1448 layout.operator("mesh.hide", text="Hide")
1449 layout.operator("mesh.reveal", text="Reveal")
1450 layout.operator("mesh.select_inverse")
1451 layout.operator("mesh.flip_normals")
1452 layout.operator("mesh.vertices_smooth", text="Smooth")
1453 # layout.operator("mesh.bevel", text="Bevel")
1454 layout.operator("mesh.faces_shade_smooth")
1455 layout.operator("mesh.faces_shade_flat")
1456 layout.operator("mesh.blend_from_shape")
1457 layout.operator("mesh.shape_propagate_to_all")
1458 layout.operator("mesh.select_vertex_path")
1461 class VIEW3D_MT_edit_mesh_select_mode(bpy.types.Menu):
1462 bl_label = "Mesh Select Mode"
1464 def draw(self, context):
1465 layout = self.layout
1467 layout.operator_context = 'INVOKE_REGION_WIN'
1469 prop = layout.operator("wm.context_set_value", text="Vertex", icon='VERTEXSEL')
1470 prop.value = "(True, False, False)"
1471 prop.data_path = "tool_settings.mesh_select_mode"
1473 prop = layout.operator("wm.context_set_value", text="Edge", icon='EDGESEL')
1474 prop.value = "(False, True, False)"
1475 prop.data_path = "tool_settings.mesh_select_mode"
1477 prop = layout.operator("wm.context_set_value", text="Face", icon='FACESEL')
1478 prop.value = "(False, False, True)"
1479 prop.data_path = "tool_settings.mesh_select_mode"
1482 class VIEW3D_MT_edit_mesh_extrude(bpy.types.Menu):
1483 bl_label = "Extrude"
1485 _extrude_funcs = { \
1486 "VERT": lambda layout: layout.operator("mesh.extrude_vertices_move", text="Vertices Only"),
1487 "EDGE": lambda layout: layout.operator("mesh.extrude_edges_move", text="Edges Only"),
1488 "FACE": lambda layout: layout.operator("mesh.extrude_faces_move", text="Individual Faces"),
1489 "REGION": lambda layout: layout.operator("view3d.edit_mesh_extrude_move_normal", text="Region"),
1493 def extrude_options(context):
1494 mesh = context.object.data
1495 select_mode = context.tool_settings.mesh_select_mode
1498 if mesh.total_face_sel:
1499 menu += ["REGION", "FACE"]
1500 if mesh.total_edge_sel and (select_mode[0] or select_mode[1]):
1502 if mesh.total_vert_sel and select_mode[0]:
1505 # should never get here
1508 def draw(self, context):
1509 layout = self.layout
1510 layout.operator_context = 'INVOKE_REGION_WIN'
1512 for menu_id in self.extrude_options(context):
1513 self._extrude_funcs[menu_id](layout)
1516 class VIEW3D_OT_edit_mesh_extrude_individual_move(bpy.types.Operator):
1517 "Extrude individual elements and move"
1518 bl_label = "Extrude Individual and Move"
1519 bl_idname = "view3d.edit_mesh_extrude_individual_move"
1521 def execute(self, context):
1522 mesh = context.object.data
1523 select_mode = context.tool_settings.mesh_select_mode
1525 totface = mesh.total_face_sel
1526 totedge = mesh.total_edge_sel
1527 # totvert = mesh.total_vert_sel
1529 if select_mode[2] and totface == 1:
1530 bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": 'NORMAL', "constraint_axis": (False, False, True)})
1531 elif select_mode[2] and totface > 1:
1532 bpy.ops.mesh.extrude_faces_move('INVOKE_REGION_WIN')
1533 elif select_mode[1] and totedge >= 1:
1534 bpy.ops.mesh.extrude_edges_move('INVOKE_REGION_WIN')
1536 bpy.ops.mesh.extrude_vertices_move('INVOKE_REGION_WIN')
1538 # ignore return from operators above because they are 'RUNNING_MODAL', and cause this one not to be freed. [#24671]
1541 def invoke(self, context, event):
1542 return self.execute(context)
1545 class VIEW3D_OT_edit_mesh_extrude_move(bpy.types.Operator):
1546 "Extrude and move along normals"
1547 bl_label = "Extrude and Move on Normals"
1548 bl_idname = "view3d.edit_mesh_extrude_move_normal"
1550 def execute(self, context):
1551 mesh = context.object.data
1553 totface = mesh.total_face_sel
1554 totedge = mesh.total_edge_sel
1555 # totvert = mesh.total_vert_sel
1558 bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": 'NORMAL', "constraint_axis": (False, False, True)})
1560 bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": 'NORMAL', "constraint_axis": (True, True, False)})
1562 bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN')
1564 # ignore return from operators above because they are 'RUNNING_MODAL', and cause this one not to be freed. [#24671]
1567 def invoke(self, context, event):
1568 return self.execute(context)
1571 class VIEW3D_MT_edit_mesh_vertices(bpy.types.Menu):
1572 bl_label = "Vertices"
1574 def draw(self, context):
1575 layout = self.layout
1576 layout.operator_context = 'INVOKE_REGION_WIN'
1578 layout.operator("mesh.merge")
1579 layout.operator("mesh.rip_move")
1580 layout.operator("mesh.split")
1581 layout.operator("mesh.separate")
1585 layout.operator("mesh.vertices_smooth")
1586 layout.operator("mesh.remove_doubles")
1587 layout.operator("mesh.vertices_sort")
1588 layout.operator("mesh.vertices_randomize")
1590 layout.operator("mesh.select_vertex_path")
1592 layout.operator("mesh.blend_from_shape")
1594 layout.operator("object.vertex_group_blend")
1595 layout.operator("mesh.shape_propagate_to_all")
1599 layout.menu("VIEW3D_MT_vertex_group")
1600 layout.menu("VIEW3D_MT_hook")
1603 class VIEW3D_MT_edit_mesh_edges(bpy.types.Menu):
1606 def draw(self, context):
1607 layout = self.layout
1608 layout.operator_context = 'INVOKE_REGION_WIN'
1610 layout.operator("mesh.edge_face_add")
1611 layout.operator("mesh.subdivide")
1615 layout.operator("mesh.mark_seam")
1616 layout.operator("mesh.mark_seam", text="Clear Seam").clear = True
1620 layout.operator("mesh.mark_sharp")
1621 layout.operator("mesh.mark_sharp", text="Clear Sharp").clear = True
1625 layout.operator("mesh.edge_rotate", text="Rotate Edge CW").direction = 'CW'
1626 layout.operator("mesh.edge_rotate", text="Rotate Edge CCW").direction = 'CCW'
1630 layout.operator("TRANSFORM_OT_edge_slide")
1631 layout.operator("TRANSFORM_OT_edge_crease")
1632 layout.operator("mesh.loop_multi_select", text="Edge Loop")
1634 # uiItemO(layout, "Loopcut", 0, "mesh.loop_cut"); // CutEdgeloop(em, 1);
1635 # uiItemO(layout, "Edge Slide", 0, "mesh.edge_slide"); // EdgeSlide(em, 0,0.0);
1637 layout.operator("mesh.loop_multi_select", text="Edge Ring").ring = True
1639 layout.operator("mesh.loop_to_region")
1640 layout.operator("mesh.region_to_loop")
1643 class VIEW3D_MT_edit_mesh_faces(bpy.types.Menu):
1645 bl_idname = "VIEW3D_MT_edit_mesh_faces"
1647 def draw(self, context):
1648 layout = self.layout
1649 layout.operator_context = 'INVOKE_REGION_WIN'
1651 layout.operator("mesh.flip_normals")
1652 # layout.operator("mesh.bevel")
1653 # layout.operator("mesh.bevel")
1654 layout.operator("mesh.edge_face_add")
1655 layout.operator("mesh.fill")
1656 layout.operator("mesh.beautify_fill")
1657 layout.operator("mesh.solidify")
1658 layout.operator("mesh.sort_faces")
1662 layout.operator("mesh.fgon_make")
1663 layout.operator("mesh.fgon_clear")
1667 layout.operator("mesh.quads_convert_to_tris")
1668 layout.operator("mesh.tris_convert_to_quads")
1669 layout.operator("mesh.edge_flip")
1673 layout.operator("mesh.faces_shade_smooth")
1674 layout.operator("mesh.faces_shade_flat")
1678 # uiItemO(layout, NULL, 0, "mesh.face_mode"); // mesh_set_face_flags(em, 1);
1679 # uiItemBooleanO(layout, NULL, 0, "mesh.face_mode", "clear", 1); // mesh_set_face_flags(em, 0);
1681 layout.operator("mesh.edge_rotate", text="Rotate Edge CW").direction = 'CW'
1685 layout.operator_menu_enum("mesh.uvs_rotate", "direction")
1686 layout.operator_menu_enum("mesh.uvs_mirror", "axis")
1687 layout.operator_menu_enum("mesh.colors_rotate", "direction")
1688 layout.operator_menu_enum("mesh.colors_mirror", "axis")
1691 class VIEW3D_MT_edit_mesh_normals(bpy.types.Menu):
1692 bl_label = "Normals"
1694 def draw(self, context):
1695 layout = self.layout
1697 layout.operator("mesh.normals_make_consistent", text="Recalculate Outside")
1698 layout.operator("mesh.normals_make_consistent", text="Recalculate Inside").inside = True
1702 layout.operator("mesh.flip_normals")
1705 class VIEW3D_MT_edit_mesh_showhide(ShowHideMenu, bpy.types.Menu):
1706 _operator_name = "mesh"
1709 # draw_curve is used by VIEW3D_MT_edit_curve and VIEW3D_MT_edit_surface
1712 def draw_curve(self, context):
1713 layout = self.layout
1715 settings = context.tool_settings
1717 layout.menu("VIEW3D_MT_transform")
1718 layout.menu("VIEW3D_MT_mirror")
1719 layout.menu("VIEW3D_MT_snap")
1723 layout.operator("curve.extrude")
1724 layout.operator("curve.duplicate")
1725 layout.operator("curve.separate")
1726 layout.operator("curve.make_segment")
1727 layout.operator("curve.cyclic_toggle")
1728 layout.operator("curve.delete", text="Delete...")
1732 layout.menu("VIEW3D_MT_edit_curve_ctrlpoints")
1733 layout.menu("VIEW3D_MT_edit_curve_segments")
1737 layout.prop_menu_enum(settings, "proportional_edit")
1738 layout.prop_menu_enum(settings, "proportional_edit_falloff")
1742 layout.menu("VIEW3D_MT_edit_curve_showhide")
1745 class VIEW3D_MT_edit_curve(bpy.types.Menu):
1751 class VIEW3D_MT_edit_curve_ctrlpoints(bpy.types.Menu):
1752 bl_label = "Control Points"
1754 def draw(self, context):
1755 layout = self.layout
1757 edit_object = context.edit_object
1759 if edit_object.type == 'CURVE':
1760 layout.operator("transform.transform", text="Tilt").mode = 'TILT'
1761 layout.operator("curve.tilt_clear")
1762 layout.operator("curve.separate")
1766 layout.operator_menu_enum("curve.handle_type_set", "type")
1770 layout.menu("VIEW3D_MT_hook")
1773 class VIEW3D_MT_edit_curve_segments(bpy.types.Menu):
1774 bl_label = "Segments"
1776 def draw(self, context):
1777 layout = self.layout
1779 layout.operator("curve.subdivide")
1780 layout.operator("curve.switch_direction")
1783 class VIEW3D_MT_edit_curve_specials(bpy.types.Menu):
1784 bl_label = "Specials"
1786 def draw(self, context):
1787 layout = self.layout
1789 layout.operator("curve.subdivide")
1790 layout.operator("curve.switch_direction")
1791 layout.operator("curve.spline_weight_set")
1792 layout.operator("curve.radius_set")
1793 layout.operator("curve.smooth")
1794 layout.operator("curve.smooth_radius")
1797 class VIEW3D_MT_edit_curve_showhide(ShowHideMenu, bpy.types.Menu):
1798 _operator_name = "curve"
1801 class VIEW3D_MT_edit_surface(bpy.types.Menu):
1802 bl_label = "Surface"
1807 class VIEW3D_MT_edit_font(bpy.types.Menu):
1810 def draw(self, context):
1811 layout = self.layout
1813 layout.operator("font.file_paste")
1817 layout.menu("VIEW3D_MT_edit_text_chars")
1821 layout.operator("font.style_toggle", text="Toggle Bold").style = 'BOLD'
1822 layout.operator("font.style_toggle", text="Toggle Italic").style = 'ITALIC'
1823 layout.operator("font.style_toggle", text="Toggle Underline").style = 'UNDERLINE'
1824 layout.operator("font.style_toggle", text="Toggle Small Caps").style = 'SMALL_CAPS'
1827 class VIEW3D_MT_edit_text_chars(bpy.types.Menu):
1828 bl_label = "Special Characters"
1830 def draw(self, context):
1831 layout = self.layout
1833 layout.operator("font.text_insert", text="Copyright|Alt C").text = b'\xC2\xA9'.decode()
1834 layout.operator("font.text_insert", text="Registered Trademark|Alt R").text = b'\xC2\xAE'.decode()
1838 layout.operator("font.text_insert", text="Degree Sign|Alt G").text = b'\xC2\xB0'.decode()
1839 layout.operator("font.text_insert", text="Multiplication Sign|Alt x").text = b'\xC3\x97'.decode()
1840 layout.operator("font.text_insert", text="Circle|Alt .").text = b'\xC2\x8A'.decode()
1841 layout.operator("font.text_insert", text="Superscript 1|Alt 1").text = b'\xC2\xB9'.decode()
1842 layout.operator("font.text_insert", text="Superscript 2|Alt 2").text = b'\xC2\xB2'.decode()
1843 layout.operator("font.text_insert", text="Superscript 3|Alt 3").text = b'\xC2\xB3'.decode()
1844 layout.operator("font.text_insert", text="Double >>|Alt >").text = b'\xC2\xBB'.decode()
1845 layout.operator("font.text_insert", text="Double <<|Alt <").text = b'\xC2\xAB'.decode()
1846 layout.operator("font.text_insert", text="Promillage|Alt %").text = b'\xE2\x80\xB0'.decode()
1850 layout.operator("font.text_insert", text="Dutch Florin|Alt F").text = b'\xC2\xA4'.decode()
1851 layout.operator("font.text_insert", text="British Pound|Alt L").text = b'\xC2\xA3'.decode()
1852 layout.operator("font.text_insert", text="Japanese Yen|Alt Y").text = b'\xC2\xA5'.decode()
1856 layout.operator("font.text_insert", text="German S|Alt S").text = b'\xC3\x9F'.decode()
1857 layout.operator("font.text_insert", text="Spanish Question Mark|Alt ?").text = b'\xC2\xBF'.decode()
1858 layout.operator("font.text_insert", text="Spanish Exclamation Mark|Alt !").text = b'\xC2\xA1'.decode()
1861 class VIEW3D_MT_edit_meta(bpy.types.Menu):
1862 bl_label = "Metaball"
1864 def draw(self, context):
1865 layout = self.layout
1867 settings = context.tool_settings
1869 layout.operator("ed.undo")
1870 layout.operator("ed.redo")
1871 layout.operator("ed.undo_history")
1875 layout.menu("VIEW3D_MT_transform")
1876 layout.menu("VIEW3D_MT_mirror")
1877 layout.menu("VIEW3D_MT_snap")
1881 layout.operator("mball.delete_metaelems", text="Delete...")
1882 layout.operator("mball.duplicate_metaelems")
1886 layout.prop_menu_enum(settings, "proportional_edit")
1887 layout.prop_menu_enum(settings, "proportional_edit_falloff")
1891 layout.menu("VIEW3D_MT_edit_meta_showhide")
1894 class VIEW3D_MT_edit_meta_showhide(bpy.types.Menu):
1895 bl_label = "Show/Hide"
1897 def draw(self, context):
1898 layout = self.layout
1900 layout.operator("mball.reveal_metaelems", text="Show Hidden")
1901 layout.operator("mball.hide_metaelems", text="Hide Selected")
1902 layout.operator("mball.hide_metaelems", text="Hide Unselected").unselected = True
1905 class VIEW3D_MT_edit_lattice(bpy.types.Menu):
1906 bl_label = "Lattice"
1908 def draw(self, context):
1909 layout = self.layout
1911 settings = context.tool_settings
1913 layout.menu("VIEW3D_MT_transform")
1914 layout.menu("VIEW3D_MT_mirror")
1915 layout.menu("VIEW3D_MT_snap")
1919 layout.operator("lattice.make_regular")
1923 layout.prop_menu_enum(settings, "proportional_edit")
1924 layout.prop_menu_enum(settings, "proportional_edit_falloff")
1927 class VIEW3D_MT_edit_armature(bpy.types.Menu):
1928 bl_label = "Armature"
1930 def draw(self, context):
1931 layout = self.layout
1933 edit_object = context.edit_object
1934 arm = edit_object.data
1936 layout.menu("VIEW3D_MT_transform")
1937 layout.menu("VIEW3D_MT_mirror")
1938 layout.menu("VIEW3D_MT_snap")
1939 layout.menu("VIEW3D_MT_edit_armature_roll")
1943 layout.operator("armature.extrude_move")
1945 if arm.use_mirror_x:
1946 layout.operator("armature.extrude_forked")
1948 layout.operator("armature.duplicate_move")
1949 layout.operator("armature.merge")
1950 layout.operator("armature.fill")
1951 layout.operator("armature.delete")
1952 layout.operator("armature.separate")
1956 layout.operator("armature.subdivide", text="Subdivide")
1957 layout.operator("armature.switch_direction", text="Switch Direction")
1961 layout.operator_context = 'EXEC_AREA'
1962 layout.operator("armature.autoside_names", text="AutoName Left/Right").type = 'XAXIS'
1963 layout.operator("armature.autoside_names", text="AutoName Front/Back").type = 'YAXIS'
1964 layout.operator("armature.autoside_names", text="AutoName Top/Bottom").type = 'ZAXIS'
1965 layout.operator("armature.flip_names")
1969 layout.operator_context = 'INVOKE_DEFAULT'
1970 layout.operator("armature.armature_layers")
1971 layout.operator("armature.bone_layers")
1975 layout.menu("VIEW3D_MT_edit_armature_parent")
1979 layout.operator_menu_enum("armature.flags_set", "mode", text="Bone Settings")
1982 class VIEW3D_MT_armature_specials(bpy.types.Menu):
1983 bl_label = "Specials"
1985 def draw(self, context):
1986 layout = self.layout
1988 layout.operator_context = 'INVOKE_REGION_WIN'
1990 layout.operator("armature.subdivide", text="Subdivide")
1991 layout.operator("armature.switch_direction", text="Switch Direction")
1995 layout.operator_context = 'EXEC_REGION_WIN'
1996 layout.operator("armature.autoside_names", text="AutoName Left/Right").type = 'XAXIS'
1997 layout.operator("armature.autoside_names", text="AutoName Front/Back").type = 'YAXIS'
1998 layout.operator("armature.autoside_names", text="AutoName Top/Bottom").type = 'ZAXIS'
1999 layout.operator("armature.flip_names", text="Flip Names")
2002 class VIEW3D_MT_edit_armature_parent(bpy.types.Menu):
2005 def draw(self, context):
2006 layout = self.layout
2008 layout.operator("armature.parent_set", text="Make")
2009 layout.operator("armature.parent_clear", text="Clear")
2012 class VIEW3D_MT_edit_armature_roll(bpy.types.Menu):
2013 bl_label = "Bone Roll"
2015 def draw(self, context):
2016 layout = self.layout
2018 layout.operator_menu_enum("armature.calculate_roll", "type")
2022 layout.operator("transform.transform", text="Set Roll").mode = 'BONE_ROLL'
2024 # ********** Panel **********
2027 class VIEW3D_PT_view3d_properties(bpy.types.Panel):
2028 bl_space_type = 'VIEW_3D'
2029 bl_region_type = 'UI'
2033 def poll(cls, context):
2034 view = context.space_data
2037 def draw(self, context):
2038 layout = self.layout
2040 view = context.space_data
2042 col = layout.column()
2043 col.active = view.region_3d.view_perspective != 'CAMERA'
2044 col.prop(view, "lens")
2045 col.label(text="Lock to Object:")
2046 col.prop(view, "lock_object", text="")
2047 if view.lock_object and view.lock_object.type == 'ARMATURE':
2048 col.prop_search(view, "lock_bone", view.lock_object.data, "bones", text="")
2049 elif not view.lock_object:
2050 col.prop(view, "lock_cursor", text="Lock to Cursor")
2052 col = layout.column()
2053 col.prop(view, "lock_camera")
2055 col = layout.column(align=True)
2056 col.label(text="Clip:")
2057 col.prop(view, "clip_start", text="Start")
2058 col.prop(view, "clip_end", text="End")
2060 subcol = col.column()
2061 subcol.enabled = not view.lock_camera_and_layers
2062 subcol.label(text="Local Camera:")
2063 subcol.prop(view, "camera", text="")
2065 layout.column().prop(view, "cursor_location")
2068 class VIEW3D_PT_view3d_name(bpy.types.Panel):
2069 bl_space_type = 'VIEW_3D'
2070 bl_region_type = 'UI'
2074 def poll(cls, context):
2075 return (context.space_data and context.active_object)
2077 def draw(self, context):
2078 layout = self.layout
2080 ob = context.active_object
2082 row.label(text="", icon='OBJECT_DATA')
2083 row.prop(ob, "name", text="")
2085 if ob.type == 'ARMATURE' and ob.mode in {'EDIT', 'POSE'}:
2086 bone = context.active_bone
2089 row.label(text="", icon='BONE_DATA')
2090 row.prop(bone, "name", text="")
2093 class VIEW3D_PT_view3d_display(bpy.types.Panel):
2094 bl_space_type = 'VIEW_3D'
2095 bl_region_type = 'UI'
2096 bl_label = "Display"
2097 bl_options = {'DEFAULT_CLOSED'}
2100 def poll(cls, context):
2101 view = context.space_data
2104 def draw(self, context):
2105 layout = self.layout
2107 view = context.space_data
2108 scene = context.scene
2109 gs = scene.game_settings
2112 col = layout.column()
2113 col.prop(view, "show_only_render")
2115 col = layout.column()
2116 display_all = not view.show_only_render
2117 col.active = display_all
2118 col.prop(view, "show_outline_selected")
2119 col.prop(view, "show_all_objects_origin")
2120 col.prop(view, "show_relationship_lines")
2121 if ob and ob.type == 'MESH':
2123 col.prop(mesh, "show_all_edges")
2125 col = layout.column()
2126 col.active = display_all
2127 split = col.split(percentage=0.55)
2128 split.prop(view, "show_floor", text="Grid Floor")
2130 row = split.row(align=True)
2131 row.prop(view, "show_axis_x", text="X", toggle=True)
2132 row.prop(view, "show_axis_y", text="Y", toggle=True)
2133 row.prop(view, "show_axis_z", text="Z", toggle=True)
2135 sub = col.column(align=True)
2136 sub.active = (display_all and view.show_floor)
2137 sub.prop(view, "grid_lines", text="Lines")
2138 sub.prop(view, "grid_scale", text="Scale")
2139 subsub = sub.column(align=True)
2140 subsub.active = scene.unit_settings.system == 'NONE'
2141 subsub.prop(view, "grid_subdivisions", text="Subdivisions")
2143 col = layout.column()
2144 col.label(text="Shading:")
2145 col.prop(gs, "material_mode", text="")
2146 col.prop(view, "show_textured_solid")
2150 region = view.region_quadview
2152 layout.operator("screen.region_quadview", text="Toggle Quad View")
2155 col = layout.column()
2156 col.prop(region, "lock_rotation")
2158 row.enabled = region.lock_rotation
2159 row.prop(region, "show_sync_view")
2161 row.enabled = region.lock_rotation and region.show_sync_view
2162 row.prop(region, "use_box_clip")
2165 class VIEW3D_PT_view3d_meshdisplay(bpy.types.Panel):
2166 bl_space_type = 'VIEW_3D'
2167 bl_region_type = 'UI'
2168 bl_label = "Mesh Display"
2171 def poll(cls, context):
2172 # The active object check is needed because of localmode
2173 return (context.active_object and (context.mode == 'EDIT_MESH'))
2175 def draw(self, context):
2176 layout = self.layout
2178 mesh = context.active_object.data
2180 col = layout.column()
2181 col.label(text="Overlays:")
2182 col.prop(mesh, "show_edges", text="Edges")
2183 col.prop(mesh, "show_faces", text="Faces")
2184 col.prop(mesh, "show_edge_crease", text="Creases")
2185 col.prop(mesh, "show_edge_bevel_weight", text="Bevel Weights")
2186 col.prop(mesh, "show_edge_seams", text="Seams")
2187 col.prop(mesh, "show_edge_sharp", text="Sharp")
2190 col.label(text="Normals:")
2191 col.prop(mesh, "show_normal_face", text="Face")
2192 col.prop(mesh, "show_normal_vertex", text="Vertex")
2193 col.prop(context.scene.tool_settings, "normal_size", text="Normal Size")
2196 col.label(text="Numerics:")
2197 col.prop(mesh, "show_extra_edge_length")
2198 col.prop(mesh, "show_extra_face_angle")
2199 col.prop(mesh, "show_extra_face_area")
2202 class VIEW3D_PT_view3d_curvedisplay(bpy.types.Panel):
2203 bl_space_type = 'VIEW_3D'
2204 bl_region_type = 'UI'
2205 bl_label = "Curve Display"
2208 def poll(cls, context):
2209 editmesh = context.mode == 'EDIT_CURVE'
2212 def draw(self, context):
2213 layout = self.layout
2215 curve = context.active_object.data
2217 col = layout.column()
2218 col.label(text="Overlays:")
2219 col.prop(curve, "show_handles", text="Handles")
2220 col.prop(curve, "show_normal_face", text="Normals")
2221 col.prop(context.scene.tool_settings, "normal_size", text="Normal Size")
2224 class VIEW3D_PT_background_image(bpy.types.Panel):
2225 bl_space_type = 'VIEW_3D'
2226 bl_region_type = 'UI'
2227 bl_label = "Background Images"
2228 bl_options = {'DEFAULT_CLOSED'}
2231 def poll(cls, context):
2232 view = context.space_data
2233 # bg = context.space_data.background_image
2236 def draw_header(self, context):
2237 layout = self.layout
2238 view = context.space_data
2240 layout.prop(view, "show_background_images", text="")
2242 def draw(self, context):
2243 layout = self.layout
2245 view = context.space_data
2247 col = layout.column()
2248 col.operator("view3d.background_image_add", text="Add Image")
2250 for i, bg in enumerate(view.background_images):
2251 layout.active = view.show_background_images
2253 row = box.row(align=True)
2254 row.prop(bg, "show_expanded", text="", emboss=False)
2256 row.prop(bg.image, "name", text="", emboss=False)
2258 row.label(text="Not Set")
2259 row.operator("view3d.background_image_remove", text="", emboss=False, icon='X').index = i
2261 box.prop(bg, "view_axis", text="Axis")
2263 if bg.show_expanded:
2265 row.template_ID(bg, "image", open="image.open")
2267 box.template_image(bg, "image", bg.image_user, compact=True)
2269 box.prop(bg, "opacity", slider=True)
2270 if bg.view_axis != 'CAMERA':
2271 box.prop(bg, "size")
2272 row = box.row(align=True)
2273 row.prop(bg, "offset_x", text="X")
2274 row.prop(bg, "offset_y", text="Y")
2277 class VIEW3D_PT_transform_orientations(bpy.types.Panel):
2278 bl_space_type = 'VIEW_3D'
2279 bl_region_type = 'UI'
2280 bl_label = "Transform Orientations"
2281 bl_options = {'DEFAULT_CLOSED'}
2284 def poll(cls, context):
2285 view = context.space_data
2288 def draw(self, context):
2289 layout = self.layout
2291 view = context.space_data
2293 col = layout.column()
2295 col.prop(view, "transform_orientation")
2296 col.operator("transform.create_orientation", text="Create")
2298 orientation = view.current_orientation
2301 col.prop(orientation, "name")
2302 col.operator("transform.delete_orientation", text="Delete")
2305 class VIEW3D_PT_etch_a_ton(bpy.types.Panel):
2306 bl_space_type = 'VIEW_3D'
2307 bl_region_type = 'UI'
2308 bl_label = "Skeleton Sketching"
2309 bl_options = {'DEFAULT_CLOSED'}
2312 def poll(cls, context):
2313 scene = context.space_data
2314 ob = context.active_object
2315 return scene and ob and ob.type == 'ARMATURE' and ob.mode == 'EDIT'
2317 def draw_header(self, context):
2318 layout = self.layout
2319 toolsettings = context.scene.tool_settings
2321 layout.prop(toolsettings, "use_bone_sketching", text="")
2323 def draw(self, context):
2324 layout = self.layout
2325 toolsettings = context.scene.tool_settings
2327 col = layout.column()
2329 col.prop(toolsettings, "use_etch_quick")
2330 col.prop(toolsettings, "use_etch_overdraw")
2332 col.prop(toolsettings, "etch_convert_mode")
2334 if toolsettings.etch_convert_mode == 'LENGTH':
2335 col.prop(toolsettings, "etch_length_limit")
2336 elif toolsettings.etch_convert_mode == 'ADAPTIVE':
2337 col.prop(toolsettings, "etch_adaptive_limit")
2338 elif toolsettings.etch_convert_mode == 'FIXED':
2339 col.prop(toolsettings, "etch_subdivision_number")
2340 elif toolsettings.etch_convert_mode == 'RETARGET':
2341 col.prop(toolsettings, "etch_template")
2342 col.prop(toolsettings, "etch_roll_mode")
2343 col.prop(toolsettings, "use_etch_autoname")
2344 col.prop(toolsettings, "etch_number")
2345 col.prop(toolsettings, "etch_side")
2347 col.operator("sketch.convert", text="Convert")
2350 class VIEW3D_PT_context_properties(bpy.types.Panel):
2351 bl_space_type = 'VIEW_3D'
2352 bl_region_type = 'UI'
2353 bl_label = "Properties"
2354 bl_options = {'DEFAULT_CLOSED'}
2356 def _active_context_member(context):
2357 obj = context.object
2361 return "active_pose_bone"
2362 elif mode == 'EDIT' and obj.type == 'ARMATURE':
2363 return "active_bone"
2370 def poll(cls, context):
2371 member = cls._active_context_member(context)
2373 context_member = getattr(context, member)
2374 return context_member and context_member.keys()
2378 def draw(self, context):
2380 member = __class__._active_context_member(context)
2383 # Draw with no edit button
2384 rna_prop_ui.draw(self.layout, context, member, object, False)
2388 bpy.utils.register_module(__name__)
2392 bpy.utils.unregister_module(__name__)
2394 if __name__ == "__main__":
2397 if __name__ == "__main__": # only for live edit.
2398 bpy.utils.register_module(__name__)