Merge pull request #13240 from Krakean/fix_interpretcomma_as_decimalpoint
Makes possible to interpret comma as decimal point in editor
This commit is contained in:
commit
03a2cf2f94
1 changed files with 9 additions and 6 deletions
|
@ -4621,21 +4621,24 @@ SectionedPropertyEditor::~SectionedPropertyEditor() {
|
||||||
|
|
||||||
double PropertyValueEvaluator::eval(const String &p_text) {
|
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)
|
if (!obj || !script_language)
|
||||||
return _default_eval(p_text);
|
return _default_eval(p_new_text);
|
||||||
|
|
||||||
Ref<Script> script = Ref<Script>(script_language->create_script());
|
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();
|
Error err = script->reload();
|
||||||
if (err) {
|
if (err) {
|
||||||
print_line("[PropertyValueEvaluator] Error loading script for expression: " + p_text);
|
print_line("[PropertyValueEvaluator] Error loading script for expression: " + p_new_text);
|
||||||
return _default_eval(p_text);
|
return _default_eval(p_new_text);
|
||||||
}
|
}
|
||||||
|
|
||||||
Object dummy;
|
Object dummy;
|
||||||
ScriptInstance *script_instance = script->instance_create(&dummy);
|
ScriptInstance *script_instance = script->instance_create(&dummy);
|
||||||
if (!script_instance)
|
if (!script_instance)
|
||||||
return _default_eval(p_text);
|
return _default_eval(p_new_text);
|
||||||
|
|
||||||
Variant::CallError call_err;
|
Variant::CallError call_err;
|
||||||
Variant arg = obj;
|
Variant arg = obj;
|
||||||
|
@ -4646,7 +4649,7 @@ double PropertyValueEvaluator::eval(const String &p_text) {
|
||||||
}
|
}
|
||||||
print_line("[PropertyValueEvaluator]: Error eval! Error code: " + itos(call_err.error));
|
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) {
|
void PropertyValueEvaluator::edit(Object *p_obj) {
|
||||||
|
|
Loading…
Reference in a new issue