forked from bartvdbraak/blender
patch [#29726] Enable looping with Follow Path constraint and cyclic curves. by Peter Amstutz (tetron)
This commit is contained in:
parent
d7d856a23d
commit
532afede02
@ -1255,6 +1255,7 @@ static void followpath_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr
|
||||
float quat[4];
|
||||
if ((data->followflag & FOLLOWPATH_STATIC) == 0) {
|
||||
/* animated position along curve depending on time */
|
||||
Nurb *nu = cu->nurb.first;
|
||||
curvetime= cu->ctime - data->offset;
|
||||
|
||||
/* ctime is now a proper var setting of Curve which gets set by Animato like any other var that's animated,
|
||||
@ -1264,8 +1265,19 @@ static void followpath_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr
|
||||
* factor, which then gets clamped to lie within 0.0 - 1.0 range
|
||||
*/
|
||||
curvetime /= cu->pathlen;
|
||||
|
||||
if (nu && nu->flagu & CU_NURB_CYCLIC) {
|
||||
/* If the curve is cyclic, enable looping around if the time is
|
||||
* outside the bounds 0..1 */
|
||||
if ((curvetime < 0.0f) || (curvetime > 1.0f)) {
|
||||
curvetime -= floor(curvetime);
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* The curve is not cyclic, so clamp to the begin/end points. */
|
||||
CLAMP(curvetime, 0.0f, 1.0f);
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* fixed position along curve */
|
||||
curvetime= data->offset_fac;
|
||||
|
Loading…
Reference in New Issue
Block a user