You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2026-01-05 19:31:35 +00:00
Removed redundant ClassDB::is_class_enabled() and moved second dynamic_cast inside worst case if
This commit is contained in:
@@ -175,14 +175,12 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const {
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
Object *obj = nullptr;
|
||||
//node belongs to this scene and must be created
|
||||
Object *obj = ClassDB::instantiate(snames[n.type]);
|
||||
|
||||
if (ClassDB::is_class_enabled(snames[n.type])) {
|
||||
//node belongs to this scene and must be created
|
||||
obj = ClassDB::instantiate(snames[n.type]);
|
||||
}
|
||||
node = Object::cast_to<Node>(obj);
|
||||
|
||||
if (!Object::cast_to<Node>(obj)) {
|
||||
if (!node) {
|
||||
if (obj) {
|
||||
memdelete(obj);
|
||||
obj = nullptr;
|
||||
@@ -203,9 +201,9 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const {
|
||||
if (!obj) {
|
||||
obj = memnew(Node);
|
||||
}
|
||||
}
|
||||
|
||||
node = Object::cast_to<Node>(obj);
|
||||
node = Object::cast_to<Node>(obj);
|
||||
}
|
||||
}
|
||||
|
||||
if (node) {
|
||||
|
||||
Reference in New Issue
Block a user