[Bf-blender-cvs] [ec76f38b090] master: Discard non-free axis scaling in Maintain Volume to improve 2.79 compat.

Alexander Gavrilov noreply at git.blender.org
Thu Mar 1 18:49:12 CET 2018


Commit: ec76f38b0902e9effcee0cd96efd07fe6d1d1f4c
Author: Alexander Gavrilov
Date:   Thu Mar 1 20:45:18 2018 +0300
Branches: master
https://developer.blender.org/rBec76f38b0902e9effcee0cd96efd07fe6d1d1f4c

Discard non-free axis scaling in Maintain Volume to improve 2.79 compat.

It seems the reason the old version of the constraint overcompensates
as reported in T48079 is to allow the constraint to work with uniform
scaling on all axes. However the way it did that actually _requires_
uniform scaling for the constraint to work correctly, and breaks if
only the free scaling axis is used to avoid redundant channels.

This version attempts to allow both by discarding scaling in the non-
free directions instead of applying the correction on top of it.

===================================================================

M	source/blender/blenkernel/intern/constraint.c

===================================================================

diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index c77cac7bcbd..5d8053e0036 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -1938,16 +1938,16 @@ static void samevolume_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *
 	/* apply scaling factor to the channels not being kept */
 	switch (data->flag) {
 		case SAMEVOL_X:
-			mul_v3_fl(cob->matrix[1], fac);
-			mul_v3_fl(cob->matrix[2], fac);
+			mul_v3_fl(cob->matrix[1], fac / obsize[1]);
+			mul_v3_fl(cob->matrix[2], fac / obsize[2]);
 			break;
 		case SAMEVOL_Y:
-			mul_v3_fl(cob->matrix[0], fac);
-			mul_v3_fl(cob->matrix[2], fac);
+			mul_v3_fl(cob->matrix[0], fac / obsize[0]);
+			mul_v3_fl(cob->matrix[2], fac / obsize[2]);
 			break;
 		case SAMEVOL_Z:
-			mul_v3_fl(cob->matrix[0], fac);
-			mul_v3_fl(cob->matrix[1], fac);
+			mul_v3_fl(cob->matrix[0], fac / obsize[0]);
+			mul_v3_fl(cob->matrix[1], fac / obsize[1]);
 			break;
 	}
 }



More information about the Bf-blender-cvs mailing list