summaryrefslogtreecommitdiffstats
path: root/modules/openxr/register_types.cpp
diff options
context:
space:
mode:
authorBastiaan Olij <mux213@gmail.com>2022-03-17 10:24:47 +1100
committerBastiaan Olij <mux213@gmail.com>2022-04-04 18:43:29 +1000
commit9b7b9de0e5e8bfe49ad9e02474eb9ddd5d7dacd5 (patch)
tree1b97984c4874521c4551c5d76ba03ef05b46abb3 /modules/openxr/register_types.cpp
parent7bb963efe9083662baa356f56a2d5c368b96a9a0 (diff)
downloadredot-engine-9b7b9de0e5e8bfe49ad9e02474eb9ddd5d7dacd5.tar.gz
Add action map editor for OpenXR
Diffstat (limited to 'modules/openxr/register_types.cpp')
-rw-r--r--modules/openxr/register_types.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/modules/openxr/register_types.cpp b/modules/openxr/register_types.cpp
index 47ee1316e7..0b48be5f2a 100644
--- a/modules/openxr/register_types.cpp
+++ b/modules/openxr/register_types.cpp
@@ -38,6 +38,22 @@
#include "action_map/openxr_action_set.h"
#include "action_map/openxr_interaction_profile.h"
+#ifdef TOOLS_ENABLED
+
+#include "editor/editor_node.h"
+#include "editor/openxr_editor_plugin.h"
+
+static void _editor_init() {
+ if (OpenXRAPI::openxr_is_enabled(false)) {
+ // Only add our OpenXR action map editor if OpenXR is enabled for our project
+
+ OpenXREditorPlugin *openxr_plugin = memnew(OpenXREditorPlugin());
+ EditorNode::get_singleton()->add_editor_plugin(openxr_plugin);
+ }
+}
+
+#endif
+
OpenXRAPI *openxr_api = nullptr;
Ref<OpenXRInterface> openxr_interface;
@@ -74,6 +90,10 @@ void register_openxr_types() {
openxr_interface->initialize();
}
}
+
+#ifdef TOOLS_ENABLED
+ EditorNode::add_init_callback(_editor_init);
+#endif
}
void unregister_openxr_types() {