Fix build error when disabling WITH_XR_OPENXR
This commit is contained in:
Submodule release/scripts/addons updated: 8ad9de7c1e...56f4310e60
Submodule release/scripts/addons_contrib updated: 26a8b2eadc...eae381b698
@@ -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 **********************************/
|
||||
|
||||
|
@@ -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],
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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");
|
||||
|
@@ -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,
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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,
|
||||
const wmXrEyeData *eye_data,
|
||||
@@ -4910,6 +4917,7 @@ void wm_event_add_xrevent(const wmXrAction *action,
|
||||
BLI_addtail(&surface_data->events, event);
|
||||
}
|
||||
}
|
||||
#endif /* WITH_XR_OPENXR */
|
||||
|
||||
/** \} */
|
||||
|
||||
|
@@ -216,12 +216,12 @@ int WM_gesture_box_invoke_3d(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
rcti winrct_prev;
|
||||
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);
|
||||
event_mut.x = mval[0];
|
||||
event_mut.y = mval[1];
|
||||
|
||||
@@ -324,12 +324,12 @@ int WM_gesture_box_modal_3d(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
wmXrActionData *customdata = event->customdata;
|
||||
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);
|
||||
|
||||
if (event->val == KM_PRESS) {
|
||||
event_mut.type = MOUSEMOVE;
|
||||
|
@@ -33,9 +33,12 @@ struct ARegion;
|
||||
struct GHOST_TabletData;
|
||||
struct GHOST_XrPose;
|
||||
struct ScrArea;
|
||||
|
||||
#ifdef WITH_XR_OPENXR
|
||||
struct wmSurface;
|
||||
struct wmXrAction;
|
||||
struct wmXrEyeData;
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -151,6 +154,8 @@ void wm_event_free_handler(wmEventHandler *handler);
|
||||
void wm_event_do_handlers(bContext *C);
|
||||
|
||||
void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, void *customdata);
|
||||
|
||||
#ifdef WITH_XR_OPENXR
|
||||
void wm_event_add_xrevent(const struct wmXrAction *action,
|
||||
const struct GHOST_XrPose *controller_pose,
|
||||
const struct wmXrEyeData *eye_data,
|
||||
@@ -159,6 +164,7 @@ void wm_event_add_xrevent(const struct wmXrAction *action,
|
||||
unsigned int subaction_idx,
|
||||
short val,
|
||||
bool press_start);
|
||||
#endif
|
||||
|
||||
void wm_event_do_depsgraph(bContext *C, bool is_after_open_file);
|
||||
void wm_event_do_refresh_wm_and_depsgraph(bContext *C);
|
||||
|
Reference in New Issue
Block a user