Removed redundant ClassDB::is_class_enabled() and moved second dynamic_cast inside worst case if
This commit is contained in:
parent
13d25f9980
commit
b6cfc55113
1 changed files with 6 additions and 8 deletions
|
@ -175,14 +175,12 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const {
|
|||
#endif
|
||||
}
|
||||
} else {
|
||||
Object *obj = nullptr;
|
||||
|
||||
if (ClassDB::is_class_enabled(snames[n.type])) {
|
||||
//node belongs to this scene and must be created
|
||||
obj = ClassDB::instantiate(snames[n.type]);
|
||||
}
|
||||
Object *obj = ClassDB::instantiate(snames[n.type]);
|
||||
|
||||
if (!Object::cast_to<Node>(obj)) {
|
||||
node = Object::cast_to<Node>(obj);
|
||||
|
||||
if (!node) {
|
||||
if (obj) {
|
||||
memdelete(obj);
|
||||
obj = nullptr;
|
||||
|
@ -203,10 +201,10 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const {
|
|||
if (!obj) {
|
||||
obj = memnew(Node);
|
||||
}
|
||||
}
|
||||
|
||||
node = Object::cast_to<Node>(obj);
|
||||
}
|
||||
}
|
||||
|
||||
if (node) {
|
||||
// may not have found the node (part of instantiated scene and removed)
|
||||
|
|
Loading…
Reference in a new issue