From 31a1bcfcd7041c3d346ce8b4eb16786c353153c1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 21 Nov 2013 02:15:38 +1100 Subject: fix T37411: Transform mouse constraint could fail in some situations. Was caused by int rounding when an axis was < 1.0. --- source/blender/editors/transform/transform_constraints.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index 8df289ff917..4ba87eb8c39 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -930,9 +930,9 @@ static void setNearestAxis2d(TransInfo *t) static void setNearestAxis3d(TransInfo *t) { float zfac; - float mvec[3], axis[3], proj[3]; + float mvec[3], proj[3]; float len[3]; - int i, icoord[2]; + int i; /* calculate mouse movement */ mvec[0] = (float)(t->mval[0] - t->con.imval[0]); @@ -950,15 +950,16 @@ static void setNearestAxis3d(TransInfo *t) zfac = len_v3(t->persinv[0]) * 2.0f / t->ar->winx * zfac * 30.0f; for (i = 0; i < 3; i++) { + float axis[3], axis_2d[2]; + copy_v3_v3(axis, t->con.mtx[i]); mul_v3_fl(axis, zfac); /* now we can project to get window coordinate */ add_v3_v3(axis, t->con.center); - projectIntView(t, axis, icoord); + projectFloatView(t, axis, axis_2d); - axis[0] = (float)(icoord[0] - t->center2d[0]); - axis[1] = (float)(icoord[1] - t->center2d[1]); + sub_v2_v2v2(axis, axis_2d, t->center2d); axis[2] = 0.0f; if (normalize_v3(axis) != 0.0f) { -- cgit v1.2.3