[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [57309] trunk/blender/source/blender: jpbouza Feature Request: Transformation Constraint now allows applies rotation

Joshua Leung aligorith at gmail.com
Sun Jun 9 14:30:13 CEST 2013


Revision: 57309
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=57309
Author:   aligorith
Date:     2013-06-09 12:30:13 +0000 (Sun, 09 Jun 2013)
Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/constraint.c
    trunk/blender/source/blender/editors/transform/transform_conversions.c

Modified: trunk/blender/source/blender/blenkernel/intern/constraint.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/constraint.c	2013-06-09 12:05:29 UTC (rev 57308)
+++ trunk/blender/source/blender/blenkernel/intern/constraint.c	2013-06-09 12:30:13 UTC (rev 57309)
@@ -3259,15 +3259,16 @@
 			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 */

Modified: trunk/blender/source/blender/editors/transform/transform_conversions.c
===================================================================
--- trunk/blender/source/blender/editors/transform/transform_conversions.c	2013-06-09 12:05:29 UTC (rev 57308)
+++ trunk/blender/source/blender/editors/transform/transform_conversions.c	2013-06-09 12:30:13 UTC (rev 57309)
@@ -4563,16 +4563,17 @@
 			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 */




More information about the Bf-blender-cvs mailing list