Merge pull request #60723 from reduz/refactor-module-initialization

This commit is contained in:
Rémi Verschelde 2022-05-04 19:08:43 +02:00 committed by GitHub
commit 84f64ddde9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
103 changed files with 897 additions and 454 deletions

View file

@ -34,7 +34,11 @@
Ref<MobileVRInterface> mobile_vr;
void register_mobile_vr_types() {
void initialize_mobile_vr_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
GDREGISTER_CLASS(MobileVRInterface);
if (XRServer::get_singleton()) {
@ -43,7 +47,11 @@ void register_mobile_vr_types() {
}
}
void unregister_mobile_vr_types() {
void uninitialize_mobile_vr_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
if (mobile_vr.is_valid()) {
// uninitialise our interface if it is initialised
if (mobile_vr->is_initialized()) {

View file

@ -31,7 +31,9 @@
#ifndef MOBILE_VR_REGISTER_TYPES_H
#define MOBILE_VR_REGISTER_TYPES_H
void register_mobile_vr_types();
void unregister_mobile_vr_types();
#include "modules/register_module_types.h"
void initialize_mobile_vr_module(ModuleInitializationLevel p_level);
void uninitialize_mobile_vr_module(ModuleInitializationLevel p_level);
#endif // MOBILE_VR_REGISTER_TYPES_H