Allow using a comma as decimal separator in EditorSpinSlider

This closes https://github.com/godotengine/godot-proposals/issues/1576.

(cherry picked from commit 3800e7d2ba)
This commit is contained in:
Hugo Locurcio 2020-09-27 22:29:40 +02:00 committed by Rémi Verschelde
parent f8cc7893d0
commit ebff4c3e83
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -376,7 +376,12 @@ String EditorSpinSlider::get_label() const {
}
void EditorSpinSlider::_evaluate_input_text() {
String text = value_input->get_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 = value_input->get_text().replace(",", ".");
Ref<Expression> expr;
expr.instance();
Error err = expr->parse(text);