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)
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="")
101 if toolsettings.use_snap_project and obj.mode == 'EDIT':
102 row.prop(toolsettings, "use_snap_project_self", text="")
105 row = layout.row(align=True)
106 row.operator("render.opengl", text="", icon='RENDER_STILL')
107 props = row.operator("render.opengl", text="", icon='RENDER_ANIMATION')
108 props.animation = True
111 if obj and obj.mode == 'POSE':
112 row = layout.row(align=True)
113 row.operator("pose.copy", text="", icon='COPYDOWN')
114 row.operator("pose.paste", text="", icon='PASTEDOWN')
115 props = row.operator("pose.paste", text="", icon='PASTEFLIPDOWN')
119 # ********** Menu **********
121 # ********** Utilities **********
124 class ShowHideMenu():
125 bl_label = "Show/Hide"
128 def draw(self, context):
131 layout.operator("%s.reveal" % self._operator_name, text="Show Hidden")
132 layout.operator("%s.hide" % self._operator_name, text="Hide Selected")
133 layout.operator("%s.hide" % self._operator_name, text="Hide Unselected").unselected = True
136 class VIEW3D_MT_transform(bpy.types.Menu):
137 bl_label = "Transform"
139 # TODO: get rid of the custom text strings?
140 def draw(self, context):
143 layout.operator("transform.translate", text="Grab/Move")
144 # TODO: sub-menu for grab per axis
145 layout.operator("transform.rotate", text="Rotate")
146 # TODO: sub-menu for rot per axis
147 layout.operator("transform.resize", text="Scale")
148 # TODO: sub-menu for scale per axis
152 layout.operator("transform.tosphere", text="To Sphere")
153 layout.operator("transform.shear", text="Shear")
154 layout.operator("transform.warp", text="Warp")
155 layout.operator("transform.push_pull", text="Push/Pull")
159 layout.operator("transform.translate", text="Move Texture Space").texture_space = True
160 layout.operator("transform.resize", text="Scale Texture Space").texture_space = True
165 if obj.type == 'ARMATURE' and obj.mode in {'EDIT', 'POSE'} and obj.data.draw_type in {'BBONE', 'ENVELOPE'}:
166 layout.operator("transform.transform", text="Scale Envelope/BBone").mode = 'BONE_SIZE'
168 if context.edit_object and context.edit_object.type == 'ARMATURE':
169 layout.operator("armature.align")
171 layout.operator_context = 'EXEC_REGION_WIN'
172 layout.operator("transform.transform", text="Align to Transform Orientation").mode = 'ALIGN' # XXX see alignmenu() in edit.c of b2.4x to get this working
176 layout.operator_context = 'EXEC_AREA'
178 layout.operator("object.origin_set", text="Geometry to Origin").type = 'GEOMETRY_ORIGIN'
179 layout.operator("object.origin_set", text="Origin to Geometry").type = 'ORIGIN_GEOMETRY'
180 layout.operator("object.origin_set", text="Origin to 3D Cursor").type = 'ORIGIN_CURSOR'
184 layout.operator("object.randomize_transform")
185 layout.operator("object.align")
189 layout.operator("object.anim_transforms_to_deltas")
192 class VIEW3D_MT_mirror(bpy.types.Menu):
195 def draw(self, context):
198 layout.operator("transform.mirror", text="Interactive Mirror")
202 layout.operator_context = 'INVOKE_REGION_WIN'
204 props = layout.operator("transform.mirror", text="X Global")
205 props.constraint_axis = (True, False, False)
206 props.constraint_orientation = 'GLOBAL'
207 props = layout.operator("transform.mirror", text="Y Global")
208 props.constraint_axis = (False, True, False)
209 props.constraint_orientation = 'GLOBAL'
210 props = layout.operator("transform.mirror", text="Z Global")
211 props.constraint_axis = (False, False, True)
212 props.constraint_orientation = 'GLOBAL'
214 if context.edit_object:
217 props = layout.operator("transform.mirror", text="X Local")
218 props.constraint_axis = (True, False, False)
219 props.constraint_orientation = 'LOCAL'
220 props = layout.operator("transform.mirror", text="Y Local")
221 props.constraint_axis = (False, True, False)
222 props.constraint_orientation = 'LOCAL'
223 props = layout.operator("transform.mirror", text="Z Local")
224 props.constraint_axis = (False, False, True)
225 props.constraint_orientation = 'LOCAL'
227 layout.operator("object.vertex_group_mirror")
230 class VIEW3D_MT_snap(bpy.types.Menu):
233 def draw(self, context):
236 layout.operator("view3d.snap_selected_to_grid", text="Selection to Grid")
237 layout.operator("view3d.snap_selected_to_cursor", text="Selection to Cursor")
241 layout.operator("view3d.snap_cursor_to_selected", text="Cursor to Selected")
242 layout.operator("view3d.snap_cursor_to_center", text="Cursor to Center")
243 layout.operator("view3d.snap_cursor_to_grid", text="Cursor to Grid")
244 layout.operator("view3d.snap_cursor_to_active", text="Cursor to Active")
247 class VIEW3D_MT_uv_map(bpy.types.Menu):
248 bl_label = "UV Mapping"
250 def draw(self, context):
253 layout.operator("uv.unwrap")
255 layout.operator_context = 'INVOKE_DEFAULT'
256 layout.operator("uv.smart_project")
257 layout.operator("uv.lightmap_pack")
258 layout.operator("uv.follow_active_quads")
262 layout.operator_context = 'EXEC_DEFAULT'
263 layout.operator("uv.cube_project")
264 layout.operator("uv.cylinder_project")
265 layout.operator("uv.sphere_project")
269 layout.operator("uv.project_from_view")
270 layout.operator("uv.project_from_view", text="Project from View (Bounds)").scale_to_bounds = True
274 layout.operator("uv.reset")
277 # ********** View menus **********
280 class VIEW3D_MT_view(bpy.types.Menu):
283 def draw(self, context):
286 layout.operator("view3d.properties", icon='MENU_PANEL')
287 layout.operator("view3d.toolshelf", icon='MENU_PANEL')
291 layout.operator("view3d.viewnumpad", text="Camera").type = 'CAMERA'
292 layout.operator("view3d.viewnumpad", text="Top").type = 'TOP'
293 layout.operator("view3d.viewnumpad", text="Bottom").type = 'BOTTOM'
294 layout.operator("view3d.viewnumpad", text="Front").type = 'FRONT'
295 layout.operator("view3d.viewnumpad", text="Back").type = 'BACK'
296 layout.operator("view3d.viewnumpad", text="Right").type = 'RIGHT'
297 layout.operator("view3d.viewnumpad", text="Left").type = 'LEFT'
299 layout.menu("VIEW3D_MT_view_cameras", text="Cameras")
303 layout.operator("view3d.view_persportho")
307 layout.menu("VIEW3D_MT_view_navigation")
308 layout.menu("VIEW3D_MT_view_align")
312 layout.operator_context = 'INVOKE_REGION_WIN'
314 layout.operator("view3d.clip_border", text="Clipping Border...")
315 layout.operator("view3d.zoom_border", text="Zoom Border...")
319 layout.operator("view3d.layers", text="Show All Layers").nr = 0
323 layout.operator("view3d.localview", text="View Global/Local")
324 layout.operator("view3d.view_selected")
325 layout.operator("view3d.view_all")
329 layout.operator("screen.animation_play", text="Playback Animation")
333 layout.operator("screen.area_dupli")
334 layout.operator("screen.region_quadview")
335 layout.operator("screen.screen_full_area")
338 class VIEW3D_MT_view_navigation(bpy.types.Menu):
339 bl_label = "Navigation"
341 def draw(self, context):
344 layout.operator_enum("view3d.view_orbit", "type")
348 layout.operator_enum("view3d.view_pan", "type")
352 layout.operator("view3d.zoom", text="Zoom In").delta = 1
353 layout.operator("view3d.zoom", text="Zoom Out").delta = -1
354 layout.operator("view3d.zoom_camera_1_to_1", text="Zoom Camera 1:1")
358 layout.operator("view3d.fly")
361 class VIEW3D_MT_view_align(bpy.types.Menu):
362 bl_label = "Align View"
364 def draw(self, context):
367 layout.menu("VIEW3D_MT_view_align_selected")
371 layout.operator("view3d.view_all", text="Center Cursor and View All").center = True
372 layout.operator("view3d.camera_to_view", text="Align Active Camera to View")
373 layout.operator("view3d.view_selected")
374 layout.operator("view3d.view_center_cursor")
377 class VIEW3D_MT_view_align_selected(bpy.types.Menu):
378 bl_label = "Align View to Selected"
380 def draw(self, context):
383 props = layout.operator("view3d.viewnumpad", text="Top")
384 props.align_active = True
386 props = layout.operator("view3d.viewnumpad", text="Bottom")
387 props.align_active = True
388 props.type = 'BOTTOM'
389 props = layout.operator("view3d.viewnumpad", text="Front")
390 props.align_active = True
392 props = layout.operator("view3d.viewnumpad", text="Back")
393 props.align_active = True
395 props = layout.operator("view3d.viewnumpad", text="Right")
396 props.align_active = True
398 props = layout.operator("view3d.viewnumpad", text="Left")
399 props.align_active = True
403 class VIEW3D_MT_view_cameras(bpy.types.Menu):
406 def draw(self, context):
409 layout.operator("view3d.object_as_camera")
410 layout.operator("view3d.viewnumpad", text="Active Camera").type = 'CAMERA'
412 # ********** Select menus, suffix from context.mode **********
415 class VIEW3D_MT_select_object(bpy.types.Menu):
418 def draw(self, context):
421 layout.operator("view3d.select_border")
422 layout.operator("view3d.select_circle")
426 layout.operator("object.select_all", text="Select/Deselect All")
427 layout.operator("object.select_inverse", text="Inverse")
428 layout.operator("object.select_random", text="Random")
429 layout.operator("object.select_mirror", text="Mirror")
430 layout.operator("object.select_by_layer", text="Select All by Layer")
431 layout.operator_menu_enum("object.select_by_type", "type", text="Select All by Type...")
432 layout.operator("object.select_camera", text="Select Camera")
436 layout.operator_menu_enum("object.select_grouped", "type", text="Grouped")
437 layout.operator_menu_enum("object.select_linked", "type", text="Linked")
438 layout.operator("object.select_pattern", text="Select Pattern...")
441 class VIEW3D_MT_select_pose(bpy.types.Menu):
444 def draw(self, context):
447 layout.operator("view3d.select_border")
451 layout.operator("pose.select_all", text="Select/Deselect All")
452 layout.operator("pose.select_inverse", text="Inverse")
453 layout.operator("pose.select_flip_active", text="Flip Active")
454 layout.operator("pose.select_constraint_target", text="Constraint Target")
455 layout.operator("pose.select_linked", text="Linked")
459 layout.operator("pose.select_hierarchy", text="Parent").direction = 'PARENT'
460 layout.operator("pose.select_hierarchy", text="Child").direction = 'CHILD'
464 props = layout.operator("pose.select_hierarchy", text="Extend Parent")
466 props.direction = 'PARENT'
468 props = layout.operator("pose.select_hierarchy", text="Extend Child")
470 props.direction = 'CHILD'
474 layout.operator_menu_enum("pose.select_grouped", "type", text="Grouped")
475 layout.operator("object.select_pattern", text="Select Pattern...")
478 class VIEW3D_MT_select_particle(bpy.types.Menu):
481 def draw(self, context):
484 layout.operator("view3d.select_border")
488 layout.operator("particle.select_all", text="Select/Deselect All")
489 layout.operator("particle.select_linked")
490 layout.operator("particle.select_inverse")
494 layout.operator("particle.select_more")
495 layout.operator("particle.select_less")
499 layout.operator("particle.select_roots", text="Roots")
500 layout.operator("particle.select_tips", text="Tips")
503 class VIEW3D_MT_select_edit_mesh(bpy.types.Menu):
506 def draw(self, context):
509 layout.operator("view3d.select_border")
510 layout.operator("view3d.select_circle")
514 layout.operator("mesh.select_all", text="Select/Deselect All")
515 layout.operator("mesh.select_inverse", text="Inverse")
519 layout.operator("mesh.select_random", text="Random")
520 layout.operator("mesh.select_nth", text="Every N Number of Verts")
521 layout.operator("mesh.edges_select_sharp", text="Sharp Edges")
522 layout.operator("mesh.faces_select_linked_flat", text="Linked Flat Faces")
523 layout.operator("mesh.faces_select_interior", text="Interior Faces")
524 layout.operator("mesh.select_axis", text="Side of Active")
528 layout.operator("mesh.select_by_number_vertices", text="Triangles").type = 'TRIANGLES'
529 layout.operator("mesh.select_by_number_vertices", text="Quads").type = 'QUADS'
530 if context.scene.tool_settings.mesh_select_mode[2] == False:
531 layout.operator("mesh.select_non_manifold", text="Non Manifold")
532 layout.operator("mesh.select_by_number_vertices", text="Loose Verts/Edges").type = 'OTHER'
533 layout.operator("mesh.select_similar", text="Similar")
537 layout.operator("mesh.select_less", text="Less")
538 layout.operator("mesh.select_more", text="More")
542 layout.operator("mesh.select_mirror", text="Mirror")
544 layout.operator("mesh.select_linked", text="Linked")
545 layout.operator("mesh.select_vertex_path", text="Vertex Path")
546 layout.operator("mesh.loop_multi_select", text="Edge Loop")
547 layout.operator("mesh.loop_multi_select", text="Edge Ring").ring = True
551 layout.operator("mesh.loop_to_region")
552 layout.operator("mesh.region_to_loop")
555 class VIEW3D_MT_select_edit_curve(bpy.types.Menu):
558 def draw(self, context):
561 layout.operator("view3d.select_border")
562 layout.operator("view3d.select_circle")
566 layout.operator("curve.select_all", text="Select/Deselect All")
567 layout.operator("curve.select_inverse")
568 layout.operator("curve.select_random")
569 layout.operator("curve.select_nth", text="Every Nth Number of Points")
573 layout.operator("curve.de_select_first")
574 layout.operator("curve.de_select_last")
575 layout.operator("curve.select_next")
576 layout.operator("curve.select_previous")
580 layout.operator("curve.select_more")
581 layout.operator("curve.select_less")
584 class VIEW3D_MT_select_edit_surface(bpy.types.Menu):
587 def draw(self, context):
590 layout.operator("view3d.select_border")
591 layout.operator("view3d.select_circle")
595 layout.operator("curve.select_all", text="Select/Deselect All")
596 layout.operator("curve.select_inverse")
597 layout.operator("curve.select_random")
598 layout.operator("curve.select_nth", text="Every Nth Number of Points")
602 layout.operator("curve.select_row")
606 layout.operator("curve.select_more")
607 layout.operator("curve.select_less")
610 class VIEW3D_MT_select_edit_metaball(bpy.types.Menu):
613 def draw(self, context):
616 layout.operator("view3d.select_border")
620 layout.operator("mball.select_all").action = 'TOGGLE'
621 layout.operator("mball.select_inverse_metaelems")
625 layout.operator("mball.select_random_metaelems")
628 class VIEW3D_MT_select_edit_lattice(bpy.types.Menu):
631 def draw(self, context):
634 layout.operator("view3d.select_border")
638 layout.operator("lattice.select_all", text="Select/Deselect All")
641 class VIEW3D_MT_select_edit_armature(bpy.types.Menu):
644 def draw(self, context):
647 layout.operator("view3d.select_border")
651 layout.operator("armature.select_all", text="Select/Deselect All")
652 layout.operator("armature.select_inverse", text="Inverse")
656 layout.operator("armature.select_hierarchy", text="Parent").direction = 'PARENT'
657 layout.operator("armature.select_hierarchy", text="Child").direction = 'CHILD'
661 props = layout.operator("armature.select_hierarchy", text="Extend Parent")
663 props.direction = 'PARENT'
665 props = layout.operator("armature.select_hierarchy", text="Extend Child")
667 props.direction = 'CHILD'
669 layout.operator("object.select_pattern", text="Select Pattern...")
672 class VIEW3D_MT_select_face(bpy.types.Menu): # XXX no matching enum
675 def draw(self, context):
676 # layout = self.layout
679 # see view3d_select_faceselmenu
682 # ********** Object menu **********
685 class VIEW3D_MT_object(bpy.types.Menu):
686 bl_context = "objectmode"
689 def draw(self, context):
692 layout.operator("ed.undo")
693 layout.operator("ed.redo")
694 layout.operator("ed.undo_history")
698 layout.menu("VIEW3D_MT_transform")
699 layout.menu("VIEW3D_MT_mirror")
700 layout.menu("VIEW3D_MT_object_clear")
701 layout.menu("VIEW3D_MT_object_apply")
702 layout.menu("VIEW3D_MT_snap")
706 layout.menu("VIEW3D_MT_object_animation")
710 layout.operator("object.duplicate_move")
711 layout.operator("object.duplicate_move_linked")
712 layout.operator("object.delete", text="Delete...")
713 layout.operator("object.proxy_make", text="Make Proxy...")
714 layout.menu("VIEW3D_MT_make_links", text="Make Links...")
715 layout.operator("object.make_dupli_face")
716 layout.operator_menu_enum("object.make_local", "type", text="Make Local...")
717 layout.menu("VIEW3D_MT_make_single_user")
721 layout.menu("VIEW3D_MT_object_parent")
722 layout.menu("VIEW3D_MT_object_track")
723 layout.menu("VIEW3D_MT_object_group")
724 layout.menu("VIEW3D_MT_object_constraints")
728 layout.menu("VIEW3D_MT_object_game")
732 layout.operator("object.join_uvs")
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(bpy.types.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(bpy.types.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(bpy.types.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(bpy.types.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(bpy.types.Menu):
883 def draw(self, context):
886 layout.operator("object.parent_set", text="Set")
887 layout.operator("object.parent_clear", text="Clear")
890 class VIEW3D_MT_object_track(bpy.types.Menu):
893 def draw(self, context):
896 layout.operator("object.track_set", text="Set")
897 layout.operator("object.track_clear", text="Clear")
900 class VIEW3D_MT_object_group(bpy.types.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(bpy.types.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_showhide(bpy.types.Menu):
927 bl_label = "Show/Hide"
929 def draw(self, context):
932 layout.operator("object.hide_view_clear", text="Show Hidden")
933 layout.operator("object.hide_view_set", text="Hide Selected")
934 layout.operator("object.hide_view_set", text="Hide Unselected").unselected = True
937 class VIEW3D_MT_make_single_user(bpy.types.Menu):
938 bl_label = "Make Single User"
940 def draw(self, context):
943 props = layout.operator("object.make_single_user", text="Object")
946 props = layout.operator("object.make_single_user", text="Object & Data")
947 props.object = props.obdata = True
949 props = layout.operator("object.make_single_user", text="Object & Data & Materials+Tex")
950 props.object = props.obdata = props.material = props.texture = True
952 props = layout.operator("object.make_single_user", text="Materials+Tex")
953 props.material = props.texture = True
955 props = layout.operator("object.make_single_user", text="Object Animation")
956 props.animation = True
959 class VIEW3D_MT_make_links(bpy.types.Menu):
960 bl_label = "Make Links"
962 def draw(self, context):
965 if(len(bpy.data.scenes) > 10):
966 layout.operator_context = 'INVOKE_DEFAULT'
967 layout.operator("object.make_links_scene", text="Objects to Scene...", icon='OUTLINER_OB_EMPTY')
968 layout.operator("object.make_links_scene", text="Markers to Scene...", icon='OUTLINER_OB_EMPTY')
970 layout.operator_menu_enum("object.make_links_scene", "scene", text="Objects to Scene...")
971 layout.operator_menu_enum("marker.make_links_scene", "scene", text="Markers to Scene...")
973 layout.operator_enum("object.make_links_data", "type") # inline
976 class VIEW3D_MT_object_game(bpy.types.Menu):
979 def draw(self, context):
982 layout.operator("object.logic_bricks_copy", text="Copy Logic Bricks")
986 layout.operator("object.game_property_copy", text="Replace Properties").operation = 'REPLACE'
987 layout.operator("object.game_property_copy", text="Merge Properties").operation = 'MERGE'
988 layout.operator_menu_enum("object.game_property_copy", "property", text="Copy Properties...")
992 layout.operator("object.game_property_clear")
995 # ********** Vertex paint menu **********
998 class VIEW3D_MT_paint_vertex(bpy.types.Menu):
1001 def draw(self, context):
1002 layout = self.layout
1004 layout.operator("ed.undo")
1005 layout.operator("ed.redo")
1009 layout.operator("paint.vertex_color_set")
1010 layout.operator("paint.vertex_color_dirt")
1013 class VIEW3D_MT_hook(bpy.types.Menu):
1016 def draw(self, context):
1017 layout = self.layout
1018 layout.operator_context = 'EXEC_AREA'
1019 layout.operator("object.hook_add_newob")
1020 layout.operator("object.hook_add_selob")
1022 if [mod.type == 'HOOK' for mod in context.active_object.modifiers]:
1024 layout.operator_menu_enum("object.hook_assign", "modifier")
1025 layout.operator_menu_enum("object.hook_remove", "modifier")
1027 layout.operator_menu_enum("object.hook_select", "modifier")
1028 layout.operator_menu_enum("object.hook_reset", "modifier")
1029 layout.operator_menu_enum("object.hook_recenter", "modifier")
1032 class VIEW3D_MT_vertex_group(bpy.types.Menu):
1033 bl_label = "Vertex Groups"
1035 def draw(self, context):
1036 layout = self.layout
1037 layout.operator_context = 'EXEC_AREA'
1038 layout.operator("object.vertex_group_assign", text="Assign to New Group").new = True
1040 ob = context.active_object
1041 if ob.mode == 'EDIT':
1042 if ob.vertex_groups.active:
1044 layout.operator("object.vertex_group_assign", text="Assign to Active Group")
1045 layout.operator("object.vertex_group_remove_from", text="Remove from Active Group")
1046 layout.operator("object.vertex_group_remove_from", text="Remove from All").all = True
1049 if ob.vertex_groups.active:
1050 layout.operator_menu_enum("object.vertex_group_set_active", "group", text="Set Active Group")
1051 layout.operator("object.vertex_group_remove", text="Remove Active Group")
1052 layout.operator("object.vertex_group_remove", text="Remove All Groups").all = True
1054 # ********** Weight paint menu **********
1057 class VIEW3D_MT_paint_weight(bpy.types.Menu):
1058 bl_label = "Weights"
1060 def draw(self, context):
1061 layout = self.layout
1063 layout.operator("ed.undo")
1064 layout.operator("ed.redo")
1065 layout.operator("ed.undo_history")
1069 layout.operator("paint.weight_from_bones", text="Assign Automatic From Bones").type = 'AUTOMATIC'
1070 layout.operator("paint.weight_from_bones", text="Assign From Bone Envelopes").type = 'ENVELOPES'
1074 layout.operator("object.vertex_group_normalize_all", text="Normalize All")
1075 layout.operator("object.vertex_group_normalize", text="Normalize")
1076 layout.operator("object.vertex_group_invert", text="Invert")
1077 layout.operator("object.vertex_group_clean", text="Clean")
1078 layout.operator("object.vertex_group_levels", text="Levels")
1082 layout.operator("paint.weight_set")
1084 # ********** Sculpt menu **********
1087 class VIEW3D_MT_sculpt(bpy.types.Menu):
1090 def draw(self, context):
1091 layout = self.layout
1093 tool_settings = context.tool_settings
1094 sculpt = tool_settings.sculpt
1095 brush = tool_settings.sculpt.brush
1097 layout.operator("ed.undo")
1098 layout.operator("ed.redo")
1102 layout.prop(sculpt, "use_symmetry_x")
1103 layout.prop(sculpt, "use_symmetry_y")
1104 layout.prop(sculpt, "use_symmetry_z")
1106 layout.prop(sculpt, "lock_x")
1107 layout.prop(sculpt, "lock_y")
1108 layout.prop(sculpt, "lock_z")
1110 layout.operator_menu_enum("brush.curve_preset", "shape")
1113 if brush is not None: # unlikely but can happen
1114 sculpt_tool = brush.sculpt_tool
1116 if sculpt_tool != 'GRAB':
1117 layout.prop_menu_enum(brush, "stroke_method")
1119 if sculpt_tool in {'DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'}:
1120 layout.prop_menu_enum(brush, "direction")
1122 if sculpt_tool == 'LAYER':
1123 layout.prop(brush, "use_persistent")
1124 layout.operator("sculpt.set_persistent_base")
1127 layout.prop(sculpt, "use_threaded", text="Threaded Sculpt")
1128 layout.prop(sculpt, "show_brush")
1130 # TODO, make availabel from paint menu!
1131 layout.prop(tool_settings, "sculpt_paint_use_unified_size", text="Unify Size")
1132 layout.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Unify Strength")
1134 # ********** Particle menu **********
1137 class VIEW3D_MT_particle(bpy.types.Menu):
1138 bl_label = "Particle"
1140 def draw(self, context):
1141 layout = self.layout
1143 particle_edit = context.tool_settings.particle_edit
1145 layout.operator("ed.undo")
1146 layout.operator("ed.redo")
1147 layout.operator("ed.undo_history")
1151 layout.operator("particle.mirror")
1155 layout.operator("particle.remove_doubles")
1156 layout.operator("particle.delete")
1158 if particle_edit.select_mode == 'POINT':
1159 layout.operator("particle.subdivide")
1161 layout.operator("particle.rekey")
1162 layout.operator("particle.weight_set")
1166 layout.menu("VIEW3D_MT_particle_showhide")
1169 class VIEW3D_MT_particle_specials(bpy.types.Menu):
1170 bl_label = "Specials"
1172 def draw(self, context):
1173 layout = self.layout
1174 particle_edit = context.tool_settings.particle_edit
1176 layout.operator("particle.rekey")
1179 if particle_edit.select_mode == 'POINT':
1180 layout.operator("particle.subdivide")
1181 layout.operator("particle.select_roots")
1182 layout.operator("particle.select_tips")
1184 layout.operator("particle.remove_doubles")
1187 class VIEW3D_MT_particle_showhide(ShowHideMenu, bpy.types.Menu):
1188 _operator_name = "particle"
1190 # ********** Pose Menu **********
1193 class VIEW3D_MT_pose(bpy.types.Menu):
1196 def draw(self, context):
1197 layout = self.layout
1199 layout.operator("ed.undo")
1200 layout.operator("ed.redo")
1201 layout.operator("ed.undo_history")
1205 layout.menu("VIEW3D_MT_transform")
1207 layout.menu("VIEW3D_MT_pose_transform")
1208 layout.menu("VIEW3D_MT_pose_apply")
1210 layout.menu("VIEW3D_MT_snap")
1214 layout.menu("VIEW3D_MT_object_animation")
1218 layout.menu("VIEW3D_MT_pose_slide")
1219 layout.menu("VIEW3D_MT_pose_propagate")
1223 layout.operator("pose.copy")
1224 layout.operator("pose.paste")
1225 layout.operator("pose.paste", text="Paste X-Flipped Pose").flipped = True
1229 layout.menu("VIEW3D_MT_pose_library")
1230 layout.menu("VIEW3D_MT_pose_motion")
1231 layout.menu("VIEW3D_MT_pose_group")
1235 layout.menu("VIEW3D_MT_object_parent")
1236 layout.menu("VIEW3D_MT_pose_ik")
1237 layout.menu("VIEW3D_MT_pose_constraints")
1241 layout.operator_context = 'EXEC_AREA'
1242 layout.operator("pose.autoside_names", text="AutoName Left/Right").axis = 'XAXIS'
1243 layout.operator("pose.autoside_names", text="AutoName Front/Back").axis = 'YAXIS'
1244 layout.operator("pose.autoside_names", text="AutoName Top/Bottom").axis = 'ZAXIS'
1246 layout.operator("pose.flip_names")
1248 layout.operator("pose.quaternions_flip")
1252 layout.operator_context = 'INVOKE_AREA'
1253 layout.operator("pose.armature_layers", text="Change Armature Layers...")
1254 layout.operator("pose.bone_layers", text="Change Bone Layers...")
1258 layout.menu("VIEW3D_MT_pose_showhide")
1259 layout.menu("VIEW3D_MT_bone_options_toggle", text="Bone Settings")
1262 class VIEW3D_MT_pose_transform(bpy.types.Menu):
1263 bl_label = "Clear Transform"
1265 def draw(self, context):
1266 layout = self.layout
1268 layout.operator("pose.transforms_clear", text="All")
1270 layout.operator("pose.loc_clear", text="Location")
1271 layout.operator("pose.rot_clear", text="Rotation")
1272 layout.operator("pose.scale_clear", text="Scale")
1274 layout.label(text="Origin")
1277 class VIEW3D_MT_pose_slide(bpy.types.Menu):
1278 bl_label = "In-Betweens"
1280 def draw(self, context):
1281 layout = self.layout
1283 layout.operator("pose.push")
1284 layout.operator("pose.relax")
1285 layout.operator("pose.breakdown")
1288 class VIEW3D_MT_pose_propagate(bpy.types.Menu):
1289 bl_label = "Propagate"
1291 def draw(self, context):
1292 layout = self.layout
1294 layout.operator("pose.propagate")
1298 layout.operator("pose.propagate", text="To Next Keyframe").mode = 'NEXT_KEY'
1299 layout.operator("pose.propagate", text="To Last Keyframe (Make Cyclic)").mode = 'LAST_KEY'
1303 layout.operator("pose.propagate", text="On Selected Markers").mode = 'SELECTED_MARKERS'
1306 class VIEW3D_MT_pose_library(bpy.types.Menu):
1307 bl_label = "Pose Library"
1309 def draw(self, context):
1310 layout = self.layout
1312 layout.operator("poselib.browse_interactive", text="Browse Poses...")
1316 layout.operator("poselib.pose_add", text="Add Pose...")
1317 layout.operator("poselib.pose_rename", text="Rename Pose...")
1318 layout.operator("poselib.pose_remove", text="Remove Pose...")
1321 class VIEW3D_MT_pose_motion(bpy.types.Menu):
1322 bl_label = "Motion Paths"
1324 def draw(self, context):
1325 layout = self.layout
1327 layout.operator("pose.paths_calculate", text="Calculate")
1328 layout.operator("pose.paths_clear", text="Clear")
1331 class VIEW3D_MT_pose_group(bpy.types.Menu):
1332 bl_label = "Bone Groups"
1334 def draw(self, context):
1335 layout = self.layout
1336 layout.operator("pose.group_add")
1337 layout.operator("pose.group_remove")
1341 layout.operator("pose.group_assign")
1342 layout.operator("pose.group_unassign")
1345 class VIEW3D_MT_pose_ik(bpy.types.Menu):
1346 bl_label = "Inverse Kinematics"
1348 def draw(self, context):
1349 layout = self.layout
1351 layout.operator("pose.ik_add")
1352 layout.operator("pose.ik_clear")
1355 class VIEW3D_MT_pose_constraints(bpy.types.Menu):
1356 bl_label = "Constraints"
1358 def draw(self, context):
1359 layout = self.layout
1361 layout.operator("pose.constraint_add_with_targets", text="Add (With Targets)...")
1362 layout.operator("pose.constraints_copy")
1363 layout.operator("pose.constraints_clear")
1366 class VIEW3D_MT_pose_showhide(ShowHideMenu, bpy.types.Menu):
1367 _operator_name = "pose"
1370 class VIEW3D_MT_pose_apply(bpy.types.Menu):
1373 def draw(self, context):
1374 layout = self.layout
1376 layout.operator("pose.armature_apply")
1377 layout.operator("pose.visual_transform_apply")
1381 def draw(self, context):
1382 layout = self.layout
1387 "use_envelope_multiply",
1388 "use_inherit_rotation",
1389 "use_inherit_scale",
1392 if context.mode == 'EDIT_ARMATURE':
1393 bone_props = bpy.types.EditBone.bl_rna.properties
1394 data_path_iter = "selected_bones"
1396 options.append("lock")
1398 bone_props = bpy.types.Bone.bl_rna.properties
1399 data_path_iter = "selected_pose_bones"
1400 opt_suffix = "bone."
1403 props = layout.operator("wm.context_collection_boolean_set", text=bone_props[opt].name)
1404 props.data_path_iter = data_path_iter
1405 props.data_path_item = opt_suffix + opt
1406 props.type = self.type
1409 class VIEW3D_MT_bone_options_toggle(bpy.types.Menu, BoneOptions):
1410 bl_label = "Toggle Bone Options"
1414 class VIEW3D_MT_bone_options_enable(bpy.types.Menu, BoneOptions):
1415 bl_label = "Enable Bone Options"
1419 class VIEW3D_MT_bone_options_disable(bpy.types.Menu, BoneOptions):
1420 bl_label = "Disable Bone Options"
1423 # ********** Edit Menus, suffix from ob.type **********
1426 class VIEW3D_MT_edit_mesh(bpy.types.Menu):
1429 def draw(self, context):
1430 layout = self.layout
1432 settings = context.tool_settings
1434 layout.operator("ed.undo")
1435 layout.operator("ed.redo")
1436 layout.operator("ed.undo_history")
1440 layout.menu("VIEW3D_MT_transform")
1441 layout.menu("VIEW3D_MT_mirror")
1442 layout.menu("VIEW3D_MT_snap")
1446 layout.menu("VIEW3D_MT_uv_map", text="UV Unwrap...")
1450 layout.operator("view3d.edit_mesh_extrude_move_normal", text="Extrude Region")
1451 layout.operator("view3d.edit_mesh_extrude_individual_move", text="Extrude Individual")
1452 layout.operator("mesh.duplicate_move")
1453 layout.operator("mesh.delete", text="Delete...")
1457 layout.menu("VIEW3D_MT_edit_mesh_vertices")
1458 layout.menu("VIEW3D_MT_edit_mesh_edges")
1459 layout.menu("VIEW3D_MT_edit_mesh_faces")
1460 layout.menu("VIEW3D_MT_edit_mesh_normals")
1464 layout.prop(settings, "use_mesh_automerge")
1465 layout.prop_menu_enum(settings, "proportional_edit")
1466 layout.prop_menu_enum(settings, "proportional_edit_falloff")
1470 layout.menu("VIEW3D_MT_edit_mesh_showhide")
1473 class VIEW3D_MT_edit_mesh_specials(bpy.types.Menu):
1474 bl_label = "Specials"
1476 def draw(self, context):
1477 layout = self.layout
1479 layout.operator_context = 'INVOKE_REGION_WIN'
1481 layout.operator("mesh.subdivide", text="Subdivide")
1482 layout.operator("mesh.subdivide", text="Subdivide Smooth").smoothness = 1.0
1483 layout.operator("mesh.merge", text="Merge...")
1484 layout.operator("mesh.remove_doubles")
1485 layout.operator("mesh.hide", text="Hide")
1486 layout.operator("mesh.reveal", text="Reveal")
1487 layout.operator("mesh.select_inverse")
1488 layout.operator("mesh.flip_normals")
1489 layout.operator("mesh.vertices_smooth", text="Smooth")
1490 # layout.operator("mesh.bevel", text="Bevel")
1491 layout.operator("mesh.faces_shade_smooth")
1492 layout.operator("mesh.faces_shade_flat")
1493 layout.operator("mesh.blend_from_shape")
1494 layout.operator("mesh.shape_propagate_to_all")
1495 layout.operator("mesh.select_vertex_path")
1498 class VIEW3D_MT_edit_mesh_select_mode(bpy.types.Menu):
1499 bl_label = "Mesh Select Mode"
1501 def draw(self, context):
1502 layout = self.layout
1504 layout.operator_context = 'INVOKE_REGION_WIN'
1506 prop = layout.operator("wm.context_set_value", text="Vertex", icon='VERTEXSEL')
1507 prop.value = "(True, False, False)"
1508 prop.data_path = "tool_settings.mesh_select_mode"
1510 prop = layout.operator("wm.context_set_value", text="Edge", icon='EDGESEL')
1511 prop.value = "(False, True, False)"
1512 prop.data_path = "tool_settings.mesh_select_mode"
1514 prop = layout.operator("wm.context_set_value", text="Face", icon='FACESEL')
1515 prop.value = "(False, False, True)"
1516 prop.data_path = "tool_settings.mesh_select_mode"
1519 class VIEW3D_MT_edit_mesh_extrude(bpy.types.Menu):
1520 bl_label = "Extrude"
1522 _extrude_funcs = { \
1523 "VERT": lambda layout: layout.operator("mesh.extrude_vertices_move", text="Vertices Only"),
1524 "EDGE": lambda layout: layout.operator("mesh.extrude_edges_move", text="Edges Only"),
1525 "FACE": lambda layout: layout.operator("mesh.extrude_faces_move", text="Individual Faces"),
1526 "REGION": lambda layout: layout.operator("view3d.edit_mesh_extrude_move_normal", text="Region"),
1530 def extrude_options(context):
1531 mesh = context.object.data
1532 select_mode = context.tool_settings.mesh_select_mode
1535 if mesh.total_face_sel:
1536 menu += ["REGION", "FACE"]
1537 if mesh.total_edge_sel and (select_mode[0] or select_mode[1]):
1539 if mesh.total_vert_sel and select_mode[0]:
1542 # should never get here
1545 def draw(self, context):
1546 layout = self.layout
1547 layout.operator_context = 'INVOKE_REGION_WIN'
1549 for menu_id in self.extrude_options(context):
1550 self._extrude_funcs[menu_id](layout)
1553 class VIEW3D_OT_edit_mesh_extrude_individual_move(bpy.types.Operator):
1554 "Extrude individual elements and move"
1555 bl_label = "Extrude Individual and Move"
1556 bl_idname = "view3d.edit_mesh_extrude_individual_move"
1558 def execute(self, context):
1559 mesh = context.object.data
1560 select_mode = context.tool_settings.mesh_select_mode
1562 totface = mesh.total_face_sel
1563 totedge = mesh.total_edge_sel
1564 # totvert = mesh.total_vert_sel
1566 if select_mode[2] and totface == 1:
1567 bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": 'NORMAL', "constraint_axis": (False, False, True)})
1568 elif select_mode[2] and totface > 1:
1569 bpy.ops.mesh.extrude_faces_move('INVOKE_REGION_WIN')
1570 elif select_mode[1] and totedge >= 1:
1571 bpy.ops.mesh.extrude_edges_move('INVOKE_REGION_WIN')
1573 bpy.ops.mesh.extrude_vertices_move('INVOKE_REGION_WIN')
1575 # ignore return from operators above because they are 'RUNNING_MODAL', and cause this one not to be freed. [#24671]
1578 def invoke(self, context, event):
1579 return self.execute(context)
1582 class VIEW3D_OT_edit_mesh_extrude_move(bpy.types.Operator):
1583 "Extrude and move along normals"
1584 bl_label = "Extrude and Move on Normals"
1585 bl_idname = "view3d.edit_mesh_extrude_move_normal"
1587 def execute(self, context):
1588 mesh = context.object.data
1590 totface = mesh.total_face_sel
1591 totedge = mesh.total_edge_sel
1592 # totvert = mesh.total_vert_sel
1595 bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": 'NORMAL', "constraint_axis": (False, False, True)})
1597 bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": 'NORMAL', "constraint_axis": (True, True, False)})
1599 bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN')
1601 # ignore return from operators above because they are 'RUNNING_MODAL', and cause this one not to be freed. [#24671]
1604 def invoke(self, context, event):
1605 return self.execute(context)
1608 class VIEW3D_MT_edit_mesh_vertices(bpy.types.Menu):
1609 bl_label = "Vertices"
1611 def draw(self, context):
1612 layout = self.layout
1613 layout.operator_context = 'INVOKE_REGION_WIN'
1615 layout.operator("mesh.merge")
1616 layout.operator("mesh.rip_move")
1617 layout.operator("mesh.split")
1618 layout.operator("mesh.separate")
1622 layout.operator("mesh.vertices_smooth")
1623 layout.operator("mesh.remove_doubles")
1624 layout.operator("mesh.vertices_sort")
1625 layout.operator("mesh.vertices_randomize")
1627 layout.operator("mesh.select_vertex_path")
1629 layout.operator("mesh.blend_from_shape")
1631 layout.operator("object.vertex_group_blend")
1632 layout.operator("mesh.shape_propagate_to_all")
1636 layout.menu("VIEW3D_MT_vertex_group")
1637 layout.menu("VIEW3D_MT_hook")
1640 class VIEW3D_MT_edit_mesh_edges(bpy.types.Menu):
1643 def draw(self, context):
1644 layout = self.layout
1645 layout.operator_context = 'INVOKE_REGION_WIN'
1647 layout.operator("mesh.edge_face_add")
1648 layout.operator("mesh.subdivide")
1652 layout.operator("mesh.mark_seam")
1653 layout.operator("mesh.mark_seam", text="Clear Seam").clear = True
1657 layout.operator("mesh.mark_sharp")
1658 layout.operator("mesh.mark_sharp", text="Clear Sharp").clear = True
1662 layout.operator("mesh.edge_rotate", text="Rotate Edge CW").direction = 'CW'
1663 layout.operator("mesh.edge_rotate", text="Rotate Edge CCW").direction = 'CCW'
1667 layout.operator("TRANSFORM_OT_edge_slide")
1668 layout.operator("TRANSFORM_OT_edge_crease")
1669 layout.operator("mesh.loop_multi_select", text="Edge Loop")
1671 # uiItemO(layout, "Loopcut", 0, "mesh.loop_cut"); // CutEdgeloop(em, 1);
1672 # uiItemO(layout, "Edge Slide", 0, "mesh.edge_slide"); // EdgeSlide(em, 0,0.0);
1674 layout.operator("mesh.loop_multi_select", text="Edge Ring").ring = True
1676 layout.operator("mesh.loop_to_region")
1677 layout.operator("mesh.region_to_loop")
1680 class VIEW3D_MT_edit_mesh_faces(bpy.types.Menu):
1682 bl_idname = "VIEW3D_MT_edit_mesh_faces"
1684 def draw(self, context):
1685 layout = self.layout
1686 layout.operator_context = 'INVOKE_REGION_WIN'
1688 layout.operator("mesh.flip_normals")
1689 # layout.operator("mesh.bevel")
1690 # layout.operator("mesh.bevel")
1691 layout.operator("mesh.edge_face_add")
1692 layout.operator("mesh.fill")
1693 layout.operator("mesh.beautify_fill")
1694 layout.operator("mesh.solidify")
1695 layout.operator("mesh.sort_faces")
1699 layout.operator("mesh.fgon_make")
1700 layout.operator("mesh.fgon_clear")
1704 layout.operator("mesh.quads_convert_to_tris")
1705 layout.operator("mesh.tris_convert_to_quads")
1706 layout.operator("mesh.edge_flip")
1710 layout.operator("mesh.faces_shade_smooth")
1711 layout.operator("mesh.faces_shade_flat")
1715 # uiItemO(layout, NULL, 0, "mesh.face_mode"); // mesh_set_face_flags(em, 1);
1716 # uiItemBooleanO(layout, NULL, 0, "mesh.face_mode", "clear", 1); // mesh_set_face_flags(em, 0);
1718 layout.operator("mesh.edge_rotate", text="Rotate Edge CW").direction = 'CW'
1722 layout.operator_menu_enum("mesh.uvs_rotate", "direction")
1723 layout.operator_menu_enum("mesh.uvs_mirror", "axis")
1724 layout.operator_menu_enum("mesh.colors_rotate", "direction")
1725 layout.operator_menu_enum("mesh.colors_mirror", "axis")
1728 class VIEW3D_MT_edit_mesh_normals(bpy.types.Menu):
1729 bl_label = "Normals"
1731 def draw(self, context):
1732 layout = self.layout
1734 layout.operator("mesh.normals_make_consistent", text="Recalculate Outside")
1735 layout.operator("mesh.normals_make_consistent", text="Recalculate Inside").inside = True
1739 layout.operator("mesh.flip_normals")
1742 class VIEW3D_MT_edit_mesh_showhide(ShowHideMenu, bpy.types.Menu):
1743 _operator_name = "mesh"
1746 # draw_curve is used by VIEW3D_MT_edit_curve and VIEW3D_MT_edit_surface
1749 def draw_curve(self, context):
1750 layout = self.layout
1752 settings = context.tool_settings
1754 layout.menu("VIEW3D_MT_transform")
1755 layout.menu("VIEW3D_MT_mirror")
1756 layout.menu("VIEW3D_MT_snap")
1760 layout.operator("curve.extrude")
1761 layout.operator("curve.duplicate")
1762 layout.operator("curve.separate")
1763 layout.operator("curve.make_segment")
1764 layout.operator("curve.cyclic_toggle")
1765 layout.operator("curve.delete", text="Delete...")
1769 layout.menu("VIEW3D_MT_edit_curve_ctrlpoints")
1770 layout.menu("VIEW3D_MT_edit_curve_segments")
1774 layout.prop_menu_enum(settings, "proportional_edit")
1775 layout.prop_menu_enum(settings, "proportional_edit_falloff")
1779 layout.menu("VIEW3D_MT_edit_curve_showhide")
1782 class VIEW3D_MT_edit_curve(bpy.types.Menu):
1788 class VIEW3D_MT_edit_curve_ctrlpoints(bpy.types.Menu):
1789 bl_label = "Control Points"
1791 def draw(self, context):
1792 layout = self.layout
1794 edit_object = context.edit_object
1796 if edit_object.type == 'CURVE':
1797 layout.operator("transform.transform", text="Tilt").mode = 'TILT'
1798 layout.operator("curve.tilt_clear")
1799 layout.operator("curve.separate")
1803 layout.operator_menu_enum("curve.handle_type_set", "type")
1807 layout.menu("VIEW3D_MT_hook")
1810 class VIEW3D_MT_edit_curve_segments(bpy.types.Menu):
1811 bl_label = "Segments"
1813 def draw(self, context):
1814 layout = self.layout
1816 layout.operator("curve.subdivide")
1817 layout.operator("curve.switch_direction")
1820 class VIEW3D_MT_edit_curve_specials(bpy.types.Menu):
1821 bl_label = "Specials"
1823 def draw(self, context):
1824 layout = self.layout
1826 layout.operator("curve.subdivide")
1827 layout.operator("curve.switch_direction")
1828 layout.operator("curve.spline_weight_set")
1829 layout.operator("curve.radius_set")
1830 layout.operator("curve.smooth")
1831 layout.operator("curve.smooth_radius")
1834 class VIEW3D_MT_edit_curve_showhide(ShowHideMenu, bpy.types.Menu):
1835 _operator_name = "curve"
1838 class VIEW3D_MT_edit_surface(bpy.types.Menu):
1839 bl_label = "Surface"
1844 class VIEW3D_MT_edit_font(bpy.types.Menu):
1847 def draw(self, context):
1848 layout = self.layout
1850 layout.operator("font.file_paste")
1854 layout.menu("VIEW3D_MT_edit_text_chars")
1858 layout.operator("font.style_toggle", text="Toggle Bold").style = 'BOLD'
1859 layout.operator("font.style_toggle", text="Toggle Italic").style = 'ITALIC'
1860 layout.operator("font.style_toggle", text="Toggle Underline").style = 'UNDERLINE'
1861 layout.operator("font.style_toggle", text="Toggle Small Caps").style = 'SMALL_CAPS'
1864 class VIEW3D_MT_edit_text_chars(bpy.types.Menu):
1865 bl_label = "Special Characters"
1867 def draw(self, context):
1868 layout = self.layout
1870 layout.operator("font.text_insert", text="Copyright|Alt C").text = b'\xC2\xA9'.decode()
1871 layout.operator("font.text_insert", text="Registered Trademark|Alt R").text = b'\xC2\xAE'.decode()
1875 layout.operator("font.text_insert", text="Degree Sign|Alt G").text = b'\xC2\xB0'.decode()
1876 layout.operator("font.text_insert", text="Multiplication Sign|Alt x").text = b'\xC3\x97'.decode()
1877 layout.operator("font.text_insert", text="Circle|Alt .").text = b'\xC2\x8A'.decode()
1878 layout.operator("font.text_insert", text="Superscript 1|Alt 1").text = b'\xC2\xB9'.decode()
1879 layout.operator("font.text_insert", text="Superscript 2|Alt 2").text = b'\xC2\xB2'.decode()
1880 layout.operator("font.text_insert", text="Superscript 3|Alt 3").text = b'\xC2\xB3'.decode()
1881 layout.operator("font.text_insert", text="Double >>|Alt >").text = b'\xC2\xBB'.decode()
1882 layout.operator("font.text_insert", text="Double <<|Alt <").text = b'\xC2\xAB'.decode()
1883 layout.operator("font.text_insert", text="Promillage|Alt %").text = b'\xE2\x80\xB0'.decode()
1887 layout.operator("font.text_insert", text="Dutch Florin|Alt F").text = b'\xC2\xA4'.decode()
1888 layout.operator("font.text_insert", text="British Pound|Alt L").text = b'\xC2\xA3'.decode()
1889 layout.operator("font.text_insert", text="Japanese Yen|Alt Y").text = b'\xC2\xA5'.decode()
1893 layout.operator("font.text_insert", text="German S|Alt S").text = b'\xC3\x9F'.decode()
1894 layout.operator("font.text_insert", text="Spanish Question Mark|Alt ?").text = b'\xC2\xBF'.decode()
1895 layout.operator("font.text_insert", text="Spanish Exclamation Mark|Alt !").text = b'\xC2\xA1'.decode()
1898 class VIEW3D_MT_edit_meta(bpy.types.Menu):
1899 bl_label = "Metaball"
1901 def draw(self, context):
1902 layout = self.layout
1904 settings = context.tool_settings
1906 layout.operator("ed.undo")
1907 layout.operator("ed.redo")
1908 layout.operator("ed.undo_history")
1912 layout.menu("VIEW3D_MT_transform")
1913 layout.menu("VIEW3D_MT_mirror")
1914 layout.menu("VIEW3D_MT_snap")
1918 layout.operator("mball.delete_metaelems", text="Delete...")
1919 layout.operator("mball.duplicate_metaelems")
1923 layout.prop_menu_enum(settings, "proportional_edit")
1924 layout.prop_menu_enum(settings, "proportional_edit_falloff")
1928 layout.menu("VIEW3D_MT_edit_meta_showhide")
1931 class VIEW3D_MT_edit_meta_showhide(bpy.types.Menu):
1932 bl_label = "Show/Hide"
1934 def draw(self, context):
1935 layout = self.layout
1937 layout.operator("mball.reveal_metaelems", text="Show Hidden")
1938 layout.operator("mball.hide_metaelems", text="Hide Selected")
1939 layout.operator("mball.hide_metaelems", text="Hide Unselected").unselected = True
1942 class VIEW3D_MT_edit_lattice(bpy.types.Menu):
1943 bl_label = "Lattice"
1945 def draw(self, context):
1946 layout = self.layout
1948 settings = context.tool_settings
1950 layout.menu("VIEW3D_MT_transform")
1951 layout.menu("VIEW3D_MT_mirror")
1952 layout.menu("VIEW3D_MT_snap")
1956 layout.operator("lattice.make_regular")
1960 layout.prop_menu_enum(settings, "proportional_edit")
1961 layout.prop_menu_enum(settings, "proportional_edit_falloff")
1964 class VIEW3D_MT_edit_armature(bpy.types.Menu):
1965 bl_label = "Armature"
1967 def draw(self, context):
1968 layout = self.layout
1970 edit_object = context.edit_object
1971 arm = edit_object.data
1973 layout.menu("VIEW3D_MT_transform")
1974 layout.menu("VIEW3D_MT_mirror")
1975 layout.menu("VIEW3D_MT_snap")
1976 layout.menu("VIEW3D_MT_edit_armature_roll")
1980 layout.operator("armature.extrude_move")
1982 if arm.use_mirror_x:
1983 layout.operator("armature.extrude_forked")
1985 layout.operator("armature.duplicate_move")
1986 layout.operator("armature.merge")
1987 layout.operator("armature.fill")
1988 layout.operator("armature.delete")
1989 layout.operator("armature.separate")
1993 layout.operator("armature.subdivide", text="Subdivide")
1994 layout.operator("armature.switch_direction", text="Switch Direction")
1998 layout.operator_context = 'EXEC_AREA'
1999 layout.operator("armature.autoside_names", text="AutoName Left/Right").type = 'XAXIS'
2000 layout.operator("armature.autoside_names", text="AutoName Front/Back").type = 'YAXIS'
2001 layout.operator("armature.autoside_names", text="AutoName Top/Bottom").type = 'ZAXIS'
2002 layout.operator("armature.flip_names")
2006 layout.operator_context = 'INVOKE_DEFAULT'
2007 layout.operator("armature.armature_layers")
2008 layout.operator("armature.bone_layers")
2012 layout.menu("VIEW3D_MT_edit_armature_parent")
2016 layout.menu("VIEW3D_MT_bone_options_toggle", text="Bone Settings")
2019 class VIEW3D_MT_armature_specials(bpy.types.Menu):
2020 bl_label = "Specials"
2022 def draw(self, context):
2023 layout = self.layout
2025 layout.operator_context = 'INVOKE_REGION_WIN'
2027 layout.operator("armature.subdivide", text="Subdivide")
2028 layout.operator("armature.switch_direction", text="Switch Direction")
2032 layout.operator_context = 'EXEC_REGION_WIN'
2033 layout.operator("armature.autoside_names", text="AutoName Left/Right").type = 'XAXIS'
2034 layout.operator("armature.autoside_names", text="AutoName Front/Back").type = 'YAXIS'
2035 layout.operator("armature.autoside_names", text="AutoName Top/Bottom").type = 'ZAXIS'
2036 layout.operator("armature.flip_names", text="Flip Names")
2039 class VIEW3D_MT_edit_armature_parent(bpy.types.Menu):
2042 def draw(self, context):
2043 layout = self.layout
2045 layout.operator("armature.parent_set", text="Make")
2046 layout.operator("armature.parent_clear", text="Clear")
2049 class VIEW3D_MT_edit_armature_roll(bpy.types.Menu):
2050 bl_label = "Bone Roll"
2052 def draw(self, context):
2053 layout = self.layout
2055 layout.operator_menu_enum("armature.calculate_roll", "type")
2059 layout.operator("transform.transform", text="Set Roll").mode = 'BONE_ROLL'
2061 # ********** Panel **********
2064 class VIEW3D_PT_view3d_properties(bpy.types.Panel):
2065 bl_space_type = 'VIEW_3D'
2066 bl_region_type = 'UI'
2070 def poll(cls, context):
2071 view = context.space_data
2074 def draw(self, context):
2075 layout = self.layout
2077 view = context.space_data
2079 col = layout.column()
2080 col.active = view.region_3d.view_perspective != 'CAMERA'
2081 col.prop(view, "lens")
2082 col.label(text="Lock to Object:")
2083 col.prop(view, "lock_object", text="")
2084 if view.lock_object and view.lock_object.type == 'ARMATURE':
2085 col.prop_search(view, "lock_bone", view.lock_object.data, "bones", text="")
2086 elif not view.lock_object:
2087 col.prop(view, "lock_cursor", text="Lock to Cursor")
2089 col = layout.column()
2090 col.prop(view, "lock_camera")
2092 col = layout.column(align=True)
2093 col.label(text="Clip:")
2094 col.prop(view, "clip_start", text="Start")
2095 col.prop(view, "clip_end", text="End")
2097 subcol = col.column()
2098 subcol.enabled = not view.lock_camera_and_layers
2099 subcol.label(text="Local Camera:")
2100 subcol.prop(view, "camera", text="")
2102 layout.column().prop(view, "cursor_location")
2105 class VIEW3D_PT_view3d_name(bpy.types.Panel):
2106 bl_space_type = 'VIEW_3D'
2107 bl_region_type = 'UI'
2111 def poll(cls, context):
2112 return (context.space_data and context.active_object)
2114 def draw(self, context):
2115 layout = self.layout
2117 ob = context.active_object
2119 row.label(text="", icon='OBJECT_DATA')
2120 row.prop(ob, "name", text="")
2122 if ob.type == 'ARMATURE' and ob.mode in {'EDIT', 'POSE'}:
2123 bone = context.active_bone
2126 row.label(text="", icon='BONE_DATA')
2127 row.prop(bone, "name", text="")
2130 class VIEW3D_PT_view3d_display(bpy.types.Panel):
2131 bl_space_type = 'VIEW_3D'
2132 bl_region_type = 'UI'
2133 bl_label = "Display"
2134 bl_options = {'DEFAULT_CLOSED'}
2137 def poll(cls, context):
2138 view = context.space_data
2141 def draw(self, context):
2142 layout = self.layout
2144 view = context.space_data
2145 scene = context.scene
2146 gs = scene.game_settings
2149 col = layout.column()
2150 col.prop(view, "show_only_render")
2152 col = layout.column()
2153 display_all = not view.show_only_render
2154 col.active = display_all
2155 col.prop(view, "show_outline_selected")
2156 col.prop(view, "show_all_objects_origin")
2157 col.prop(view, "show_relationship_lines")
2158 if ob and ob.type == 'MESH':
2160 col.prop(mesh, "show_all_edges")
2162 col = layout.column()
2163 col.active = display_all
2164 split = col.split(percentage=0.55)
2165 split.prop(view, "show_floor", text="Grid Floor")
2167 row = split.row(align=True)
2168 row.prop(view, "show_axis_x", text="X", toggle=True)
2169 row.prop(view, "show_axis_y", text="Y", toggle=True)
2170 row.prop(view, "show_axis_z", text="Z", toggle=True)
2172 sub = col.column(align=True)
2173 sub.active = (display_all and view.show_floor)
2174 sub.prop(view, "grid_lines", text="Lines")
2175 sub.prop(view, "grid_scale", text="Scale")
2176 subsub = sub.column(align=True)
2177 subsub.active = scene.unit_settings.system == 'NONE'
2178 subsub.prop(view, "grid_subdivisions", text="Subdivisions")
2180 col = layout.column()
2181 col.label(text="Shading:")
2182 col.prop(gs, "material_mode", text="")
2183 col.prop(view, "show_textured_solid")
2187 region = view.region_quadview
2189 layout.operator("screen.region_quadview", text="Toggle Quad View")
2192 col = layout.column()
2193 col.prop(region, "lock_rotation")
2195 row.enabled = region.lock_rotation
2196 row.prop(region, "show_sync_view")
2198 row.enabled = region.lock_rotation and region.show_sync_view
2199 row.prop(region, "use_box_clip")
2202 class VIEW3D_PT_view3d_meshdisplay(bpy.types.Panel):
2203 bl_space_type = 'VIEW_3D'
2204 bl_region_type = 'UI'
2205 bl_label = "Mesh Display"
2208 def poll(cls, context):
2209 # The active object check is needed because of localmode
2210 return (context.active_object and (context.mode == 'EDIT_MESH'))
2212 def draw(self, context):
2213 layout = self.layout
2215 mesh = context.active_object.data
2217 col = layout.column()
2218 col.label(text="Overlays:")
2219 col.prop(mesh, "show_edges", text="Edges")
2220 col.prop(mesh, "show_faces", text="Faces")
2221 col.prop(mesh, "show_edge_crease", text="Creases")
2222 col.prop(mesh, "show_edge_bevel_weight", text="Bevel Weights")
2223 col.prop(mesh, "show_edge_seams", text="Seams")
2224 col.prop(mesh, "show_edge_sharp", text="Sharp")
2227 col.label(text="Normals:")
2228 col.prop(mesh, "show_normal_face", text="Face")
2229 col.prop(mesh, "show_normal_vertex", text="Vertex")
2230 col.prop(context.scene.tool_settings, "normal_size", text="Normal Size")
2233 col.label(text="Numerics:")
2234 col.prop(mesh, "show_extra_edge_length")
2235 col.prop(mesh, "show_extra_face_angle")
2236 col.prop(mesh, "show_extra_face_area")
2239 class VIEW3D_PT_view3d_curvedisplay(bpy.types.Panel):
2240 bl_space_type = 'VIEW_3D'
2241 bl_region_type = 'UI'
2242 bl_label = "Curve Display"
2245 def poll(cls, context):
2246 editmesh = context.mode == 'EDIT_CURVE'
2249 def draw(self, context):
2250 layout = self.layout
2252 curve = context.active_object.data
2254 col = layout.column()
2255 col.label(text="Overlays:")
2256 col.prop(curve, "show_handles", text="Handles")
2257 col.prop(curve, "show_normal_face", text="Normals")
2258 col.prop(context.scene.tool_settings, "normal_size", text="Normal Size")
2261 class VIEW3D_PT_background_image(bpy.types.Panel):
2262 bl_space_type = 'VIEW_3D'
2263 bl_region_type = 'UI'
2264 bl_label = "Background Images"
2265 bl_options = {'DEFAULT_CLOSED'}
2268 def poll(cls, context):
2269 view = context.space_data
2270 # bg = context.space_data.background_image
2273 def draw_header(self, context):
2274 layout = self.layout
2275 view = context.space_data
2277 layout.prop(view, "show_background_images", text="")
2279 def draw(self, context):
2280 layout = self.layout
2282 view = context.space_data
2284 col = layout.column()
2285 col.operator("view3d.background_image_add", text="Add Image")
2287 for i, bg in enumerate(view.background_images):
2288 layout.active = view.show_background_images
2290 row = box.row(align=True)
2291 row.prop(bg, "show_expanded", text="", emboss=False)
2293 row.prop(bg.image, "name", text="", emboss=False)
2295 row.label(text="Not Set")
2296 row.operator("view3d.background_image_remove", text="", emboss=False, icon='X').index = i
2298 box.prop(bg, "view_axis", text="Axis")
2300 if bg.show_expanded:
2302 row.template_ID(bg, "image", open="image.open")
2304 box.template_image(bg, "image", bg.image_user, compact=True)
2306 box.prop(bg, "opacity", slider=True)
2307 if bg.view_axis != 'CAMERA':
2308 box.prop(bg, "size")
2309 row = box.row(align=True)
2310 row.prop(bg, "offset_x", text="X")
2311 row.prop(bg, "offset_y", text="Y")
2314 class VIEW3D_PT_transform_orientations(bpy.types.Panel):
2315 bl_space_type = 'VIEW_3D'
2316 bl_region_type = 'UI'
2317 bl_label = "Transform Orientations"
2318 bl_options = {'DEFAULT_CLOSED'}
2321 def poll(cls, context):
2322 view = context.space_data
2325 def draw(self, context):
2326 layout = self.layout
2328 view = context.space_data
2330 col = layout.column()
2332 col.prop(view, "transform_orientation")
2333 col.operator("transform.create_orientation", text="Create")
2335 orientation = view.current_orientation
2338 col.prop(orientation, "name")
2339 col.operator("transform.delete_orientation", text="Delete")
2342 class VIEW3D_PT_etch_a_ton(bpy.types.Panel):
2343 bl_space_type = 'VIEW_3D'
2344 bl_region_type = 'UI'
2345 bl_label = "Skeleton Sketching"
2346 bl_options = {'DEFAULT_CLOSED'}
2349 def poll(cls, context):
2350 scene = context.space_data
2351 ob = context.active_object
2352 return scene and ob and ob.type == 'ARMATURE' and ob.mode == 'EDIT'
2354 def draw_header(self, context):
2355 layout = self.layout
2356 toolsettings = context.scene.tool_settings
2358 layout.prop(toolsettings, "use_bone_sketching", text="")
2360 def draw(self, context):
2361 layout = self.layout
2362 toolsettings = context.scene.tool_settings
2364 col = layout.column()
2366 col.prop(toolsettings, "use_etch_quick")
2367 col.prop(toolsettings, "use_etch_overdraw")
2369 col.prop(toolsettings, "etch_convert_mode")
2371 if toolsettings.etch_convert_mode == 'LENGTH':
2372 col.prop(toolsettings, "etch_length_limit")
2373 elif toolsettings.etch_convert_mode == 'ADAPTIVE':
2374 col.prop(toolsettings, "etch_adaptive_limit")
2375 elif toolsettings.etch_convert_mode == 'FIXED':
2376 col.prop(toolsettings, "etch_subdivision_number")
2377 elif toolsettings.etch_convert_mode == 'RETARGET':
2378 col.prop(toolsettings, "etch_template")
2379 col.prop(toolsettings, "etch_roll_mode")
2380 col.prop(toolsettings, "use_etch_autoname")
2381 col.prop(toolsettings, "etch_number")
2382 col.prop(toolsettings, "etch_side")
2384 col.operator("sketch.convert", text="Convert")
2387 class VIEW3D_PT_context_properties(bpy.types.Panel):
2388 bl_space_type = 'VIEW_3D'
2389 bl_region_type = 'UI'
2390 bl_label = "Properties"
2391 bl_options = {'DEFAULT_CLOSED'}
2393 def _active_context_member(context):
2394 obj = context.object
2398 return "active_pose_bone"
2399 elif mode == 'EDIT' and obj.type == 'ARMATURE':
2400 return "active_bone"
2407 def poll(cls, context):
2408 member = cls._active_context_member(context)
2410 context_member = getattr(context, member)
2411 return context_member and context_member.keys()
2415 def draw(self, context):
2417 member = VIEW3D_PT_context_properties._active_context_member(context)
2420 # Draw with no edit button
2421 rna_prop_ui.draw(self.layout, context, member, object, False)
2425 bpy.utils.register_module(__name__)
2429 bpy.utils.unregister_module(__name__)
2431 if __name__ == "__main__":
2434 if __name__ == "__main__": # only for live edit.
2435 bpy.utils.register_module(__name__)