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:
authorJoshua Leung <aligorith@gmail.com>2014-04-24 18:17:12 +0400
committerJoshua Leung <aligorith@gmail.com>2014-04-24 19:14:02 +0400
commite80fbf8674c0913de6e5b747a8ff4d41c0d7cf46 (patch)
tree6bb7a468b6a60b8d4136c580ce2ef573138a9426
parent9c28a241538f8bf5a54ca5670cac3cbb5bff9e13 (diff)
More AutoSnap Bugfixes: Time Stepping in Graph Editor
* Frame Step now works correctly and as expected * Second Step kindof works, but the handles are not well behaved.
-rw-r--r--source/blender/editors/transform/transform_conversions.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 5e5dd00476b..8830b0297a2 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -4129,6 +4129,28 @@ void flushTransGraphData(TransInfo *t)
td2d->loc2d[0] = BKE_nla_tweakedit_remap(adt, td2d->loc[0], NLATIME_CONVERT_UNMAP);
else
td2d->loc2d[0] = td2d->loc[0];
+
+ /* Time-stepping auto-snapping modes don't get applied for Graph Editor transforms,
+ * as these use the generic transform modes which don't account for this sort of thing.
+ * These ones aren't affected by NLA mapping, so we do this after the conversion...
+ *
+ * NOTE: We also have to apply to td->loc, as that's what the handle-adjustment step below looks
+ * to, otherwise we get "swimming handles"
+ */
+ if ((td->flag & TD_NOTIMESNAP) == 0 && ELEM(sipo->autosnap, SACTSNAP_STEP, SACTSNAP_TSTEP)) {
+ switch (sipo->autosnap) {
+ case SACTSNAP_STEP: /* frame step */
+ td2d->loc2d[0] = floor((double)td2d->loc[0] + 0.5);
+ td->loc[0] = floor((double)td->loc[0] + 0.5);
+ break;
+
+ case SACTSNAP_TSTEP: /* second step */
+ /* XXX: the handle behaviour in this case is still not quite right... */
+ td2d->loc[0] = floor(((double)td2d->loc[0] / secf) + 0.5) * secf;
+ td->loc[0] = floor(((double)td->loc[0] / secf) + 0.5) * secf;
+ break;
+ }
+ }
/* if int-values only, truncate to integers */
if (td->flag & TD_INTVALUES)