Allow ClassDB to create a Object without postinitialization for GDExtension.

This commit is contained in:
Daylily-Zeleen
2024-04-22 22:34:44 +08:00
parent 8dfb8efaa9
commit 3d575801ce
40 changed files with 345 additions and 140 deletions

View File

@@ -207,10 +207,13 @@ void Object::cancel_free() {
_predelete_ok = false;
}
void Object::_postinitialize() {
_class_name_ptr = _get_class_namev(); // Set the direct pointer, which is much faster to obtain, but can only happen after postinitialize.
void Object::_initialize() {
_class_name_ptr = _get_class_namev(); // Set the direct pointer, which is much faster to obtain, but can only happen after _initialize.
_initialize_classv();
_class_name_ptr = nullptr; // May have been called from a constructor.
}
void Object::_postinitialize() {
notification(NOTIFICATION_POSTINITIALIZE);
}
@@ -2129,6 +2132,7 @@ bool predelete_handler(Object *p_object) {
}
void postinitialize_handler(Object *p_object) {
p_object->_initialize();
p_object->_postinitialize();
}