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:
authorJulian Eisel <eiseljulian@gmail.com>2019-11-05 17:33:16 +0300
committerJulian Eisel <eiseljulian@gmail.com>2019-11-05 17:33:48 +0300
commit7f1fadba67718434efecb7aa2c0aaf8dbea6f042 (patch)
tree554a3d257f69173b5e094f6985efeae2bb911fca /source/blender/windowmanager/intern/wm_operators.c
parent8537cdc71d8145572a06eabc7ec39030b3c99118 (diff)
Core XR Support [part 4]: Blender-side changes (+ the remaining bits)
Changes for the higher level, more Blender specific side of the implementation. Main additions: * WM-XR: Layer tying Ghost-XR to the Blender specific APIs/data * wmSurface API: drawable, non-window container (manages Ghost-OpenGL and GPU context) * DNA/RNA for initial management of VR session settings * Utility batch & config file for using the Oculus runtime (Windows only) Differential Revision: https://developer.blender.org/D6193
Diffstat (limited to 'source/blender/windowmanager/intern/wm_operators.c')
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 6bafbed9804..1e6455da9c9 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -3470,6 +3470,39 @@ static void WM_OT_stereo3d_set(wmOperatorType *ot)
/** \} */
+#ifdef WITH_OPENXR
+static int wm_xr_session_toggle_exec(bContext *C, wmOperator *UNUSED(op))
+{
+ wmWindowManager *wm = CTX_wm_manager(C);
+
+ /* Lazy-create xr context - tries to dynlink to the runtime, reading active_runtime.json. */
+ if (wm_xr_context_ensure(C, wm) == false) {
+ return OPERATOR_CANCELLED;
+ }
+
+ wm_xr_session_toggle(C, wm->xr.context);
+
+ return OPERATOR_FINISHED;
+}
+
+static void WM_OT_xr_session_toggle(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Toggle VR Session";
+ ot->idname = "WM_OT_xr_session_toggle";
+ ot->description =
+ "Attempt to open a view for use with virtual reality headsets, or close it if already "
+ "opened";
+
+ /* callbacks */
+ ot->exec = wm_xr_session_toggle_exec;
+
+ /* XXX INTERNAL just to hide it from the search menu by default, an Add-on will expose it in the
+ * UI instead. Not meant as a permanent solution. */
+ ot->flag = OPTYPE_INTERNAL;
+}
+#endif /* WITH_OPENXR */
+
/* -------------------------------------------------------------------- */
/** \name Operator Registration & Keymaps
* \{ */
@@ -3511,6 +3544,9 @@ void wm_operatortypes_register(void)
WM_operatortype_append(WM_OT_call_panel);
WM_operatortype_append(WM_OT_radial_control);
WM_operatortype_append(WM_OT_stereo3d_set);
+#ifdef WITH_OPENXR
+ WM_operatortype_append(WM_OT_xr_session_toggle);
+#endif
#if defined(WIN32)
WM_operatortype_append(WM_OT_console_toggle);
#endif