Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Erwin <significant.bit@gmail.com>2011-08-07 21:22:47 +0400
committerMike Erwin <significant.bit@gmail.com>2011-08-07 21:22:47 +0400
commitf12df1e3863ca2043947c64786e0f3c7f0fccca0 (patch)
tree093b248ff2067bc51e3d00ae588fb8588467c12b /source/blender/windowmanager
parent3a55da7616fa5613b8a95a591059bb55102dbfb4 (diff)
ndof data change: operators can access values as vectors or components, as both are handy
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/WM_types.h10
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c33
2 files changed, 26 insertions, 17 deletions
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index 7fd52e89a5f..697133bb163 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -389,8 +389,14 @@ typedef struct wmNDOFMotionData {
/* awfully similar to GHOST_TEventNDOFMotionData... */
// 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 tvec[3]; // translation
- float rvec[3]; // rotation:
+ union {
+ float tvec[3]; // translation
+ struct { float tx, ty, tz; };
+ };
+ union {
+ float rvec[3]; // rotation:
+ struct { float rx, ry, rz; };
+ };
// axis = (rx,ry,rz).normalized
// amount = (rx,ry,rz).magnitude [in revolutions, 1.0 = 360 deg]
float dt; // time since previous NDOF Motion event
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 258d6bbc025..c1fd903c479 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -2329,29 +2329,32 @@ static void attach_ndof_data(wmEvent* event, const GHOST_TEventNDOFMotionData* g
const float s = U.ndof_sensitivity;
- data->tvec[0]= s * ghost->tx;
+ data->tx = s * ghost->tx;
- data->rvec[0]= s * ghost->rx;
- data->rvec[1]= s * ghost->ry;
- data->rvec[2]= s * ghost->rz;
+ data->rx = s * ghost->rx;
+ data->rx = s * ghost->ry;
+ data->rx = s * ghost->rz;
if (U.ndof_flag & NDOF_ZOOM_UPDOWN)
{
- // rotate so Y is where Z was (maintain handed-ness)
- data->tvec[1]= s * ghost->tz;
- data->tvec[2]= s * -ghost->ty;
-
- // should this affect rotation also?
- // initial guess is 'yes', but get user feedback immediately!
-#if 0 // after turning this on, my guess becomes 'no'
- data->rvec[1]= s * ghost->rz;
- data->rvec[2]= s * ghost->ry;
+ /* rotate so Y is where Z was */
+ data->ty = s * ghost->tz;
+ data->tz = s * ghost->ty;
+ /* maintain handed-ness? or just do what feels right? */
+
+ /* should this affect rotation also?
+ * initial guess is 'yes', but get user feedback immediately!
+ */
+#if 0
+ /* after turning this on, my guess becomes 'no' */
+ data->ry = s * ghost->rz;
+ data->rz = s * ghost->ry;
#endif
}
else
{
- data->tvec[1]= s * ghost->ty;
- data->tvec[2]= s * ghost->tz;
+ data->ty = s * ghost->ty;
+ data->tz = s * ghost->tz;
}
data->dt = ghost->dt;