diff options
author | Sebastian Parborg <darkdefende@gmail.com> | 2021-05-20 21:41:10 +0300 |
---|---|---|
committer | Sebastian Parborg <darkdefende@gmail.com> | 2021-05-20 21:41:10 +0300 |
commit | 6a0906c09a263f5fb17449407f5988c4bda53436 (patch) | |
tree | d55bdb234e197bb51598d2aad6bf346d55862d24 /source/blender/blenkernel/intern | |
parent | 2e7d3ad7b51bbc05cdcbbc3c055f961f3a2c28a8 (diff) |
Fix T87854: Add clamp option to Path Animation
Previously, the "follow path constraint" and "follow parented curve"
were clamped. This restriction was lifted in rBcf2baa585cc8
Add back an option to get the old behavior in the "Path animation" settings.
Reviewed By: Sybren
Differential Revision: http://developer.blender.org/D11263
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/constraint.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 4 |
2 files changed, 9 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 2ee030ca83f..bcd2c75be0d 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -1473,8 +1473,12 @@ static void followpath_get_tarmat(struct Depsgraph *UNUSED(depsgraph), * that's animated, but this will only work if it actually is animated... * * we divide the curvetime calculated in the previous step by the length of the path, - * to get a time factor, which then gets clamped to lie within 0.0 - 1.0 range. */ + * to get a time factor. */ curvetime /= cu->pathlen; + + if (cu->flag & CU_PATH_CLAMP) { + CLAMP(curvetime, 0.0f, 1.0f); + } } else { /* fixed position along curve */ diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 825f660fa3a..34c77cd9155 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -3288,6 +3288,10 @@ static bool ob_parcurve(Object *ob, Object *par, float r_mat[4][4]) ctime = cu->ctime; } + if (cu->flag & CU_PATH_CLAMP) { + CLAMP(ctime, 0.0f, 1.0f); + } + unit_m4(r_mat); /* vec: 4 items! */ |