diff options
-rw-r--r-- | source/blender/editors/transform/transform.h | 2 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_orientations.c | 12 |
2 files changed, 8 insertions, 6 deletions
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index dfcd3e4cfd6..20512a18ae3 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -875,6 +875,8 @@ bool applyTransformOrientation(const struct TransformOrientation *ts, float r_ma #define ORIENTATION_VERT 2 #define ORIENTATION_EDGE 3 #define ORIENTATION_FACE 4 +#define ORIENTATION_USE_PLANE(ty) \ + ELEM(ty, ORIENTATION_NORMAL, ORIENTATION_EDGE, ORIENTATION_FACE) int getTransformOrientation_ex(const struct bContext *C, float normal[3], float plane[3], const short around); int getTransformOrientation(const struct bContext *C, float normal[3], float plane[3]); diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 93d4b1d5409..2dcd11d89ff 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -793,12 +793,7 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3 } } - if (is_zero_v3(plane)) { - result = ORIENTATION_VERT; - } - else { - result = ORIENTATION_EDGE; - } + result = ORIENTATION_EDGE; } else if (em->bm->totvertsel > 3) { BMIter iter; @@ -1101,6 +1096,11 @@ void ED_getTransformOrientationMatrix(const bContext *C, float orientation_mat[3 type = getTransformOrientation_ex(C, normal, plane, around); + /* Fallback, when the plane can't be calculated. */ + if (ORIENTATION_USE_PLANE(type) && is_zero_v3(plane)) { + type = ORIENTATION_VERT; + } + switch (type) { case ORIENTATION_NORMAL: if (createSpaceNormalTangent(orientation_mat, normal, plane) == 0) { |