jpbouza Feature Request: Transformation Constraint now allows applies rotation
offsets too (like for location)
This is useful in some cases when Copy Rotation constraints would otherwise be
used for this purpose but cannot be used for various reasons. Basically, this
works in practically the same way that the Copy Rotation offsets work, including
the same weirdness that you'll get when trying to manually rotate these in the
3D viewport using "global" space manipulations ("local/normal" spaces though
still seem to work really nicely).
WARNING: this may potentially break old files with transform constraint setups
involving rotation outputs. Please check whether this causes any problems on old
files, and report back if there are any issues.
This commit is contained in:
@@ -3259,15 +3259,16 @@ static void transform_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
|
||||
case 1: /* rotation */
|
||||
for (i = 0; i < 3; i++) {
|
||||
float tmin, tmax;
|
||||
float val;
|
||||
|
||||
tmin = data->to_min[i];
|
||||
tmax = data->to_max[i];
|
||||
|
||||
/* all values here should be in degrees */
|
||||
eul[i] = tmin + (sval[(int)data->map[i]] * (tmax - tmin));
|
||||
val = tmin + (sval[(int)data->map[i]] * (tmax - tmin));
|
||||
|
||||
/* now convert final value back to radians */
|
||||
eul[i] = DEG2RADF(eul[i]);
|
||||
/* now convert final value back to radians, and add to original rotation (so that it can still be rotated) */
|
||||
eul[i] += DEG2RADF(val);
|
||||
}
|
||||
break;
|
||||
default: /* location */
|
||||
|
||||
@@ -4563,16 +4563,17 @@ static bool constraints_list_needinv(TransInfo *t, ListBase *list)
|
||||
if ((con->flag & CONSTRAINT_DISABLE) == 0 && (con->enforce != 0.0f)) {
|
||||
/* (affirmative) returns for specific constraints here... */
|
||||
/* constraints that require this regardless */
|
||||
if (ELEM5(con->type,
|
||||
if (ELEM6(con->type,
|
||||
CONSTRAINT_TYPE_CHILDOF,
|
||||
CONSTRAINT_TYPE_FOLLOWPATH,
|
||||
CONSTRAINT_TYPE_CLAMPTO,
|
||||
CONSTRAINT_TYPE_OBJECTSOLVER,
|
||||
CONSTRAINT_TYPE_FOLLOWTRACK))
|
||||
CONSTRAINT_TYPE_FOLLOWTRACK,
|
||||
CONSTRAINT_TYPE_TRANSFORM))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* constraints that require this only under special conditions */
|
||||
if (con->type == CONSTRAINT_TYPE_ROTLIKE) {
|
||||
/* CopyRot constraint only does this when rotating, and offset is on */
|
||||
|
||||
Reference in New Issue
Block a user