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:
authorBastien Montagne <montagne29@wanadoo.fr>2017-08-10 16:46:40 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2017-08-10 16:46:40 +0300
commit1126b83c9ba93b2ff4ea2a8b630e96e28cd506f6 (patch)
tree8b223e068083882a4db2dfe46b34cf57b06ba73a /source/blender/editors/interface/interface.c
parent7db3994c4be0337d7be36536cb1f34cf96b3305b (diff)
parent496b510438b2f994cafcec6e36fe300be9fe015f (diff)
Merge branch 'id_copy_refactor' into id_override_static
Diffstat (limited to 'source/blender/editors/interface/interface.c')
-rw-r--r--source/blender/editors/interface/interface.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index dd7b22cc816..d0d1940469a 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -684,7 +684,7 @@ static bool ui_but_update_from_old_block(const bContext *C, uiBlock *block, uiBu
if (oldbut->active) {
/* flags from the buttons we want to refresh, may want to add more here... */
- const int flag_copy = UI_BUT_REDALERT;
+ const int flag_copy = UI_BUT_REDALERT | UI_HAS_ICON;
found_active = true;
@@ -1165,6 +1165,8 @@ static void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block)
uiBut *but;
char buf[128];
+ BLI_assert(block->flag & UI_BLOCK_LOOP);
+
/* only do it before bounding */
if (block->rect.xmin != block->rect.xmax)
return;
@@ -1179,6 +1181,9 @@ static void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block)
}
else {
for (but = block->buttons.first; but; but = but->next) {
+ if (but->dt != UI_EMBOSS_PULLDOWN) {
+ continue;
+ }
if (ui_but_event_operator_string(C, but, buf, sizeof(buf))) {
ui_but_add_shortcut(but, buf, false);
@@ -2236,20 +2241,26 @@ void ui_but_string_get_ex(uiBut *but, char *str, const size_t maxlen, const int
ui_get_but_string_unit(but, str, maxlen, value, false, float_precision);
}
else {
- const int prec = (float_precision == -1) ? ui_but_calc_float_precision(but, value) : float_precision;
+ int prec = (float_precision == -1) ? ui_but_calc_float_precision(but, value) : float_precision;
if (use_exp_float) {
- const int l10 = (int)log10(fabs(value));
- if (l10 < -6 || l10 > 12) {
+ const int int_digits_num = integer_digits_f(value);
+ if (int_digits_num < -6 || int_digits_num > 12) {
BLI_snprintf(str, maxlen, "%.*g", prec, value);
if (r_use_exp_float) {
*r_use_exp_float = true;
}
}
else {
- BLI_snprintf(str, maxlen, "%.*f", prec - l10 + (int)(l10 < 0), value);
+ prec -= int_digits_num;
+ CLAMP(prec, 0, UI_PRECISION_FLOAT_MAX);
+ BLI_snprintf(str, maxlen, "%.*f", prec, value);
}
}
else {
+#if 0 /* TODO, but will likely break some stuff, so better after 2.79 release. */
+ prec -= int_digits_num;
+ CLAMP(prec, 0, UI_PRECISION_FLOAT_MAX);
+#endif
BLI_snprintf(str, maxlen, "%.*f", prec, value);
}
}