[Bf-blender-cvs] [57b11d8b4e3] blender-v2.79a-release: Fix T53311: transform edge/normal orientation

Campbell Barton noreply at git.blender.org
Fri Jan 12 05:48:34 CET 2018


Commit: 57b11d8b4e3e760b08bef330b6c36a5164052623
Author: Campbell Barton
Date:   Thu Jan 11 19:09:45 2018 +1100
Branches: blender-v2.79a-release
https://developer.blender.org/rB57b11d8b4e3e760b08bef330b6c36a5164052623

Fix T53311: transform edge/normal orientation

When the edge is aligned with it's own normals,
transform orientation wasn't aligned with the edge.

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

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 54959304d72..f3078eb7824 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -743,10 +743,19 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3
 							SWAP(BMVert *, v_pair[0], v_pair[1]);
 						}
 
-						add_v3_v3v3(normal, v_pair[0]->no, v_pair[1]->no);
-						sub_v3_v3v3(plane, v_pair[0]->co, v_pair[1]->co);
-						/* flip the plane normal so we point outwards */
-						negate_v3(plane);
+						add_v3_v3v3(normal, v_pair[1]->no, v_pair[0]->no);
+						sub_v3_v3v3(plane, v_pair[1]->co, v_pair[0]->co);
+
+						if (normalize_v3(plane) != 0.0f) {
+							/* For edges it'd important the resulting matrix can rotate around the edge,
+							 * project onto the plane so we can use a fallback value. */
+							project_plane_normalized_v3_v3v3(normal, normal, plane);
+							if (UNLIKELY(normalize_v3(normal) == 0.0f)) {
+								/* in the case the normal and plane are aligned,
+								 * use a fallback normal which is orthogonal to the plane. */
+								ortho_v3_v3(normal, plane);
+							}
+						}
 					}
 
 					result = ORIENTATION_EDGE;



More information about the Bf-blender-cvs mailing list