Skip to content

Commit

Permalink
Use Engine::get_singleton()->register_singleton(...) to register si…
Browse files Browse the repository at this point in the history
…ngletons for the OpenXR extension wrappers.
  • Loading branch information
m4gr3d committed Jan 12, 2024
1 parent f384632 commit eb6d98e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion demo/main.gd
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ func _ready():
var vp: Viewport = get_viewport()
vp.use_xr = true

scene_capture = OpenXRFbSceneCaptureExtensionWrapper.get_singleton()
scene_capture = Engine.get_singleton("OpenXRFbSceneCaptureExtensionWrapper")
scene_capture.connect("scene_capture_completed", _on_scene_capture_completed)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ OpenXRFbSceneCaptureExtensionWrapper::~OpenXRFbSceneCaptureExtensionWrapper() {

void OpenXRFbSceneCaptureExtensionWrapper::_bind_methods() {

ClassDB::bind_static_method("OpenXRFbSceneCaptureExtensionWrapper", D_METHOD("get_singleton"), &OpenXRFbSceneCaptureExtensionWrapper::get_singleton);
ClassDB::bind_method(D_METHOD("is_scene_capture_supported"), &OpenXRFbSceneCaptureExtensionWrapper::is_scene_capture_supported);
ClassDB::bind_method(D_METHOD("is_scene_capture_enabled"), &OpenXRFbSceneCaptureExtensionWrapper::is_scene_capture_enabled);
ClassDB::bind_method(D_METHOD("request_scene_capture"), &OpenXRFbSceneCaptureExtensionWrapper::request_scene_capture);
Expand Down
2 changes: 2 additions & 0 deletions godotopenxrmeta/src/main/cpp/register_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

#include <gdextension_interface.h>

#include <godot_cpp/classes/engine.hpp>
#include <godot_cpp/core/class_db.hpp>
#include <godot_cpp/core/defs.hpp>
#include <godot_cpp/godot.hpp>
Expand All @@ -49,6 +50,7 @@ void initialize_plugin_module(ModuleInitializationLevel p_level)
case MODULE_INITIALIZATION_LEVEL_CORE: {
ClassDB::register_class<OpenXRFbSceneCaptureExtensionWrapper>();
OpenXRFbSceneCaptureExtensionWrapper::get_singleton()->register_extension_wrapper();
Engine::get_singleton()->register_singleton("OpenXRFbSceneCaptureExtensionWrapper", OpenXRFbSceneCaptureExtensionWrapper::get_singleton());
} break;

case MODULE_INITIALIZATION_LEVEL_EDITOR: {
Expand Down

0 comments on commit eb6d98e

Please sign in to comment.