diff options
author | Ton Roosendaal <ton@blender.org> | 2005-12-17 22:02:39 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2005-12-17 22:02:39 +0300 |
commit | 6d9cda7aaaf117d8043dc850289254dbf1da01b4 (patch) | |
tree | 3f0e3a13ef8edad3334fc310a294ce434c9b59bd /source/blender | |
parent | 7fd55a735df3bfa827273643277ed2c37818fff8 (diff) |
Orange:
Enabled Striding in NLA to also use FollowPath Constraint. Until now it
only worked when Object was parented to a Curve.
Interesting feature now is that it checks for all FollowPath Constraints,
and it chooses to stride over the first Path found with influence > 0.5.
Note: to make swithing to other paths work, map the time curve for these
paths to match the switch. This is not very NLA friendly... but let the
dudes in studio test it first. :)
Todo for later once; ensure proper blending...
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/action.c | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index f253cd6a705..0cbccd2a1b4 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -804,6 +804,26 @@ static float stridechannel_frame(Object *ob, bActionStrip *strip, Path *path, fl return 0.0f; } +/* simple case for now; only the curve path with constraint value > 0.5 */ +/* blending we might do later... */ +static Object *get_parent_path(Object *ob) +{ + bConstraint *con; + + if(ob->parent && ob->parent->type==OB_CURVE) + return ob->parent; + + for (con = ob->constraints.first; con; con=con->next) { + if(con->type==CONSTRAINT_TYPE_FOLLOWPATH) { + if(con->enforce>0.5f) { + bFollowPathConstraint *data= con->data; + return data->tar; + } + } + } + return NULL; +} + /* ************** do the action ************ */ static void do_nla(Object *ob, int blocktype) @@ -872,17 +892,19 @@ static void do_nla(Object *ob, int blocktype) /* Handle path */ if ((strip->flag & ACTSTRIP_USESTRIDE) && (blocktype==ID_AR) && (ob->ipoflag & OB_DISABLE_PATH)==0){ - if (ob->parent && ob->parent->type==OB_CURVE){ - Curve *cu = ob->parent->data; + Object *parent= get_parent_path(ob); + + if (parent) { + Curve *cu = parent->data; float ctime, pdist; if (cu->flag & CU_PATH){ /* Ensure we have a valid path */ - if(cu->path==NULL || cu->path->data==NULL) makeDispListCurveTypes(ob->parent, 0); + if(cu->path==NULL || cu->path->data==NULL) makeDispListCurveTypes(parent, 0); if(cu->path) { /* Find the position on the path */ - ctime= bsystem_time(ob, ob->parent, scene_cfra, 0.0); + ctime= bsystem_time(ob, parent, scene_cfra, 0.0); if(calc_ipo_spec(cu->ipo, CU_SPEED, &ctime)==0) { ctime /= cu->pathlen; @@ -891,7 +913,7 @@ static void do_nla(Object *ob, int blocktype) pdist = ctime*cu->path->totdist; if(tpose && strip->stridechannel[0]) { - striptime= stridechannel_frame(ob->parent, strip, cu->path, pdist, tpose->stride_offset); + striptime= stridechannel_frame(parent, strip, cu->path, pdist, tpose->stride_offset); } else { if (strip->stridelen) { |