Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/transform')
-rw-r--r--source/blender/editors/transform/transform.c22
-rw-r--r--source/blender/editors/transform/transform_constraints.c2
-rw-r--r--source/blender/editors/transform/transform_conversions.c2
3 files changed, 18 insertions, 8 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 1c50e833c6d..e69f0695697 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -3209,11 +3209,21 @@ static void headerResize(TransInfo *t, float vec[3], char *str)
(void)spos;
}
-#define SIGN(a) (a<-FLT_EPSILON ? 1 : a>FLT_EPSILON ? 2 : 3)
-#define VECSIGNFLIP(a, b) ((SIGN(a[0]) & SIGN(b[0])) == 0 || (SIGN(a[1]) & SIGN(b[1])) == 0 || (SIGN(a[2]) & SIGN(b[2])) == 0)
+/* FLT_EPSILON is too small [#29633], 0.0000001f starts to flip */
+#define TX_FLIP_EPS 0.00001f
+BLI_INLINE int tx_sign(const float a)
+{
+ return (a < -TX_FLIP_EPS ? 1 : a > TX_FLIP_EPS ? 2 : 3);
+}
+BLI_INLINE int tx_vec_sign_flip(const float a[3], const float b[3])
+{
+ return ((tx_sign(a[0]) & tx_sign(b[0])) == 0 ||
+ (tx_sign(a[1]) & tx_sign(b[1])) == 0 ||
+ (tx_sign(a[2]) & tx_sign(b[2])) == 0);
+}
/* smat is reference matrix, only scaled */
-static void TransMat3ToSize(float mat[][3], float smat[][3], float *size)
+static void TransMat3ToSize(float mat[][3], float smat[][3], float size[3])
{
float vec[3];
@@ -3225,9 +3235,9 @@ static void TransMat3ToSize(float mat[][3], float smat[][3], float *size)
size[2] = normalize_v3(vec);
/* first tried with dotproduct... but the sign flip is crucial */
- if (VECSIGNFLIP(mat[0], smat[0]) ) size[0] = -size[0];
- if (VECSIGNFLIP(mat[1], smat[1]) ) size[1] = -size[1];
- if (VECSIGNFLIP(mat[2], smat[2]) ) size[2] = -size[2];
+ if (tx_vec_sign_flip(mat[0], smat[0]) ) size[0] = -size[0];
+ if (tx_vec_sign_flip(mat[1], smat[1]) ) size[1] = -size[1];
+ if (tx_vec_sign_flip(mat[2], smat[2]) ) size[2] = -size[2];
}
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c
index 8e8b909270b..58d8a06415a 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -151,8 +151,8 @@ static void postConstraintChecks(TransInfo *t, float vec[3], float pvec[3])
if (hasNumInput(&t->num)) {
applyNumInput(&t->num, vec);
- removeAspectRatio(t, vec);
constraintNumInput(t, vec);
+ removeAspectRatio(t, vec);
}
/* autovalues is operator param, use that directly but not if snapping is forced */
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 9bbd3f59cbf..5b79b69f7ec 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -2486,7 +2486,7 @@ int clipUVTransform(TransInfo *t, float *vec, int resize)
max[0] = aspx; max[1] = aspy;
for (a = 0, td = t->data; a < t->total; a++, td++) {
- DO_MINMAX2(td->loc, min, max);
+ minmax_v2v2_v2(min, max, td->loc);
}
if (resize) {