Fix #110108: NLA absolute snapping #111984
|
@ -662,18 +662,20 @@ static void snap_transform_data(TransInfo *t, TransDataContainer *tc)
|
|||
}
|
||||
|
||||
float offset = 0;
|
||||
float closest_snap_offset = FLT_MAX;
|
||||
float smallest_snap_delta = FLT_MAX;
|
||||
|
||||
/* In order to move the strip in a block and not each end individually,
|
||||
* find the minimal snap offset first and then shift the whole strip by that amount. */
|
||||
for (int i = 0; i < tc->data_len; i++) {
|
||||
TransData td = tc->data[i];
|
||||
float snap_value;
|
||||
transform_snap_anim_flush_data(t, &td, snap_mode, &snap_value);
|
||||
|
||||
/* In order to move the strip in a block and not each end individually, find the minimal snap
|
||||
* offset and shift the whole strip by that amount. */
|
||||
const float snap_offset = *td.loc - snap_value;
|
||||
if (fabs(snap_offset) < fabs(closest_snap_offset)) {
|
||||
/* The snap_delta measures how far from the unsnapped position the value has moved. */
|
||||
|
||||
const float snap_delta = *td.loc - snap_value;
|
||||
if (fabs(snap_delta) < fabs(smallest_snap_delta)) {
|
||||
offset = snap_value - td.iloc[0];
|
||||
closest_snap_offset = snap_offset;
|
||||
smallest_snap_delta = snap_delta;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Minor: first line in comment is a little long.
Might read better.