summaryrefslogtreecommitdiff
path: root/editor/property_editor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/property_editor.cpp')
-rw-r--r--editor/property_editor.cpp57
1 files changed, 0 insertions, 57 deletions
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp
index 508db2e03f..c611327a31 100644
--- a/editor/property_editor.cpp
+++ b/editor/property_editor.cpp
@@ -1991,60 +1991,3 @@ CustomPropertyEditor::CustomPropertyEditor() {
create_dialog = NULL;
property_select = NULL;
}
-
-/////////////////////////////
-
-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_new_text);
-
- Ref<Script> script = Ref<Script>(script_language->create_script());
- script->set_source_code(_build_script(p_new_text));
- Error err = script->reload();
- if (err) {
- ERR_PRINTS("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_new_text);
-
- Variant::CallError call_err;
- Variant arg = obj;
- const Variant *args[] = { &arg };
- double result = script_instance->call("eval", args, 1, call_err);
- if (call_err.error == Variant::CallError::CALL_OK) {
- return result;
- }
- ERR_PRINTS("PropertyValueEvaluator: Eval failed, error code: " + itos(call_err.error));
-
- return _default_eval(p_new_text);
-}
-
-void PropertyValueEvaluator::edit(Object *p_obj) {
- obj = p_obj;
-}
-
-String PropertyValueEvaluator::_build_script(const String &p_text) {
- String script_text = "tool\nextends Object\nfunc eval(s):\n\tself = s\n\treturn " + p_text.strip_edges() + "\n";
- return script_text;
-}
-
-PropertyValueEvaluator::PropertyValueEvaluator() {
- script_language = NULL;
-
- for (int i = 0; i < ScriptServer::get_language_count(); i++) {
- if (ScriptServer::get_language(i)->get_name() == "GDScript") {
- script_language = ScriptServer::get_language(i);
- }
- }
-}
-
-PropertyValueEvaluator::~PropertyValueEvaluator() {
-}