summaryrefslogtreecommitdiffstats
path: root/editor/gui/editor_spin_slider.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/gui/editor_spin_slider.cpp')
-rw-r--r--editor/gui/editor_spin_slider.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/editor/gui/editor_spin_slider.cpp b/editor/gui/editor_spin_slider.cpp
index a1b0ecad6b..750837cce9 100644
--- a/editor/gui/editor_spin_slider.cpp
+++ b/editor/gui/editor_spin_slider.cpp
@@ -525,17 +525,24 @@ String EditorSpinSlider::get_suffix() const {
}
void EditorSpinSlider::_evaluate_input_text() {
- // Replace comma with dot to support it as decimal separator (GH-6028).
- // This prevents using functions like `pow()`, but using functions
- // in EditorSpinSlider is a barely known (and barely used) feature.
- // Instead, we'd rather support German/French keyboard layouts out of the box.
- const String text = TS->parse_number(value_input->get_text().replace(",", "."));
-
Ref<Expression> expr;
expr.instantiate();
+
+ // Convert commas ',' to dots '.' for French/German etc. keyboard layouts.
+ String text = value_input->get_text().replace(",", ".");
+ text = text.replace(";", ",");
+ text = TS->parse_number(text);
+
Error err = expr->parse(text);
if (err != OK) {
- return;
+ // If the expression failed try without converting commas to dots - they might have been for parameter separation.
+ text = value_input->get_text();
+ text = TS->parse_number(text);
+
+ err = expr->parse(text);
+ if (err != OK) {
+ return;
+ }
}
Variant v = expr->execute(Array(), nullptr, false, true);