Transform: fix use of "snap_point" property

There is not much documentation on the "snap_point" property, but by
code it is possible to note that it serves to set a target snap point
and is of internal use as it is hidden from the Redo panel.

However, this property was still very dependent on Tools settings and
if set to an operator's call, it changes the scene configurations
inadequately.

Therefore,
- remove this dependency from UI for rotation and resize operators,
- do not change the state of the snap in the scene and
- cleanup the code.
This commit is contained in:
Germano Cavalcante 2023-01-24 17:06:53 -03:00
parent 0f52aa0954
commit 1ad11355a3
2 changed files with 6 additions and 8 deletions

View File

@ -1586,7 +1586,7 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
/* Update `ToolSettings` for properties that change during modal. */
if (t->flag & T_MODAL) {
/* Do we check for parameter? */
if (transformModeUseSnap(t)) {
if (transformModeUseSnap(t) && !(t->tsnap.status & SNAP_FORCED)) {
if (!(t->modifiers & MOD_SNAP) != !(t->tsnap.flag & SCE_SNAP)) {
/* Type is #eSnapFlag, but type must match various snap attributes in #ToolSettings. */
short *snap_flag_ptr;

View File

@ -147,6 +147,10 @@ bool transformModeUseSnap(const TransInfo *t)
static bool doForceIncrementSnap(const TransInfo *t)
{
if (t->tsnap.status & SNAP_FORCED) {
return false;
}
return !transformModeUseSnap(t);
}
@ -525,13 +529,7 @@ void transform_snap_mixed_apply(TransInfo *t, float *vec)
return;
}
if (t->tsnap.status & SNAP_FORCED) {
t->tsnap.snap_source_fn(t);
t->tsnap.snap_mode_apply_fn(t, vec);
}
else if (((t->tsnap.mode & ~(SCE_SNAP_MODE_INCREMENT | SCE_SNAP_MODE_GRID)) != 0) &&
transform_snap_is_active(t)) {
if (t->tsnap.mode & ~(SCE_SNAP_MODE_INCREMENT | SCE_SNAP_MODE_GRID)) {
double current = PIL_check_seconds_timer();
/* Time base quirky code to go around find-nearest slowness. */