summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2017-08-16 16:32:29 +0200
committerGitHub <noreply@github.com>2017-08-16 16:32:29 +0200
commit6abb7bd13b6224fd6dae2a78444a2c1afa553125 (patch)
treea4cb4b87f45ff7670f1882d06be9f3a5b92926b8
parent603b262d9bfe757e4a009a80f1c80230d35512ba (diff)
parentae2d4490472a129b2f7d73efac0b4dbf257a8018 (diff)
Merge pull request #10366 from RandomShaper/revive-prop-eval
Revive inspector property evaluation
-rw-r--r--editor/property_editor.cpp5
-rw-r--r--modules/gdscript/gd_script.cpp2
2 files changed, 3 insertions, 4 deletions
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp
index 0176f606d6..e791fa48c8 100644
--- a/editor/property_editor.cpp
+++ b/editor/property_editor.cpp
@@ -4774,12 +4774,11 @@ double PropertyValueEvaluator::eval(const String &p_text) {
return _default_eval(p_text);
}
- ScriptInstance *script_instance = script->instance_create(this);
+ ScriptInstance *script_instance = script->instance_create(obj);
if (!script_instance)
return _default_eval(p_text);
Variant::CallError call_err;
- script_instance->call("set_this", obj);
double result = script_instance->call("e", NULL, 0, call_err);
if (call_err.error == Variant::CallError::CALL_OK) {
return result;
@@ -4796,7 +4795,7 @@ void PropertyValueEvaluator::edit(Object *p_obj) {
}
String PropertyValueEvaluator::_build_script(const String &p_text) {
- String script_text = "tool\nvar this\nfunc set_this(p_this):\n\tthis=p_this\nfunc e():\n\treturn ";
+ String script_text = "tool\nextends Object\nfunc e():\n\treturn ";
script_text += p_text.strip_edges();
script_text += "\n";
return script_text;
diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp
index 9d304c6d34..2d06c0f5d2 100644
--- a/modules/gdscript/gd_script.cpp
+++ b/modules/gdscript/gd_script.cpp
@@ -615,7 +615,7 @@ Error GDScript::reload(bool p_keep_state) {
if (basedir != "")
basedir = basedir.get_base_dir();
- if (basedir.find("res://") == -1 && basedir.find("user://") == -1) {
+ if (basedir != "" && basedir.find("res://") == -1 && basedir.find("user://") == -1) {
//loading a template, don't parse
return OK;
}