diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/interface/interface_anim.c | 8 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 2 |
2 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c index 991cd54fecf..5da294302e9 100644 --- a/source/blender/editors/interface/interface_anim.c +++ b/source/blender/editors/interface/interface_anim.c @@ -99,6 +99,10 @@ void ui_but_anim_flag(uiBut *but, float cfra) } } +/** + * \a str can be NULL to only perform check if \a but has an expression at all. + * \return if button has an expression. + */ bool ui_but_anim_expression_get(uiBut *but, char *str, size_t maxlen) { FCurve *fcu; @@ -111,7 +115,9 @@ bool ui_but_anim_expression_get(uiBut *but, char *str, size_t maxlen) driver = fcu->driver; if (driver && driver->type == DRIVER_TYPE_PYTHON) { - BLI_strncpy(str, driver->expression, maxlen); + if (str) { + BLI_strncpy(str, driver->expression, maxlen); + } return true; } } diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index f3eeadb6604..fc511d61e2b 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -3067,7 +3067,7 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data) data->str = ui_but_string_get_dynamic(but, &data->maxlen); } - if (ui_but_is_float(but) && !ui_but_is_unit(but)) { + if (ui_but_is_float(but) && !ui_but_is_unit(but) && !ui_but_anim_expression_get(but, NULL, 0)) { BLI_str_rstrip_float_zero(data->str, '\0'); } |