diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-04-13 15:15:43 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-04-13 15:15:43 +0400 |
commit | 4263c13c392fadea67f7b4884fb6af50585a6c69 (patch) | |
tree | 5ebe4a797fc21c6ecfbe660701c2597b65104f59 /source/blender/blenkernel/intern | |
parent | b27e240124a89b6ab09eda33b90b457999d566c7 (diff) |
Animato Bugfixes:
* Copying objects with animation data now works correctly. Previously, actions were not getting copied correctly, leading to loss of data in some cases.
* Action and Graph editors now display the name of the Action concerned (for 'Action' folder channels), making it easier to tell which AnimData blocks are sharing the same actions
* Added some code to make relative KeyingSets (converted from absolute ones) work better.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/action.c | 30 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/anim_sys.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/fcurve.c | 2 |
3 files changed, 33 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 9ed469c9028..7221650ac44 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -169,17 +169,39 @@ void free_action (bAction *act) bAction *copy_action (bAction *src) { bAction *dst = NULL; - //bActionGroup *dgrp, *sgrp; // XXX not used yet + bActionGroup *dgrp, *sgrp; + FCurve *dfcu, *sfcu; if (src == NULL) return NULL; dst= copy_libblock(src); - BLI_duplicatelist(&dst->groups, &src->groups); // XXX not used yet + /* duplicate the lists of groups and markers */ + BLI_duplicatelist(&dst->groups, &src->groups); BLI_duplicatelist(&dst->markers, &src->markers); - /* copy f-curves */ - copy_fcurves(&dst->curves, &src->curves); + /* copy F-Curves, fixing up the links as we go */ + dst->curves.first= dst->curves.last= NULL; + + for (sfcu= src->curves.first; sfcu; sfcu= sfcu->next) { + /* duplicate F-Curve */ + dfcu= copy_fcurve(sfcu); + BLI_addtail(&dst->curves, dfcu); + + /* fix group links (kindof bad list-in-list search, but this is the most reliable way) */ + for (dgrp=dst->groups.first, sgrp=src->groups.first; dgrp && sgrp; dgrp=dgrp->next, sgrp=sgrp->next) { + if (sfcu->grp == sgrp) { + dfcu->grp= dgrp; + + if (dgrp->channels.first == sfcu) + dgrp->channels.first= dfcu; + if (dgrp->channels.last == sfcu) + dgrp->channels.last= dfcu; + + break; + } + } + } dst->id.flag |= LIB_FAKEUSER; // XXX this is nasty for new users... maybe we don't want this anymore dst->id.us++; diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index f1340215967..ebced7837ae 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -279,6 +279,10 @@ void BKE_keyingset_add_destination (KeyingSet *ks, ID *id, const char group_name strcpy(ksp->group, ""); } + /* store additional info for relative paths (just in case user makes the set relative) */ + if (id) + ksp->idtype= GS(id->name); + /* just copy path info */ // XXX no checks are performed for templates yet // should array index be checked too? @@ -859,7 +863,7 @@ void BKE_animsys_evaluate_all_animation (Main *main, float ctime) // TODO... /* objects */ - EVAL_ANIM_IDS(main->object.first, 0); + EVAL_ANIM_IDS(main->object.first, ADT_RECALC_ANIM); /* worlds */ EVAL_ANIM_IDS(main->world.first, ADT_RECALC_ANIM); diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index acdaec63c3b..3e1b6f29403 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -98,7 +98,9 @@ FCurve *copy_fcurve (FCurve *fcu) /* make a copy */ fcu_d= MEM_dupallocN(fcu); + fcu_d->next= fcu_d->prev= NULL; + fcu_d->grp= NULL; /* copy curve data */ fcu_d->bezt= MEM_dupallocN(fcu_d->bezt); |