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 co[3],
|
||||||
const float axis[3],
|
const float axis[3],
|
||||||
const float angle);
|
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 **********************************/
|
/********************************** Normals **********************************/
|
||||||
|
|
||||||
|
@@ -5194,6 +5194,23 @@ void map_to_plane_axis_angle_v2_v3v3fl(float r_co[2],
|
|||||||
copy_v2_v2(r_co, tmp);
|
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 **********************************/
|
/********************************* Normals **********************************/
|
||||||
|
|
||||||
void accumulate_vertex_normals_tri_v3(float n1[3],
|
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);
|
ED_annotation_draw_view3d(DEG_get_input_scene(depsgraph), depsgraph, v3d, region, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef WITH_XR_OPENXR
|
||||||
/* Controllers. */
|
/* Controllers. */
|
||||||
if ((v3d->flag2 & V3D_XR_SHOW_CONTROLLERS) != 0) {
|
if ((v3d->flag2 & V3D_XR_SHOW_CONTROLLERS) != 0) {
|
||||||
GPU_depth_test(GPU_DEPTH_ALWAYS);
|
GPU_depth_test(GPU_DEPTH_ALWAYS);
|
||||||
WM_xr_draw_controllers();
|
WM_xr_draw_controllers();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
GPU_depth_test(GPU_DEPTH_LESS_EQUAL);
|
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];
|
float winmat_prev[4][4];
|
||||||
int mval[2];
|
int mval[2];
|
||||||
|
|
||||||
WM_xr_controller_loc_to_mval(customdata->controller_loc,
|
map_to_pixel(mval,
|
||||||
customdata->eye_viewmat,
|
customdata->controller_loc,
|
||||||
customdata->eye_winmat,
|
customdata->eye_viewmat,
|
||||||
customdata->eye_width,
|
customdata->eye_winmat,
|
||||||
customdata->eye_height,
|
customdata->eye_width,
|
||||||
mval);
|
customdata->eye_height);
|
||||||
|
|
||||||
RNA_int_set_array(op->ptr, "location", mval);
|
RNA_int_set_array(op->ptr, "location", mval);
|
||||||
|
|
||||||
|
@@ -40,7 +40,9 @@
|
|||||||
|
|
||||||
#include "WM_types.h"
|
#include "WM_types.h"
|
||||||
|
|
||||||
#include "../ghost/GHOST_Types.h"
|
#ifdef WITH_XR_OPENXR
|
||||||
|
# include "../ghost/GHOST_Types.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef RNA_RUNTIME
|
#ifdef RNA_RUNTIME
|
||||||
|
|
||||||
@@ -709,7 +711,7 @@ static int rna_Event_xr_type_get(PointerRNA *ptr)
|
|||||||
{
|
{
|
||||||
const wmEvent *event = ptr->data;
|
const wmEvent *event = ptr->data;
|
||||||
if (WM_event_is_xr(event)) {
|
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);
|
WM_event_xr_data(event, NULL, (char *)&type, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
@@ -2236,11 +2238,19 @@ static void rna_def_event(BlenderRNA *brna)
|
|||||||
PropertyRNA *prop;
|
PropertyRNA *prop;
|
||||||
|
|
||||||
static const EnumPropertyItem xr_types[] = {
|
static const EnumPropertyItem xr_types[] = {
|
||||||
{GHOST_kXrActionTypeBooleanInput, "BOOLEAN", 0, "Boolean", "Boolean value"},
|
{1, "BOOLEAN", 0, "Boolean", "Boolean value"},
|
||||||
{GHOST_kXrActionTypeFloatInput, "FLOAT", 0, "Float", "Float value"},
|
{2, "FLOAT", 0, "Float", "Float value"},
|
||||||
{GHOST_kXrActionTypeVector2fInput, "VEC2F", 0, "Vector2f", "2D float vector value"},
|
{3, "VEC2F", 0, "Vector2f", "2D float vector value"},
|
||||||
{0, NULL, 0, NULL, NULL},
|
{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);
|
srna = RNA_def_struct(brna, "Event", NULL);
|
||||||
RNA_def_struct_ui_text(srna, "Event", "Window Manager Event");
|
RNA_def_struct_ui_text(srna, "Event", "Window Manager Event");
|
||||||
|
@@ -29,7 +29,9 @@
|
|||||||
|
|
||||||
#include "WM_types.h"
|
#include "WM_types.h"
|
||||||
|
|
||||||
#include "../ghost/GHOST_Types.h"
|
#ifdef WITH_XR_OPENXR
|
||||||
|
# include "../ghost/GHOST_Types.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "rna_internal.h"
|
#include "rna_internal.h"
|
||||||
|
|
||||||
@@ -565,11 +567,19 @@ static void rna_def_xr_session_state(BlenderRNA *brna)
|
|||||||
PropertyRNA *parm, *prop;
|
PropertyRNA *parm, *prop;
|
||||||
|
|
||||||
static const EnumPropertyItem action_types[] = {
|
static const EnumPropertyItem action_types[] = {
|
||||||
{GHOST_kXrActionTypeFloatInput, "BUTTON", 0, "Button", "Button state action"},
|
{2, "BUTTON", 0, "Button", "Button state action"},
|
||||||
{GHOST_kXrActionTypePoseInput, "POSE", 0, "Pose", "3D pose action"},
|
{4, "POSE", 0, "Pose", "3D pose action"},
|
||||||
{GHOST_kXrActionTypeVibrationOutput, "HAPTIC", 0, "Haptic", "Haptic output action"},
|
{100, "HAPTIC", 0, "Haptic", "Haptic output action"},
|
||||||
{0, NULL, 0, NULL, NULL},
|
{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[] = {
|
static const EnumPropertyItem op_flags[] = {
|
||||||
{XR_OP_PRESS,
|
{XR_OP_PRESS,
|
||||||
|
@@ -66,10 +66,13 @@ struct wmOperator;
|
|||||||
struct wmOperatorType;
|
struct wmOperatorType;
|
||||||
struct wmPaintCursor;
|
struct wmPaintCursor;
|
||||||
struct wmTabletData;
|
struct wmTabletData;
|
||||||
|
|
||||||
|
#ifdef WITH_XR_OPENXR
|
||||||
struct GHOST_XrActionSetInfo;
|
struct GHOST_XrActionSetInfo;
|
||||||
struct GHOST_XrActionInfo;
|
struct GHOST_XrActionInfo;
|
||||||
struct GHOST_XrActionSpaceInfo;
|
struct GHOST_XrActionSpaceInfo;
|
||||||
struct GHOST_XrActionBindingsInfo;
|
struct GHOST_XrActionBindingsInfo;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef WITH_INPUT_NDOF
|
#ifdef WITH_INPUT_NDOF
|
||||||
struct wmNDOFMotionData;
|
struct wmNDOFMotionData;
|
||||||
@@ -996,12 +999,6 @@ void WM_xr_haptic_action_stop(wmXrData *xr,
|
|||||||
const char *const *subaction_paths);
|
const char *const *subaction_paths);
|
||||||
|
|
||||||
/* wm_xr_draw.c */
|
/* 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*/);
|
void WM_xr_draw_controllers(void /*const struct wmXrSessionState *state*/);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -85,7 +85,9 @@
|
|||||||
#include "wm_surface.h"
|
#include "wm_surface.h"
|
||||||
#include "wm_window.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.h"
|
||||||
#include "DEG_depsgraph_query.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.
|
* 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)
|
static void wm_event_surface_free_all(wmXrSurfaceData *surface_data)
|
||||||
{
|
{
|
||||||
ListBase *events = &surface_data->events;
|
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);
|
CTX_wm_window_set(C, NULL);
|
||||||
}
|
}
|
||||||
|
#endif /* WITH_XR_OPENXR */
|
||||||
|
|
||||||
/* Called in main loop. */
|
/* Called in main loop. */
|
||||||
/* Goes over entire hierarchy: events -> window -> screen -> area -> region. */
|
/* 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);
|
CTX_wm_window_set(C, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef WITH_XR_OPENXR
|
||||||
/* Handle surface events. */
|
/* Handle surface events. */
|
||||||
wm_surfaces_iter(C, wm_event_do_surface_handlers);
|
wm_surfaces_iter(C, wm_event_do_surface_handlers);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Update key configuration after handling events. */
|
/* Update key configuration after handling events. */
|
||||||
WM_keyconfig_update(wm);
|
WM_keyconfig_update(wm);
|
||||||
@@ -4834,6 +4840,7 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, void
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef WITH_XR_OPENXR
|
||||||
void wm_event_add_xrevent(const wmXrAction *action,
|
void wm_event_add_xrevent(const wmXrAction *action,
|
||||||
const GHOST_XrPose *controller_pose,
|
const GHOST_XrPose *controller_pose,
|
||||||
const wmXrEyeData *eye_data,
|
const wmXrEyeData *eye_data,
|
||||||
@@ -4910,6 +4917,7 @@ void wm_event_add_xrevent(const wmXrAction *action,
|
|||||||
BLI_addtail(&surface_data->events, event);
|
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;
|
rcti winrct_prev;
|
||||||
int mval[2];
|
int mval[2];
|
||||||
|
|
||||||
WM_xr_controller_loc_to_mval(customdata->controller_loc,
|
map_to_pixel(mval,
|
||||||
customdata->eye_viewmat,
|
customdata->controller_loc,
|
||||||
customdata->eye_winmat,
|
customdata->eye_viewmat,
|
||||||
customdata->eye_width,
|
customdata->eye_winmat,
|
||||||
customdata->eye_height,
|
customdata->eye_width,
|
||||||
mval);
|
customdata->eye_height);
|
||||||
event_mut.x = mval[0];
|
event_mut.x = mval[0];
|
||||||
event_mut.y = mval[1];
|
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;
|
wmXrActionData *customdata = event->customdata;
|
||||||
int mval[2];
|
int mval[2];
|
||||||
|
|
||||||
WM_xr_controller_loc_to_mval(customdata->controller_loc,
|
map_to_pixel(mval,
|
||||||
customdata->eye_viewmat,
|
customdata->controller_loc,
|
||||||
customdata->eye_winmat,
|
customdata->eye_viewmat,
|
||||||
customdata->eye_width,
|
customdata->eye_winmat,
|
||||||
customdata->eye_height,
|
customdata->eye_width,
|
||||||
mval);
|
customdata->eye_height);
|
||||||
|
|
||||||
if (event->val == KM_PRESS) {
|
if (event->val == KM_PRESS) {
|
||||||
event_mut.type = MOUSEMOVE;
|
event_mut.type = MOUSEMOVE;
|
||||||
|
@@ -33,9 +33,12 @@ struct ARegion;
|
|||||||
struct GHOST_TabletData;
|
struct GHOST_TabletData;
|
||||||
struct GHOST_XrPose;
|
struct GHOST_XrPose;
|
||||||
struct ScrArea;
|
struct ScrArea;
|
||||||
|
|
||||||
|
#ifdef WITH_XR_OPENXR
|
||||||
struct wmSurface;
|
struct wmSurface;
|
||||||
struct wmXrAction;
|
struct wmXrAction;
|
||||||
struct wmXrEyeData;
|
struct wmXrEyeData;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -151,6 +154,8 @@ void wm_event_free_handler(wmEventHandler *handler);
|
|||||||
void wm_event_do_handlers(bContext *C);
|
void wm_event_do_handlers(bContext *C);
|
||||||
|
|
||||||
void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, void *customdata);
|
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,
|
void wm_event_add_xrevent(const struct wmXrAction *action,
|
||||||
const struct GHOST_XrPose *controller_pose,
|
const struct GHOST_XrPose *controller_pose,
|
||||||
const struct wmXrEyeData *eye_data,
|
const struct wmXrEyeData *eye_data,
|
||||||
@@ -159,6 +164,7 @@ void wm_event_add_xrevent(const struct wmXrAction *action,
|
|||||||
unsigned int subaction_idx,
|
unsigned int subaction_idx,
|
||||||
short val,
|
short val,
|
||||||
bool press_start);
|
bool press_start);
|
||||||
|
#endif
|
||||||
|
|
||||||
void wm_event_do_depsgraph(bContext *C, bool is_after_open_file);
|
void wm_event_do_depsgraph(bContext *C, bool is_after_open_file);
|
||||||
void wm_event_do_refresh_wm_and_depsgraph(bContext *C);
|
void wm_event_do_refresh_wm_and_depsgraph(bContext *C);
|
||||||
|
Reference in New Issue
Block a user