Merge pull request #33144 from nekomatata/inspect-remote-tool-script-2

Fixed remote inspector for tool scripts
This commit is contained in:
Rémi Verschelde 2019-10-29 12:01:40 +01:00 committed by GitHub
commit 18c46bb8e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 2 deletions

View File

@ -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>);

View File

@ -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; }

View File

@ -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();