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_action.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_action.c')
-rw-r--r--source/blender/editors/transform/transform_convert_action.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/editors/transform/transform_convert_action.c b/source/blender/editors/transform/transform_convert_action.c
index 30cb9fa20e5..8a3b254be5c 100644
--- a/source/blender/editors/transform/transform_convert_action.c
+++ b/source/blender/editors/transform/transform_convert_action.c
@@ -45,6 +45,8 @@
#include "WM_types.h"
#include "transform.h"
+#include "transform_snap.h"
+
#include "transform_convert.h"
/* helper struct for gp-frame transforms */
@@ -604,6 +606,19 @@ void recalcData_actedit(TransInfo *t)
flushTransIntFrameActionData(t);
}
+ /* Flush 2d vector. */
+ TransDataContainer *tc = TRANS_DATA_CONTAINER_FIRST_SINGLE(t);
+ const short autosnap = getAnimEdit_SnapMode(t);
+ TransData *td;
+ TransData2D *td2d;
+ int i = 0;
+ for (td = tc->data, td2d = tc->data_2d; i < tc->data_len; i++, td++, td2d++) {
+ if ((autosnap != SACTSNAP_OFF) && (t->state != TRANS_CANCEL) && !(td->flag & TD_NOTIMESNAP)) {
+ transform_snap_anim_flush_data(t, td, autosnap, td->loc);
+ }
+ transform_convert_flush_handle2D(td, td2d, 1.0f);
+ }
+
if (ac.datatype != ANIMCONT_MASK) {
/* Get animdata blocks visible in editor,
* assuming that these will be the ones where things changed. */