Fail at instantiating if the root node is instantiated

(cherry picked from commit f400c9239e)
This commit is contained in:
gyroninja 2021-09-17 02:55:26 -07:00 committed by Rémi Verschelde
parent 41b1f2a7f9
commit 96d418cb94
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -102,8 +102,9 @@ Node *SceneState::instance(GenEditState p_edit_state) const {
#endif
parent = nparent;
} else {
// i == 0 is root node. Confirm that it doesn't have a parent defined.
// i == 0 is root node.
ERR_FAIL_COND_V_MSG(n.parent != -1, nullptr, vformat("Invalid scene: root node %s cannot specify a parent node.", snames[n.name]));
ERR_FAIL_COND_V_MSG(n.type == TYPE_INSTANCED && base_scene_idx < 0, nullptr, vformat("Invalid scene: root node %s in an instance, but there's no base scene.", snames[n.name]));
}
Node *node = NULL;