[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32105] trunk/blender/source/blender/ blenkernel/intern/constraint.c: Fix for [#23549] Copy rotation don' t work if influence is another than 0 or 1

Janne Karhu jhkarh at gmail.com
Fri Sep 24 19:47:29 CEST 2010


Revision: 32105
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32105
Author:   jhk
Date:     2010-09-24 19:47:28 +0200 (Fri, 24 Sep 2010)

Log Message:
-----------
Fix for [#23549] Copy rotation don't work if influence is another than 0 or 1
* Replaced constraint result interpolation with much simpler logic, hopefully this doesn't create any unseen complications :)

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

Modified: trunk/blender/source/blender/blenkernel/intern/constraint.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/constraint.c	2010-09-24 11:28:56 UTC (rev 32104)
+++ trunk/blender/source/blender/blenkernel/intern/constraint.c	2010-09-24 17:47:28 UTC (rev 32105)
@@ -4409,7 +4409,7 @@
 			}
 		}
 		
-		/* Solve the constraint */
+		/* Solve the constraint and put result in cob->matrix */
 		cti->evaluate_constraint(con, cob, &targets);
 		
 		/* clear targets after use 
@@ -4421,23 +4421,13 @@
 		}
 		
 		/* Interpolate the enforcement, to blend result of constraint into final owner transform */
-		/* 1. Remove effects of original matrix from constraint solution ==> delta */
-		invert_m4_m4(imat, oldmat);
-		copy_m4_m4(solution, cob->matrix);
-		mul_m4_m4m4(delta, solution, imat);
-		
-		/* 2. If constraint influence is not full strength, then interpolate
-		 * 	identity_matrix --> delta_matrix to get the effect the constraint actually exerts
-		 */
+		/* Note: all kind of stuff here before (caused trouble), much easier to just interpolate, or did I miss something? -jahka */
 		if (enf < 1.0) {
-			float identity[4][4];
-			unit_m4(identity);
-			blend_m4_m4m4(delta, identity, delta, enf);
+			float solution[4][4];
+			copy_m4_m4(solution, cob->matrix);
+			blend_m4_m4m4(cob->matrix, oldmat, solution, enf);
 		}
 		
-		/* 3. Now multiply the delta by the matrix in use before the evaluation */
-		mul_m4_m4m4(cob->matrix, delta, oldmat);
-		
 		/* move owner back into worldspace for next constraint/other business */
 		if ((con->flag & CONSTRAINT_SPACEONCE) == 0) 
 			constraint_mat_convertspace(cob->ob, cob->pchan, cob->matrix, con->ownspace, CONSTRAINT_SPACE_WORLD);





More information about the Bf-blender-cvs mailing list