diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-08-13 08:24:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-13 08:24:01 +0200 |
commit | e7d484982eb011259d5d11d022e18b513eae2c30 (patch) | |
tree | 3b9cd4a195fe62765db4ee069c4db5669b6e090a | |
parent | 1ccc2af2263f599681c92fe4e11995ece6ccc074 (diff) | |
parent | 98a3b2e5f48444a95ac5382d18ae5ab1fe8683f7 (diff) |
Merge pull request #31292 from iwek7/fixDebuggerInspectionForNodes
Fixes issue with debug inspecing of nodes that are not in the scene tree
-rw-r--r-- | core/script_debugger_remote.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp index 5f01e043c4..6dd9054aaa 100644 --- a/core/script_debugger_remote.cpp +++ b/core/script_debugger_remote.cpp @@ -601,9 +601,19 @@ void ScriptDebuggerRemote::_send_object_id(ObjectID p_id) { } } } + if (Node *node = Object::cast_to<Node>(obj)) { - PropertyInfo pi(Variant::NODE_PATH, String("Node/path")); - properties.push_front(PropertyDesc(pi, node->get_path())); + // in some cases node will not be in tree here + // for instance where it created as variable and not yet added to tree + // in such cases we can't ask for it's path + if (node->is_inside_tree()) { + PropertyInfo pi(Variant::NODE_PATH, String("Node/path")); + properties.push_front(PropertyDesc(pi, node->get_path())); + } else { + PropertyInfo pi(Variant::STRING, String("Node/path")); + properties.push_front(PropertyDesc(pi, "[Orphan]")); + } + } else if (Resource *res = Object::cast_to<Resource>(obj)) { if (Script *s = Object::cast_to<Script>(res)) { Map<StringName, Variant> constants; |