summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorDualMatrix <piet.goris@gmail.com>2018-09-22 22:31:56 +0200
committerDualMatrix <piet.goris@gmail.com>2018-09-23 14:58:15 +0200
commitf483460e389727cd29fdd53e212037934a0bd767 (patch)
treed440b55b7ecf6fa3a58ac41f7fa005a4a6994263 /editor
parent2613e59f59a67d78214e58cdb8856f50bfc08b19 (diff)
Removed obsoleted core/helper/value_evaluator.h and moved math_fieldwise to core/math/
Removed obsoleted core/helper/value_evaluator.h and moved math_fieldwise to core/math/
Diffstat (limited to 'editor')
-rw-r--r--editor/multi_node_edit.cpp2
-rw-r--r--editor/property_editor.cpp57
-rw-r--r--editor/property_editor.h21
3 files changed, 1 insertions, 79 deletions
diff --git a/editor/multi_node_edit.cpp b/editor/multi_node_edit.cpp
index 173be01586..be4e752d55 100644
--- a/editor/multi_node_edit.cpp
+++ b/editor/multi_node_edit.cpp
@@ -30,7 +30,7 @@
#include "multi_node_edit.h"
-#include "core/helper/math_fieldwise.h"
+#include "core/math/math_fieldwise.h"
#include "editor_node.h"
bool MultiNodeEdit::_set(const StringName &p_name, const Variant &p_value) {
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() {
-}
diff --git a/editor/property_editor.h b/editor/property_editor.h
index ee3a56d857..c74103df3d 100644
--- a/editor/property_editor.h
+++ b/editor/property_editor.h
@@ -171,30 +171,9 @@ public:
void set_read_only(bool p_read_only) { read_only = p_read_only; }
- void set_value_evaluator(PropertyValueEvaluator *p_evaluator) { evaluator = p_evaluator; }
-
bool edit(Object *p_owner, const String &p_name, Variant::Type p_type, const Variant &p_variant, int p_hint, String p_hint_text);
CustomPropertyEditor();
};
-class PropertyValueEvaluator : public ValueEvaluator {
- GDCLASS(PropertyValueEvaluator, ValueEvaluator);
-
- Object *obj;
- ScriptLanguage *script_language;
- String _build_script(const String &p_text);
-
- _FORCE_INLINE_ double _default_eval(const String &p_text) {
- return p_text.to_double();
- }
-
-public:
- void edit(Object *p_obj);
- double eval(const String &p_text);
-
- PropertyValueEvaluator();
- ~PropertyValueEvaluator();
-};
-
#endif