You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-08 12:40:44 +00:00
Merge pull request #100437 from KoBeWi/ruaninstancequestionmark
Add `is_instance()` helper method to Node
This commit is contained in:
@@ -2797,7 +2797,7 @@ Node *Node::_duplicate(int p_flags, HashMap<const Node *, Node *> *r_duplimap) c
|
||||
nip->set_instance_path(ip->get_instance_path());
|
||||
node = nip;
|
||||
|
||||
} else if ((p_flags & DUPLICATE_USE_INSTANTIATION) && !get_scene_file_path().is_empty()) {
|
||||
} else if ((p_flags & DUPLICATE_USE_INSTANTIATION) && is_instance()) {
|
||||
Ref<PackedScene> res = ResourceLoader::load(get_scene_file_path());
|
||||
ERR_FAIL_COND_V(res.is_null(), nullptr);
|
||||
PackedScene::GenEditState edit_state = PackedScene::GEN_EDIT_STATE_DISABLED;
|
||||
@@ -2822,7 +2822,7 @@ Node *Node::_duplicate(int p_flags, HashMap<const Node *, Node *> *r_duplimap) c
|
||||
ERR_FAIL_NULL_V(node, nullptr);
|
||||
}
|
||||
|
||||
if (!get_scene_file_path().is_empty()) { //an instance
|
||||
if (is_instance()) {
|
||||
node->set_scene_file_path(get_scene_file_path());
|
||||
node->data.editable_instance = data.editable_instance;
|
||||
}
|
||||
@@ -2853,7 +2853,7 @@ Node *Node::_duplicate(int p_flags, HashMap<const Node *, Node *> *r_duplimap) c
|
||||
|
||||
node_tree.push_back(descendant);
|
||||
|
||||
if (!descendant->get_scene_file_path().is_empty() && instance_roots.has(descendant->get_owner())) {
|
||||
if (descendant->is_instance() && instance_roots.has(descendant->get_owner())) {
|
||||
instance_roots.push_back(descendant);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user