Fix: Prevent warnings from popping up when trying to edit driver expressions from...
authorJoshua Leung <aligorith@gmail.com>
Mon, 26 Oct 2015 10:24:41 +0000 (23:24 +1300)
committerJoshua Leung <aligorith@gmail.com>
Mon, 26 Oct 2015 10:24:41 +0000 (23:24 +1300)
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.

source/blender/editors/interface/interface_handlers.c

index 010bb8b37f11f5959abf02e8cf46bb17c442f8e2..52666e84cce203d94361728a4fdd03f427eb5a75 100644 (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)) {