diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-01-11 06:22:37 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-01-11 06:22:37 +0300 |
commit | 1b9c56c4235c9cc23d985c9e1443babc431737a2 (patch) | |
tree | 777b35a3e96d6f8db5db979abc95901ae7789ed6 /source/blender/editors/interface | |
parent | 22577d98c9eec04b77f3501f21b2dca37846a962 (diff) |
bugfix [#25577] Ctrl-Z after adding Color Ramp key resets ramp.
buttons would not add an undo event if the button had no tooltip/draw-string.
add a fallback string 'Unknown Action' so undo's are predictable.
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 0f1e44aff1d..f719d41e7b6 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -326,18 +326,22 @@ static void ui_apply_autokey_undo(bContext *C, uiBut *but) { Scene *scene= CTX_data_scene(C); uiAfterFunc *after; - const char *str= NULL; if(but->flag & UI_BUT_UNDO) { + const char *str= NULL; + /* define which string to use for undo */ if ELEM(but->type, LINK, INLINK) str= "Add button link"; else if ELEM(but->type, MENU, ICONTEXTROW) str= but->drawstr; else if(but->drawstr[0]) str= but->drawstr; else str= but->tip; - } - /* delayed, after all other funcs run, popups are closed, etc */ - if(str) { + /* fallback, else we dont get an undo! */ + if(str == NULL || str[0] == '\0') { + str= "Unknown Action"; + } + + /* delayed, after all other funcs run, popups are closed, etc */ after= MEM_callocN(sizeof(uiAfterFunc), "uiAfterFunc"); BLI_strncpy(after->undostr, str, sizeof(after->undostr)); BLI_addtail(&UIAfterFuncs, after); |