fix T37411: Transform mouse constraint could fail in some situations.
Was caused by int rounding when an axis was < 1.0.
This commit is contained in:
parent
82238c3e36
commit
31a1bcfcd7
Notes:
blender-bot
2023-02-14 11:36:58 +01:00
Referenced by issue #37411, Z axis could not be selected
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue