Merge branch 'blender-v2.92-release'
[blender-addons.git] / space_view3d_spacebar_menu / armature_menus.py
blob2196efa87232b996db678fb4ee9d2c18ae62ad7c
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 #####
18 # Contributed to by: meta-androcto, JayDez, sim88, sam, lijenstina, mkb, wisaac, CoDEmanX #
21 import bpy
22 from bpy.types import (
23 Operator,
24 Menu,
26 from bpy.props import (
27 BoolProperty,
28 StringProperty,
30 from .object_menus import *
32 # ********** Object Armature Interactive Mode **********
33 class VIEW3D_MT_InteractiveModeArmature(Menu):
34 bl_idname = "VIEW3D_MT_Object_Interactive_Armature"
35 bl_label = "Interactive Mode"
36 bl_description = "Menu of objects interactive mode"
38 def draw(self, context):
39 layout = self.layout
41 layout.operator(VIEW3D_OT_SetObjectMode.bl_idname, text="Object", icon="OBJECT_DATAMODE").mode = "OBJECT"
42 layout.operator(VIEW3D_OT_SetObjectMode.bl_idname, text="Edit", icon="EDITMODE_HLT").mode = "EDIT"
43 layout.operator(VIEW3D_OT_SetObjectMode.bl_idname, text="Pose", icon="POSE_HLT").mode = "POSE"
46 # Armature Menu's #
48 class VIEW3D_MT_Edit_Armature(Menu):
49 bl_label = "Armature"
51 def draw(self, context):
52 layout = self.layout
53 toolsettings = context.tool_settings
55 # layout.prop_menu_enum(toolsettings, "proportional_edit", icon="PROP_CON")
56 layout.prop_menu_enum(toolsettings, "proportional_edit_falloff", icon="SMOOTHCURVE")
57 layout.separator()
59 layout.menu("VIEW3D_MT_bone_options_toggle", text="Bone Settings")
60 layout.operator("armature.merge")
61 layout.operator("armature.fill")
62 layout.operator("armature.split")
63 layout.operator("armature.separate")
64 layout.operator("armature.switch_direction", text="Switch Direction")
66 layout.operator_context = 'EXEC_AREA'
67 layout.operator("armature.symmetrize")
68 layout.separator()
70 layout.operator("armature.delete")
71 layout.separator()
73 layout.operator_context = 'INVOKE_DEFAULT'
74 layout.operator("armature.armature_layers")
75 layout.operator("armature.bone_layers")
78 class VIEW3D_MT_EditArmatureTK(Menu):
79 bl_label = "Armature Tools"
81 def draw(self, context):
82 layout = self.layout
83 layout.operator("armature.subdivide", text="Subdivide")
84 layout.operator("armature.extrude_move")
85 layout.operator("armature.extrude_forked")
86 layout.operator("armature.duplicate_move")
87 layout.separator()
88 layout.menu("VIEW3D_MT_edit_armature_delete")
89 layout.separator()
90 layout.operator("transform.transform",
91 text="Scale Envelope Distance").mode = 'BONE_SIZE'
92 layout.operator("transform.transform",
93 text="Scale B-Bone Width").mode = 'BONE_SIZE'
96 # Armature Pose Menu's #
98 class VIEW3D_MT_Pose(Menu):
99 bl_label = "Pose"
101 def draw(self, context):
102 layout = self.layout
104 layout.menu("VIEW3D_MT_object_animation")
105 layout.menu("VIEW3D_MT_pose_slide")
106 layout.menu("VIEW3D_MT_pose_propagate")
107 layout.menu("VIEW3D_MT_pose_library")
108 layout.menu("VIEW3D_MT_pose_motion")
109 layout.separator()
110 layout.menu("VIEW3D_MT_pose_group")
111 layout.menu("VIEW3D_MT_object_parent")
112 layout.separator()
113 layout.menu("VIEW3D_MT_pose_ik")
114 layout.menu("VIEW3D_MT_pose_constraints")
115 layout.menu("VIEW3D_MT_PoseNames")
116 layout.operator("pose.quaternions_flip")
117 layout.operator_context = 'INVOKE_AREA'
118 layout.separator()
119 layout.operator("armature.armature_layers", text="Change Armature Layers...")
120 layout.operator("pose.bone_layers", text="Change Bone Layers...")
121 layout.separator()
122 layout.menu("VIEW3D_MT_pose_showhide")
123 layout.menu("VIEW3D_MT_bone_options_toggle", text="Bone Settings")
126 class VIEW3D_MT_PoseCopy(Menu):
127 bl_label = "Pose Copy"
129 def draw(self, context):
130 layout = self.layout
131 layout.operator("pose.copy")
132 layout.operator("pose.paste")
133 layout.operator("pose.paste",
134 text="Paste X-Flipped Pose").flipped = True
137 class VIEW3D_MT_PoseNames(Menu):
138 bl_label = "Pose Names"
140 def draw(self, context):
141 layout = self.layout
142 layout.operator_context = 'EXEC_AREA'
143 layout.operator("pose.autoside_names",
144 text="AutoName Left/Right").axis = 'XAXIS'
145 layout.operator("pose.autoside_names",
146 text="AutoName Front/Back").axis = 'YAXIS'
147 layout.operator("pose.autoside_names",
148 text="AutoName Top/Bottom").axis = 'ZAXIS'
149 layout.operator("pose.flip_names")
152 # List The Classes #
154 classes = (
155 VIEW3D_MT_Pose,
156 VIEW3D_MT_PoseCopy,
157 VIEW3D_MT_PoseNames,
158 VIEW3D_MT_Edit_Armature,
159 VIEW3D_MT_EditArmatureTK,
160 VIEW3D_MT_InteractiveModeArmature,
164 # Register Classes & Hotkeys #
165 def register():
166 for cls in classes:
167 bpy.utils.register_class(cls)
170 # Unregister Classes & Hotkeys #
171 def unregister():
173 for cls in reversed(classes):
174 bpy.utils.unregister_class(cls)
177 if __name__ == "__main__":
178 register()