Fix: Prevent warnings from popping up when trying to edit driver expressions from buttons

Previously, a warning was added to provide feedback to users trying to change the values
of driven properties why their edits would not have any effect on the propeerty. However,
it turned out that instead of only showing up when the user tried to increment/decrement/slide
the property's value, it was also firing everytime they were trying to edit the expression.
That however is not what we want at all!

This fix assumes that BUTTON_STATE_TEXT_EDITING is used for expression editing, and
BUTTON_STATE_NUM_EDITING (or everything else) refers to the user trying to adjust the
value normally.
This commit is contained in:
Joshua Leung 2015-10-26 23:24:41 +13:00
parent 0a3ca175af
commit 04ff2784da
1 changed files with 8 additions and 2 deletions

View File

@ -7555,8 +7555,14 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s
else if (data->state == BUTTON_STATE_NUM_EDITING) {
ui_numedit_end(but, data);
if (but->flag & UI_BUT_DRIVEN)
WM_report(C, RPT_INFO, "Can't edit driven number value, see graph editor for the driver setup.");
if (but->flag & UI_BUT_DRIVEN) {
/* Only warn when editing stepping/dragging the value.
* No warnings should show for editing driver expressions though!
*/
if (state != BUTTON_STATE_TEXT_EDITING) {
WM_report(C, RPT_INFO, "Can't edit driven number value, see graph editor for the driver setup.");
}
}
if (ui_but_is_cursor_warp(but)) {