diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-04-14 14:18:48 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-04-14 14:18:48 +0400 |
commit | 2d17d8623910b7cbcb353d410a47b9c758d8bc41 (patch) | |
tree | a07a0ba63591d1e64cbdd48bb0e2104a2284c316 | |
parent | cf6a1630cf365354a74e9a721a4122a3fc7481c9 (diff) |
Action Code - Tidied up some code that wasn't working yet
-rw-r--r-- | source/blender/blenkernel/BKE_action.h | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/action.c | 43 |
2 files changed, 18 insertions, 28 deletions
diff --git a/source/blender/blenkernel/BKE_action.h b/source/blender/blenkernel/BKE_action.h index a5a978ae3fa..ccab3ecb99e 100644 --- a/source/blender/blenkernel/BKE_action.h +++ b/source/blender/blenkernel/BKE_action.h @@ -64,9 +64,8 @@ void free_action(struct bAction *act); // XXX is this needed? void make_local_action(struct bAction *act); - + /* Some kind of bounding box operation on the action */ -// XXX depreceated.. void calc_action_range(const struct bAction *act, float *start, float *end, int incl_hidden); /* Action Groups API ----------------- */ diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 7221650ac44..a64177259b8 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -762,38 +762,27 @@ float get_action_frame_inv(Object *ob, float cframe) /* Calculate the extents of given action */ void calc_action_range(const bAction *act, float *start, float *end, int incl_hidden) { - // FCurve *fcu; + FCurve *fcu; float min=999999999.0f, max=-999999999.0f; - int foundvert=0; + short foundvert=0; if (act) { -#if 0 // XXX old animation system - for (chan=act->chanbase.first; chan; chan=chan->next) { - if ((incl_hidden) || (chan->flag & ACHAN_HIDDEN)==0) { - if (chan->ipo) { - for (icu=chan->ipo->curve.first; icu; icu=icu->next) { - if (icu->totvert) { - min= MIN2(min, icu->bezt[0].vec[1][0]); - max= MAX2(max, icu->bezt[icu->totvert-1].vec[1][0]); - foundvert=1; - } - } - } - for (conchan=chan->constraintChannels.first; conchan; conchan=conchan->next) { - if (conchan->ipo) { - for (icu=conchan->ipo->curve.first; icu; icu=icu->next) { - if (icu->totvert) { - min= MIN2(min, icu->bezt[0].vec[1][0]); - max= MAX2(max, icu->bezt[icu->totvert-1].vec[1][0]); - foundvert=1; - } - } - } - } + for (fcu= act->curves.first; fcu; fcu= fcu->next) { + if (fcu->totvert) { + float nmin, nmax; + + /* get extents for this curve */ + calc_fcurve_range(fcu, &nmin, &nmax); + + /* compare to the running tally */ + min= MIN2(min, nmin); + max= MAX2(max, nmax); + + foundvert= 1; } } -#endif // XXX old animation system } + if (foundvert) { if(min==max) max+= 1.0f; *start= min; @@ -869,9 +858,11 @@ void copy_pose_result(bPose *to, bPose *from) if(pchanto) { Mat4CpyMat4(pchanto->pose_mat, pchanfrom->pose_mat); Mat4CpyMat4(pchanto->chan_mat, pchanfrom->chan_mat); + /* used for local constraints */ VECCOPY(pchanto->loc, pchanfrom->loc); QUATCOPY(pchanto->quat, pchanfrom->quat); + VECCOPY(pchanto->eul, pchanfrom->eul); VECCOPY(pchanto->size, pchanfrom->size); VECCOPY(pchanto->pose_head, pchanfrom->pose_head); |