=== Constraints ===
Patch by Juho Vepsäläinen (bebraw) [ #5850 ] Inverted axis' buttons to Copy Rotation and Copy Location constraints This patch adds the options to invert the value being copied from each axis of the Copy Rot/Copy Loc constraints. This commit also includes some slight code sanitization and tool tips cleanup (for the two track constraints, the tool tips were really unuseful).
This commit is contained in:
@@ -1620,6 +1620,12 @@ static void do_local_constraint(bPoseChannel *pchan, bConstraint *con)
|
||||
pchan->loc[1]= FloatLerpf(pchant->loc[1], pchan->loc[1], fac);
|
||||
if (data->flag & LOCLIKE_Z)
|
||||
pchan->loc[2]= FloatLerpf(pchant->loc[2], pchan->loc[2], fac);
|
||||
if (data->flag & LOCLIKE_X_INVERT)
|
||||
pchan->loc[0]= FloatLerpf(pchant->loc[0], pchan->loc[0], -fac);
|
||||
if (data->flag & LOCLIKE_Y_INVERT)
|
||||
pchan->loc[1]= FloatLerpf(pchant->loc[1], pchan->loc[1], -fac);
|
||||
if (data->flag & LOCLIKE_Z_INVERT)
|
||||
pchan->loc[2]= FloatLerpf(pchant->loc[2], pchan->loc[2], -fac);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1639,6 +1645,9 @@ static void do_local_constraint(bPoseChannel *pchan, bConstraint *con)
|
||||
if(data->flag & ROTLIKE_X) euln[0]= FloatLerpf(eult[0], eul[0], fac);
|
||||
if(data->flag & ROTLIKE_Y) euln[1]= FloatLerpf(eult[1], eul[1], fac);
|
||||
if(data->flag & ROTLIKE_Z) euln[2]= FloatLerpf(eult[2], eul[2], fac);
|
||||
if(data->flag & ROTLIKE_X_INVERT) euln[0]= FloatLerpf(eult[0], eul[0], -fac);
|
||||
if(data->flag & ROTLIKE_Y_INVERT) euln[1]= FloatLerpf(eult[1], eul[1], -fac);
|
||||
if(data->flag & ROTLIKE_Z_INVERT) euln[2]= FloatLerpf(eult[2], eul[2], -fac);
|
||||
compatible_eul(eul, euln);
|
||||
EulToQuat(euln, pchan->quat);
|
||||
}
|
||||
|
||||
@@ -1241,7 +1241,6 @@ short get_constraint_target_matrix (bConstraint *con, short ownertype, void* own
|
||||
return valid;
|
||||
}
|
||||
|
||||
|
||||
/* only called during solve_constraints */
|
||||
/* bone constraints create a fake object to work on, then ob is a workob */
|
||||
/* if ownerdata is set, it's the posechannel */
|
||||
@@ -1277,12 +1276,21 @@ void evaluate_constraint (bConstraint *constraint, Object *ob, short ownertype,
|
||||
|
||||
data = constraint->data;
|
||||
|
||||
if (data->flag & LOCLIKE_X)
|
||||
if (data->flag & LOCLIKE_X) {
|
||||
ob->obmat[3][0] = targetmat[3][0];
|
||||
if (data->flag & LOCLIKE_Y)
|
||||
|
||||
if(data->flag & LOCLIKE_X_INVERT) ob->obmat[3][0] *= -1;
|
||||
}
|
||||
if (data->flag & LOCLIKE_Y) {
|
||||
ob->obmat[3][1] = targetmat[3][1];
|
||||
if (data->flag & LOCLIKE_Z)
|
||||
|
||||
if(data->flag & LOCLIKE_Y_INVERT) ob->obmat[3][1] *= -1;
|
||||
}
|
||||
if (data->flag & LOCLIKE_Z) {
|
||||
ob->obmat[3][2] = targetmat[3][2];
|
||||
|
||||
if(data->flag & LOCLIKE_Z_INVERT) ob->obmat[3][2] *= -1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CONSTRAINT_TYPE_ROTLIKE:
|
||||
@@ -1301,12 +1309,25 @@ void evaluate_constraint (bConstraint *constraint, Object *ob, short ownertype,
|
||||
Mat4ToEul(ob->obmat, obeul);
|
||||
|
||||
if(data->flag != (ROTLIKE_X|ROTLIKE_Y|ROTLIKE_Z)) {
|
||||
if(!(data->flag & ROTLIKE_X)) eul[0]= obeul[0];
|
||||
if(!(data->flag & ROTLIKE_Y)) eul[1]= obeul[1];
|
||||
if(!(data->flag & ROTLIKE_Z)) eul[2]= obeul[2];
|
||||
if(!(data->flag & ROTLIKE_X)) {
|
||||
eul[0]= obeul[0];
|
||||
}
|
||||
if(!(data->flag & ROTLIKE_Y)) {
|
||||
eul[1]= obeul[1];
|
||||
}
|
||||
if(!(data->flag & ROTLIKE_Z)) {
|
||||
eul[2]= obeul[2];
|
||||
}
|
||||
compatible_eul(eul, obeul);
|
||||
}
|
||||
|
||||
|
||||
if((data->flag & ROTLIKE_X) && (data->flag & ROTLIKE_X_INVERT))
|
||||
eul[0]*=-1;
|
||||
if((data->flag & ROTLIKE_Y) && (data->flag & ROTLIKE_Y_INVERT))
|
||||
eul[1]*=-1;
|
||||
if((data->flag & ROTLIKE_Z) && (data->flag & ROTLIKE_Z_INVERT))
|
||||
eul[2]*=-1;
|
||||
|
||||
LocEulSizeToMat4(ob->obmat, loc, eul, size);
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user