diff options
Diffstat (limited to 'release/scripts/ui/buttons_data_bone.py')
-rw-r--r-- | release/scripts/ui/buttons_data_bone.py | 210 |
1 files changed, 163 insertions, 47 deletions
diff --git a/release/scripts/ui/buttons_data_bone.py b/release/scripts/ui/buttons_data_bone.py index e8041cc7393..5971e4492ce 100644 --- a/release/scripts/ui/buttons_data_bone.py +++ b/release/scripts/ui/buttons_data_bone.py @@ -48,7 +48,7 @@ class BONE_PT_transform(BoneButtonsPanel): else: pchan = ob.pose.pose_channels[context.bone.name] - + layout.itemR(pchan, "rotation_mode") row = layout.row() col = row.column() @@ -67,8 +67,6 @@ class BONE_PT_transform(BoneButtonsPanel): col.itemR(pchan, "rotation_euler", text="Rotation") row.column().itemR(pchan, "scale") - - layout.itemR(pchan, "rotation_mode") class BONE_PT_transform_locks(BoneButtonsPanel): __label__ = "Transform Locks" @@ -100,8 +98,8 @@ class BONE_PT_transform_locks(BoneButtonsPanel): row.column().itemR(pchan, "lock_scale") -class BONE_PT_relations(BoneButtonsPanel): - __label__ = "Relations" +class BONE_PT_bone(BoneButtonsPanel): + __label__ = "Bone" def draw(self, context): layout = self.layout @@ -117,17 +115,7 @@ class BONE_PT_relations(BoneButtonsPanel): pchan = ob.pose.pose_channels[context.bone.name] split = layout.split() - - col = split.column() - col.itemL(text="Layers:") - col.itemR(bone, "layer", text="") - - col.itemS() - - if ob and pchan: - col.itemL(text="Bone Group:") - col.item_pointerR(pchan, "bone_group", ob.pose, "bone_groups", text="") - + col = split.column() col.itemL(text="Parent:") if context.bone: @@ -135,46 +123,119 @@ class BONE_PT_relations(BoneButtonsPanel): else: col.item_pointerR(bone, "parent", arm, "edit_bones", text="") - sub = col.column() - sub.active = bone.parent != None - sub.itemR(bone, "connected") - sub.itemR(bone, "hinge", text="Inherit Rotation") - sub.itemR(bone, "inherit_scale", text="Inherit Scale") - - -class BONE_PT_display(BoneButtonsPanel): - __label__ = "Display" - - def poll(self, context): - return context.bone - - def draw(self, context): - layout = self.layout + row = col.row() + row.active = bone.parent != None + row.itemR(bone, "connected") - ob = context.object - bone = context.bone - arm = context.armature + col.itemL(text="Layers:") + col.itemR(bone, "layer", text="") - if not bone: - bone = context.edit_bone - pchan = None - else: - pchan = ob.pose.pose_channels[context.bone.name] + col = split.column() + col.itemL(text="Inherit:") + col.itemR(bone, "hinge", text="Rotation") + col.itemR(bone, "inherit_scale", text="Scale") + col.itemL(text="Display:") + col.itemR(bone, "draw_wire", text="Wireframe") + col.itemR(bone, "hidden", text="Hide") if ob and pchan: - split = layout.split() - - col = split.column() - - col.itemR(bone, "draw_wire", text="Wireframe") - col.itemR(bone, "hidden", text="Hide") col = split.column() + col.itemL(text="Bone Group:") + col.item_pointerR(pchan, "bone_group", ob.pose, "bone_groups", text="") + col = split.column() col.itemL(text="Custom Shape:") col.itemR(pchan, "custom_shape", text="") +class BONE_PT_inverse_kinematics(BoneButtonsPanel): + __label__ = "Inverse Kinematics" + __default_closed__ = True + + def poll(self, context): + ob = context.object + bone = context.bone + + if ob and context.bone: + pchan = ob.pose.pose_channels[context.bone.name] + return pchan.has_ik + + return False + + def draw(self, context): + layout = self.layout + + ob = context.object + bone = context.bone + pchan = ob.pose.pose_channels[context.bone.name] + + row = layout.row() + row.itemR(ob.pose, "ik_solver") + + split = layout.split(percentage=0.25) + split.itemR(pchan, "ik_dof_x", text="X") + row = split.row() + row.itemR(pchan, "ik_stiffness_x", text="Stiffness", slider=True) + row.active = pchan.ik_dof_x + + split = layout.split(percentage=0.25) + row = split.row() + row.itemR(pchan, "ik_limit_x", text="Limit") + row.active = pchan.ik_dof_x + row = split.row(align=True) + row.itemR(pchan, "ik_min_x", text="") + row.itemR(pchan, "ik_max_x", text="") + row.active = pchan.ik_dof_x and pchan.ik_limit_x + + split = layout.split(percentage=0.25) + split.itemR(pchan, "ik_dof_y", text="Y") + row = split.row() + row.itemR(pchan, "ik_stiffness_y", text="Stiffness", slider=True) + row.active = pchan.ik_dof_y + + split = layout.split(percentage=0.25) + row = split.row() + row.itemR(pchan, "ik_limit_y", text="Limit") + row.active = pchan.ik_dof_y + row = split.row(align=True) + row.itemR(pchan, "ik_min_y", text="") + row.itemR(pchan, "ik_max_y", text="") + row.active = pchan.ik_dof_y and pchan.ik_limit_y + + split = layout.split(percentage=0.25) + split.itemR(pchan, "ik_dof_z", text="Z") + row = split.row() + row.itemR(pchan, "ik_stiffness_z", text="Stiffness", slider=True) + row.active = pchan.ik_dof_z + + split = layout.split(percentage=0.25) + row = split.row() + row.itemR(pchan, "ik_limit_z", text="Limit") + row.active = pchan.ik_dof_z + row = split.row(align=True) + row.itemR(pchan, "ik_min_z", text="") + row.itemR(pchan, "ik_max_z", text="") + row.active = pchan.ik_dof_z and pchan.ik_limit_z + split = layout.split() + split.itemR(pchan, "ik_stretch", text="Stretch", slider=True) + split.itemL() + + if ob.pose.ik_solver == "ITASC": + layout.itemL(text="Joint constraint:") + split = layout.split(percentage=0.3) + row = split.row() + row.itemR(pchan, "ik_rot_control", text="Rotation") + row = split.row() + row.itemR(pchan, "ik_rot_weight", text="Weight", slider=True) + row.active = pchan.ik_rot_control + # not supported yet + #split = layout.split(percentage=0.3) + #row = split.row() + #row.itemR(pchan, "ik_lin_control", text="Size") + #row = split.row() + #row.itemR(pchan, "ik_lin_weight", text="Weight", slider=True) + #row.active = pchan.ik_lin_control class BONE_PT_deform(BoneButtonsPanel): __label__ = "Deform" @@ -224,10 +285,65 @@ class BONE_PT_deform(BoneButtonsPanel): col.itemL(text="Offset:") col.itemR(bone, "cyclic_offset") +class BONE_PT_iksolver_itasc(BoneButtonsPanel): + __idname__ = "BONE_PT_iksolver_itasc" + __label__ = "iTaSC parameters" + __default_closed__ = True + + def poll(self, context): + ob = context.object + bone = context.bone + + if ob and context.bone: + pchan = ob.pose.pose_channels[context.bone.name] + return pchan.has_ik and ob.pose.ik_solver == "ITASC" and ob.pose.ik_param + + return False + + def draw(self, context): + layout = self.layout + + ob = context.object + itasc = ob.pose.ik_param + + layout.row().itemR(itasc, "simulation") + if itasc.simulation: + split = layout.split() + row = split.row() + row.itemR(itasc, "reiteration") + row = split.row() + if itasc.reiteration: + itasc.initial_reiteration = True + row.itemR(itasc, "initial_reiteration") + row.active = not itasc.reiteration + + flow = layout.column_flow() + flow.itemR(itasc, "precision") + flow.itemR(itasc, "num_iter") + flow.active = not itasc.simulation or itasc.initial_reiteration or itasc.reiteration + + if itasc.simulation: + layout.itemR(itasc, "auto_step") + row = layout.row() + if itasc.auto_step: + row.itemR(itasc, "min_step") + row.itemR(itasc, "max_step") + else: + row.itemR(itasc, "num_step") + + layout.itemR(itasc, "solver") + if itasc.simulation: + layout.itemR(itasc, "feedback") + layout.itemR(itasc, "max_velocity") + if itasc.solver == "DLS": + row = layout.row() + row.itemR(itasc, "dampmax") + row.itemR(itasc, "dampeps") bpy.types.register(BONE_PT_context_bone) bpy.types.register(BONE_PT_transform) bpy.types.register(BONE_PT_transform_locks) -bpy.types.register(BONE_PT_relations) -bpy.types.register(BONE_PT_display) +bpy.types.register(BONE_PT_bone) bpy.types.register(BONE_PT_deform) +bpy.types.register(BONE_PT_inverse_kinematics) +bpy.types.register(BONE_PT_iksolver_itasc) |