Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/windowmanager/xr')
-rw-r--r--source/blender/windowmanager/xr/intern/wm_xr_action.c9
-rw-r--r--source/blender/windowmanager/xr/intern/wm_xr_intern.h6
-rw-r--r--source/blender/windowmanager/xr/intern/wm_xr_operators.c5
-rw-r--r--source/blender/windowmanager/xr/intern/wm_xr_session.c8
4 files changed, 22 insertions, 6 deletions
diff --git a/source/blender/windowmanager/xr/intern/wm_xr_action.c b/source/blender/windowmanager/xr/intern/wm_xr_action.c
index 6750e7a7d77..a83415c98af 100644
--- a/source/blender/windowmanager/xr/intern/wm_xr_action.c
+++ b/source/blender/windowmanager/xr/intern/wm_xr_action.c
@@ -391,13 +391,20 @@ void WM_xr_action_binding_destroy(wmXrData *xr,
xr->runtime->context, action_set_name, 1, &action_name, &profile_path);
}
-bool WM_xr_active_action_set_set(wmXrData *xr, const char *action_set_name)
+bool WM_xr_active_action_set_set(wmXrData *xr, const char *action_set_name, bool delayed)
{
wmXrActionSet *action_set = action_set_find(xr, action_set_name);
if (!action_set) {
return false;
}
+ if (delayed) {
+ /* Save name to activate action set later, before next actions sync
+ * (see #wm_xr_session_actions_update()). */
+ strcpy(xr->runtime->session_state.active_action_set_next, action_set_name);
+ return true;
+ }
+
{
/* Clear any active modal/haptic actions. */
wmXrActionSet *active_action_set = xr->runtime->session_state.active_action_set;
diff --git a/source/blender/windowmanager/xr/intern/wm_xr_intern.h b/source/blender/windowmanager/xr/intern/wm_xr_intern.h
index 3fc1f362541..8ad694b6fd2 100644
--- a/source/blender/windowmanager/xr/intern/wm_xr_intern.h
+++ b/source/blender/windowmanager/xr/intern/wm_xr_intern.h
@@ -54,9 +54,11 @@ typedef struct wmXrSessionState {
ListBase controllers; /* #wmXrController */
/** The currently active action set that will be updated on calls to
- * wm_xr_session_actions_update(). If NULL, all action sets will be treated as active and
+ * #wm_xr_session_actions_update(). If NULL, all action sets will be treated as active and
* updated. */
struct wmXrActionSet *active_action_set;
+ /* Name of the action set (if any) to activate before the next actions sync. */
+ char active_action_set_next[64]; /* MAX_NAME */
} wmXrSessionState;
typedef struct wmXrRuntimeData {
@@ -107,7 +109,7 @@ typedef struct wmXrDrawData {
GHOST_XrPose base_pose;
/** Base scale (uniform, world space). */
float base_scale;
- /** Offset to _substract_ from the OpenXR eye and viewer pose to get the wanted effective pose
+ /** Offset to _subtract_ from the OpenXR eye and viewer pose to get the wanted effective pose
* (e.g. a pose exactly at the landmark position). */
float eye_position_ofs[3]; /* Local/view space. */
} wmXrDrawData;
diff --git a/source/blender/windowmanager/xr/intern/wm_xr_operators.c b/source/blender/windowmanager/xr/intern/wm_xr_operators.c
index 3c090423c41..3f0c72a4a05 100644
--- a/source/blender/windowmanager/xr/intern/wm_xr_operators.c
+++ b/source/blender/windowmanager/xr/intern/wm_xr_operators.c
@@ -731,8 +731,9 @@ static void wm_xr_raycast(Scene *scene,
sctx,
depsgraph,
NULL,
- &(const struct SnapObjectParams){
- .snap_select = (selectable_only ? SNAP_SELECTABLE : SNAP_ALL)},
+ &(const struct SnapObjectParams){.snap_target_select = (selectable_only ?
+ SCE_SNAP_TARGET_ONLY_SELECTABLE :
+ SCE_SNAP_TARGET_ALL)},
origin,
direction,
ray_dist,
diff --git a/source/blender/windowmanager/xr/intern/wm_xr_session.c b/source/blender/windowmanager/xr/intern/wm_xr_session.c
index 2a829e274d9..a4d2a65830f 100644
--- a/source/blender/windowmanager/xr/intern/wm_xr_session.c
+++ b/source/blender/windowmanager/xr/intern/wm_xr_session.c
@@ -1175,7 +1175,6 @@ void wm_xr_session_actions_update(wmWindowManager *wm)
XrSessionSettings *settings = &xr->session_settings;
GHOST_XrContextHandle xr_context = xr->runtime->context;
wmXrSessionState *state = &xr->runtime->session_state;
- wmXrActionSet *active_action_set = state->active_action_set;
if (state->is_navigation_dirty) {
memcpy(&state->nav_pose_prev, &state->nav_pose, sizeof(state->nav_pose_prev));
@@ -1192,6 +1191,13 @@ void wm_xr_session_actions_update(wmWindowManager *wm)
&state->viewer_pose, settings->base_scale * state->nav_scale, state->viewer_viewmat);
}
+ /* Set active action set if requested previously. */
+ if (state->active_action_set_next[0]) {
+ WM_xr_active_action_set_set(xr, state->active_action_set_next, false);
+ state->active_action_set_next[0] = '\0';
+ }
+ wmXrActionSet *active_action_set = state->active_action_set;
+
const bool synced = GHOST_XrSyncActions(xr_context,
active_action_set ? active_action_set->name : NULL);
if (!synced) {