ndof changes: turned off 3D mouse during transform, removed timing bug in image/uv, added option for zoom axis (up/down vs. forward/backward)

This commit is contained in:
2011-08-02 22:50:06 +00:00
parent 4fc56e39bd
commit 3af9651b90
4 changed files with 31 additions and 12 deletions

View File

@@ -452,14 +452,9 @@ static int view_ndof_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
wmNDOFMotionData* ndof = (wmNDOFMotionData*) event->customdata;
float dt = ndof->dt > 0.25f ? 0.0125f : ndof->dt;
/* this is probably the first event for this motion, so set dt to something reasonable
* TODO: replace such guesswork with a flag or field from the NDOF manager
*/
/* tune these until it feels right */
const float zoom_sensitivity = 0.5f;
const float pan_sensitivity = 300.f;
const float zoom_sensitivity = 0.5f; // 50% per second (I think)
const float pan_sensitivity = 300.f; // screen pixels per second
float pan_x = pan_sensitivity * dt * ndof->tvec[0] / sima->zoom;
float pan_y = pan_sensitivity * dt * ndof->tvec[1] / sima->zoom;

View File

@@ -360,11 +360,17 @@ static int transform_modal(bContext *C, wmOperator *op, wmEvent *event)
TransInfo *t = op->customdata;
#if 0
// stable 2D mouse coords map to different 3D coords while the 3D mouse is active
// in other words, 2D deltas are no longer good enough!
// disable until individual 'transformers' behave better
if (event->type == NDOF_MOTION)
{
/* puts("transform_modal: passing through NDOF_MOTION"); */
return OPERATOR_PASS_THROUGH;
}
#endif
/* XXX insert keys are called here, and require context */
t->context= C;

View File

@@ -600,6 +600,9 @@ extern UserDef U; /* from blenkernel blender.c */
/* actually... users probably don't care about what the mode
is called, just that it feels right */
#define NDOF_ORBIT_INVERT_AXES (1 << 6)
/* zoom is up/down if this flag is set (otherwise forward/backward) */
#define NDOF_ZOOM_UPDOWN (1 << 7)
#define NDOF_INVERT_ZOOM (1 << 8)
#ifdef __cplusplus

View File

@@ -2324,12 +2324,27 @@ static void attach_ndof_data(wmEvent* event, const GHOST_TEventNDOFMotionData* g
const float s = U.ndof_sensitivity;
data->tvec[0]= s * ghost->tx;
data->tvec[1]= s * ghost->ty;
data->tvec[2]= s * ghost->tz;
data->rvec[0]= s * ghost->rx;
data->rvec[1]= s * ghost->ry;
data->rvec[2]= s * ghost->rz;
if (U.ndof_flags & NDOF_ZOOM_UPDOWN)
{
// swap Y and Z
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!
data->rvec[1]= s * ghost->rz;
data->rvec[2]= s * ghost->ry;
}
else
{
data->tvec[1]= s * ghost->ty;
data->tvec[2]= s * ghost->tz;
data->rvec[1]= s * ghost->ry;
data->rvec[2]= s * ghost->rz;
}
data->dt = ghost->dt;