Fix for clamping large UV coords in UV-panel
Would clamp value ranges in UI when outside hard coded range.
This commit is contained in:
parent
60f7f93c16
commit
c44f489d24
|
@ -141,11 +141,25 @@ static void uvedit_vertex_buttons(const bContext *C, uiBlock *block)
|
|||
em = BKE_editmesh_from_object(obedit);
|
||||
|
||||
if (uvedit_center(scene, em, ima, center)) {
|
||||
float range_xy[2][2] = {
|
||||
{-10.0f, 10.0f},
|
||||
{-10.0f, 10.0f},
|
||||
};
|
||||
|
||||
copy_v2_v2(uvedit_old_center, center);
|
||||
|
||||
/* expand UI range by center */
|
||||
CLAMP_MAX(range_xy[0][0], uvedit_old_center[0]);
|
||||
CLAMP_MIN(range_xy[0][1], uvedit_old_center[0]);
|
||||
CLAMP_MAX(range_xy[1][0], uvedit_old_center[1]);
|
||||
CLAMP_MIN(range_xy[1][1], uvedit_old_center[1]);
|
||||
|
||||
if (!(sima->flag & SI_COORDFLOATS)) {
|
||||
uvedit_old_center[0] *= imx;
|
||||
uvedit_old_center[1] *= imy;
|
||||
|
||||
mul_v2_fl(range_xy[0], imx);
|
||||
mul_v2_fl(range_xy[1], imy);
|
||||
}
|
||||
|
||||
if (sima->flag & SI_COORDFLOATS) {
|
||||
|
@ -159,9 +173,9 @@ static void uvedit_vertex_buttons(const bContext *C, uiBlock *block)
|
|||
|
||||
UI_block_align_begin(block);
|
||||
uiDefButF(block, UI_BTYPE_NUM, B_UVEDIT_VERTEX, IFACE_("X:"), 0, 0, width, UI_UNIT_Y, &uvedit_old_center[0],
|
||||
-10 * imx, 10.0 * imx, step, digits, "");
|
||||
UNPACK2(range_xy[0]), step, digits, "");
|
||||
uiDefButF(block, UI_BTYPE_NUM, B_UVEDIT_VERTEX, IFACE_("Y:"), width, 0, width, UI_UNIT_Y, &uvedit_old_center[1],
|
||||
-10 * imy, 10.0 * imy, step, digits, "");
|
||||
UNPACK2(range_xy[1]), step, digits, "");
|
||||
UI_block_align_end(block);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue