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-06-09 16:30:13 +0400
committerJoshua Leung <aligorith@gmail.com>2013-06-09 16:30:13 +0400
commitf3a4eab75134ef92d58edd02553fe6e9f74c8fde (patch)
treed6608328cd84177636979eecf76c81880e26a5eb
parent79ef7169e9b9fc94088759cb254ba24b6dab096a (diff)
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.
-rw-r--r--source/blender/blenkernel/intern/constraint.c7
-rw-r--r--source/blender/editors/transform/transform_conversions.c7
2 files changed, 8 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index 4f0606ddb40..0cd13d528d5 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -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 */
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index b93f03bea0b..f0abd0743ac 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -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 */