[Bf-blender-cvs] [c62eb91] master: Fix T45775: Bad 'Normal' transform space for edge of non-uniformed scaled object.

Bastien Montagne noreply at git.blender.org
Thu Aug 13 12:47:05 CEST 2015


Commit: c62eb919ec11617387f7842ef190e9be6359fec2
Author: Bastien Montagne
Date:   Thu Aug 13 12:45:13 2015 +0200
Branches: master
https://developer.blender.org/rBc62eb919ec11617387f7842ef190e9be6359fec2

Fix T45775: Bad 'Normal' transform space for edge of non-uniformed scaled object.

Non-uniform scaled obmat will lead to transformation not preserving angles, so
we must ensure our normal is orthogonal to the edge **after** applying obmat.

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

M	source/blender/editors/transform/transform_orientations.c

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

diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c
index 7fea8e1..c49e867 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -718,7 +718,6 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
 					/* should never fail */
 					if (LIKELY(v_pair[0] && v_pair[1])) {
 						bool v_pair_swap = false;
-						float tvec[3];
 						/**
 						 * Logic explained:
 						 *
@@ -749,11 +748,6 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
 						sub_v3_v3v3(plane, v_pair[0]->co, v_pair[1]->co);
 						/* flip the plane normal so we point outwards */
 						negate_v3(plane);
-
-						/* align normal to edge direction (so normal is perpendicular to the plane).
-						 * 'ORIENTATION_EDGE' will do the other way around */
-						project_v3_v3v3(tvec, normal, plane);
-						sub_v3_v3(normal, tvec);
 					}
 
 					result = ORIENTATION_EDGE;
@@ -962,8 +956,16 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
 
 		/* Vectors from edges don't need the special transpose inverse multiplication */
 		if (result == ORIENTATION_EDGE) {
+			float tvec[3];
+
 			mul_mat3_m4_v3(ob->obmat, normal);
 			mul_mat3_m4_v3(ob->obmat, plane);
+
+			/* align normal to edge direction (so normal is perpendicular to the plane).
+			 * 'ORIENTATION_EDGE' will do the other way around.
+			 * This has to be done **after** applying obmat, see T45775! */
+			project_v3_v3v3(tvec, normal, plane);
+			sub_v3_v3(normal, tvec);
 		}
 		else {
 			mul_m3_v3(mat, normal);




More information about the Bf-blender-cvs mailing list