diff options
author | Bastiaan Olij <mux213@gmail.com> | 2019-03-13 20:43:21 +1100 |
---|---|---|
committer | Bastiaan Olij <mux213@gmail.com> | 2019-04-27 08:39:21 +1000 |
commit | 1a1b35721a89e2b27d2b18b8b746c37fd56734aa (patch) | |
tree | 31a52c25ee18de46a3cba7aade5c8701f80e5161 /scene | |
parent | ac95466aff13e0444ec897ba14e89154fa132c63 (diff) |
Send notifications to ARVRInterfaces
Diffstat (limited to 'scene')
-rw-r--r-- | scene/3d/arvr_nodes.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/scene/3d/arvr_nodes.cpp b/scene/3d/arvr_nodes.cpp index e5346c4c53..c0bd8993eb 100644 --- a/scene/3d/arvr_nodes.cpp +++ b/scene/3d/arvr_nodes.cpp @@ -583,6 +583,10 @@ void ARVROrigin::set_world_scale(float p_world_scale) { }; void ARVROrigin::_notification(int p_what) { + // get our ARVRServer + ARVRServer *arvr_server = ARVRServer::get_singleton(); + ERR_FAIL_NULL(arvr_server); + switch (p_what) { case NOTIFICATION_ENTER_TREE: { set_process_internal(true); @@ -591,10 +595,6 @@ void ARVROrigin::_notification(int p_what) { set_process_internal(false); }; break; case NOTIFICATION_INTERNAL_PROCESS: { - // get our ARVRServer - ARVRServer *arvr_server = ARVRServer::get_singleton(); - ERR_FAIL_NULL(arvr_server); - // set our world origin to our node transform arvr_server->set_world_origin(get_global_transform()); @@ -611,6 +611,14 @@ void ARVROrigin::_notification(int p_what) { default: break; }; + + // send our notification to all active ARVR interfaces, they may need to react to it also + for (int i = 0; i < arvr_server->get_interface_count(); i++) { + Ref<ARVRInterface> interface = arvr_server->get_interface(i); + if (interface.is_valid() && interface->is_initialized()) { + interface->notification(p_what); + } + } }; ARVROrigin::ARVROrigin() { |