[Bf-blender-cvs] [4586813de6b] vr_scene_inspection: Cleanup: Use "Viewer Pose" not just "Viewer"
Julian Eisel
noreply at git.blender.org
Mon Mar 16 21:49:59 CET 2020
Commit: 4586813de6b9141a88b9ad15955c7ac8b39c7bdd
Author: Julian Eisel
Date: Mon Mar 16 21:44:25 2020 +0100
Branches: vr_scene_inspection
https://developer.blender.org/rB4586813de6b9141a88b9ad15955c7ac8b39c7bdd
Cleanup: Use "Viewer Pose" not just "Viewer"
===================================================================
M source/blender/editors/space_view3d/view3d_draw.c
M source/blender/makesrna/intern/rna_xr.c
M source/blender/windowmanager/WM_api.h
M source/blender/windowmanager/intern/wm_xr.c
===================================================================
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 95b039540ca..78d053c36a7 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -329,7 +329,7 @@ static void view3d_xr_mirror_setup(const wmWindowManager *wm,
float viewmat[4][4];
const float lens_old = v3d->lens;
- if (!WM_xr_session_state_viewer_matrix_info_get(&wm->xr, viewmat, &v3d->lens)) {
+ if (!WM_xr_session_state_viewer_pose_matrix_info_get(&wm->xr, viewmat, &v3d->lens)) {
/* Can't get info from XR session, use fallback values. */
copy_m4_m4(viewmat, rv3d->viewmat);
v3d->lens = lens_old;
diff --git a/source/blender/makesrna/intern/rna_xr.c b/source/blender/makesrna/intern/rna_xr.c
index e0e0d69d940..c0e6b827451 100644
--- a/source/blender/makesrna/intern/rna_xr.c
+++ b/source/blender/makesrna/intern/rna_xr.c
@@ -60,22 +60,22 @@ static wmXrData *rna_XrSessionState_wm_xr_data_get(PointerRNA *ptr)
}
# endif
-static void rna_XrSessionState_viewer_location_get(PointerRNA *ptr, float *r_values)
+static void rna_XrSessionState_viewer_pose_location_get(PointerRNA *ptr, float *r_values)
{
# ifdef WITH_XR_OPENXR
const wmXrData *xr = rna_XrSessionState_wm_xr_data_get(ptr);
- WM_xr_session_state_viewer_location_get(xr, r_values);
+ WM_xr_session_state_viewer_pose_location_get(xr, r_values);
# else
UNUSED_VARS(ptr);
zero_v3(r_values);
# endif
}
-static void rna_XrSessionState_viewer_rotation_get(PointerRNA *ptr, float *r_values)
+static void rna_XrSessionState_viewer_pose_rotation_get(PointerRNA *ptr, float *r_values)
{
# ifdef WITH_XR_OPENXR
const wmXrData *xr = rna_XrSessionState_wm_xr_data_get(ptr);
- WM_xr_session_state_viewer_rotation_get(xr, r_values);
+ WM_xr_session_state_viewer_pose_rotation_get(xr, r_values);
# else
UNUSED_VARS(ptr);
unit_qt(r_values);
@@ -94,17 +94,17 @@ static void rna_def_xr_session_settings(BlenderRNA *brna)
"SCENE_CAMERA",
0,
"Scene Camera",
- "Follow the active scene camera to define the VR view's reference pose"},
+ "Follow the active scene camera to define the VR view's base pose"},
{XR_BASE_POSE_OBJECT,
"OBJECT",
0,
"Object",
- "Follow the transformation of an object to define the VR view's reference pose"},
+ "Follow the transformation of an object to define the VR view's base pose"},
{XR_BASE_POSE_CUSTOM,
"CUSTOM",
0,
"Custom",
- "Follow a custom transformation to define the VR view's reference pose"},
+ "Follow a custom transformation to define the VR view's base pose"},
{0, NULL, 0, NULL, NULL},
};
@@ -120,23 +120,24 @@ static void rna_def_xr_session_settings(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_enum_items(prop, base_pose_types);
RNA_def_property_ui_text(
- prop, "Base Pose Type", "Define where the base pose for the VR view comes from");
+ prop,
+ "Base Pose Type",
+ "Define where the location and rotation for the VR view come from, to which "
+ "translation and rotation deltas from the VR headset will be applied to");
RNA_def_property_update(prop, NC_WM | ND_XR_DATA_CHANGED, NULL);
prop = RNA_def_property(srna, "base_pose_object", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(
- prop,
- "Base Pose Object",
- "Object to take the location and rotation for the centroid from, to which translation and "
- "rotation deltas from the VR headset will be applied to");
+ RNA_def_property_ui_text(prop,
+ "Base Pose Object",
+ "Object to take the location and rotation to which translation and "
+ "rotation deltas from the VR headset will be applied to");
RNA_def_property_update(prop, NC_WM | ND_XR_DATA_CHANGED, NULL);
prop = RNA_def_property(srna, "base_pose_location", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_ui_text(
- prop,
- "Base Pose Location",
- "Coordinates for the centroid to apply translation deltas from the VR headset to");
+ RNA_def_property_ui_text(prop,
+ "Base Pose Location",
+ "Coordinates to apply translation deltas from the VR headset to");
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
RNA_def_property_update(prop, NC_WM | ND_XR_DATA_CHANGED, NULL);
@@ -196,22 +197,22 @@ static void rna_def_xr_session_state(BlenderRNA *brna)
parm = RNA_def_boolean(func, "result", 0, "Result", "");
RNA_def_function_return(func, parm);
- prop = RNA_def_property(srna, "viewer_location", PROP_FLOAT, PROP_TRANSLATION);
+ 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_location_get", NULL, NULL);
+ RNA_def_property_float_funcs(prop, "rna_XrSessionState_viewer_pose_location_get", NULL, NULL);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(
prop,
- "Viewer Location",
+ "Viewer Pose Location",
"Last known location of the viewer pose (center between the eyes) in world space");
- prop = RNA_def_property(srna, "viewer_rotation", PROP_FLOAT, PROP_QUATERNION);
+ prop = RNA_def_property(srna, "viewer_pose_rotation", PROP_FLOAT, PROP_QUATERNION);
RNA_def_property_array(prop, 4);
- RNA_def_property_float_funcs(prop, "rna_XrSessionState_viewer_rotation_get", NULL, NULL);
+ RNA_def_property_float_funcs(prop, "rna_XrSessionState_viewer_pose_rotation_get", NULL, NULL);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(
prop,
- "Viewer Rotation",
+ "Viewer Pose Rotation",
"Last known rotation of the viewer pose (center between the eyes) in world space");
}
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index f5cd26d26c4..1be7a8679c4 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -876,11 +876,11 @@ void WM_generic_user_data_free(struct wmGenericUserData *user_data);
bool WM_xr_session_exists(const wmXrData *xr);
bool WM_xr_session_is_ready(const wmXrData *xr);
struct wmXrSessionState *WM_xr_session_state_handle_get(const wmXrData *xr);
-bool WM_xr_session_state_viewer_location_get(const wmXrData *xr, float r_location[3]);
-bool WM_xr_session_state_viewer_rotation_get(const wmXrData *xr, float r_rotation[4]);
-bool WM_xr_session_state_viewer_matrix_info_get(const wmXrData *xr,
- float r_viewmat[4][4],
- float *r_focal_len);
+bool WM_xr_session_state_viewer_pose_location_get(const wmXrData *xr, float r_location[3]);
+bool WM_xr_session_state_viewer_pose_rotation_get(const wmXrData *xr, float r_rotation[4]);
+bool WM_xr_session_state_viewer_pose_matrix_info_get(const wmXrData *xr,
+ float r_viewmat[4][4],
+ float *r_focal_len);
#endif
#ifdef __cplusplus
diff --git a/source/blender/windowmanager/intern/wm_xr.c b/source/blender/windowmanager/intern/wm_xr.c
index 7a1e406a247..6291ec080fd 100644
--- a/source/blender/windowmanager/intern/wm_xr.c
+++ b/source/blender/windowmanager/intern/wm_xr.c
@@ -104,7 +104,7 @@ typedef struct wmXrDrawData {
/** The pose (location + rotation) to which eye deltas will be applied to when drawing (world
* space). With positional tracking enabled, it should be the same as the base pose, when
* disabled it also contains a location delta from the moment the option was toggled. */
- GHOST_XrPose reference_pose;
+ GHOST_XrPose base_pose;
float eye_position_ofs[3]; /* Local/view space. */
} wmXrDrawData;
@@ -250,9 +250,9 @@ void wm_xr_runtime_data_free(wmXrRuntimeData **runtime)
MEM_SAFE_FREE(*runtime);
}
-static void wm_xr_reference_pose_calc(const Scene *scene,
- const XrSessionSettings *settings,
- GHOST_XrPose *r_pose)
+static void wm_xr_base_pose_calc(const Scene *scene,
+ const XrSessionSettings *settings,
+ GHOST_XrPose *r_base_pose)
{
const Object *base_pose_object = ((settings->base_pose_type == XR_BASE_POSE_OBJECT) &&
settings->base_pose_object) ?
@@ -262,26 +262,26 @@ static void wm_xr_reference_pose_calc(const Scene *scene,
if (settings->base_pose_type == XR_BASE_POSE_CUSTOM) {
float tmp_quatx[4], tmp_quatz[4];
- copy_v3_v3(r_pose->position, settings->base_pose_location);
+ copy_v3_v3(r_base_pose->position, settings->base_pose_location);
axis_angle_to_quat_single(tmp_quatx, 'X', M_PI_2);
axis_angle_to_quat_single(tmp_quatz, 'Z', settings->base_pose_angle);
- mul_qt_qtqt(r_pose->orientation_quat, tmp_quatz, tmp_quatx);
+ mul_qt_qtqt(r_base_pose->orientation_quat, tmp_quatz, tmp_quatx);
}
else if (base_pose_object) {
float tmp_quat[4];
float tmp_eul[3];
- mat4_to_loc_quat(r_pose->position, tmp_quat, base_pose_object->obmat);
+ mat4_to_loc_quat(r_base_pose->position, tmp_quat, base_pose_object->obmat);
/* Only use rotation around Z-axis to align view with floor. */
quat_to_eul(tmp_eul, tmp_quat);
tmp_eul[0] = M_PI_2;
tmp_eul[1] = 0;
- eul_to_quat(r_pose->orientation_quat, tmp_eul);
+ eul_to_quat(r_base_pose->orientation_quat, tmp_eul);
}
else {
- copy_v3_fl(r_pose->position, 0.0f);
- axis_angle_to_quat_single(r_pose->orientation_quat, 'X', M_PI_2);
+ copy_v3_fl(r_base_pose->position, 0.0f);
+ axis_angle_to_quat_single(r_base_pose->orientation_quat, 'X', M_PI_2);
}
}
@@ -298,7 +298,7 @@ static void wm_xr_draw_data_populate(const wmXrSessionState *state,
memset(r_draw_data, 0, sizeof(*r_draw
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list