[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [19704] branches/blender2.5/blender/source /blender: Animato Bugfixes:

Joshua Leung aligorith at gmail.com
Mon Apr 13 13:15:44 CEST 2009


Revision: 19704
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19704
Author:   aligorith
Date:     2009-04-13 13:15:43 +0200 (Mon, 13 Apr 2009)

Log Message:
-----------
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.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/blenkernel/intern/action.c
    branches/blender2.5/blender/source/blender/blenkernel/intern/anim_sys.c
    branches/blender2.5/blender/source/blender/blenkernel/intern/fcurve.c
    branches/blender2.5/blender/source/blender/editors/armature/poselib.c
    branches/blender2.5/blender/source/blender/editors/space_action/action_draw.c
    branches/blender2.5/blender/source/blender/editors/space_graph/graph_draw.c

Modified: branches/blender2.5/blender/source/blender/blenkernel/intern/action.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/intern/action.c	2009-04-13 06:50:02 UTC (rev 19703)
+++ branches/blender2.5/blender/source/blender/blenkernel/intern/action.c	2009-04-13 11:15:43 UTC (rev 19704)
@@ -169,18 +169,40 @@
 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++;
 	

Modified: branches/blender2.5/blender/source/blender/blenkernel/intern/anim_sys.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/intern/anim_sys.c	2009-04-13 06:50:02 UTC (rev 19703)
+++ branches/blender2.5/blender/source/blender/blenkernel/intern/anim_sys.c	2009-04-13 11:15:43 UTC (rev 19704)
@@ -279,6 +279,10 @@
 			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 @@
 	// 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);

Modified: branches/blender2.5/blender/source/blender/blenkernel/intern/fcurve.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/intern/fcurve.c	2009-04-13 06:50:02 UTC (rev 19703)
+++ branches/blender2.5/blender/source/blender/blenkernel/intern/fcurve.c	2009-04-13 11:15:43 UTC (rev 19704)
@@ -98,7 +98,9 @@
 		
 	/* 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);

Modified: branches/blender2.5/blender/source/blender/editors/armature/poselib.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/armature/poselib.c	2009-04-13 06:50:02 UTC (rev 19703)
+++ branches/blender2.5/blender/source/blender/editors/armature/poselib.c	2009-04-13 11:15:43 UTC (rev 19704)
@@ -193,8 +193,7 @@
 	/* init object's poselib action (unlink old one if there) */
 	if (ob->poselib)
 		ob->poselib->id.us--;
-	// XXX old anim stuff
-	// ob->poselib= add_empty_action("PoseLib");
+	ob->poselib= add_empty_action("PoseLib");
 	
 	return ob->poselib;
 }

Modified: branches/blender2.5/blender/source/blender/editors/space_action/action_draw.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_action/action_draw.c	2009-04-13 06:50:02 UTC (rev 19703)
+++ branches/blender2.5/blender/source/blender/editors/space_action/action_draw.c	2009-04-13 11:15:43 UTC (rev 19704)
@@ -499,7 +499,7 @@
 						expand= ICON_TRIA_RIGHT;
 					
 					sel = SEL_ACTC(act);
-					strcpy(name, "Action");
+					strcpy(name, act->id.name+2);
 				}
 					break;
 				case ANIMTYPE_FILLMATD: /* object materials (dopesheet) expand widget */

Modified: branches/blender2.5/blender/source/blender/editors/space_graph/graph_draw.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_graph/graph_draw.c	2009-04-13 06:50:02 UTC (rev 19703)
+++ branches/blender2.5/blender/source/blender/editors/space_graph/graph_draw.c	2009-04-13 11:15:43 UTC (rev 19704)
@@ -1007,7 +1007,7 @@
 						expand= ICON_TRIA_RIGHT;
 					
 					sel = SEL_ACTC(act);
-					strcpy(name, "Action");
+					strcpy(name, act->id.name+2);
 				}
 					break;
 				case ANIMTYPE_FILLDRIVERS: /* drivers widget */





More information about the Bf-blender-cvs mailing list