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:
Diffstat (limited to 'source/blender/blenkernel/intern/constraint.c')
-rw-r--r--source/blender/blenkernel/intern/constraint.c65
1 files changed, 22 insertions, 43 deletions
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index dfbcc51a93c..88e73a00ba7 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -121,7 +121,6 @@ bConstraintOb *constraints_make_evalob (Scene *scene, Object *ob, void *subdata,
if (ob) {
cob->ob = ob;
cob->type = datatype;
- cob->rotOrder = EULER_ORDER_DEFAULT; // TODO: when objects have rotation order too, use that
Mat4CpyMat4(cob->matrix, ob->obmat);
}
else
@@ -138,15 +137,6 @@ bConstraintOb *constraints_make_evalob (Scene *scene, Object *ob, void *subdata,
cob->pchan = (bPoseChannel *)subdata;
cob->type = datatype;
- if (cob->pchan->rotmode > 0) {
- /* should be some type of Euler order */
- cob->rotOrder= cob->pchan->rotmode;
- }
- else {
- /* Quats, so eulers should just use default order */
- cob->rotOrder= EULER_ORDER_DEFAULT;
- }
-
/* matrix in world-space */
Mat4MulMat4(cob->matrix, cob->pchan->pose_mat, ob->obmat);
}
@@ -674,7 +664,6 @@ static void default_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstrain
* (Hopefully all compilers will be happy with the lines with just a space on them. Those are
* really just to help this code easier to read)
*/
-// TODO: cope with getting rotation order...
#define SINGLETARGET_GET_TARS(con, datatar, datasubtarget, ct, list) \
{ \
ct= MEM_callocN(sizeof(bConstraintTarget), "tempConstraintTarget"); \
@@ -698,7 +687,6 @@ static void default_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstrain
* (Hopefully all compilers will be happy with the lines with just a space on them. Those are
* really just to help this code easier to read)
*/
-// TODO: cope with getting rotation order...
#define SINGLETARGETNS_GET_TARS(con, datatar, ct, list) \
{ \
ct= MEM_callocN(sizeof(bConstraintTarget), "tempConstraintTarget"); \
@@ -807,11 +795,11 @@ static void childof_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *ta
/* extract components of both matrices */
VECCOPY(loc, ct->matrix[3]);
- Mat4ToEulO(ct->matrix, eul, ct->rotOrder);
+ Mat4ToEul(ct->matrix, eul);
Mat4ToSize(ct->matrix, size);
VECCOPY(loco, invmat[3]);
- Mat4ToEulO(invmat, eulo, cob->rotOrder);
+ Mat4ToEul(invmat, eulo);
Mat4ToSize(invmat, sizo);
/* disable channels not enabled */
@@ -826,8 +814,8 @@ static void childof_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *ta
if (!(data->flag & CHILDOF_SIZEZ)) size[2]= sizo[2]= 1.0f;
/* make new target mat and offset mat */
- LocEulOSizeToMat4(ct->matrix, loc, eul, size, ct->rotOrder);
- LocEulOSizeToMat4(invmat, loco, eulo, sizo, cob->rotOrder);
+ LocEulSizeToMat4(ct->matrix, loc, eul, size);
+ LocEulSizeToMat4(invmat, loco, eulo, sizo);
/* multiply target (parent matrix) by offset (parent inverse) to get
* the effect of the parent that will be exherted on the owner
@@ -1178,26 +1166,17 @@ static void followpath_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr
makeDispListCurveTypes(cob->scene, ct->tar, 0);
if (cu->path && cu->path->data) {
- if ((data->followflag & FOLLOWPATH_STATIC) == 0) {
- /* animated position along curve depending on time */
- curvetime= bsystem_time(cob->scene, ct->tar, ctime, 0.0) - data->offset;
-
- /* ctime is now a proper var setting of Curve which gets set by Animato like any other var that's animated,
- * but this will only work if it actually is animated...
- *
- * we firstly calculate the modulus of cu->ctime/cu->pathlen to clamp ctime within the 0.0 to 1.0 times pathlen
- * range, then divide this (the modulus) by pathlen to get a value between 0.0 and 1.0
- */
- curvetime= fmod(cu->ctime, cu->pathlen) / cu->pathlen;
+ curvetime= bsystem_time(cob->scene, ct->tar, (float)ctime, 0.0) - data->offset;
+
+#if 0 // XXX old animation system
+ if (calc_ipo_spec(cu->ipo, CU_SPEED, &curvetime)==0) {
+ curvetime /= cu->pathlen;
CLAMP(curvetime, 0.0, 1.0);
}
- else {
- /* fixed position along curve */
- curvetime= data->offset; // XXX might need a more sensible value
- }
+#endif // XXX old animation system
if ( where_on_path(ct->tar, curvetime, vec, dir) ) {
- if (data->followflag & FOLLOWPATH_FOLLOW) {
+ if (data->followflag) {
vectoquat(dir, (short) data->trackflag, (short) data->upflag, quat);
Normalize(dir);
@@ -1325,7 +1304,7 @@ static void rotlimit_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *t
VECCOPY(loc, cob->matrix[3]);
Mat4ToSize(cob->matrix, size);
- Mat4ToEulO(cob->matrix, eul, cob->rotOrder);
+ Mat4ToEul(cob->matrix, eul);
/* eulers: radians to degrees! */
eul[0] = (float)(eul[0] / M_PI * 180);
@@ -1360,7 +1339,7 @@ static void rotlimit_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *t
eul[1] = (float)(eul[1] / 180 * M_PI);
eul[2] = (float)(eul[2] / 180 * M_PI);
- LocEulOSizeToMat4(cob->matrix, loc, eul, size, cob->rotOrder);
+ LocEulSizeToMat4(cob->matrix, loc, eul, size);
}
static bConstraintTypeInfo CTI_ROTLIMIT = {
@@ -1567,14 +1546,14 @@ static void rotlike_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *ta
VECCOPY(loc, cob->matrix[3]);
Mat4ToSize(cob->matrix, size);
- Mat4ToEulO(ct->matrix, eul, ct->rotOrder);
- Mat4ToEulO(cob->matrix, obeul, cob->rotOrder);
+ Mat4ToEul(ct->matrix, eul);
+ Mat4ToEul(cob->matrix, obeul);
if ((data->flag & ROTLIKE_X)==0)
eul[0] = obeul[0];
else {
if (data->flag & ROTLIKE_OFFSET)
- eulerO_rot(eul, obeul[0], 'x', cob->rotOrder);
+ euler_rot(eul, obeul[0], 'x');
if (data->flag & ROTLIKE_X_INVERT)
eul[0] *= -1;
@@ -1584,7 +1563,7 @@ static void rotlike_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *ta
eul[1] = obeul[1];
else {
if (data->flag & ROTLIKE_OFFSET)
- eulerO_rot(eul, obeul[1], 'y', cob->rotOrder);
+ euler_rot(eul, obeul[1], 'y');
if (data->flag & ROTLIKE_Y_INVERT)
eul[1] *= -1;
@@ -1594,14 +1573,14 @@ static void rotlike_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *ta
eul[2] = obeul[2];
else {
if (data->flag & ROTLIKE_OFFSET)
- eulerO_rot(eul, obeul[2], 'z', cob->rotOrder);
+ euler_rot(eul, obeul[2], 'z');
if (data->flag & ROTLIKE_Z_INVERT)
eul[2] *= -1;
}
compatible_eul(eul, obeul);
- LocEulOSizeToMat4(cob->matrix, loc, eul, size, cob->rotOrder);
+ LocEulSizeToMat4(cob->matrix, loc, eul, size);
}
}
@@ -3057,7 +3036,7 @@ static void transform_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
Mat4ToSize(ct->matrix, dvec);
break;
case 1: /* rotation (convert to degrees first) */
- Mat4ToEulO(ct->matrix, dvec, cob->rotOrder);
+ Mat4ToEul(ct->matrix, dvec);
for (i=0; i<3; i++)
dvec[i] = (float)(dvec[i] / M_PI * 180);
break;
@@ -3068,7 +3047,7 @@ static void transform_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
/* extract components of owner's matrix */
VECCOPY(loc, cob->matrix[3]);
- Mat4ToEulO(cob->matrix, eul, cob->rotOrder);
+ Mat4ToEul(cob->matrix, eul);
Mat4ToSize(cob->matrix, size);
/* determine where in range current transforms lie */
@@ -3123,7 +3102,7 @@ static void transform_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
}
/* apply to matrix */
- LocEulOSizeToMat4(cob->matrix, loc, eul, size, cob->rotOrder);
+ LocEulSizeToMat4(cob->matrix, loc, eul, size);
}
}