summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Koteroff <vortex@verona.im>2017-11-24 13:44:36 +0300
committerDmitry Koteroff <vortex@verona.im>2017-11-26 23:08:16 +0300
commita4109200aae678263e9a5e6d578b38dddcd09630 (patch)
treecde39fbef2d0c571d36718dce06366c4a92829b8
parent6086252f66ac185b97b0580352383e4b068b9fe5 (diff)
Makes possible to interpret comma as decimal point in editor
-rw-r--r--editor/property_editor.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp
index bc7d8f4b14..425a2cb173 100644
--- a/editor/property_editor.cpp
+++ b/editor/property_editor.cpp
@@ -4596,21 +4596,24 @@ SectionedPropertyEditor::~SectionedPropertyEditor() {
double PropertyValueEvaluator::eval(const String &p_text) {
+ // If range value contains a comma replace it with dot (issue #6028)
+ const String &p_new_text = p_text.replace(",", ".");
+
if (!obj || !script_language)
- return _default_eval(p_text);
+ return _default_eval(p_new_text);
Ref<Script> script = Ref<Script>(script_language->create_script());
- script->set_source_code(_build_script(p_text));
+ script->set_source_code(_build_script(p_new_text));
Error err = script->reload();
if (err) {
- print_line("[PropertyValueEvaluator] Error loading script for expression: " + p_text);
- return _default_eval(p_text);
+ print_line("[PropertyValueEvaluator] Error loading script for expression: " + p_new_text);
+ return _default_eval(p_new_text);
}
Object dummy;
ScriptInstance *script_instance = script->instance_create(&dummy);
if (!script_instance)
- return _default_eval(p_text);
+ return _default_eval(p_new_text);
Variant::CallError call_err;
Variant arg = obj;
@@ -4621,7 +4624,7 @@ double PropertyValueEvaluator::eval(const String &p_text) {
}
print_line("[PropertyValueEvaluator]: Error eval! Error code: " + itos(call_err.error));
- return _default_eval(p_text);
+ return _default_eval(p_new_text);
}
void PropertyValueEvaluator::edit(Object *p_obj) {