[Bf-blender-cvs] [2eb44677dd8] xr-actions-D9124: Fix build error when disabling WITH_XR_OPENXR
Peter Kim
noreply at git.blender.org
Sun Oct 18 08:19:14 CEST 2020
Commit: 2eb44677dd8ed036aa6046a064549bb359b547d9
Author: Peter Kim
Date: Sun Oct 18 15:09:13 2020 +0900
Branches: xr-actions-D9124
https://developer.blender.org/rB2eb44677dd8ed036aa6046a064549bb359b547d9
Fix build error when disabling WITH_XR_OPENXR
===================================================================
M release/scripts/addons
M release/scripts/addons_contrib
M source/blender/blenlib/BLI_math_geom.h
M source/blender/blenlib/intern/math_geom.c
M source/blender/draw/intern/draw_manager.c
M source/blender/editors/space_view3d/view3d_select.c
M source/blender/makesrna/intern/rna_wm.c
M source/blender/makesrna/intern/rna_xr.c
M source/blender/windowmanager/WM_api.h
M source/blender/windowmanager/intern/wm_event_system.c
M source/blender/windowmanager/intern/wm_gesture_ops.c
M source/blender/windowmanager/wm_event_system.h
===================================================================
diff --git a/release/scripts/addons b/release/scripts/addons
index 8ad9de7c1e1..56f4310e602 160000
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@ -1 +1 @@
-Subproject commit 8ad9de7c1e1022dee907ddce78f4c357111fc09e
+Subproject commit 56f4310e602c6b596a30b5f776d6700e72376ab3
diff --git a/release/scripts/addons_contrib b/release/scripts/addons_contrib
index 26a8b2eadc7..eae381b6982 160000
--- a/release/scripts/addons_contrib
+++ b/release/scripts/addons_contrib
@@ -1 +1 @@
-Subproject commit 26a8b2eadc7abb2a30fac50eb5505aa24daf5785
+Subproject commit eae381b698248e70e4a3c62bdf239f9d5a0470a9
diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h
index a9a55b10a9e..44fa087b092 100644
--- a/source/blender/blenlib/BLI_math_geom.h
+++ b/source/blender/blenlib/BLI_math_geom.h
@@ -705,6 +705,12 @@ void map_to_plane_axis_angle_v2_v3v3fl(float r_co[2],
const float co[3],
const float axis[3],
const float angle);
+void map_to_pixel(int r_co[2],
+ const float co[3],
+ const float viewmat[4][4],
+ const float winmat[4][4],
+ int winx,
+ int winy);
/********************************** Normals **********************************/
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c
index 8ca84d9c582..d1cd5e64453 100644
--- a/source/blender/blenlib/intern/math_geom.c
+++ b/source/blender/blenlib/intern/math_geom.c
@@ -5194,6 +5194,23 @@ void map_to_plane_axis_angle_v2_v3v3fl(float r_co[2],
copy_v2_v2(r_co, tmp);
}
+void map_to_pixel(int r_co[2],
+ const float co[3],
+ const float viewmat[4][4],
+ const float winmat[4][4],
+ int winx,
+ int winy)
+{
+ float persmat[4][4];
+ float vec[3];
+
+ mul_m4_m4m4(persmat, winmat, viewmat);
+ mul_v3_project_m4_v3(vec, persmat, co);
+
+ r_co[0] = (int)(((float)winx / 2.0f) * (1.0f + vec[0]));
+ r_co[1] = (int)(((float)winy / 2.0f) * (1.0f + vec[1]));
+}
+
/********************************* Normals **********************************/
void accumulate_vertex_normals_tri_v3(float n1[3],
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index 2545564e6fe..e31b7a17134 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -1462,11 +1462,13 @@ void DRW_draw_callbacks_post_scene(void)
ED_annotation_draw_view3d(DEG_get_input_scene(depsgraph), depsgraph, v3d, region, true);
}
+#ifdef WITH_XR_OPENXR
/* Controllers. */
if ((v3d->flag2 & V3D_XR_SHOW_CONTROLLERS) != 0) {
GPU_depth_test(GPU_DEPTH_ALWAYS);
WM_xr_draw_controllers();
}
+#endif
GPU_depth_test(GPU_DEPTH_LESS_EQUAL);
}
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index 47c92593f59..e24718c0e77 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -2526,12 +2526,12 @@ static int view3d_select_invoke_3d(bContext *C, wmOperator *op, const wmEvent *e
float winmat_prev[4][4];
int mval[2];
- WM_xr_controller_loc_to_mval(customdata->controller_loc,
- customdata->eye_viewmat,
- customdata->eye_winmat,
- customdata->eye_width,
- customdata->eye_height,
- mval);
+ map_to_pixel(mval,
+ customdata->controller_loc,
+ customdata->eye_viewmat,
+ customdata->eye_winmat,
+ customdata->eye_width,
+ customdata->eye_height);
RNA_int_set_array(op->ptr, "location", mval);
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index 5cbe1a1cbbf..310593efb64 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -40,7 +40,9 @@
#include "WM_types.h"
-#include "../ghost/GHOST_Types.h"
+#ifdef WITH_XR_OPENXR
+# include "../ghost/GHOST_Types.h"
+#endif
#ifdef RNA_RUNTIME
@@ -709,7 +711,7 @@ static int rna_Event_xr_type_get(PointerRNA *ptr)
{
const wmEvent *event = ptr->data;
if (WM_event_is_xr(event)) {
- GHOST_XrActionType type;
+ int type;
WM_event_xr_data(event, NULL, (char *)&type, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
return type;
}
@@ -2236,11 +2238,19 @@ static void rna_def_event(BlenderRNA *brna)
PropertyRNA *prop;
static const EnumPropertyItem xr_types[] = {
- {GHOST_kXrActionTypeBooleanInput, "BOOLEAN", 0, "Boolean", "Boolean value"},
- {GHOST_kXrActionTypeFloatInput, "FLOAT", 0, "Float", "Float value"},
- {GHOST_kXrActionTypeVector2fInput, "VEC2F", 0, "Vector2f", "2D float vector value"},
+ {1, "BOOLEAN", 0, "Boolean", "Boolean value"},
+ {2, "FLOAT", 0, "Float", "Float value"},
+ {3, "VEC2F", 0, "Vector2f", "2D float vector value"},
{0, NULL, 0, NULL, NULL},
};
+# ifdef WITH_XR_OPENXR
+ BLI_STATIC_ASSERT(GHOST_kXrActionTypeBooleanInput == 1,
+ "Boolean action type does not match GHOST_XrActionType value");
+ BLI_STATIC_ASSERT(GHOST_kXrActionTypeFloatInput == 2,
+ "Float action type does not match GHOST_XrActionType value");
+ BLI_STATIC_ASSERT(GHOST_kXrActionTypeVector2fInput == 3,
+ "Vector2f action type does not match GHOST_XrActionType value");
+# endif
srna = RNA_def_struct(brna, "Event", NULL);
RNA_def_struct_ui_text(srna, "Event", "Window Manager Event");
diff --git a/source/blender/makesrna/intern/rna_xr.c b/source/blender/makesrna/intern/rna_xr.c
index da302001614..56b7c7f3031 100644
--- a/source/blender/makesrna/intern/rna_xr.c
+++ b/source/blender/makesrna/intern/rna_xr.c
@@ -29,7 +29,9 @@
#include "WM_types.h"
-#include "../ghost/GHOST_Types.h"
+#ifdef WITH_XR_OPENXR
+# include "../ghost/GHOST_Types.h"
+#endif
#include "rna_internal.h"
@@ -565,11 +567,19 @@ static void rna_def_xr_session_state(BlenderRNA *brna)
PropertyRNA *parm, *prop;
static const EnumPropertyItem action_types[] = {
- {GHOST_kXrActionTypeFloatInput, "BUTTON", 0, "Button", "Button state action"},
- {GHOST_kXrActionTypePoseInput, "POSE", 0, "Pose", "3D pose action"},
- {GHOST_kXrActionTypeVibrationOutput, "HAPTIC", 0, "Haptic", "Haptic output action"},
+ {2, "BUTTON", 0, "Button", "Button state action"},
+ {4, "POSE", 0, "Pose", "3D pose action"},
+ {100, "HAPTIC", 0, "Haptic", "Haptic output action"},
{0, NULL, 0, NULL, NULL},
};
+# ifdef WITH_XR_OPENXR
+ BLI_STATIC_ASSERT(GHOST_kXrActionTypeFloatInput == 2,
+ "Float action type does not match GHOST_XrActionType value");
+ BLI_STATIC_ASSERT(GHOST_kXrActionTypePoseInput == 4,
+ "Pose action type does not match GHOST_XrActionType value");
+ BLI_STATIC_ASSERT(GHOST_kXrActionTypeVibrationOutput == 100,
+ "Haptic action type does not match GHOST_XrActionType value");
+# endif
static const EnumPropertyItem op_flags[] = {
{XR_OP_PRESS,
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index 8b77226b0f3..23a45b2a0e9 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -66,10 +66,13 @@ struct wmOperator;
struct wmOperatorType;
struct wmPaintCursor;
struct wmTabletData;
+
+#ifdef WITH_XR_OPENXR
struct GHOST_XrActionSetInfo;
struct GHOST_XrActionInfo;
struct GHOST_XrActionSpaceInfo;
struct GHOST_XrActionBindingsInfo;
+#endif
#ifdef WITH_INPUT_NDOF
struct wmNDOFMotionData;
@@ -996,12 +999,6 @@ void WM_xr_haptic_action_stop(wmXrData *xr,
const char *const *subaction_paths);
/* wm_xr_draw.c */
-void WM_xr_controller_loc_to_mval(const float loc[3],
- const float viewmat[4][4],
- const float winmat[4][4],
- int winx,
- int winy,
- int r_mval[2]);
void WM_xr_draw_controllers(void /*const struct wmXrSessionState *state*/);
#endif
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index d6271667413..5a612f5286e 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -85,7 +85,9 @@
#include "wm_surface.h"
#include "wm_window.h"
-#include "xr/intern/wm_xr_intern.h"
+#ifdef WITH_XR_OPENXR
+# include "xr/intern/wm_xr_intern.h"
+#endif
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
@@ -3167,6 +3169,7 @@ static void wm_event_free_and_remove_from_queue_if_valid(wmEvent *event)
* Handle events for all windows, run from the #WM_main event loop.
* \{ */
+#ifdef WITH_XR_OPENXR
static void wm_event_surface_free_all(wmXrSurfaceData *surface_data)
{
ListBase *events = &surface_data->events;
@@ -3257,6 +3260,7 @@ static void wm_event_do_surface_handlers(bContext *C, wmSurface *surface)
CTX_wm_window_set(C, NULL);
}
+#endif /* WITH_XR_OPENXR */
/* Called in main loop. */
/* Goes over entire hierarchy: events -> window -> screen -> area -> region. */
@@ -3522,8 +3526,10 @@ void wm_event_do_handlers(bContext *C)
CTX_wm_window_set(C, NULL);
}
+#ifdef WITH_XR_OPENXR
/* Handle surface events. */
wm_surfaces_iter(C, wm_event_do_surface_handlers);
+#endif
/* Update key configuration after handling events. */
WM_keyconfig_update(wm);
@@ -4834,6 +4840,7 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, void
#endif
}
+#ifdef WITH_XR_OPENXR
void wm_event_add_xrevent(const wmXrAction *action,
const GHOST_XrPose *controller_pose,
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list