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

Merge pull request #100437 from KoBeWi/ruaninstancequestionmark

Add `is_instance()` helper method to Node
This commit is contained in:
Thaddeus Crews
2025-09-23 12:08:48 -05:00
8 changed files with 29 additions and 26 deletions

View File

@@ -749,7 +749,7 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Has
// save the child instantiated scenes that are chosen as editable, so they can be restored
// upon load back
if (p_node != p_owner && !p_node->get_scene_file_path().is_empty() && p_owner->is_editable_instance(p_node)) {
if (p_node != p_owner && p_node->is_instance() && p_owner->is_editable_instance(p_node)) {
editable_instances.push_back(p_owner->get_path_to(p_node));
// Node is the root of an editable instance.
is_editable_instance = true;
@@ -783,7 +783,7 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Has
bool instantiated_by_owner = false;
Vector<SceneState::PackState> states_stack = PropertyUtils::get_node_states_stack(p_node, p_owner, &instantiated_by_owner);
if (!p_node->get_scene_file_path().is_empty() && p_node->get_owner() == p_owner && instantiated_by_owner) {
if (p_node->is_instance() && p_node->get_owner() == p_owner && instantiated_by_owner) {
if (p_node->get_scene_instance_load_placeholder()) {
//it's a placeholder, use the placeholder path
nd.instance = _vm_get_variant(p_node->get_scene_file_path(), variant_map);
@@ -1123,7 +1123,7 @@ Error SceneState::_parse_connections(Node *p_owner, Node *p_node, HashMap<String
ERR_CONTINUE(!common_parent);
if (common_parent != p_owner && common_parent->get_scene_file_path().is_empty()) {
if (common_parent != p_owner && !common_parent->is_instance()) {
common_parent = common_parent->get_owner();
}
@@ -1183,8 +1183,7 @@ Error SceneState::_parse_connections(Node *p_owner, Node *p_node, HashMap<String
nl = nullptr;
} else {
if (!nl->get_scene_file_path().is_empty()) {
//is an instance
if (nl->is_instance()) {
Ref<SceneState> state = nl->get_scene_instance_state();
if (state.is_valid()) {
int from_node = state->find_node_by_path(nl->get_path_to(p_node));