Fix/workaround T47685: Drag keymap slider fails

This is a special case where the UI update function re-creases the keymap we're currently editing.
Making it so dragging values fails.
This commit is contained in:
Campbell Barton 2016-03-09 17:33:38 +11:00 committed by Sergey Sharybin
parent 3d1f050608
commit e511c7a34e
3 changed files with 7 additions and 1 deletions

View File

@ -181,6 +181,7 @@ enum {
UI_BUT_TIP_FORCE = (1 << 28), /* force show tooltips when holding option/alt if U's USER_TOOLTIPS is off */
UI_BUT_TEXTEDIT_UPDATE = (1 << 29), /* when widget is in textedit mode, update value on each char stroke */
UI_BUT_SEARCH_UNLINK = (1 << 30), /* show unlink for search button */
UI_BUT_UPDATE_DELAY = (1 << 31), /* don't run updates while dragging (needed in rare cases). */
};
#define UI_PANEL_WIDTH 340

View File

@ -7769,7 +7769,9 @@ static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonA
/* XXX curve is temp */
}
else {
data->interactive = true;
if ((but->flag & UI_BUT_UPDATE_DELAY) == 0) {
data->interactive = true;
}
}
data->state = BUTTON_STATE_INIT;

View File

@ -3662,6 +3662,9 @@ void uiTemplateKeymapItemProperties(uiLayout *layout, PointerRNA *ptr)
/* operator buttons may store props for use (file selector, [#36492]) */
if (but->rnaprop) {
UI_but_func_set(but, keymap_item_modified, ptr->data, NULL);
/* Otherwise the keymap will be re-generated which we're trying to edit, see: T47685 */
UI_but_flag_enable(but, UI_BUT_UPDATE_DELAY);
}
}
}