1
0
mirror of https://github.com/godotengine/godot.git synced 2025-12-04 17:04:49 +00:00

Prevent selecting hidden nodes in 3D and Canvas Item editors

This commit is contained in:
hilfazer
2021-02-21 09:19:48 +01:00
parent 3bb628d8fe
commit 442e550114
4 changed files with 26 additions and 14 deletions

View File

@@ -1966,6 +1966,23 @@ bool Node::is_editable_instance(const Node *p_node) const {
return p_node->data.editable_instance;
}
Node *Node::get_deepest_editable_node(Node *p_start_node) const {
ERR_FAIL_NULL_V(p_start_node, nullptr);
ERR_FAIL_COND_V(!is_a_parent_of(p_start_node), nullptr);
Node const *iterated_item = p_start_node;
Node *node = p_start_node;
while (iterated_item->get_owner() && iterated_item->get_owner() != this) {
if (!is_editable_instance(iterated_item->get_owner()))
node = iterated_item->get_owner();
iterated_item = iterated_item->get_owner();
}
return node;
}
void Node::set_scene_instance_state(const Ref<SceneState> &p_state) {
data.instance_state = p_state;
}