[Bf-blender-cvs] [634812e5799] xr-actions-D9124: Merge branch 'master' into xr-actions-D9124

Peter Kim noreply at git.blender.org
Wed Nov 11 15:43:37 CET 2020


Commit: 634812e579966ecf4371f0749eebce26ebf2b10d
Author: Peter Kim
Date:   Wed Nov 11 23:42:43 2020 +0900
Branches: xr-actions-D9124
https://developer.blender.org/rB634812e579966ecf4371f0749eebce26ebf2b10d

Merge branch 'master' into xr-actions-D9124

===================================================================



===================================================================

diff --cc source/blender/windowmanager/WM_api.h
index e6044a668fb,fd0b99fb9ae..f9817cf9465
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@@ -870,17 -857,9 +870,20 @@@ void WM_event_ndof_to_quat(const struc
  float WM_event_tablet_data(const struct wmEvent *event, int *pen_flip, float tilt[2]);
  bool WM_event_is_tablet(const struct wmEvent *event);
  
+ int WM_event_absolute_delta_x(const struct wmEvent *event);
+ int WM_event_absolute_delta_y(const struct wmEvent *event);
+ 
 +void WM_event_xr_data(const struct wmEvent *event,
 +                      char **action_set,
 +                      char **action,
 +                      char *type,
 +                      float state[2],
 +                      float controller_loc[3],
 +                      float controller_rot[4],
 +                      float eye_viewmat[4][4],
 +                      float *eye_lens);
 +bool WM_event_is_xr(const struct wmEvent *event);
 +
  #ifdef WITH_INPUT_IME
  bool WM_event_is_ime_switch(const struct wmEvent *event);
  #endif
diff --cc source/blender/windowmanager/intern/wm_event_query.c
index bbdb6a79419,a996796104b..a9f421dfaaf
--- a/source/blender/windowmanager/intern/wm_event_query.c
+++ b/source/blender/windowmanager/intern/wm_event_query.c
@@@ -422,55 -422,38 +422,87 @@@ bool WM_event_is_tablet(const struct wm
  
  /** \} */
  
+ /* -------------------------------------------------------------------- */
+ /** \name Event Scroll's Absolute Deltas
+  *
+  * User may change the scroll behavior, and the deltas are automatically inverted.
+  * These functions return the absolute direction, swipe up/right gives positive values.
+  *
+  * \{ */
+ 
+ int WM_event_absolute_delta_x(const struct wmEvent *event)
+ {
+   int dx = event->x - event->prevx;
+ 
+   if (!event->is_direction_inverted) {
+     dx = -dx;
+   }
+ 
+   return dx;
+ }
+ 
+ int WM_event_absolute_delta_y(const struct wmEvent *event)
+ {
+   int dy = event->y - event->prevy;
+ 
+   if (!event->is_direction_inverted) {
+     dy = -dy;
+   }
+ 
+   return dy;
+ }
+ 
+ /** \} */
+ 
 +/* -------------------------------------------------------------------- */
 +/** \name XR Input Access
 + * \{ */
 +
 +void WM_event_xr_data(const wmEvent *event,
 +                      char **action_set,
 +                      char **action,
 +                      char *type,
 +                      float state[2],
 +                      float controller_loc[3],
 +                      float controller_rot[4],
 +                      float eye_viewmat[4][4],
 +                      float *eye_lens)
 +{
 +  const wmXrActionData *data = event->customdata;
 +
 +  if (action_set) {
 +    strcpy(*action_set, data->action_set);
 +  }
 +  if (action) {
 +    strcpy(*action, data->action);
 +  }
 +  if (type) {
 +    *type = data->type;
 +  }
 +  if (state) {
 +    copy_v2_v2(state, data->state);
 +  }
 +  if (controller_loc) {
 +    copy_v3_v3(controller_loc, data->controller_loc);
 +  }
 +  if (controller_rot) {
 +    copy_v4_v4(controller_rot, data->controller_rot);
 +  }
 +  if (eye_viewmat) {
 +    copy_m4_m4(eye_viewmat, data->eye_viewmat);
 +  }
 +  if (eye_lens) {
 +    *eye_lens = data->eye_lens;
 +  }
 +}
 +
 +bool WM_event_is_xr(const struct wmEvent *event)
 +{
 +  return (event->custom == EVT_DATA_XR);
 +}
 +
 +/** \} */
 +
  /* -------------------------------------------------------------------- */
  /** \name Event IME Input Access
   * \{ */



More information about the Bf-blender-cvs mailing list