Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGermano Cavalcante <germano.costa@ig.com.br>2021-08-19 16:28:43 +0300
committerGermano Cavalcante <germano.costa@ig.com.br>2021-08-19 16:34:13 +0300
commitb0d9e6797fb866e7a58876c7977c98a190070310 (patch)
tree99db77c25e2adfeb0113033db877882dac0d051e /source/blender/editors/transform/transform_convert.c
parent119d53263f0d0dc5474cb36e888dbdd48a64f9c6 (diff)
Fix T87173: wrong Auto-Snap in animation editors
This was partially broken with {rBde9ea94fc6f}. The `Frame Step` and `Second Step` snapping options were working as if they were `Nearest Frame` and `Nearest Second` respectively in the `Dope Sheet` and `NLA` editors. In the `Graph Editor` the problem was more serious: "Second Step: ... The keyframe itself moves along as though in snapping were active at all, while its handles 'stay behind' until it reaches the next second boundary, at which point the teleport handles to 'catch up'". The snapping code for these modes was spread across the transform mode code and `recalcData` of each data type. Therefore, create a unified snapping code for these options so that all issues are fixed in one place. Differetial Revision: https://developer.blender.org/D12241
Diffstat (limited to 'source/blender/editors/transform/transform_convert.c')
-rw-r--r--source/blender/editors/transform/transform_convert.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/source/blender/editors/transform/transform_convert.c b/source/blender/editors/transform/transform_convert.c
index 3f730956dd0..094ae080de0 100644
--- a/source/blender/editors/transform/transform_convert.c
+++ b/source/blender/editors/transform/transform_convert.c
@@ -1662,6 +1662,23 @@ void animrecord_check_state(TransInfo *t, struct Object *ob)
}
}
+void transform_convert_flush_handle2D(TransData *td, TransData2D *td2d, const float inv_unit_scale)
+{
+ /* If the handles are to be moved too
+ * (as side-effect of keyframes moving, to keep the general effect)
+ * offset them by the same amount so that the general angles are maintained
+ * (i.e. won't change while handles are free-to-roam and keyframes are snap-locked).
+ */
+ if ((td->flag & TD_MOVEHANDLE1) && td2d->h1) {
+ td2d->h1[0] = td2d->ih1[0] + td->loc[0] - td->iloc[0];
+ td2d->h1[1] = td2d->ih1[1] + (td->loc[1] - td->iloc[1]) * inv_unit_scale;
+ }
+ if ((td->flag & TD_MOVEHANDLE2) && td2d->h2) {
+ td2d->h2[0] = td2d->ih2[0] + td->loc[0] - td->iloc[0];
+ td2d->h2[1] = td2d->ih2[1] + (td->loc[1] - td->iloc[1]) * inv_unit_scale;
+ }
+}
+
/* called for updating while transform acts, once per redraw */
void recalcData(TransInfo *t)
{