diff options
author | Joshua Leung <aligorith@gmail.com> | 2007-07-28 13:00:15 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2007-07-28 13:00:15 +0400 |
commit | f8544eefad2017b107c145e729c5947b47588ad2 (patch) | |
tree | 0c83aaa1473dbafd9f80007f191e3d9cc9134918 /source/blender/blenkernel | |
parent | 34e4388a5cd3782b40f723df2e3603a104be7cbc (diff) |
A few little code cleanups for constraints code. I've just removed some lines that weren't needed.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/constraint.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 95359a22711..ca82006acf8 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -803,10 +803,11 @@ bConstraintOb *constraints_make_evalob (Object *ob, void *subdata, short datatyp cob->ob = ob; cob->type = datatype; Mat4CpyMat4(cob->matrix, ob->obmat); - Mat4CpyMat4(cob->startmat, ob->obmat); } - else + else Mat4One(cob->matrix); + + Mat4CpyMat4(cob->startmat, cob->matrix); } break; case TARGET_BONE: @@ -819,16 +820,17 @@ bConstraintOb *constraints_make_evalob (Object *ob, void *subdata, short datatyp /* matrix in world-space */ Mat4MulMat4(cob->matrix, cob->pchan->pose_mat, ob->obmat); - Mat4CpyMat4(cob->startmat, cob->matrix); } else Mat4One(cob->matrix); - Mat4CpyMat4(cob->startmat, cob->matrix); + + Mat4CpyMat4(cob->startmat, cob->matrix); } break; default: // other types not yet handled Mat4One(cob->matrix); + Mat4One(cob->startmat); break; } @@ -892,9 +894,8 @@ void do_constraint_channels (ListBase *conbase, ListBase *chanbase, float ctime) switch (icu->adrcode) { case CO_ENFORCE: { - con->enforce = icu->curval; - if (con->enforce<0.0f) con->enforce= 0.0f; - else if (con->enforce>1.0f) con->enforce= 1.0f; + /* Influence is clamped to 0.0f -> 1.0f range */ + con->enforce = CLAMPIS(icu->curval, 0.0f, 1.0f); } break; } @@ -932,6 +933,7 @@ static void constraint_mat_convertspace (Object *ob, bPoseChannel *pchan, float Mat4CpyMat4(tempmat, mat); Mat4MulMat4(mat, tempmat, imat); } + /* pose to local */ if (to == CONSTRAINT_SPACE_LOCAL) { /* call self with slightly different values */ @@ -974,7 +976,7 @@ static void constraint_mat_convertspace (Object *ob, bPoseChannel *pchan, float offs_bone[3][0]= offs_bone[3][1]= offs_bone[3][2]= 0.0f; Mat4MulVecfl(pchan->parent->pose_mat, tmat[3]); - Mat4MulMat4(diff_mat, offs_bone, tmat); + Mat4MulMat4(diff_mat, tmat, offs_bone); Mat4Invert(imat, diff_mat); } else { @@ -1029,9 +1031,7 @@ static void constraint_mat_convertspace (Object *ob, bPoseChannel *pchan, float offs_bone[3][0]= offs_bone[3][1]= offs_bone[3][2]= 0.0f; Mat4MulVecfl(pchan->parent->pose_mat, tmat[3]); - Mat4MulMat4(diff_mat, offs_bone, tmat); - - Mat4MulMat4(diff_mat, pchan->parent->pose_mat, offs_bone); + Mat4MulMat4(diff_mat, tmat, offs_bone); Mat4CpyMat4(tempmat, mat); Mat4MulMat4(mat, tempmat, diff_mat); } |