From cc1ba4569ccdb77a9371140def316caecac71da5 Mon Sep 17 00:00:00 2001 From: Mike Erwin Date: Thu, 14 Jul 2011 21:20:45 +0000 Subject: more consistent and modal-friendly ndof events, fly mode v1 --- source/blender/windowmanager/WM_types.h | 27 ++++++++++++++-------- .../blender/windowmanager/intern/wm_event_system.c | 2 ++ 2 files changed, 19 insertions(+), 10 deletions(-) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index 26c394a2ad3..7476410ec19 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -377,17 +377,24 @@ typedef struct wmTabletData { float Ytilt; /* as above */ } wmTabletData; -typedef struct { +typedef enum { // motion progress, for modal handlers + P_NOT_STARTED, + P_STARTING, // <-- + P_IN_PROGRESS, // <-- only these are sent for NDOF motion + P_FINISHING, // <-- + P_FINISHED + } wmProgress; + +typedef struct wmNDOFMotionData { /* awfully similar to GHOST_TEventNDOFMotionData... */ - - /* Each component normally ranges from -1 to +1, but can exceed that. */ - - float tx, ty, tz; /* translation: -x left, +y forward, -z up */ - float rx, ry, rz; /* rotation: - axis = (rx,ry,rz).normalized - amount = (rx,ry,rz).magnitude [in revolutions, 1.0 = 360 deg] */ - - float dt; // time since previous NDOF Motion event (or zero if this is the first) + // Each component normally ranges from -1 to +1, but can exceed that. + // These use blender standard view coordinates, with positive rotations being CCW about the axis. + float tx, ty, tz; // translation + float rx, ry, rz; // rotation: + // axis = (rx,ry,rz).normalized + // amount = (rx,ry,rz).magnitude [in revolutions, 1.0 = 360 deg] + float dt; // time since previous NDOF Motion event + wmProgress progress; // is this the first event, the last, or one of many in between? } wmNDOFMotionData; typedef struct wmTimer { diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index b41eebc5298..c2df53c9e91 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -2324,6 +2324,8 @@ static void attach_ndof_data(wmEvent* event, const GHOST_TEventNDOFMotionData* g data->dt = ghost->dt; + data->progress = (wmProgress) ghost->progress; + event->custom = EVT_DATA_NDOF_MOTION; event->customdata = data; event->customdatafree = 1; -- cgit v1.2.3