[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39159] trunk/blender/source/blender/ windowmanager: ndof data change: operators can access values as vectors or components, as both are handy
Mike Erwin
significant.bit at gmail.com
Sun Aug 7 19:22:47 CEST 2011
Revision: 39159
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39159
Author: merwin
Date: 2011-08-07 17:22:47 +0000 (Sun, 07 Aug 2011)
Log Message:
-----------
ndof data change: operators can access values as vectors or components, as both are handy
Modified Paths:
--------------
trunk/blender/source/blender/windowmanager/WM_types.h
trunk/blender/source/blender/windowmanager/intern/wm_event_system.c
Modified: trunk/blender/source/blender/windowmanager/WM_types.h
===================================================================
--- trunk/blender/source/blender/windowmanager/WM_types.h 2011-08-07 17:19:18 UTC (rev 39158)
+++ trunk/blender/source/blender/windowmanager/WM_types.h 2011-08-07 17:22:47 UTC (rev 39159)
@@ -389,8 +389,14 @@
/* 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
Modified: trunk/blender/source/blender/windowmanager/intern/wm_event_system.c
===================================================================
--- trunk/blender/source/blender/windowmanager/intern/wm_event_system.c 2011-08-07 17:19:18 UTC (rev 39158)
+++ trunk/blender/source/blender/windowmanager/intern/wm_event_system.c 2011-08-07 17:22:47 UTC (rev 39159)
@@ -2329,29 +2329,32 @@
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;
+ /* 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->rvec[1]= s * ghost->rz;
- data->rvec[2]= s * ghost->ry;
+ /* 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;
More information about the Bf-blender-cvs
mailing list