Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2009-04-13 15:15:43 +0400
committerJoshua Leung <aligorith@gmail.com>2009-04-13 15:15:43 +0400
commit4263c13c392fadea67f7b4884fb6af50585a6c69 (patch)
tree5ebe4a797fc21c6ecfbe660701c2597b65104f59 /source/blender/blenkernel/intern/action.c
parentb27e240124a89b6ab09eda33b90b457999d566c7 (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/action.c')
-rw-r--r--source/blender/blenkernel/intern/action.c30
1 files changed, 26 insertions, 4 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++;