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 rna_prop_ui import PropertyPanel
23 class ArmatureButtonsPanel():
24 bl_space_type = 'PROPERTIES'
25 bl_region_type = 'WINDOW'
29 def poll(cls, context):
30 return context.armature
33 class DATA_PT_context_arm(ArmatureButtonsPanel, bpy.types.Panel):
35 bl_options = {'HIDE_HEADER'}
37 def draw(self, context):
41 arm = context.armature
42 space = context.space_data
45 layout.template_ID(ob, "data")
47 layout.template_ID(space, "pin_id")
50 class DATA_PT_skeleton(ArmatureButtonsPanel, bpy.types.Panel):
53 def draw(self, context):
56 arm = context.armature
58 layout.prop(arm, "pose_position", expand=True)
61 col.label(text="Layers:")
62 col.prop(arm, "layers", text="")
63 col.label(text="Protected Layers:")
64 col.prop(arm, "layers_protected", text="")
66 layout.label(text="Deform:")
67 flow = layout.column_flow()
68 flow.prop(arm, "use_deform_vertex_groups", text="Vertex Groups")
69 flow.prop(arm, "use_deform_envelopes", text="Envelopes")
70 flow.prop(arm, "use_deform_preserve_volume", text="Quaternion")
73 class DATA_PT_display(ArmatureButtonsPanel, bpy.types.Panel):
76 def draw(self, context):
80 arm = context.armature
82 layout.prop(arm, "draw_type", expand=True)
84 split = layout.split()
87 col.prop(arm, "show_names", text="Names")
88 col.prop(arm, "show_axes", text="Axes")
89 col.prop(arm, "show_bone_custom_shapes", text="Shapes")
92 col.prop(arm, "show_group_colors", text="Colors")
94 col.prop(ob, "show_x_ray", text="X-Ray")
95 col.prop(arm, "use_deform_delay", text="Delay Refresh")
98 class DATA_PT_bone_groups(ArmatureButtonsPanel, bpy.types.Panel):
99 bl_label = "Bone Groups"
102 def poll(cls, context):
103 return (context.object and context.object.type == 'ARMATURE' and context.object.pose)
105 def draw(self, context):
112 row.template_list(pose, "bone_groups", pose.bone_groups, "active_index", rows=2)
114 col = row.column(align=True)
115 col.active = (ob.proxy is None)
116 col.operator("pose.group_add", icon='ZOOMIN', text="")
117 col.operator("pose.group_remove", icon='ZOOMOUT', text="")
119 group = pose.bone_groups.active
121 col = layout.column()
122 col.active = (ob.proxy is None)
123 col.prop(group, "name")
125 split = layout.split()
126 split.active = (ob.proxy is None)
129 col.prop(group, "color_set")
132 sub = col.row(align=True)
133 sub.prop(group.colors, "normal", text="")
134 sub.prop(group.colors, "select", text="")
135 sub.prop(group.colors, "active", text="")
138 row.active = (ob.proxy is None)
140 sub = row.row(align=True)
141 sub.operator("pose.group_assign", text="Assign")
142 sub.operator("pose.group_unassign", text="Remove") # row.operator("pose.bone_group_remove_from", text="Remove")
144 sub = row.row(align=True)
145 sub.operator("pose.group_select", text="Select")
146 sub.operator("pose.group_deselect", text="Deselect")
149 class DATA_PT_pose_library(ArmatureButtonsPanel, bpy.types.Panel):
150 bl_label = "Pose Library"
151 bl_options = {'DEFAULT_CLOSED'}
154 def poll(cls, context):
155 return (context.object and context.object.type == 'ARMATURE' and context.object.pose)
157 def draw(self, context):
161 poselib = ob.pose_library
163 layout.template_ID(ob, "pose_library", new="poselib.new", unlink="poselib.unlink")
167 row.template_list(poselib, "pose_markers", poselib.pose_markers, "active_index", rows=5)
169 col = row.column(align=True)
170 col.active = (poselib.library is None)
172 # invoke should still be used for 'add', as it is needed to allow
173 # add/replace options to be used properly
174 col.operator("poselib.pose_add", icon='ZOOMIN', text="")
176 col.operator_context = 'EXEC_DEFAULT' # exec not invoke, so that menu doesn't need showing
178 pose_marker_active = poselib.pose_markers.active
180 if pose_marker_active is not None:
181 col.operator("poselib.pose_remove", icon='ZOOMOUT', text="").pose = pose_marker_active.name
182 col.operator("poselib.apply_pose", icon='ZOOM_SELECTED', text="").pose_index = poselib.pose_markers.active_index
184 layout.operator("poselib.action_sanitise")
187 # TODO: this panel will soon be depreceated too
188 class DATA_PT_ghost(ArmatureButtonsPanel, bpy.types.Panel):
191 def draw(self, context):
194 arm = context.armature
196 layout.prop(arm, "ghost_type", expand=True)
198 split = layout.split()
200 col = split.column(align=True)
202 if arm.ghost_type == 'RANGE':
203 col.prop(arm, "ghost_frame_start", text="Start")
204 col.prop(arm, "ghost_frame_end", text="End")
205 col.prop(arm, "ghost_size", text="Step")
206 elif arm.ghost_type == 'CURRENT_FRAME':
207 col.prop(arm, "ghost_step", text="Range")
208 col.prop(arm, "ghost_size", text="Step")
211 col.label(text="Display:")
212 col.prop(arm, "show_only_ghost_selected", text="Selected Only")
215 class DATA_PT_iksolver_itasc(ArmatureButtonsPanel, bpy.types.Panel):
216 bl_label = "iTaSC parameters"
217 bl_options = {'DEFAULT_CLOSED'}
220 def poll(cls, context):
222 return (ob and ob.pose)
224 def draw(self, context):
228 itasc = ob.pose.ik_param
230 layout.prop(ob.pose, "ik_solver")
233 layout.prop(itasc, "mode", expand=True)
234 simulation = (itasc.mode == 'SIMULATION')
236 layout.label(text="Reiteration:")
237 layout.prop(itasc, "reiteration_method", expand=True)
240 row.active = not simulation or itasc.reiteration_method != 'NEVER'
241 row.prop(itasc, "precision")
242 row.prop(itasc, "iterations")
245 layout.prop(itasc, "use_auto_step")
247 if itasc.use_auto_step:
248 row.prop(itasc, "step_min", text="Min")
249 row.prop(itasc, "step_max", text="Max")
251 row.prop(itasc, "step_count")
253 layout.prop(itasc, "solver")
255 layout.prop(itasc, "feedback")
256 layout.prop(itasc, "velocity_max")
257 if itasc.solver == 'DLS':
259 row.prop(itasc, "damping_max", text="Damp", slider=True)
260 row.prop(itasc, "damping_epsilon", text="Eps", slider=True)
262 from bl_ui.properties_animviz import (
263 MotionPathButtonsPanel,
264 OnionSkinButtonsPanel,
267 class DATA_PT_motion_paths(MotionPathButtonsPanel, bpy.types.Panel):
268 #bl_label = "Bones Motion Paths"
272 def poll(cls, context):
273 # XXX: include posemode check?
274 return (context.object) and (context.armature)
276 def draw(self, context):
281 self.draw_settings(context, ob.pose.animation_visualisation, bones=True)
285 split = layout.split()
286 split.operator("pose.paths_calculate", text="Calculate Paths")
287 split.operator("pose.paths_clear", text="Clear Paths")
290 class DATA_PT_onion_skinning(OnionSkinButtonsPanel): # , bpy.types.Panel): # inherit from panel when ready
291 #bl_label = "Bones Onion Skinning"
295 def poll(cls, context):
296 # XXX: include posemode check?
297 return (context.object) and (context.armature)
299 def draw(self, context):
304 self.draw_settings(context, ob.pose.animation_visualisation, bones=True)
307 class DATA_PT_custom_props_arm(ArmatureButtonsPanel, PropertyPanel, bpy.types.Panel):
308 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
309 _context_path = "object.data"
310 _property_type = bpy.types.Armature