[Bf-blender-cvs] [eed31613e59] xr-controller-support: XR: Smooth transition between modal actions

Peter Kim noreply at git.blender.org
Fri Jun 18 14:37:18 CEST 2021


Commit: eed31613e5931e5f5a4a590220bf982e4f90982a
Author: Peter Kim
Date:   Fri Jun 18 21:26:38 2021 +0900
Branches: xr-controller-support
https://developer.blender.org/rBeed31613e5931e5f5a4a590220bf982e4f90982a

XR: Smooth transition between modal actions

Although only one modal action is allowed at a time, if another
modal action is pressed when the current modal action ends, then
transition immediately to that one.

===================================================================

M	source/blender/windowmanager/xr/intern/wm_xr_session.c

===================================================================

diff --git a/source/blender/windowmanager/xr/intern/wm_xr_session.c b/source/blender/windowmanager/xr/intern/wm_xr_session.c
index 991868bed43..0d527d88ec8 100644
--- a/source/blender/windowmanager/xr/intern/wm_xr_session.c
+++ b/source/blender/windowmanager/xr/intern/wm_xr_session.c
@@ -741,7 +741,7 @@ static const GHOST_XrPose *wm_xr_session_controller_pose_find(const wmXrSessionS
   return NULL;
 }
 
-inline bool test_float_state(const float *state, float threshold, eXrActionFlag flag)
+BLI_INLINE bool test_float_state(const float *state, float threshold, eXrActionFlag flag)
 {
   if ((flag & XR_ACTION_AXIS0_POS) != 0) {
     if (*state > threshold) {
@@ -761,7 +761,7 @@ inline bool test_float_state(const float *state, float threshold, eXrActionFlag
   return false;
 }
 
-inline bool test_vec2f_state(const float state[2], float threshold, eXrActionFlag flag)
+BLI_INLINE bool test_vec2f_state(const float state[2], float threshold, eXrActionFlag flag)
 {
   if ((flag & XR_ACTION_AXIS0_POS) != 0) {
     if (state[0] < 0.0f) {
@@ -827,18 +827,18 @@ static void wm_xr_session_events_dispatch(const XrSessionSettings *settings,
                 if (modal || (action->flag & XR_ACTION_PRESS) != 0) {
                   val = KM_PRESS;
                   press_start = true;
-                  if (modal && !active_modal_action) {
-                    /* Set active modal action. */
-                    active_modal_action = action_set->active_modal_action = action;
-                    active_modal_action->active_modal_path =
-                        &action->subaction_paths[subaction_idx];
-                  }
                 }
               }
               else if (modal) {
                 val = KM_PRESS;
                 press_start = false;
               }
+              if (modal && !active_modal_action) {
+                /* Set active modal action. */
+                active_modal_action = action_set->active_modal_action = action;
+                active_modal_action->active_modal_path = &action->subaction_paths[subaction_idx];
+                press_start = true;
+              }
             }
             else if (*state_prev) {
               if (modal || (action->flag & XR_ACTION_RELEASE) != 0) {
@@ -864,18 +864,18 @@ static void wm_xr_session_events_dispatch(const XrSessionSettings *settings,
                 if (modal || (action->flag & XR_ACTION_PRESS) != 0) {
                   val = KM_PRESS;
                   press_start = true;
-                  if (modal && !active_modal_action) {
-                    /* Set active modal action. */
-                    active_modal_action = action_set->active_modal_action = action;
-                    active_modal_action->active_modal_path =
-                        &action->subaction_paths[subaction_idx];
-                  }
                 }
               }
               else if (modal) {
                 val = KM_PRESS;
                 press_start = false;
               }
+              if (modal && !active_modal_action) {
+                /* Set active modal action. */
+                active_modal_action = action_set->active_modal_action = action;
+                active_modal_action->active_modal_path = &action->subaction_paths[subaction_idx];
+                press_start = true;
+              }
             }
             else if (test_float_state(state_prev, action->float_threshold, action->flag)) {
               if (modal || (action->flag & XR_ACTION_RELEASE) != 0) {
@@ -901,18 +901,18 @@ static void wm_xr_session_events_dispatch(const XrSessionSettings *settings,
                 if (modal || (action->flag & XR_ACTION_PRESS) != 0) {
                   val = KM_PRESS;
                   press_start = true;
-                  if (modal && !active_modal_action) {
-                    /* Set active modal action. */
-                    active_modal_action = action_set->active_modal_action = action;
-                    active_modal_action->active_modal_path =
-                        &action->subaction_paths[subaction_idx];
-                  }
                 }
               }
               else if (modal) {
                 val = KM_PRESS;
                 press_start = false;
               }
+              if (modal && !active_modal_action) {
+                /* Set active modal action. */
+                active_modal_action = action_set->active_modal_action = action;
+                active_modal_action->active_modal_path = &action->subaction_paths[subaction_idx];
+                press_start = true;
+              }
             }
             else if (test_vec2f_state(*state_prev, action->float_threshold, action->flag)) {
               if (modal || (action->flag & XR_ACTION_RELEASE) != 0) {



More information about the Bf-blender-cvs mailing list