Fix T50063: Editing driver's expression eliminates "Zero" number
Disables trimming of trailing zeros in case button contains an expression.
This commit is contained in:
parent
fffb1a4cfb
commit
3fb11061ba
Notes:
blender-bot
2023-10-12 12:49:04 +02:00
Referenced by issue #50063, Editing driver's expression eliminates "Zero" number
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue