Fix T42892: UV pixel snap with negative values

This commit is contained in:
Campbell Barton 2014-12-14 12:31:19 +01:00
parent 9c81833430
commit 17253bec06
Notes: blender-bot 2023-02-14 09:43:41 +01:00
Referenced by issue #42892, UV Editor, snap to pixel rounds wrong for negative coordinates.
2 changed files with 4 additions and 4 deletions

View File

@ -2817,8 +2817,8 @@ void flushTransUVs(TransInfo *t)
td->loc2d[1] = td->loc[1] * invy;
if ((sima->flag & SI_PIXELSNAP) && (t->state != TRANS_CANCEL)) {
td->loc2d[0] = floorf(width * td->loc2d[0] + 0.5f) / width;
td->loc2d[1] = floorf(height * td->loc2d[1] + 0.5f) / height;
td->loc2d[0] = roundf(width * td->loc2d[0]) / width;
td->loc2d[1] = roundf(height * td->loc2d[1]) / height;
}
}
}

View File

@ -3189,8 +3189,8 @@ static void UV_OT_select_lasso(wmOperatorType *ot)
static void uv_snap_to_pixel(float uvco[2], float w, float h)
{
uvco[0] = ((float)((int)((uvco[0] * w) + 0.5f))) / w;
uvco[1] = ((float)((int)((uvco[1] * h) + 0.5f))) / h;
uvco[0] = roundf(uvco[0] * w) / w;
uvco[1] = roundf(uvco[1] * h) / h;
}
static void uv_snap_cursor_to_pixels(SpaceImage *sima)