1 # ##### BEGIN GPL LICENSE BLOCK #####
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 # ##### END GPL LICENSE BLOCK #####
21 from bpy.types import Header, Menu, Panel
24 class VIEW3D_HT_header(Header):
25 bl_space_type = 'VIEW_3D'
27 def draw(self, context):
30 view = context.space_data
31 mode_string = context.mode
32 edit_object = context.edit_object
33 obj = context.active_object
34 toolsettings = context.tool_settings
36 row = layout.row(align=True)
40 if context.area.show_menus:
41 sub = row.row(align=True)
43 sub.menu("VIEW3D_MT_view")
46 if mode_string not in {'EDIT_TEXT', 'SCULPT', 'PAINT_WEIGHT', 'PAINT_VERTEX', 'PAINT_TEXTURE'}:
47 sub.menu("VIEW3D_MT_select_%s" % mode_string.lower())
50 sub.menu("VIEW3D_MT_edit_%s" % edit_object.type.lower())
52 if mode_string not in {'PAINT_TEXTURE'}:
53 sub.menu("VIEW3D_MT_%s" % mode_string.lower())
55 sub.menu("VIEW3D_MT_object")
57 # Contains buttons like Mode, Pivot, Manipulator, Layer, Mesh Select Mode...
59 layout.template_header_3D()
63 if obj.mode == 'PARTICLE_EDIT':
64 row.prop(toolsettings.particle_edit, "select_mode", text="", expand=True)
67 if view.viewport_shade in {'SOLID', 'SHADED', 'TEXTURED'} and (obj.mode == 'PARTICLE_EDIT' or (obj.mode == 'EDIT' and obj.type == 'MESH')):
68 row.prop(view, "use_occlude_geometry", text="")
70 # Proportional editing
71 if obj.mode in {'EDIT', 'PARTICLE_EDIT'}:
72 row = layout.row(align=True)
73 row.prop(toolsettings, "proportional_edit", text="", icon_only=True)
74 if toolsettings.proportional_edit != 'DISABLED':
75 row.prop(toolsettings, "proportional_edit_falloff", text="", icon_only=True)
76 elif obj.mode == 'OBJECT':
77 row = layout.row(align=True)
78 row.prop(toolsettings, "use_proportional_edit_objects", text="", icon_only=True)
79 if toolsettings.use_proportional_edit_objects:
80 row.prop(toolsettings, "proportional_edit_falloff", text="", icon_only=True)
83 snap_element = toolsettings.snap_element
84 row = layout.row(align=True)
85 row.prop(toolsettings, "use_snap", text="")
86 row.prop(toolsettings, "snap_element", text="", icon_only=True)
87 if snap_element != 'INCREMENT':
88 row.prop(toolsettings, "snap_target", text="")
90 if obj.mode == 'OBJECT':
91 row.prop(toolsettings, "use_snap_align_rotation", text="")
92 elif obj.mode == 'EDIT':
93 row.prop(toolsettings, "use_snap_self", text="")
95 if snap_element == 'VOLUME':
96 row.prop(toolsettings, "use_snap_peel_object", text="")
97 elif snap_element == 'FACE':
98 row.prop(toolsettings, "use_snap_project", text="")
101 row = layout.row(align=True)
102 row.operator("render.opengl", text="", icon='RENDER_STILL')
103 props = row.operator("render.opengl", text="", icon='RENDER_ANIMATION')
104 props.animation = True
107 if obj and obj.mode == 'POSE':
108 row = layout.row(align=True)
109 row.operator("pose.copy", text="", icon='COPYDOWN')
110 row.operator("pose.paste", text="", icon='PASTEDOWN')
111 props = row.operator("pose.paste", text="", icon='PASTEFLIPDOWN')
115 # ********** Menu **********
117 # ********** Utilities **********
120 class ShowHideMenu():
121 bl_label = "Show/Hide"
124 def draw(self, context):
127 layout.operator("%s.reveal" % self._operator_name, text="Show Hidden")
128 layout.operator("%s.hide" % self._operator_name, text="Hide Selected")
129 layout.operator("%s.hide" % self._operator_name, text="Hide Unselected").unselected = True
132 class VIEW3D_MT_transform(Menu):
133 bl_label = "Transform"
135 # TODO: get rid of the custom text strings?
136 def draw(self, context):
139 layout.operator("transform.translate", text="Grab/Move")
140 # TODO: sub-menu for grab per axis
141 layout.operator("transform.rotate", text="Rotate")
142 # TODO: sub-menu for rot per axis
143 layout.operator("transform.resize", text="Scale")
144 # TODO: sub-menu for scale per axis
148 layout.operator("transform.tosphere", text="To Sphere")
149 layout.operator("transform.shear", text="Shear")
150 layout.operator("transform.warp", text="Warp")
151 layout.operator("transform.push_pull", text="Push/Pull")
155 layout.operator("transform.translate", text="Move Texture Space").texture_space = True
156 layout.operator("transform.resize", text="Scale Texture Space").texture_space = True
161 if obj.type == 'ARMATURE' and obj.mode in {'EDIT', 'POSE'} and obj.data.draw_type in {'BBONE', 'ENVELOPE'}:
162 layout.operator("transform.transform", text="Scale Envelope/BBone").mode = 'BONE_SIZE'
164 if context.edit_object and context.edit_object.type == 'ARMATURE':
165 layout.operator("armature.align")
167 layout.operator_context = 'EXEC_REGION_WIN'
168 layout.operator("transform.transform", text="Align to Transform Orientation").mode = 'ALIGN' # XXX see alignmenu() in edit.c of b2.4x to get this working
172 layout.operator_context = 'EXEC_AREA'
174 layout.operator("object.origin_set", text="Geometry to Origin").type = 'GEOMETRY_ORIGIN'
175 layout.operator("object.origin_set", text="Origin to Geometry").type = 'ORIGIN_GEOMETRY'
176 layout.operator("object.origin_set", text="Origin to 3D Cursor").type = 'ORIGIN_CURSOR'
180 layout.operator("object.randomize_transform")
181 layout.operator("object.align")
185 layout.operator("object.anim_transforms_to_deltas")
188 class VIEW3D_MT_mirror(Menu):
191 def draw(self, context):
194 layout.operator("transform.mirror", text="Interactive Mirror")
198 layout.operator_context = 'INVOKE_REGION_WIN'
200 props = layout.operator("transform.mirror", text="X Global")
201 props.constraint_axis = (True, False, False)
202 props.constraint_orientation = 'GLOBAL'
203 props = layout.operator("transform.mirror", text="Y Global")
204 props.constraint_axis = (False, True, False)
205 props.constraint_orientation = 'GLOBAL'
206 props = layout.operator("transform.mirror", text="Z Global")
207 props.constraint_axis = (False, False, True)
208 props.constraint_orientation = 'GLOBAL'
210 if context.edit_object:
213 props = layout.operator("transform.mirror", text="X Local")
214 props.constraint_axis = (True, False, False)
215 props.constraint_orientation = 'LOCAL'
216 props = layout.operator("transform.mirror", text="Y Local")
217 props.constraint_axis = (False, True, False)
218 props.constraint_orientation = 'LOCAL'
219 props = layout.operator("transform.mirror", text="Z Local")
220 props.constraint_axis = (False, False, True)
221 props.constraint_orientation = 'LOCAL'
223 layout.operator("object.vertex_group_mirror")
226 class VIEW3D_MT_snap(Menu):
229 def draw(self, context):
232 layout.operator("view3d.snap_selected_to_grid", text="Selection to Grid")
233 layout.operator("view3d.snap_selected_to_cursor", text="Selection to Cursor")
237 layout.operator("view3d.snap_cursor_to_selected", text="Cursor to Selected")
238 layout.operator("view3d.snap_cursor_to_center", text="Cursor to Center")
239 layout.operator("view3d.snap_cursor_to_grid", text="Cursor to Grid")
240 layout.operator("view3d.snap_cursor_to_active", text="Cursor to Active")
243 class VIEW3D_MT_uv_map(Menu):
244 bl_label = "UV Mapping"
246 def draw(self, context):
249 layout.operator("uv.unwrap")
251 layout.operator_context = 'INVOKE_DEFAULT'
252 layout.operator("uv.smart_project")
253 layout.operator("uv.lightmap_pack")
254 layout.operator("uv.follow_active_quads")
258 layout.operator_context = 'EXEC_DEFAULT'
259 layout.operator("uv.cube_project")
260 layout.operator("uv.cylinder_project")
261 layout.operator("uv.sphere_project")
265 layout.operator("uv.project_from_view")
266 layout.operator("uv.project_from_view", text="Project from View (Bounds)").scale_to_bounds = True
270 layout.operator("uv.reset")
273 # ********** View menus **********
276 class VIEW3D_MT_view(Menu):
279 def draw(self, context):
282 layout.operator("view3d.properties", icon='MENU_PANEL')
283 layout.operator("view3d.toolshelf", icon='MENU_PANEL')
287 layout.operator("view3d.viewnumpad", text="Camera").type = 'CAMERA'
288 layout.operator("view3d.viewnumpad", text="Top").type = 'TOP'
289 layout.operator("view3d.viewnumpad", text="Bottom").type = 'BOTTOM'
290 layout.operator("view3d.viewnumpad", text="Front").type = 'FRONT'
291 layout.operator("view3d.viewnumpad", text="Back").type = 'BACK'
292 layout.operator("view3d.viewnumpad", text="Right").type = 'RIGHT'
293 layout.operator("view3d.viewnumpad", text="Left").type = 'LEFT'
295 layout.menu("VIEW3D_MT_view_cameras", text="Cameras")
299 layout.operator("view3d.view_persportho")
303 layout.menu("VIEW3D_MT_view_navigation")
304 layout.menu("VIEW3D_MT_view_align")
308 layout.operator_context = 'INVOKE_REGION_WIN'
310 layout.operator("view3d.clip_border", text="Clipping Border...")
311 layout.operator("view3d.zoom_border", text="Zoom Border...")
315 layout.operator("view3d.layers", text="Show All Layers").nr = 0
319 layout.operator("view3d.localview", text="View Global/Local")
320 layout.operator("view3d.view_selected")
321 layout.operator("view3d.view_all")
325 layout.operator("screen.animation_play", text="Playback Animation")
329 layout.operator("screen.area_dupli")
330 layout.operator("screen.region_quadview")
331 layout.operator("screen.screen_full_area")
334 class VIEW3D_MT_view_navigation(Menu):
335 bl_label = "Navigation"
337 def draw(self, context):
340 layout.operator_enum("view3d.view_orbit", "type")
344 layout.operator_enum("view3d.view_pan", "type")
348 layout.operator("view3d.zoom", text="Zoom In").delta = 1
349 layout.operator("view3d.zoom", text="Zoom Out").delta = -1
350 layout.operator("view3d.zoom_camera_1_to_1", text="Zoom Camera 1:1")
354 layout.operator("view3d.fly")
357 class VIEW3D_MT_view_align(Menu):
358 bl_label = "Align View"
360 def draw(self, context):
363 layout.menu("VIEW3D_MT_view_align_selected")
367 layout.operator("view3d.view_all", text="Center Cursor and View All").center = True
368 layout.operator("view3d.camera_to_view", text="Align Active Camera to View")
369 layout.operator("view3d.camera_to_view_selected", text="Align Active Camera to Selected")
370 layout.operator("view3d.view_selected")
371 layout.operator("view3d.view_center_cursor")
374 class VIEW3D_MT_view_align_selected(Menu):
375 bl_label = "Align View to Selected"
377 def draw(self, context):
380 props = layout.operator("view3d.viewnumpad", text="Top")
381 props.align_active = True
383 props = layout.operator("view3d.viewnumpad", text="Bottom")
384 props.align_active = True
385 props.type = 'BOTTOM'
386 props = layout.operator("view3d.viewnumpad", text="Front")
387 props.align_active = True
389 props = layout.operator("view3d.viewnumpad", text="Back")
390 props.align_active = True
392 props = layout.operator("view3d.viewnumpad", text="Right")
393 props.align_active = True
395 props = layout.operator("view3d.viewnumpad", text="Left")
396 props.align_active = True
400 class VIEW3D_MT_view_cameras(Menu):
403 def draw(self, context):
406 layout.operator("view3d.object_as_camera")
407 layout.operator("view3d.viewnumpad", text="Active Camera").type = 'CAMERA'
409 # ********** Select menus, suffix from context.mode **********
412 class VIEW3D_MT_select_object(Menu):
415 def draw(self, context):
418 layout.operator("view3d.select_border")
419 layout.operator("view3d.select_circle")
423 layout.operator("object.select_all", text="Select/Deselect All")
424 layout.operator("object.select_inverse", text="Inverse")
425 layout.operator("object.select_random", text="Random")
426 layout.operator("object.select_mirror", text="Mirror")
427 layout.operator("object.select_by_layer", text="Select All by Layer")
428 layout.operator_menu_enum("object.select_by_type", "type", text="Select All by Type...")
429 layout.operator("object.select_camera", text="Select Camera")
433 layout.operator_menu_enum("object.select_grouped", "type", text="Grouped")
434 layout.operator_menu_enum("object.select_linked", "type", text="Linked")
435 layout.operator("object.select_pattern", text="Select Pattern...")
438 class VIEW3D_MT_select_pose(Menu):
441 def draw(self, context):
444 layout.operator("view3d.select_border")
448 layout.operator("pose.select_all", text="Select/Deselect All")
449 layout.operator("pose.select_inverse", text="Inverse")
450 layout.operator("pose.select_flip_active", text="Flip Active")
451 layout.operator("pose.select_constraint_target", text="Constraint Target")
452 layout.operator("pose.select_linked", text="Linked")
456 layout.operator("pose.select_hierarchy", text="Parent").direction = 'PARENT'
457 layout.operator("pose.select_hierarchy", text="Child").direction = 'CHILD'
461 props = layout.operator("pose.select_hierarchy", text="Extend Parent")
463 props.direction = 'PARENT'
465 props = layout.operator("pose.select_hierarchy", text="Extend Child")
467 props.direction = 'CHILD'
471 layout.operator_menu_enum("pose.select_grouped", "type", text="Grouped")
472 layout.operator("object.select_pattern", text="Select Pattern...")
475 class VIEW3D_MT_select_particle(Menu):
478 def draw(self, context):
481 layout.operator("view3d.select_border")
485 layout.operator("particle.select_all", text="Select/Deselect All")
486 layout.operator("particle.select_linked")
487 layout.operator("particle.select_inverse")
491 layout.operator("particle.select_more")
492 layout.operator("particle.select_less")
496 layout.operator("particle.select_roots", text="Roots")
497 layout.operator("particle.select_tips", text="Tips")
500 class VIEW3D_MT_select_edit_mesh(Menu):
503 def draw(self, context):
506 layout.operator("view3d.select_border")
507 layout.operator("view3d.select_circle")
511 layout.operator("mesh.select_all", text="Select/Deselect All")
512 layout.operator("mesh.select_inverse", text="Inverse")
516 layout.operator("mesh.select_random", text="Random")
517 layout.operator("mesh.select_nth", text="Every N Number of Verts")
518 layout.operator("mesh.edges_select_sharp", text="Sharp Edges")
519 layout.operator("mesh.faces_select_linked_flat", text="Linked Flat Faces")
520 layout.operator("mesh.faces_select_interior", text="Interior Faces")
521 layout.operator("mesh.select_axis", text="Side of Active")
525 layout.operator("mesh.select_by_number_vertices", text="Triangles").type = 'TRIANGLES'
526 layout.operator("mesh.select_by_number_vertices", text="Quads").type = 'QUADS'
527 if context.scene.tool_settings.mesh_select_mode[2] == False:
528 layout.operator("mesh.select_non_manifold", text="Non Manifold")
529 layout.operator("mesh.select_by_number_vertices", text="Loose Verts/Edges").type = 'OTHER'
530 layout.operator("mesh.select_similar", text="Similar")
534 layout.operator("mesh.select_less", text="Less")
535 layout.operator("mesh.select_more", text="More")
539 layout.operator("mesh.select_mirror", text="Mirror")
541 layout.operator("mesh.select_linked", text="Linked")
542 layout.operator("mesh.select_vertex_path", text="Vertex Path")
543 layout.operator("mesh.loop_multi_select", text="Edge Loop")
544 layout.operator("mesh.loop_multi_select", text="Edge Ring").ring = True
548 layout.operator("mesh.loop_to_region")
549 layout.operator("mesh.region_to_loop")
552 class VIEW3D_MT_select_edit_curve(Menu):
555 def draw(self, context):
558 layout.operator("view3d.select_border")
559 layout.operator("view3d.select_circle")
563 layout.operator("curve.select_all", text="Select/Deselect All")
564 layout.operator("curve.select_inverse")
565 layout.operator("curve.select_random")
566 layout.operator("curve.select_nth", text="Every Nth Number of Points")
570 layout.operator("curve.de_select_first")
571 layout.operator("curve.de_select_last")
572 layout.operator("curve.select_next")
573 layout.operator("curve.select_previous")
577 layout.operator("curve.select_more")
578 layout.operator("curve.select_less")
581 class VIEW3D_MT_select_edit_surface(Menu):
584 def draw(self, context):
587 layout.operator("view3d.select_border")
588 layout.operator("view3d.select_circle")
592 layout.operator("curve.select_all", text="Select/Deselect All")
593 layout.operator("curve.select_inverse")
594 layout.operator("curve.select_random")
595 layout.operator("curve.select_nth", text="Every Nth Number of Points")
599 layout.operator("curve.select_row")
603 layout.operator("curve.select_more")
604 layout.operator("curve.select_less")
607 class VIEW3D_MT_select_edit_metaball(Menu):
610 def draw(self, context):
613 layout.operator("view3d.select_border")
617 layout.operator("mball.select_all").action = 'TOGGLE'
618 layout.operator("mball.select_inverse_metaelems")
622 layout.operator("mball.select_random_metaelems")
625 class VIEW3D_MT_select_edit_lattice(Menu):
628 def draw(self, context):
631 layout.operator("view3d.select_border")
635 layout.operator("lattice.select_all", text="Select/Deselect All")
638 class VIEW3D_MT_select_edit_armature(Menu):
641 def draw(self, context):
644 layout.operator("view3d.select_border")
648 layout.operator("armature.select_all", text="Select/Deselect All")
649 layout.operator("armature.select_inverse", text="Inverse")
653 layout.operator("armature.select_hierarchy", text="Parent").direction = 'PARENT'
654 layout.operator("armature.select_hierarchy", text="Child").direction = 'CHILD'
658 props = layout.operator("armature.select_hierarchy", text="Extend Parent")
660 props.direction = 'PARENT'
662 props = layout.operator("armature.select_hierarchy", text="Extend Child")
664 props.direction = 'CHILD'
666 layout.operator("object.select_pattern", text="Select Pattern...")
669 class VIEW3D_MT_select_face(Menu): # XXX no matching enum
672 def draw(self, context):
673 # layout = self.layout
676 # see view3d_select_faceselmenu
679 # ********** Object menu **********
682 class VIEW3D_MT_object(Menu):
683 bl_context = "objectmode"
686 def draw(self, context):
689 layout.operator("ed.undo")
690 layout.operator("ed.redo")
691 layout.operator("ed.undo_history")
695 layout.menu("VIEW3D_MT_transform")
696 layout.menu("VIEW3D_MT_mirror")
697 layout.menu("VIEW3D_MT_object_clear")
698 layout.menu("VIEW3D_MT_object_apply")
699 layout.menu("VIEW3D_MT_snap")
703 layout.menu("VIEW3D_MT_object_animation")
707 layout.operator("object.duplicate_move")
708 layout.operator("object.duplicate_move_linked")
709 layout.operator("object.delete", text="Delete...")
710 layout.operator("object.proxy_make", text="Make Proxy...")
711 layout.menu("VIEW3D_MT_make_links", text="Make Links...")
712 layout.operator("object.make_dupli_face")
713 layout.operator_menu_enum("object.make_local", "type", text="Make Local...")
714 layout.menu("VIEW3D_MT_make_single_user")
718 layout.menu("VIEW3D_MT_object_parent")
719 layout.menu("VIEW3D_MT_object_track")
720 layout.menu("VIEW3D_MT_object_group")
721 layout.menu("VIEW3D_MT_object_constraints")
725 layout.menu("VIEW3D_MT_object_quick_effects")
729 layout.menu("VIEW3D_MT_object_game")
733 layout.operator("object.join")
737 layout.operator("object.move_to_layer", text="Move to Layer...")
738 layout.menu("VIEW3D_MT_object_showhide")
740 layout.operator_menu_enum("object.convert", "target")
743 class VIEW3D_MT_object_animation(Menu):
744 bl_label = "Animation"
746 def draw(self, context):
749 layout.operator("anim.keyframe_insert_menu", text="Insert Keyframe...")
750 layout.operator("anim.keyframe_delete_v3d", text="Delete Keyframe...")
751 layout.operator("anim.keying_set_active_set", text="Change Keying Set...")
754 class VIEW3D_MT_object_clear(Menu):
757 def draw(self, context):
760 layout.operator("object.location_clear", text="Location")
761 layout.operator("object.rotation_clear", text="Rotation")
762 layout.operator("object.scale_clear", text="Scale")
763 layout.operator("object.origin_clear", text="Origin")
766 class VIEW3D_MT_object_specials(Menu):
767 bl_label = "Specials"
770 def poll(cls, context):
771 # add more special types
772 return context.object
774 def draw(self, context):
778 if obj.type == 'CAMERA':
779 layout.operator_context = 'INVOKE_REGION_WIN'
781 if obj.data.type == 'PERSP':
782 props = layout.operator("wm.context_modal_mouse", text="Camera Lens Angle")
783 props.data_path_iter = "selected_editable_objects"
784 props.data_path_item = "data.lens"
785 props.input_scale = 0.1
787 props = layout.operator("wm.context_modal_mouse", text="Camera Lens Scale")
788 props.data_path_iter = "selected_editable_objects"
789 props.data_path_item = "data.ortho_scale"
790 props.input_scale = 0.01
792 if not obj.data.dof_object:
793 #layout.label(text="Test Has DOF obj");
794 props = layout.operator("wm.context_modal_mouse", text="DOF Distance")
795 props.data_path_iter = "selected_editable_objects"
796 props.data_path_item = "data.dof_distance"
797 props.input_scale = 0.02
799 if obj.type in {'CURVE', 'FONT'}:
800 layout.operator_context = 'INVOKE_REGION_WIN'
802 props = layout.operator("wm.context_modal_mouse", text="Extrude Size")
803 props.data_path_iter = "selected_editable_objects"
804 props.data_path_item = "data.extrude"
805 props.input_scale = 0.01
807 props = layout.operator("wm.context_modal_mouse", text="Width Size")
808 props.data_path_iter = "selected_editable_objects"
809 props.data_path_item = "data.offset"
810 props.input_scale = 0.01
812 if obj.type == 'EMPTY':
813 layout.operator_context = 'INVOKE_REGION_WIN'
815 props = layout.operator("wm.context_modal_mouse", text="Empty Draw Size")
816 props.data_path_iter = "selected_editable_objects"
817 props.data_path_item = "empty_draw_size"
818 props.input_scale = 0.01
820 if obj.type == 'LAMP':
821 layout.operator_context = 'INVOKE_REGION_WIN'
823 props = layout.operator("wm.context_modal_mouse", text="Energy")
824 props.data_path_iter = "selected_editable_objects"
825 props.data_path_item = "data.energy"
827 if obj.data.type in {'SPOT', 'AREA', 'POINT'}:
828 props = layout.operator("wm.context_modal_mouse", text="Falloff Distance")
829 props.data_path_iter = "selected_editable_objects"
830 props.data_path_item = "data.distance"
831 props.input_scale = 0.1
833 if obj.data.type == 'SPOT':
835 props = layout.operator("wm.context_modal_mouse", text="Spot Size")
836 props.data_path_iter = "selected_editable_objects"
837 props.data_path_item = "data.spot_size"
838 props.input_scale = 0.01
840 props = layout.operator("wm.context_modal_mouse", text="Spot Blend")
841 props.data_path_iter = "selected_editable_objects"
842 props.data_path_item = "data.spot_blend"
843 props.input_scale = -0.01
845 props = layout.operator("wm.context_modal_mouse", text="Clip Start")
846 props.data_path_iter = "selected_editable_objects"
847 props.data_path_item = "data.shadow_buffer_clip_start"
848 props.input_scale = 0.05
850 props = layout.operator("wm.context_modal_mouse", text="Clip End")
851 props.data_path_iter = "selected_editable_objects"
852 props.data_path_item = "data.shadow_buffer_clip_end"
853 props.input_scale = 0.05
857 props = layout.operator("object.isolate_type_render")
858 props = layout.operator("object.hide_render_clear_all")
861 class VIEW3D_MT_object_apply(Menu):
864 def draw(self, context):
867 layout.operator("object.transform_apply", text="Location").location = True
868 layout.operator("object.transform_apply", text="Rotation").rotation = True
869 layout.operator("object.transform_apply", text="Scale").scale = True
870 props = layout.operator("object.transform_apply", text="Rotation & Scale")
872 props.rotation = True
876 layout.operator("object.visual_transform_apply", text="Visual Transform")
877 layout.operator("object.duplicates_make_real")
880 class VIEW3D_MT_object_parent(Menu):
883 def draw(self, context):
886 layout.operator_menu_enum("object.parent_set", "type", text="Set")
887 layout.operator_menu_enum("object.parent_clear", "type", text="Clear")
890 class VIEW3D_MT_object_track(Menu):
893 def draw(self, context):
896 layout.operator_menu_enum("object.track_set", "type", text="Set")
897 layout.operator_menu_enum("object.track_clear", "type", text="Clear")
900 class VIEW3D_MT_object_group(Menu):
903 def draw(self, context):
906 layout.operator("group.create")
907 layout.operator("group.objects_remove")
911 layout.operator("group.objects_add_active")
912 layout.operator("group.objects_remove_active")
915 class VIEW3D_MT_object_constraints(Menu):
916 bl_label = "Constraints"
918 def draw(self, context):
921 layout.operator("object.constraint_add_with_targets")
922 layout.operator("object.constraints_copy")
923 layout.operator("object.constraints_clear")
926 class VIEW3D_MT_object_quick_effects(Menu):
927 bl_label = "Quick Effects"
929 def draw(self, context):
932 layout.operator("object.quick_fur")
933 layout.operator("object.quick_explode")
934 layout.operator("object.quick_smoke")
935 layout.operator("object.quick_fluid")
938 class VIEW3D_MT_object_showhide(Menu):
939 bl_label = "Show/Hide"
941 def draw(self, context):
944 layout.operator("object.hide_view_clear", text="Show Hidden")
945 layout.operator("object.hide_view_set", text="Hide Selected")
946 layout.operator("object.hide_view_set", text="Hide Unselected").unselected = True
949 class VIEW3D_MT_make_single_user(Menu):
950 bl_label = "Make Single User"
952 def draw(self, context):
955 props = layout.operator("object.make_single_user", text="Object")
958 props = layout.operator("object.make_single_user", text="Object & Data")
959 props.object = props.obdata = True
961 props = layout.operator("object.make_single_user", text="Object & Data & Materials+Tex")
962 props.object = props.obdata = props.material = props.texture = True
964 props = layout.operator("object.make_single_user", text="Materials+Tex")
965 props.material = props.texture = True
967 props = layout.operator("object.make_single_user", text="Object Animation")
968 props.animation = True
971 class VIEW3D_MT_make_links(Menu):
972 bl_label = "Make Links"
974 def draw(self, context):
977 if(len(bpy.data.scenes) > 10):
978 layout.operator_context = 'INVOKE_DEFAULT'
979 layout.operator("object.make_links_scene", text="Objects to Scene...", icon='OUTLINER_OB_EMPTY')
981 layout.operator_menu_enum("object.make_links_scene", "scene", text="Objects to Scene...")
983 layout.operator_enum("object.make_links_data", "type") # inline
985 layout.operator("object.join_uvs") # stupid place to add this!
988 class VIEW3D_MT_object_game(Menu):
991 def draw(self, context):
994 layout.operator("object.logic_bricks_copy", text="Copy Logic Bricks")
998 layout.operator("object.game_property_copy", text="Replace Properties").operation = 'REPLACE'
999 layout.operator("object.game_property_copy", text="Merge Properties").operation = 'MERGE'
1000 layout.operator_menu_enum("object.game_property_copy", "property", text="Copy Properties...")
1004 layout.operator("object.game_property_clear")
1007 # ********** Vertex paint menu **********
1010 class VIEW3D_MT_paint_vertex(Menu):
1013 def draw(self, context):
1014 layout = self.layout
1016 layout.operator("ed.undo")
1017 layout.operator("ed.redo")
1021 layout.operator("paint.vertex_color_set")
1022 layout.operator("paint.vertex_color_dirt")
1025 class VIEW3D_MT_hook(Menu):
1028 def draw(self, context):
1029 layout = self.layout
1030 layout.operator_context = 'EXEC_AREA'
1031 layout.operator("object.hook_add_newob")
1032 layout.operator("object.hook_add_selob")
1034 if [mod.type == 'HOOK' for mod in context.active_object.modifiers]:
1036 layout.operator_menu_enum("object.hook_assign", "modifier")
1037 layout.operator_menu_enum("object.hook_remove", "modifier")
1039 layout.operator_menu_enum("object.hook_select", "modifier")
1040 layout.operator_menu_enum("object.hook_reset", "modifier")
1041 layout.operator_menu_enum("object.hook_recenter", "modifier")
1044 class VIEW3D_MT_vertex_group(Menu):
1045 bl_label = "Vertex Groups"
1047 def draw(self, context):
1048 layout = self.layout
1049 layout.operator_context = 'EXEC_AREA'
1050 layout.operator("object.vertex_group_assign", text="Assign to New Group").new = True
1052 ob = context.active_object
1053 if ob.mode == 'EDIT':
1054 if ob.vertex_groups.active:
1056 layout.operator("object.vertex_group_assign", text="Assign to Active Group")
1057 layout.operator("object.vertex_group_remove_from", text="Remove from Active Group")
1058 layout.operator("object.vertex_group_remove_from", text="Remove from All").all = True
1061 if ob.vertex_groups.active:
1062 layout.operator_menu_enum("object.vertex_group_set_active", "group", text="Set Active Group")
1063 layout.operator("object.vertex_group_remove", text="Remove Active Group")
1064 layout.operator("object.vertex_group_remove", text="Remove All Groups").all = True
1066 # ********** Weight paint menu **********
1069 class VIEW3D_MT_paint_weight(Menu):
1070 bl_label = "Weights"
1072 def draw(self, context):
1073 layout = self.layout
1075 layout.operator("ed.undo")
1076 layout.operator("ed.redo")
1077 layout.operator("ed.undo_history")
1081 layout.operator("paint.weight_from_bones", text="Assign Automatic From Bones").type = 'AUTOMATIC'
1082 layout.operator("paint.weight_from_bones", text="Assign From Bone Envelopes").type = 'ENVELOPES'
1086 layout.operator("object.vertex_group_normalize_all", text="Normalize All")
1087 layout.operator("object.vertex_group_normalize", text="Normalize")
1088 layout.operator("object.vertex_group_mirror", text="Mirror")
1089 layout.operator("object.vertex_group_invert", text="Invert")
1090 layout.operator("object.vertex_group_clean", text="Clean")
1091 layout.operator("object.vertex_group_levels", text="Levels")
1092 layout.operator("object.vertex_group_fix", text="Fix Deforms")
1096 layout.operator("paint.weight_set")
1098 # ********** Sculpt menu **********
1101 class VIEW3D_MT_sculpt(Menu):
1104 def draw(self, context):
1105 layout = self.layout
1107 tool_settings = context.tool_settings
1108 sculpt = tool_settings.sculpt
1109 brush = tool_settings.sculpt.brush
1111 layout.operator("ed.undo")
1112 layout.operator("ed.redo")
1116 layout.prop(sculpt, "use_symmetry_x")
1117 layout.prop(sculpt, "use_symmetry_y")
1118 layout.prop(sculpt, "use_symmetry_z")
1120 layout.prop(sculpt, "lock_x")
1121 layout.prop(sculpt, "lock_y")
1122 layout.prop(sculpt, "lock_z")
1124 layout.operator_menu_enum("brush.curve_preset", "shape")
1127 if brush is not None: # unlikely but can happen
1128 sculpt_tool = brush.sculpt_tool
1130 if sculpt_tool != 'GRAB':
1131 layout.prop_menu_enum(brush, "stroke_method")
1133 if sculpt_tool in {'DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'}:
1134 layout.prop_menu_enum(brush, "direction")
1136 if sculpt_tool == 'LAYER':
1137 layout.prop(brush, "use_persistent")
1138 layout.operator("sculpt.set_persistent_base")
1141 layout.prop(sculpt, "use_threaded", text="Threaded Sculpt")
1142 layout.prop(sculpt, "show_brush")
1144 # TODO, make available from paint menu!
1145 layout.prop(tool_settings, "sculpt_paint_use_unified_size", text="Unify Size")
1146 layout.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Unify Strength")
1148 # ********** Particle menu **********
1151 class VIEW3D_MT_particle(Menu):
1152 bl_label = "Particle"
1154 def draw(self, context):
1155 layout = self.layout
1157 particle_edit = context.tool_settings.particle_edit
1159 layout.operator("ed.undo")
1160 layout.operator("ed.redo")
1161 layout.operator("ed.undo_history")
1165 layout.operator("particle.mirror")
1169 layout.operator("particle.remove_doubles")
1170 layout.operator("particle.delete")
1172 if particle_edit.select_mode == 'POINT':
1173 layout.operator("particle.subdivide")
1175 layout.operator("particle.rekey")
1176 layout.operator("particle.weight_set")
1180 layout.menu("VIEW3D_MT_particle_showhide")
1183 class VIEW3D_MT_particle_specials(Menu):
1184 bl_label = "Specials"
1186 def draw(self, context):
1187 layout = self.layout
1188 particle_edit = context.tool_settings.particle_edit
1190 layout.operator("particle.rekey")
1193 if particle_edit.select_mode == 'POINT':
1194 layout.operator("particle.subdivide")
1195 layout.operator("particle.select_roots")
1196 layout.operator("particle.select_tips")
1198 layout.operator("particle.remove_doubles")
1201 class VIEW3D_MT_particle_showhide(ShowHideMenu, Menu):
1202 _operator_name = "particle"
1204 # ********** Pose Menu **********
1207 class VIEW3D_MT_pose(Menu):
1210 def draw(self, context):
1211 layout = self.layout
1213 layout.operator("ed.undo")
1214 layout.operator("ed.redo")
1215 layout.operator("ed.undo_history")
1219 layout.menu("VIEW3D_MT_transform")
1221 layout.menu("VIEW3D_MT_pose_transform")
1222 layout.menu("VIEW3D_MT_pose_apply")
1224 layout.menu("VIEW3D_MT_snap")
1228 layout.menu("VIEW3D_MT_object_animation")
1232 layout.menu("VIEW3D_MT_pose_slide")
1233 layout.menu("VIEW3D_MT_pose_propagate")
1237 layout.operator("pose.copy")
1238 layout.operator("pose.paste")
1239 layout.operator("pose.paste", text="Paste X-Flipped Pose").flipped = True
1243 layout.menu("VIEW3D_MT_pose_library")
1244 layout.menu("VIEW3D_MT_pose_motion")
1245 layout.menu("VIEW3D_MT_pose_group")
1249 layout.menu("VIEW3D_MT_object_parent")
1250 layout.menu("VIEW3D_MT_pose_ik")
1251 layout.menu("VIEW3D_MT_pose_constraints")
1255 layout.operator_context = 'EXEC_AREA'
1256 layout.operator("pose.autoside_names", text="AutoName Left/Right").axis = 'XAXIS'
1257 layout.operator("pose.autoside_names", text="AutoName Front/Back").axis = 'YAXIS'
1258 layout.operator("pose.autoside_names", text="AutoName Top/Bottom").axis = 'ZAXIS'
1260 layout.operator("pose.flip_names")
1262 layout.operator("pose.quaternions_flip")
1266 layout.operator_context = 'INVOKE_AREA'
1267 layout.operator("pose.armature_layers", text="Change Armature Layers...")
1268 layout.operator("pose.bone_layers", text="Change Bone Layers...")
1272 layout.menu("VIEW3D_MT_pose_showhide")
1273 layout.menu("VIEW3D_MT_bone_options_toggle", text="Bone Settings")
1276 class VIEW3D_MT_pose_transform(Menu):
1277 bl_label = "Clear Transform"
1279 def draw(self, context):
1280 layout = self.layout
1282 layout.operator("pose.transforms_clear", text="All")
1286 layout.operator("pose.loc_clear", text="Location")
1287 layout.operator("pose.rot_clear", text="Rotation")
1288 layout.operator("pose.scale_clear", text="Scale")
1292 layout.operator("pose.user_transforms_clear", text="Reset unkeyed")
1295 class VIEW3D_MT_pose_slide(Menu):
1296 bl_label = "In-Betweens"
1298 def draw(self, context):
1299 layout = self.layout
1301 layout.operator("pose.push")
1302 layout.operator("pose.relax")
1303 layout.operator("pose.breakdown")
1306 class VIEW3D_MT_pose_propagate(Menu):
1307 bl_label = "Propagate"
1309 def draw(self, context):
1310 layout = self.layout
1312 layout.operator("pose.propagate")
1316 layout.operator("pose.propagate", text="To Next Keyframe").mode = 'NEXT_KEY'
1317 layout.operator("pose.propagate", text="To Last Keyframe (Make Cyclic)").mode = 'LAST_KEY'
1321 layout.operator("pose.propagate", text="On Selected Markers").mode = 'SELECTED_MARKERS'
1324 class VIEW3D_MT_pose_library(Menu):
1325 bl_label = "Pose Library"
1327 def draw(self, context):
1328 layout = self.layout
1330 layout.operator("poselib.browse_interactive", text="Browse Poses...")
1334 layout.operator("poselib.pose_add", text="Add Pose...")
1335 layout.operator("poselib.pose_rename", text="Rename Pose...")
1336 layout.operator("poselib.pose_remove", text="Remove Pose...")
1339 class VIEW3D_MT_pose_motion(Menu):
1340 bl_label = "Motion Paths"
1342 def draw(self, context):
1343 layout = self.layout
1345 layout.operator("pose.paths_calculate", text="Calculate")
1346 layout.operator("pose.paths_clear", text="Clear")
1349 class VIEW3D_MT_pose_group(Menu):
1350 bl_label = "Bone Groups"
1352 def draw(self, context):
1353 layout = self.layout
1354 layout.operator("pose.group_add")
1355 layout.operator("pose.group_remove")
1359 layout.operator("pose.group_assign")
1360 layout.operator("pose.group_unassign")
1363 class VIEW3D_MT_pose_ik(Menu):
1364 bl_label = "Inverse Kinematics"
1366 def draw(self, context):
1367 layout = self.layout
1369 layout.operator("pose.ik_add")
1370 layout.operator("pose.ik_clear")
1373 class VIEW3D_MT_pose_constraints(Menu):
1374 bl_label = "Constraints"
1376 def draw(self, context):
1377 layout = self.layout
1379 layout.operator("pose.constraint_add_with_targets", text="Add (With Targets)...")
1380 layout.operator("pose.constraints_copy")
1381 layout.operator("pose.constraints_clear")
1384 class VIEW3D_MT_pose_showhide(ShowHideMenu, Menu):
1385 _operator_name = "pose"
1388 class VIEW3D_MT_pose_apply(Menu):
1391 def draw(self, context):
1392 layout = self.layout
1394 layout.operator("pose.armature_apply")
1395 layout.operator("pose.visual_transform_apply")
1399 def draw(self, context):
1400 layout = self.layout
1405 "use_envelope_multiply",
1406 "use_inherit_rotation",
1407 "use_inherit_scale",
1410 if context.mode == 'EDIT_ARMATURE':
1411 bone_props = bpy.types.EditBone.bl_rna.properties
1412 data_path_iter = "selected_bones"
1414 options.append("lock")
1416 bone_props = bpy.types.Bone.bl_rna.properties
1417 data_path_iter = "selected_pose_bones"
1418 opt_suffix = "bone."
1421 props = layout.operator("wm.context_collection_boolean_set", text=bone_props[opt].name)
1422 props.data_path_iter = data_path_iter
1423 props.data_path_item = opt_suffix + opt
1424 props.type = self.type
1427 class VIEW3D_MT_bone_options_toggle(Menu, BoneOptions):
1428 bl_label = "Toggle Bone Options"
1432 class VIEW3D_MT_bone_options_enable(Menu, BoneOptions):
1433 bl_label = "Enable Bone Options"
1437 class VIEW3D_MT_bone_options_disable(Menu, BoneOptions):
1438 bl_label = "Disable Bone Options"
1441 # ********** Edit Menus, suffix from ob.type **********
1444 class VIEW3D_MT_edit_mesh(Menu):
1447 def draw(self, context):
1448 layout = self.layout
1450 settings = context.tool_settings
1452 layout.operator("ed.undo")
1453 layout.operator("ed.redo")
1454 layout.operator("ed.undo_history")
1458 layout.menu("VIEW3D_MT_transform")
1459 layout.menu("VIEW3D_MT_mirror")
1460 layout.menu("VIEW3D_MT_snap")
1464 layout.menu("VIEW3D_MT_uv_map", text="UV Unwrap...")
1468 layout.operator("view3d.edit_mesh_extrude_move_normal", text="Extrude Region")
1469 layout.operator("view3d.edit_mesh_extrude_individual_move", text="Extrude Individual")
1470 layout.operator("mesh.duplicate_move")
1471 layout.operator("mesh.delete", text="Delete...")
1475 layout.menu("VIEW3D_MT_edit_mesh_vertices")
1476 layout.menu("VIEW3D_MT_edit_mesh_edges")
1477 layout.menu("VIEW3D_MT_edit_mesh_faces")
1478 layout.menu("VIEW3D_MT_edit_mesh_normals")
1482 layout.prop(settings, "use_mesh_automerge")
1483 layout.prop_menu_enum(settings, "proportional_edit")
1484 layout.prop_menu_enum(settings, "proportional_edit_falloff")
1488 layout.menu("VIEW3D_MT_edit_mesh_showhide")
1491 class VIEW3D_MT_edit_mesh_specials(Menu):
1492 bl_label = "Specials"
1494 def draw(self, context):
1495 layout = self.layout
1497 layout.operator_context = 'INVOKE_REGION_WIN'
1499 layout.operator("mesh.subdivide", text="Subdivide")
1500 layout.operator("mesh.subdivide", text="Subdivide Smooth").smoothness = 1.0
1501 layout.operator("mesh.merge", text="Merge...")
1502 layout.operator("mesh.remove_doubles")
1503 layout.operator("mesh.hide", text="Hide")
1504 layout.operator("mesh.reveal", text="Reveal")
1505 layout.operator("mesh.select_inverse")
1506 layout.operator("mesh.flip_normals")
1507 layout.operator("mesh.vertices_smooth", text="Smooth")
1508 # layout.operator("mesh.bevel", text="Bevel")
1509 layout.operator("mesh.faces_shade_smooth")
1510 layout.operator("mesh.faces_shade_flat")
1511 layout.operator("mesh.blend_from_shape")
1512 layout.operator("mesh.shape_propagate_to_all")
1513 layout.operator("mesh.select_vertex_path")
1516 class VIEW3D_MT_edit_mesh_select_mode(Menu):
1517 bl_label = "Mesh Select Mode"
1519 def draw(self, context):
1520 layout = self.layout
1522 layout.operator_context = 'INVOKE_REGION_WIN'
1524 prop = layout.operator("wm.context_set_value", text="Vertex", icon='VERTEXSEL')
1525 prop.value = "(True, False, False)"
1526 prop.data_path = "tool_settings.mesh_select_mode"
1528 prop = layout.operator("wm.context_set_value", text="Edge", icon='EDGESEL')
1529 prop.value = "(False, True, False)"
1530 prop.data_path = "tool_settings.mesh_select_mode"
1532 prop = layout.operator("wm.context_set_value", text="Face", icon='FACESEL')
1533 prop.value = "(False, False, True)"
1534 prop.data_path = "tool_settings.mesh_select_mode"
1537 class VIEW3D_MT_edit_mesh_extrude(Menu):
1538 bl_label = "Extrude"
1541 'VERT': lambda layout: layout.operator("mesh.extrude_vertices_move", text="Vertices Only"),
1542 'EDGE': lambda layout: layout.operator("mesh.extrude_edges_move", text="Edges Only"),
1543 'FACE': lambda layout: layout.operator("mesh.extrude_faces_move", text="Individual Faces"),
1544 'REGION': lambda layout: layout.operator("view3d.edit_mesh_extrude_move_normal", text="Region"),
1548 def extrude_options(context):
1549 mesh = context.object.data
1550 select_mode = context.tool_settings.mesh_select_mode
1553 if mesh.total_face_sel:
1554 menu += ['REGION', 'FACE']
1555 if mesh.total_edge_sel and (select_mode[0] or select_mode[1]):
1557 if mesh.total_vert_sel and select_mode[0]:
1560 # should never get here
1563 def draw(self, context):
1564 layout = self.layout
1565 layout.operator_context = 'INVOKE_REGION_WIN'
1567 for menu_id in self.extrude_options(context):
1568 self._extrude_funcs[menu_id](layout)
1571 class VIEW3D_MT_edit_mesh_vertices(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(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(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(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, 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(Menu):
1751 class VIEW3D_MT_edit_curve_ctrlpoints(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(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(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, Menu):
1798 _operator_name = "curve"
1801 class VIEW3D_MT_edit_surface(Menu):
1802 bl_label = "Surface"
1807 class VIEW3D_MT_edit_font(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(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(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(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(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(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.menu("VIEW3D_MT_bone_options_toggle", text="Bone Settings")
1982 class VIEW3D_MT_armature_specials(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(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(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(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 lock_object = view.lock_object
2049 if lock_object.type == 'ARMATURE':
2050 col.prop_search(view, "lock_bone", lock_object.data, "edit_bones" if lock_object.mode == 'EDIT' else "bones", text="")
2052 col.prop(view, "lock_cursor", text="Lock to Cursor")
2054 col = layout.column()
2055 col.prop(view, "lock_camera")
2057 col = layout.column(align=True)
2058 col.label(text="Clip:")
2059 col.prop(view, "clip_start", text="Start")
2060 col.prop(view, "clip_end", text="End")
2062 subcol = col.column()
2063 subcol.enabled = not view.lock_camera_and_layers
2064 subcol.label(text="Local Camera:")
2065 subcol.prop(view, "camera", text="")
2068 class VIEW3D_PT_view3d_cursor(Panel):
2069 bl_space_type = 'VIEW_3D'
2070 bl_region_type = 'UI'
2071 bl_label = "3D Cursor"
2074 def poll(cls, context):
2075 view = context.space_data
2078 def draw(self, context):
2079 layout = self.layout
2081 view = context.space_data
2082 layout.column().prop(view, "cursor_location", text="Location")
2085 class VIEW3D_PT_view3d_name(Panel):
2086 bl_space_type = 'VIEW_3D'
2087 bl_region_type = 'UI'
2091 def poll(cls, context):
2092 return (context.space_data and context.active_object)
2094 def draw(self, context):
2095 layout = self.layout
2097 ob = context.active_object
2099 row.label(text="", icon='OBJECT_DATA')
2100 row.prop(ob, "name", text="")
2102 if ob.type == 'ARMATURE' and ob.mode in {'EDIT', 'POSE'}:
2103 bone = context.active_bone
2106 row.label(text="", icon='BONE_DATA')
2107 row.prop(bone, "name", text="")
2110 class VIEW3D_PT_view3d_display(Panel):
2111 bl_space_type = 'VIEW_3D'
2112 bl_region_type = 'UI'
2113 bl_label = "Display"
2114 bl_options = {'DEFAULT_CLOSED'}
2117 def poll(cls, context):
2118 view = context.space_data
2121 def draw(self, context):
2122 layout = self.layout
2124 view = context.space_data
2125 scene = context.scene
2126 gs = scene.game_settings
2129 col = layout.column()
2130 col.prop(view, "show_only_render")
2132 col = layout.column()
2133 display_all = not view.show_only_render
2134 col.active = display_all
2135 col.prop(view, "show_outline_selected")
2136 col.prop(view, "show_all_objects_origin")
2137 col.prop(view, "show_relationship_lines")
2138 if ob and ob.type == 'MESH':
2140 col.prop(mesh, "show_all_edges")
2142 col = layout.column()
2143 col.active = display_all
2144 split = col.split(percentage=0.55)
2145 split.prop(view, "show_floor", text="Grid Floor")
2147 row = split.row(align=True)
2148 row.prop(view, "show_axis_x", text="X", toggle=True)
2149 row.prop(view, "show_axis_y", text="Y", toggle=True)
2150 row.prop(view, "show_axis_z", text="Z", toggle=True)
2152 sub = col.column(align=True)
2153 sub.active = (display_all and view.show_floor)
2154 sub.prop(view, "grid_lines", text="Lines")
2155 sub.prop(view, "grid_scale", text="Scale")
2156 subsub = sub.column(align=True)
2157 subsub.active = scene.unit_settings.system == 'NONE'
2158 subsub.prop(view, "grid_subdivisions", text="Subdivisions")
2160 if not scene.render.use_shading_nodes:
2161 col = layout.column()
2162 col.label(text="Shading:")
2163 col.prop(gs, "material_mode", text="")
2164 col.prop(view, "show_textured_solid")
2168 region = view.region_quadview
2170 layout.operator("screen.region_quadview", text="Toggle Quad View")
2173 col = layout.column()
2174 col.prop(region, "lock_rotation")
2176 row.enabled = region.lock_rotation
2177 row.prop(region, "show_sync_view")
2179 row.enabled = region.lock_rotation and region.show_sync_view
2180 row.prop(region, "use_box_clip")
2183 class VIEW3D_PT_view3d_motion_tracking(Panel):
2184 bl_space_type = 'VIEW_3D'
2185 bl_region_type = 'UI'
2186 bl_label = "Motion Tracking"
2187 bl_options = {'DEFAULT_CLOSED'}
2190 def poll(cls, context):
2191 view = context.space_data
2194 def draw_header(self, context):
2195 layout = self.layout
2196 view = context.space_data
2198 layout.prop(view, "show_reconstruction", text="")
2200 def draw(self, context):
2201 layout = self.layout
2203 view = context.space_data
2205 col = layout.column()
2206 col.active = view.show_reconstruction
2207 col.prop(view, "show_tracks_name")
2208 col.prop(view, "show_camera_path")
2209 col.label(text="Tracks:")
2210 col.prop(view, "tracks_draw_type", text="")
2211 col.prop(view, "tracks_draw_size", text="Size")
2214 class VIEW3D_PT_view3d_meshdisplay(Panel):
2215 bl_space_type = 'VIEW_3D'
2216 bl_region_type = 'UI'
2217 bl_label = "Mesh Display"
2220 def poll(cls, context):
2221 # The active object check is needed because of local-mode
2222 return (context.active_object and (context.mode == 'EDIT_MESH'))
2224 def draw(self, context):
2225 layout = self.layout
2227 mesh = context.active_object.data
2229 col = layout.column()
2230 col.label(text="Overlays:")
2231 col.prop(mesh, "show_edges", text="Edges")
2232 col.prop(mesh, "show_faces", text="Faces")
2233 col.prop(mesh, "show_edge_crease", text="Creases")
2234 col.prop(mesh, "show_edge_bevel_weight", text="Bevel Weights")
2235 col.prop(mesh, "show_edge_seams", text="Seams")
2236 col.prop(mesh, "show_edge_sharp", text="Sharp")
2239 col.label(text="Normals:")
2240 col.prop(mesh, "show_normal_face", text="Face")
2241 col.prop(mesh, "show_normal_vertex", text="Vertex")
2242 col.prop(context.scene.tool_settings, "normal_size", text="Normal Size")
2245 col.label(text="Numerics:")
2246 col.prop(mesh, "show_extra_edge_length")
2247 col.prop(mesh, "show_extra_face_angle")
2248 col.prop(mesh, "show_extra_face_area")
2251 class VIEW3D_PT_view3d_curvedisplay(Panel):
2252 bl_space_type = 'VIEW_3D'
2253 bl_region_type = 'UI'
2254 bl_label = "Curve Display"
2257 def poll(cls, context):
2258 editmesh = context.mode == 'EDIT_CURVE'
2261 def draw(self, context):
2262 layout = self.layout
2264 curve = context.active_object.data
2266 col = layout.column()
2267 col.label(text="Overlays:")
2268 col.prop(curve, "show_handles", text="Handles")
2269 col.prop(curve, "show_normal_face", text="Normals")
2270 col.prop(context.scene.tool_settings, "normal_size", text="Normal Size")
2273 class VIEW3D_PT_background_image(Panel):
2274 bl_space_type = 'VIEW_3D'
2275 bl_region_type = 'UI'
2276 bl_label = "Background Images"
2277 bl_options = {'DEFAULT_CLOSED'}
2279 def draw_header(self, context):
2280 layout = self.layout
2281 view = context.space_data
2283 layout.prop(view, "show_background_images", text="")
2285 def draw(self, context):
2286 layout = self.layout
2288 view = context.space_data
2290 col = layout.column()
2291 col.operator("view3d.background_image_add", text="Add Image")
2293 for i, bg in enumerate(view.background_images):
2294 layout.active = view.show_background_images
2296 row = box.row(align=True)
2297 row.prop(bg, "show_expanded", text="", emboss=False)
2298 if bg.source == 'IMAGE' and bg.image:
2299 row.prop(bg.image, "name", text="", emboss=False)
2300 if bg.source == 'MOVIE' and bg.clip:
2301 row.prop(bg.clip, "name", text="", emboss=False)
2303 row.label(text="Not Set")
2304 row.operator("view3d.background_image_remove", text="", emboss=False, icon='X').index = i
2306 box.prop(bg, "view_axis", text="Axis")
2308 if bg.show_expanded:
2310 row.prop(bg, "source", expand=True)
2313 if bg.source == 'IMAGE':
2315 row.template_ID(bg, "image", open="image.open")
2317 box.template_image(bg, "image", bg.image_user, compact=True)
2320 elif bg.source == 'MOVIE':
2321 box.prop(bg, 'use_camera_clip')
2323 column = box.column()
2324 column.active = not bg.use_camera_clip
2325 column.template_ID(bg, "clip", open="clip.open")
2328 column.template_movieclip(bg, "clip", compact=True)
2330 if bg.use_camera_clip or bg.clip:
2333 column = box.column()
2334 column.active = has_bg
2335 column.prop(bg.clip_user, "proxy_render_size", text="")
2336 column.prop(bg.clip_user, "use_render_undistorted")
2339 box.prop(bg, "opacity", slider=True)
2340 if bg.view_axis != 'CAMERA':
2341 box.prop(bg, "size")
2342 row = box.row(align=True)
2343 row.prop(bg, "offset_x", text="X")
2344 row.prop(bg, "offset_y", text="Y")
2347 class VIEW3D_PT_transform_orientations(Panel):
2348 bl_space_type = 'VIEW_3D'
2349 bl_region_type = 'UI'
2350 bl_label = "Transform Orientations"
2351 bl_options = {'DEFAULT_CLOSED'}
2354 def poll(cls, context):
2355 view = context.space_data
2358 def draw(self, context):
2359 layout = self.layout
2361 view = context.space_data
2363 col = layout.column()
2365 col.prop(view, "transform_orientation")
2366 col.operator("transform.create_orientation", text="Create")
2368 orientation = view.current_orientation
2371 col.prop(orientation, "name")
2372 col.operator("transform.delete_orientation", text="Delete")
2375 class VIEW3D_PT_etch_a_ton(Panel):
2376 bl_space_type = 'VIEW_3D'
2377 bl_region_type = 'UI'
2378 bl_label = "Skeleton Sketching"
2379 bl_options = {'DEFAULT_CLOSED'}
2382 def poll(cls, context):
2383 scene = context.space_data
2384 ob = context.active_object
2385 return scene and ob and ob.type == 'ARMATURE' and ob.mode == 'EDIT'
2387 def draw_header(self, context):
2388 layout = self.layout
2389 toolsettings = context.scene.tool_settings
2391 layout.prop(toolsettings, "use_bone_sketching", text="")
2393 def draw(self, context):
2394 layout = self.layout
2395 toolsettings = context.scene.tool_settings
2397 col = layout.column()
2399 col.prop(toolsettings, "use_etch_quick")
2400 col.prop(toolsettings, "use_etch_overdraw")
2402 col.prop(toolsettings, "etch_convert_mode")
2404 if toolsettings.etch_convert_mode == 'LENGTH':
2405 col.prop(toolsettings, "etch_length_limit")
2406 elif toolsettings.etch_convert_mode == 'ADAPTIVE':
2407 col.prop(toolsettings, "etch_adaptive_limit")
2408 elif toolsettings.etch_convert_mode == 'FIXED':
2409 col.prop(toolsettings, "etch_subdivision_number")
2410 elif toolsettings.etch_convert_mode == 'RETARGET':
2411 col.prop(toolsettings, "etch_template")
2412 col.prop(toolsettings, "etch_roll_mode")
2413 col.prop(toolsettings, "use_etch_autoname")
2414 col.prop(toolsettings, "etch_number")
2415 col.prop(toolsettings, "etch_side")
2417 col.operator("sketch.convert", text="Convert")
2420 class VIEW3D_PT_context_properties(Panel):
2421 bl_space_type = 'VIEW_3D'
2422 bl_region_type = 'UI'
2423 bl_label = "Properties"
2424 bl_options = {'DEFAULT_CLOSED'}
2426 def _active_context_member(context):
2427 obj = context.object
2431 return "active_pose_bone"
2432 elif mode == 'EDIT' and obj.type == 'ARMATURE':
2433 return "active_bone"
2440 def poll(cls, context):
2441 member = cls._active_context_member(context)
2443 context_member = getattr(context, member)
2444 return context_member and context_member.keys()
2448 def draw(self, context):
2450 member = VIEW3D_PT_context_properties._active_context_member(context)
2453 # Draw with no edit button
2454 rna_prop_ui.draw(self.layout, context, member, object, False)
2458 bpy.utils.register_module(__name__)
2462 bpy.utils.unregister_module(__name__)
2464 if __name__ == "__main__":
2467 if __name__ == "__main__": # only for live edit.
2468 bpy.utils.register_module(__name__)