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:
authorCampbell Barton <ideasman42@gmail.com>2013-11-20 19:15:38 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-11-20 19:21:34 +0400
commit31a1bcfcd7041c3d346ce8b4eb16786c353153c1 (patch)
tree1e125813d8c19d27f151196b5584fb1e01f5838e
parent82238c3e3679d11e38f0e127698afc9dee8521b4 (diff)
fix T37411: Transform mouse constraint could fail in some situations.
Was caused by int rounding when an axis was < 1.0.
-rw-r--r--source/blender/editors/transform/transform_constraints.c11
1 files 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) {