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

Joshua Leung aligorith at gmail.com
Fri Jan 23 03:50:33 CET 2009


Revision: 18628
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18628
Author:   aligorith
Date:     2009-01-23 03:50:04 +0100 (Fri, 23 Jan 2009)

Log Message:
-----------
Animato Bugfixes:

* Fixed bug in with RNA-paths. String identifiers (i.e. some_collection["somekey"]) were not getting handled at all due to wrong indices it seems. I don't know of any other code using this, so hopefully there aren't any unintended bugs caused by this. 
This means that bone animation now works again.

* Added a few more sanity checks to file-reading code, and heaps of extra prints everywhere else for debugging purposes (these will be removed in due course).

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/blenkernel/intern/ipo.c
    branches/blender2.5/blender/source/blender/editors/animation/anim_filter.c
    branches/blender2.5/blender/source/blender/editors/include/ED_anim_api.h
    branches/blender2.5/blender/source/blender/editors/space_action/action_draw.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_access.c

Modified: branches/blender2.5/blender/source/blender/blenkernel/intern/ipo.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/intern/ipo.c	2009-01-22 18:09:59 UTC (rev 18627)
+++ branches/blender2.5/blender/source/blender/blenkernel/intern/ipo.c	2009-01-23 02:50:04 UTC (rev 18628)
@@ -484,29 +484,35 @@
 	 *	- beztriples are more likely to be encountered as they are keyframes (the other type wasn't used yet)
 	 */
 	// XXX we need to cope with the nasty old 'bitflag' curves... that will be a task for later
+	// XXX we also need to correct values for object-rotation curves
 	fcu->totvert= icu->totvert;
 	
 	if (icu->bezt) {
+		BezTriple *dst, *src;
+		
 		/* allocate new array for keyframes/beztriples */
 		fcu->bezt= MEM_callocN(sizeof(BezTriple)*fcu->totvert, "BezTriples");
 		
-		/* check if we need to set interpolation settings (thus doing it the 'slow' way) */
-		if (icu->ipo != IPO_MIXED) {
-			BezTriple *dst, *src;
+		/* loop through copying all BezTriples individually, as we need to modify a few things */
+		for (dst=fcu->bezt, src=icu->bezt; i < fcu->totvert; i++, dst++, src++) {
+			/* firstly, copy BezTriple data */
+			*dst= *src;
 			
-			/* loop through copying all BezTriples, as we need to set interpolation settings too */
-			for (dst=fcu->bezt, src=icu->bezt; i < fcu->totvert; i++, dst++, src++) {
-				/* firstly, copy BezTriple data */
-				*dst= *src;
+			/* now copy interpolation from curve (if not already set) */
+			if (icu->ipo != IPO_MIXED)
+				dst->ipo= icu->ipo;
 				
-				/* now copy interpolation from curve */
-				dst->ipo= icu->ipo;
+			/* correct values for object rotation curves - they were degrees/10 */
+			// XXX for now, just make them into degrees 
+			if ((icu->blocktype == ID_OB) && ELEM3(icu->adrcode, OB_ROT_X, OB_ROT_Y, OB_ROT_Z)) {
+				dst->vec[0][0] *= 10.0f;
+				dst->vec[1][0] *= 10.0f;
+				dst->vec[2][0] *= 10.0f;
 			}
 		}
-		else {
-			/* interpolation already set (from AnimSys2 branch) */
-			memcpy(fcu->bezt, icu->bezt, sizeof(BezTriple)*fcu->totvert);
-		}
+		
+		/* free this data now */
+		MEM_freeN(icu->bezt);
 	}
 	else if (icu->bp) {
 		/* TODO: need to convert from BPoint type to the more compact FPoint type... but not priority, since no data used this */
@@ -568,7 +574,6 @@
 static void ipo_to_animdata (ID *id, Ipo *ipo, char *actname, char *constname)
 {
 	AnimData *adt= BKE_animdata_from_id(id);
-	bAction *act= adt->action;
 	//bActionGroup *grp;
 	IpoCurve *icu, *icn;
 	FCurve *fcu;
@@ -576,6 +581,10 @@
 	/* sanity check */
 	if ELEM(NULL, id, ipo)
 		return;
+	if (adt == NULL) {
+		printf("ERROR ipo_to_animdata(): adt invalid \n");
+		return;
+	}
 	
 	printf("ipo to animdata - ID:%s, IPO:%s, actname:%s constname:%s  curves:%d \n", 
 		id->name+2, ipo->id.name+2, (actname)?actname:"<None>", (constname)?constname:"<None>", 
@@ -609,11 +618,13 @@
 		/* conversion path depends on whether it's a driver or not */
 		if (fcu->driver == NULL) {
 			/* try to get action */
-			if (adt->action == NULL)
-				act= adt->action= add_empty_action("ConvertedAction"); // XXX we need a better name for this...
+			if (adt->action == NULL) {
+				adt->action= add_empty_action("ConvertedAction"); // XXX we need a better name for this...
+				printf("added new action \n");
+			}
 				
 			/* add F-Curve to action */
-			BLI_addtail(&act->curves, fcu);
+			BLI_addtail(&adt->action->curves, fcu);
 		}
 		else {
 			/* add F-Curve to AnimData's drivers */
@@ -646,6 +657,7 @@
 	/* check if we need to set this Action as the AnimData's action */
 	if (adt->action == NULL) {
 		/* set this Action as AnimData's Action */
+		printf("act_to_adt - set adt action to act \n");
 		adt->action= act;
 	}
 		

Modified: branches/blender2.5/blender/source/blender/editors/animation/anim_filter.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/animation/anim_filter.c	2009-01-22 18:09:59 UTC (rev 18627)
+++ branches/blender2.5/blender/source/blender/editors/animation/anim_filter.c	2009-01-23 02:50:04 UTC (rev 18628)
@@ -289,16 +289,10 @@
 		
 		ale->data= data;
 		ale->type= datatype;
+			// XXX what is the point of the owner data?
 		ale->owner= owner;
 		ale->ownertype= ownertype;
 		
-		if ((owner) && (ownertype == ANIMTYPE_FCURVE)) {
-			FCurve *ofcu= (FCurve *)owner;
-			ale->grp= ofcu->grp;
-		}
-		else 
-			ale->grp= NULL;
-		
 		/* do specifics */
 		switch (datatype) {
 			case ANIMTYPE_OBJECT:
@@ -664,7 +658,7 @@
 }
 #endif 
 
-#if 0 // XXX old anim sys
+
 static int animdata_filter_dopesheet_mats (ListBase *anim_data, bDopeSheet *ads, Base *base, int filter_mode)
 {
 	bAnimListElem *ale=NULL;
@@ -672,7 +666,7 @@
 	int items = 0;
 	
 	/* include materials-expand widget? */
-	if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & (ANIMFILTER_IPOKEYS|ANIMFILTER_ONLYFCU))) {
+	if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_CURVESONLY)) {
 		ale= make_new_animlistelem(ob, ANIMTYPE_FILLMATD, base, ANIMTYPE_OBJECT);
 		if (ale) {
 			BLI_addtail(anim_data, ale);
@@ -681,7 +675,7 @@
 	}
 	
 	/* add materials? */
-	if (FILTER_MAT_OBJC(ob) || (filter_mode & ANIMFILTER_IPOKEYS) || (filter_mode & ANIMFILTER_ONLYFCU)) {
+	if (FILTER_MAT_OBJC(ob) || (filter_mode & ANIMFILTER_CURVESONLY)) {
 		short a;
 		
 		/* for each material, either add channels separately, or as ipo-block */
@@ -689,11 +683,11 @@
 			Material *ma= give_current_material(ob, a);
 			
 			/* for now, if no material returned, skip (this shouldn't confuse the user I hope) */
-			if (ELEM(NULL, ma, ma->ipo)) continue;
+			if (ELEM(NULL, ma, ma->adt)) continue;
 			
 			/* include material-expand widget? */
 			// hmm... do we need to store the index of this material in the array anywhere?
-			if (filter_mode & (ANIMFILTER_CHANNELS|ANIMFILTER_IPOKEYS)) {
+			if (filter_mode & ANIMFILTER_CHANNELS) {
 				ale= make_new_animlistelem(ma, ANIMTYPE_DSMAT, base, ANIMTYPE_OBJECT);
 				if (ale) {
 					BLI_addtail(anim_data, ale);
@@ -702,10 +696,8 @@
 			}
 			
 			/* add material's ipo-curve channels? */
-			if ( (FILTER_MAT_OBJD(ma) || (filter_mode & ANIMFILTER_ONLYFCU)) && 
-				  !(filter_mode & ANIMFILTER_IPOKEYS) ) 
-			{
-				items += animdata_filter_ipocurves(anim_data, ma->ipo, filter_mode, base, ANIMTYPE_OBJECT, (ID *)ma);
+			if (FILTER_MAT_OBJD(ma) || (filter_mode & ANIMFILTER_CURVESONLY)) {
+				//items += animdata_filter_ipocurves(anim_data, ma->ipo, filter_mode, base, ANIMTYPE_OBJECT, (ID *)ma);
 			}
 		}
 
@@ -715,6 +707,8 @@
 	return items;
 }
 
+#if 0 // XXX old anim sys
+
 static int animdata_filter_dopesheet_cam (ListBase *anim_data, bDopeSheet *ads, Base *base, int filter_mode)
 {
 	bAnimListElem *ale=NULL;
@@ -826,7 +820,7 @@
 		AnimData *adt= ob->adt;
 		
 		/* include action-expand widget? */
-		if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & (ANIMFILTER_CURVESONLY))) {
+		if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_CURVESONLY)) {
 			ale= make_new_animlistelem(adt->action, ANIMTYPE_FILLACTD, base, ANIMTYPE_OBJECT);
 			if (ale) {
 				ale->id= (ID *)ob; // err.... is this a good idea?
@@ -846,7 +840,7 @@
 	/* ShapeKeys? */
 	if ((key) && !(ads->filterflag & ADS_FILTER_NOSHAPEKEYS)) {
 		/* include shapekey-expand widget? */
-		if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & (ANIMFILTER_IPOKEYS|ANIMFILTER_ONLYFCU))) {
+		if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_CURVESONLY)) {
 			ale= make_new_animlistelem(key, ANIMTYPE_DSSKEY, base, ANIMTYPE_OBJECT);
 			if (ale) {
 				BLI_addtail(anim_data, ale);
@@ -855,15 +849,18 @@
 		}
 		
 		/* add channels */
-		if (FILTER_SKE_OBJD(key) || (filter_mode & ANIMFILTER_IPOKEYS) || (filter_mode & ANIMFILTER_ONLYFCU)) {
+		if (FILTER_SKE_OBJD(key) || (filter_mode & ANIMFILTER_CURVESONLY)) {
 			items += animdata_filter_shapekey(anim_data, key, filter_mode, ob, ANIMTYPE_OBJECT);
 		}
 	}
+#endif
 	
+
 	/* Materials? */
 	if ((ob->totcol) && !(ads->filterflag & ADS_FILTER_NOMAT))
 		items += animdata_filter_dopesheet_mats(anim_data, ads, base, filter_mode);
 	
+#if 0
 	/* Object Data */
 	switch (ob->type) {
 		case OB_CAMERA: /* ------- Camera ------------ */
@@ -888,7 +885,7 @@
 		}
 			break;
 	}
-#endif // XXX fixme...
+#endif
 	
 	/* return the number of items added to the list */
 	return items;
@@ -936,6 +933,7 @@
 					/* only selected should be shown */
 					continue;
 				}
+#if 0
 				if ((ads->filterflag & ADS_FILTER_NOARM) && (ob->type == OB_ARMATURE)) {
 					/* not showing armatures  */
 					continue;
@@ -944,6 +942,7 @@
 					/* not showing objects that aren't armatures */
 					continue;
 				}
+#endif
 				
 				/* check filters for datatypes */
 				actOk= (ANIMDATA_HAS_KEYS(ob) /*&& !(ads->filterflag & ADS_FILTER_NOACTS)*/);

Modified: branches/blender2.5/blender/source/blender/editors/include/ED_anim_api.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/include/ED_anim_api.h	2009-01-22 18:09:59 UTC (rev 18627)
+++ branches/blender2.5/blender/source/blender/editors/include/ED_anim_api.h	2009-01-23 02:50:04 UTC (rev 18628)
@@ -93,10 +93,9 @@
 	void	*key_data;	/* motion data - ipo or ipo-curve */
 	short	datatype;	/* type of motion data to expect */
 	
-	struct ID *id;				/* ID block (ID_SC, ID_SCE, or ID_OB) that owns the channel */
-	struct bActionGroup *grp;	/* action group that owns the channel (only for Action/Dopesheet) */
+	struct ID *id;				/* ID block that channel is attached to (may be used  */
 	
-	void 	*owner;		/* will either be an action channel or fake ipo-channel (for keys) */
+	void 	*owner;		/* group or channel which acts as this channel's owner */
 	short	ownertype;	/* type of owner */
 } bAnimListElem;
 

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-01-22 18:09:59 UTC (rev 18627)
+++ branches/blender2.5/blender/source/blender/editors/space_action/action_draw.c	2009-01-23 02:50:04 UTC (rev 18628)
@@ -617,11 +617,11 @@
 				{
 					FCurve *fcu = (FCurve *)ale->data;
 					
-					indent = 2;
+					indent = 0;
 					protect = -1; // for now, until this can be supported by others
 					
-					group= (ale->grp) ? 1 : 0;

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list