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>2015-03-09 07:45:21 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-03-09 07:49:45 +0300
commitc44f489d24a3075e978a0b4b499371fcb3803670 (patch)
tree5fa62ca79ae09f31d4cecd00a98fe9932e63cdad /source/blender/editors/uvedit
parent60f7f93c16878db0a1abbe1f610d08ce6d518775 (diff)
Fix for clamping large UV coords in UV-panel
Would clamp value ranges in UI when outside hard coded range.
Diffstat (limited to 'source/blender/editors/uvedit')
-rw-r--r--source/blender/editors/uvedit/uvedit_buttons.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/source/blender/editors/uvedit/uvedit_buttons.c b/source/blender/editors/uvedit/uvedit_buttons.c
index a15259e7d2d..0d8dd2369d8 100644
--- a/source/blender/editors/uvedit/uvedit_buttons.c
+++ b/source/blender/editors/uvedit/uvedit_buttons.c
@@ -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);
}
}