diff options
author | Peter Kim <pk15950@gmail.com> | 2021-10-05 09:55:57 +0300 |
---|---|---|
committer | Peter Kim <pk15950@gmail.com> | 2021-10-05 10:05:12 +0300 |
commit | 08511b1c3de0338314940397083adaba4e9cf492 (patch) | |
tree | 879ddffecd08dd9315847fdcffb0b2d76cee8637 /source/blender/windowmanager/xr/intern/wm_xr_intern.h | |
parent | 300403a38b8ed7f0f84125ca9a82264757ae704a (diff) |
XR: Add runtime window area for XR events
This adds an offscreen View3D window area for the VR view in order to
execute XR events/operators in the proper context. The area is created
as runtime data before XR events are dispatched and set as the active
area during XR event handling.
Since the area is runtime-only, it will not be saved in files and since
the area is offscreen, it will not interfere with regular window areas.
The area is removed with the rest of the XR runtime data on exit, file
read, or when stopping the VR session.
Note: This also adds internal types (EVT_DATA_XR, EVT_XR_ACTION) and
structs (wmXrActionData) for XR events.
Reviewed By: Severin
Differential Revision: https://developer.blender.org/D12472
Diffstat (limited to 'source/blender/windowmanager/xr/intern/wm_xr_intern.h')
-rw-r--r-- | source/blender/windowmanager/xr/intern/wm_xr_intern.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/source/blender/windowmanager/xr/intern/wm_xr_intern.h b/source/blender/windowmanager/xr/intern/wm_xr_intern.h index fc54e261f79..ee495755ac6 100644 --- a/source/blender/windowmanager/xr/intern/wm_xr_intern.h +++ b/source/blender/windowmanager/xr/intern/wm_xr_intern.h @@ -67,6 +67,9 @@ typedef struct wmXrRuntimeData { * be an invalid reference, i.e. the window may have been closed. */ wmWindow *session_root_win; + /** Offscreen area used for XR events. */ + struct ScrArea *area; + /** Although this struct is internal, RNA gets a handle to this for state information queries. */ wmXrSessionState session_state; wmXrSessionExitFn exit_fn; @@ -172,10 +175,14 @@ typedef struct wmXrActionSet { ListBase active_haptic_actions; } wmXrActionSet; +/* wm_xr.c */ wmXrRuntimeData *wm_xr_runtime_data_create(void); void wm_xr_runtime_data_free(wmXrRuntimeData **runtime); -void wm_xr_session_data_free(wmXrSessionState *state); +/* wm_xr_session.c */ +void wm_xr_session_data_free(wmXrSessionState *state); +wmWindow *wm_xr_session_root_window_or_fallback_get(const wmWindowManager *wm, + const wmXrRuntimeData *runtime_data); void wm_xr_session_draw_data_update(const wmXrSessionState *state, const XrSessionSettings *settings, const GHOST_XrDrawViewInfo *draw_view, @@ -190,12 +197,13 @@ void *wm_xr_session_gpu_binding_context_create(void); void wm_xr_session_gpu_binding_context_destroy(GHOST_ContextHandle context); void wm_xr_session_actions_init(wmXrData *xr); -void wm_xr_session_actions_update(wmXrData *xr); +void wm_xr_session_actions_update(wmWindowManager *wm); void wm_xr_session_controller_data_populate(const wmXrAction *grip_action, const wmXrAction *aim_action, wmXrData *xr); void wm_xr_session_controller_data_clear(wmXrSessionState *state); +/* wm_xr_draw.c */ void wm_xr_pose_to_mat(const GHOST_XrPose *pose, float r_mat[4][4]); void wm_xr_pose_to_imat(const GHOST_XrPose *pose, float r_imat[4][4]); void wm_xr_draw_view(const GHOST_XrDrawViewInfo *draw_view, void *customdata); |