diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-07-11 19:36:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-11 19:36:33 +0200 |
commit | 111154a4a512391640a7e1015b8f4fcc9a57de6c (patch) | |
tree | a9c4bf7fe53c9cf0b2b54bb7bc779269d7903337 | |
parent | e5c6ebbd367221f073a3e080bce60706219ef198 (diff) | |
parent | 8ecbb6a20d7d28273273297b2994491f8adc2500 (diff) |
Merge pull request #30498 from bojidar-bg/30495-cannot-insert-key
Fix inability to insert keys via Insert Key context menu
-rw-r--r-- | scene/main/node.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/scene/main/node.cpp b/scene/main/node.cpp index cf1bd96483..06d6f0871c 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -2487,7 +2487,7 @@ bool Node::has_node_and_resource(const NodePath &p_path) const { Vector<StringName> leftover_path; Node *node = get_node_and_resource(p_path, res, leftover_path, false); - return (node && res.is_valid()); + return node; } Array Node::_get_node_and_resource(const NodePath &p_path) { @@ -2525,9 +2525,15 @@ Node *Node::get_node_and_resource(const NodePath &p_path, RES &r_res, Vector<Str int j = 0; // If not p_last_is_property, we shouldn't consider the last one as part of the resource for (; j < p_path.get_subname_count() - (int)p_last_is_property; j++) { - RES new_res = j == 0 ? node->get(p_path.get_subname(j)) : r_res->get(p_path.get_subname(j)); + Variant new_res_v = j == 0 ? node->get(p_path.get_subname(j)) : r_res->get(p_path.get_subname(j)); + + if (new_res_v.get_type() == Variant::NIL) { // Found nothing on that path + return NULL; + } + + RES new_res = new_res_v; - if (new_res.is_null()) { + if (new_res.is_null()) { // No longer a resource, assume property break; } |