[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [25463] trunk/blender/source/blender/ blenloader/intern/readfile.c: Fix #20423: particle system deflection settings were not read correctly,

Brecht Van Lommel brecht at blender.org
Fri Dec 18 14:08:11 CET 2009


Revision: 25463
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=25463
Author:   blendix
Date:     2009-12-18 14:08:11 +0100 (Fri, 18 Dec 2009)

Log Message:
-----------
Fix #20423: particle system deflection settings were not read correctly,
causing crashes on free and duplication.

Modified Paths:
--------------
    trunk/blender/source/blender/blenloader/intern/readfile.c

Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c	2009-12-18 11:55:18 UTC (rev 25462)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c	2009-12-18 13:08:11 UTC (rev 25463)
@@ -3070,6 +3070,12 @@
 	}
 }
 
+void lib_link_partdeflect(FileData *fd, ID *id, PartDeflect *pd)
+{
+	if(pd && pd->tex)
+		pd->tex=newlibadr_us(fd, id->lib, pd->tex);
+}
+
 static void lib_link_particlesettings(FileData *fd, Main *main)
 {
 	ParticleSettings *part;
@@ -3086,6 +3092,9 @@
 			part->eff_group = newlibadr(fd, part->id.lib, part->eff_group);
 			part->bb_ob = newlibadr(fd, part->id.lib, part->bb_ob);
 
+			lib_link_partdeflect(fd, &part->id, part->pd);
+			lib_link_partdeflect(fd, &part->id, part->pd2);
+
 			if(part->effector_weights)
 				part->effector_weights->group = newlibadr(fd, part->id.lib, part->effector_weights->group);
 
@@ -3122,12 +3131,20 @@
 	}
 }
 
+static void direct_link_partdeflect(PartDeflect *pd)
+{
+	if(pd) pd->rng=NULL;
+}
+
 static void direct_link_particlesettings(FileData *fd, ParticleSettings *part)
 {
 	part->adt= newdataadr(fd, part->adt);
 	part->pd= newdataadr(fd, part->pd);
 	part->pd2= newdataadr(fd, part->pd2);
 
+	direct_link_partdeflect(part->pd);
+	direct_link_partdeflect(part->pd2);
+
 	part->effector_weights = newdataadr(fd, part->effector_weights);
 	if(!part->effector_weights)
 		part->effector_weights = BKE_add_effector_weights(part->eff_group);
@@ -3714,8 +3731,7 @@
 			
 			/* texture field */
 			if(ob->pd)
-				if(ob->pd->tex)
-					ob->pd->tex=newlibadr_us(fd, ob->id.lib, ob->pd->tex);
+				lib_link_partdeflect(fd, &ob->id, ob->pd);
 
 			if(ob->soft)
 				ob->soft->effector_weights->group = newlibadr(fd, ob->id.lib, ob->soft->effector_weights->group);
@@ -4030,8 +4046,7 @@
 	}
 
 	ob->pd= newdataadr(fd, ob->pd);
-	if(ob->pd)
-		ob->pd->rng=NULL;
+	direct_link_partdeflect(ob->pd);
 	ob->soft= newdataadr(fd, ob->soft);
 	if(ob->soft) {
 		SoftBody *sb= ob->soft;		





More information about the Bf-blender-cvs mailing list