summaryrefslogtreecommitdiff
path: root/scene/main
diff options
context:
space:
mode:
Diffstat (limited to 'scene/main')
-rw-r--r--scene/main/node.cpp12
-rw-r--r--scene/main/viewport.cpp4
2 files changed, 11 insertions, 5 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;
}
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 24c8ee31b2..d147d43f50 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -2579,7 +2579,7 @@ void Viewport::_drop_physics_mouseover() {
List<Control *>::Element *Viewport::_gui_show_modal(Control *p_control) {
- gui.modal_stack.push_back(p_control);
+ List<Control *>::Element *node = gui.modal_stack.push_back(p_control);
if (gui.key_focus)
p_control->_modal_set_prev_focus_owner(gui.key_focus->get_instance_id());
else
@@ -2590,7 +2590,7 @@ List<Control *>::Element *Viewport::_gui_show_modal(Control *p_control) {
_drop_mouse_focus();
}
- return gui.modal_stack.back();
+ return node;
}
Control *Viewport::_gui_get_focus_owner() {