summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-10-29 12:01:40 +0100
committerGitHub <noreply@github.com>2019-10-29 12:01:40 +0100
commit18c46bb8e588bd902d3c2e6e61648819026d8b20 (patch)
tree421413770744f5d66201e6efc7b986b5216c0369
parent0641acc576c138f592771c0cd3b0e7dc8212d1ae (diff)
parent3a26a0eaa76e5da6c27187dfe42d815276c58f94 (diff)
Merge pull request #33144 from nekomatata/inspect-remote-tool-script-2
Fixed remote inspector for tool scripts
-rw-r--r--core/ref_ptr.cpp8
-rw-r--r--core/ref_ptr.h1
-rw-r--r--editor/script_editor_debugger.cpp12
3 files changed, 19 insertions, 2 deletions
diff --git a/core/ref_ptr.cpp b/core/ref_ptr.cpp
index 961f143e5c..6da73ca41a 100644
--- a/core/ref_ptr.cpp
+++ b/core/ref_ptr.cpp
@@ -49,6 +49,14 @@ bool RefPtr::operator==(const RefPtr &p_other) const {
return *ref == *ref_other;
}
+bool RefPtr::operator!=(const RefPtr &p_other) const {
+
+ Ref<Reference> *ref = reinterpret_cast<Ref<Reference> *>(&data[0]);
+ Ref<Reference> *ref_other = reinterpret_cast<Ref<Reference> *>(const_cast<char *>(&p_other.data[0]));
+
+ return *ref != *ref_other;
+}
+
RefPtr::RefPtr(const RefPtr &p_other) {
memnew_placement(&data[0], Ref<Reference>);
diff --git a/core/ref_ptr.h b/core/ref_ptr.h
index f745ababa1..320cf35609 100644
--- a/core/ref_ptr.h
+++ b/core/ref_ptr.h
@@ -50,6 +50,7 @@ public:
bool is_null() const;
void operator=(const RefPtr &p_other);
bool operator==(const RefPtr &p_other) const;
+ bool operator!=(const RefPtr &p_other) const;
RID get_rid() const;
void unref();
_FORCE_INLINE_ void *get_data() const { return data; }
diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp
index ccee38422c..c1899b2bde 100644
--- a/editor/script_editor_debugger.cpp
+++ b/editor/script_editor_debugger.cpp
@@ -611,8 +611,16 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
}
var = ResourceLoader::load(path);
- if (pinfo.hint_string == "Script")
- debugObj->set_script(var);
+ if (pinfo.hint_string == "Script") {
+ if (debugObj->get_script() != var) {
+ debugObj->set_script(RefPtr());
+ Ref<Script> script(var);
+ if (!script.is_null()) {
+ ScriptInstance *script_instance = script->placeholder_instance_create(debugObj);
+ debugObj->set_script_and_instance(var, script_instance);
+ }
+ }
+ }
} else if (var.get_type() == Variant::OBJECT) {
if (((Object *)var)->is_class("EncodedObjectAsID")) {
var = Object::cast_to<EncodedObjectAsID>(var)->get_object_id();