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 <julian@blender.org>2020-04-29 00:16:29 +0300
committerJulian Eisel <julian@blender.org>2020-04-29 14:53:25 +0300
commit0cfd2d6f4b24a7703be4faf615eb47d9448d355c (patch)
treef19d089a139a4db8e0fc948574bda83673456f4e /source/blender/makesrna
parentc57e4418bb85aec8bd3615fd775b990badb43d30 (diff)
VR: Reset pose offsets when changing base pose
The offsets are applied after toggling positional tracking off, so that the view does not jump at that moment. But when changing the base pose, keeping that offset doesn't make sense. Especially with landmarks, which are supposed to give precise positions/rotations to jump to. For that part the VR Scene Inspection Add-on will need a little adjustment though. Also exposes an explicit function to the Python API to reset the offsets, to be used by the Add-on. This is mostly untested since I don't have access to an HMD currently.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/intern/rna_xr.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_xr.c b/source/blender/makesrna/intern/rna_xr.c
index b08e48a4b17..04a8500d136 100644
--- a/source/blender/makesrna/intern/rna_xr.c
+++ b/source/blender/makesrna/intern/rna_xr.c
@@ -45,6 +45,16 @@ static bool rna_XrSessionState_is_running(bContext *C)
# endif
}
+static void rna_XrSessionState_reset_to_base_pose(bContext *C)
+{
+# ifdef WITH_XR_OPENXR
+ wmWindowManager *wm = CTX_wm_manager(C);
+ WM_xr_session_base_pose_reset(&wm->xr);
+# else
+ UNUSED_VARS(C);
+# endif
+}
+
# ifdef WITH_XR_OPENXR
static wmXrData *rna_XrSessionState_wm_xr_data_get(PointerRNA *ptr)
{
@@ -197,6 +207,12 @@ static void rna_def_xr_session_state(BlenderRNA *brna)
parm = RNA_def_boolean(func, "result", 0, "Result", "");
RNA_def_function_return(func, parm);
+ func = RNA_def_function(srna, "reset_to_base_pose", "rna_XrSessionState_reset_to_base_pose");
+ RNA_def_function_ui_description(func, "Force resetting of position and rotation deltas");
+ RNA_def_function_flag(func, FUNC_NO_SELF);
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+
prop = RNA_def_property(srna, "viewer_pose_location", PROP_FLOAT, PROP_TRANSLATION);
RNA_def_property_array(prop, 3);
RNA_def_property_float_funcs(prop, "rna_XrSessionState_viewer_pose_location_get", NULL, NULL);