Transform: remove precision modification upon starting navigation
In order to execute the navigation of type "VIEW3D_OT_move," the user is required to press both the `Shift` and `MMB` keys. However, pressing `Shift` also activates the precision modifier for the transform. Consequently, while the `MMB` is unpressed, the transform operation unintentionally remains in precision mode, altering the mouse position. To address this issue, the solution was to eliminate the precision changes immediately after the navigation is initiated. Unfortunately, we have no way of knowing whether the user actually unintentionally enabled precision, so this solution serves as a workaround. Ideally, keymap conflicts should be avoided.
This commit is contained in:
@@ -768,6 +768,7 @@ void applyMouseInput(struct TransInfo *t,
|
||||
const int mval[2],
|
||||
float output[3]);
|
||||
void transform_input_update(TransInfo *t, const float fac);
|
||||
void transform_input_virtual_mval_reset(TransInfo *t);
|
||||
|
||||
void setCustomPoints(TransInfo *t, MouseInput *mi, const int start[2], const int end[2]);
|
||||
void setCustomPointsFromDirection(TransInfo *t, MouseInput *mi, const float dir[2]);
|
||||
|
||||
@@ -494,4 +494,18 @@ void transform_input_update(TransInfo *t, const float fac)
|
||||
}
|
||||
}
|
||||
|
||||
void transform_input_virtual_mval_reset(TransInfo *t)
|
||||
{
|
||||
MouseInput *mi = &t->mouse;
|
||||
if (ELEM(mi->apply, InputAngle, InputAngleSpring)) {
|
||||
struct InputAngle_Data *data = mi->data;
|
||||
data->angle = 0.0;
|
||||
data->mval_prev[0] = mi->imval[0];
|
||||
data->mval_prev[1] = mi->imval[1];
|
||||
}
|
||||
else {
|
||||
memset(&mi->virtual_mval, 0, sizeof(mi->virtual_mval));
|
||||
}
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
@@ -428,9 +428,10 @@ static int transform_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
}
|
||||
|
||||
if (t->modifiers & MOD_PRECISION) {
|
||||
/* Remove Precision modifier, it may have be unintentionally enabled. */
|
||||
/* WORKAROUND: Remove precision modification, it may have be unintentionally enabled. */
|
||||
t->modifiers &= ~MOD_PRECISION;
|
||||
t->mouse.precision = 0;
|
||||
t->mouse.precision = false;
|
||||
transform_input_virtual_mval_reset(t);
|
||||
}
|
||||
|
||||
/* Make sure `t->mval` is up to date before calling #transformViewUpdate. */
|
||||
|
||||
Reference in New Issue
Block a user