From 3800e7d2ba154f1355c62e86d9fe2addc53c37e5 Mon Sep 17 00:00:00 2001
From: Hugo Locurcio <hugo.locurcio@hugo.pro>
Date: Sun, 27 Sep 2020 22:29:40 +0200
Subject: [PATCH] Allow using a comma as decimal separator in EditorSpinSlider

This closes https://github.com/godotengine/godot-proposals/issues/1576.
---
 editor/editor_spin_slider.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/editor/editor_spin_slider.cpp b/editor/editor_spin_slider.cpp
index d76a3d2da7d..ac61a75a6c2 100644
--- a/editor/editor_spin_slider.cpp
+++ b/editor/editor_spin_slider.cpp
@@ -356,7 +356,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);