Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2013-09-13 07:03:46 +0400
committerJoshua Leung <aligorith@gmail.com>2013-09-13 07:03:46 +0400
commitcca746c8e65503f4a98b1ccaf1110acb793b2b9b (patch)
tree3f4d8419375463951b902782d64cfc724d58ca9b /source/blender/blenkernel/intern/action.c
parent42524915b5dfee539dea4e7033fb19db883e33c0 (diff)
Moved and renamed ED_pose_channel_in_IK_chain() ->
BKE_pose_channel_in_IK_chain() This was needed for depsgraph work, and it's cleaner for RNA to have fewer dependencies on editors
Diffstat (limited to 'source/blender/blenkernel/intern/action.c')
-rw-r--r--source/blender/blenkernel/intern/action.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index bfef3542c45..644fefad3b0 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -594,11 +594,43 @@ void BKE_pose_ikparam_init(bPose *pose)
}
}
+
+/* only for real IK, not for auto-IK */
+static bool pose_channel_in_IK_chain(Object *ob, bPoseChannel *pchan, int level)
+{
+ bConstraint *con;
+ Bone *bone;
+
+ /* No need to check if constraint is active (has influence),
+ * since all constraints with CONSTRAINT_IK_AUTO are active */
+ for (con = pchan->constraints.first; con; con = con->next) {
+ if (con->type == CONSTRAINT_TYPE_KINEMATIC) {
+ bKinematicConstraint *data = con->data;
+ if ((data->rootbone == 0) || (data->rootbone > level)) {
+ if ((data->flag & CONSTRAINT_IK_AUTO) == 0)
+ return true;
+ }
+ }
+ }
+ for (bone = pchan->bone->childbase.first; bone; bone = bone->next) {
+ pchan = BKE_pose_channel_find_name(ob->pose, bone->name);
+ if (pchan && pose_channel_in_IK_chain(ob, pchan, level + 1))
+ return true;
+ }
+ return false;
+}
+
+bool BKE_pose_channel_in_IK_chain(Object *ob, bPoseChannel *pchan)
+{
+ return pose_channel_in_IK_chain(ob, pchan, 0);
+}
+
+
void BKE_pose_channels_hash_make(bPose *pose)
{
if (!pose->chanhash) {
bPoseChannel *pchan;
-
+
pose->chanhash = BLI_ghash_str_new("make_pose_chan gh");
for (pchan = pose->chanbase.first; pchan; pchan = pchan->next)
BLI_ghash_insert(pose->chanhash, pchan->name, pchan);