[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36230] trunk/blender/source/blender/ blenkernel/intern/ipo.c: fix for crash when loading testfile from report [ #27002].

Campbell Barton ideasman42 at gmail.com
Wed Apr 20 03:21:57 CEST 2011


Revision: 36230
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36230
Author:   campbellbarton
Date:     2011-04-20 01:21:55 +0000 (Wed, 20 Apr 2011)
Log Message:
-----------
fix for crash when loading testfile from report [#27002].
error in r36222, also move AnimData *adt definitions inline to ensure they don't get mis-used across different ID types.

Revision Links:
--------------
    http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36222

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/ipo.c

Modified: trunk/blender/source/blender/blenkernel/intern/ipo.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/ipo.c	2011-04-19 23:52:14 UTC (rev 36229)
+++ trunk/blender/source/blender/blenkernel/intern/ipo.c	2011-04-20 01:21:55 UTC (rev 36230)
@@ -1668,7 +1668,6 @@
 {
 	ListBase drivers = {NULL, NULL};
 	ID *id;
-	AnimData *adt;
 	
 	if (main == NULL) {
 		printf("Argh! Main is NULL in do_versions_ipos_to_animato() \n");
@@ -1697,7 +1696,7 @@
 		/* check if object has any animation data */
 		if (ob->nlastrips.first) {
 			/* Add AnimData block */
-			adt= BKE_id_add_animdata(id);
+			BKE_id_add_animdata(id);
 			
 			/* IPO first to take into any non-NLA'd Object Animation */
 			if (ob->ipo) {
@@ -1720,7 +1719,7 @@
 		}
 		else if ((ob->ipo) || (ob->action)) {
 			/* Add AnimData block */
-			adt= BKE_id_add_animdata(id);
+			AnimData *adt= BKE_id_add_animdata(id);
 			
 			/* Action first - so that Action name get conserved */
 			if (ob->action) {
@@ -1806,8 +1805,11 @@
 		}
 		
 		/* object's action will always be object-rooted */
-		if (adt->action)
-			adt->action->idroot = ID_OB;
+		{
+			AnimData *adt= BKE_animdata_from_id(id);
+			if (adt && adt->action)
+				adt->action->idroot = ID_OB;
+		}
 	}
 	
 	/* shapekeys */
@@ -1822,7 +1824,7 @@
 		 */
 		if (key->ipo) {
 			/* Add AnimData block */
-			adt= BKE_id_add_animdata(id);
+			AnimData *adt= BKE_id_add_animdata(id);
 			
 			/* Convert Shapekey data... */
 			ipo_to_animdata(id, key->ipo, NULL, NULL, NULL);
@@ -1844,7 +1846,7 @@
 		/* we're only interested in the IPO */
 		if (ma->ipo) {
 			/* Add AnimData block */
-			adt= BKE_id_add_animdata(id);
+			AnimData *adt= BKE_id_add_animdata(id);
 			
 			/* Convert Material data... */
 			ipo_to_animdata(id, ma->ipo, NULL, NULL, NULL);
@@ -1866,7 +1868,7 @@
 		/* we're only interested in the IPO */
 		if (wo->ipo) {
 			/* Add AnimData block */
-			adt= BKE_id_add_animdata(id);
+			AnimData *adt= BKE_id_add_animdata(id);
 			
 			/* Convert World data... */
 			ipo_to_animdata(id, wo->ipo, NULL, NULL, NULL);
@@ -1886,7 +1888,7 @@
 		if (ed && ed->seqbasep) {
 			Sequence * seq;
 			
-			adt= BKE_id_add_animdata(id);
+			AnimData *adt= BKE_id_add_animdata(id);
 			
 			SEQ_BEGIN(ed, seq) {
 				IpoCurve *icu = (seq->ipo) ? seq->ipo->curve.first : NULL;
@@ -1941,7 +1943,7 @@
 		/* we're only interested in the IPO */
 		if (te->ipo) {
 			/* Add AnimData block */
-			adt= BKE_id_add_animdata(id);
+			AnimData *adt= BKE_id_add_animdata(id);
 			
 			/* Convert Texture data... */
 			ipo_to_animdata(id, te->ipo, NULL, NULL, NULL);
@@ -1963,7 +1965,7 @@
 		/* we're only interested in the IPO */
 		if (ca->ipo) {
 			/* Add AnimData block */
-			adt= BKE_id_add_animdata(id);
+			AnimData *adt= BKE_id_add_animdata(id);
 			
 			/* Convert Camera data... */
 			ipo_to_animdata(id, ca->ipo, NULL, NULL, NULL);
@@ -1985,7 +1987,7 @@
 		/* we're only interested in the IPO */
 		if (la->ipo) {
 			/* Add AnimData block */
-			adt= BKE_id_add_animdata(id);
+			AnimData *adt= BKE_id_add_animdata(id);
 			
 			/* Convert Lamp data... */
 			ipo_to_animdata(id, la->ipo, NULL, NULL, NULL);
@@ -2007,7 +2009,7 @@
 		/* we're only interested in the IPO */
 		if (cu->ipo) {
 			/* Add AnimData block */
-			adt= BKE_id_add_animdata(id);
+			AnimData *adt= BKE_id_add_animdata(id);
 			
 			/* Convert Curve data... */
 			ipo_to_animdata(id, cu->ipo, NULL, NULL, NULL);




More information about the Bf-blender-cvs mailing list