From 8ecbb6a20d7d28273273297b2994491f8adc2500 Mon Sep 17 00:00:00 2001 From: Bojidar Marinov Date: Wed, 10 Jul 2019 21:03:04 +0300 Subject: [PATCH] Fix inability to insert keys via Insert Key context menu Fixes #30495 --- scene/main/node.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 58887609737..ac381f39feb 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 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, Vectorget(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.is_null()) { + 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()) { // No longer a resource, assume property break; }