ndof data change: operators can access values as vectors or components, as both are handy

This commit is contained in:
2011-08-07 17:22:47 +00:00
parent 3a55da7616
commit f12df1e386
2 changed files with 25 additions and 16 deletions

View File

@@ -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

View File

@@ -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;
/* 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;