[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14399] trunk/blender/source/blender/ blenkernel/intern:

Brecht Van Lommel brechtvanlommel at pandora.be
Sat Apr 12 20:15:10 CEST 2008


Revision: 14399
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14399
Author:   blendix
Date:     2008-04-12 20:15:10 +0200 (Sat, 12 Apr 2008)

Log Message:
-----------

Fix for bug #8936: particle system crash with vertex groups and
zero vertices in a mesh.

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

Modified: trunk/blender/source/blender/blenkernel/intern/particle.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/particle.c	2008-04-12 17:34:48 UTC (rev 14398)
+++ trunk/blender/source/blender/blenkernel/intern/particle.c	2008-04-12 18:15:10 UTC (rev 14399)
@@ -1010,7 +1010,7 @@
 
 float psys_interpolate_value_from_verts(DerivedMesh *dm, short from, int index, float *fw, float *values)
 {
-	if(values==0)
+	if(values==0 || index==-1)
 		return 0.0;
 
 	switch(from){

Modified: trunk/blender/source/blender/blenkernel/intern/particle_system.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/particle_system.c	2008-04-12 17:34:48 UTC (rev 14398)
+++ trunk/blender/source/blender/blenkernel/intern/particle_system.c	2008-04-12 18:15:10 UTC (rev 14399)
@@ -1116,7 +1116,8 @@
 	if(tot==0){
 		no_distr=1;
 		if(children){
-			fprintf(stderr,"Particle child distribution error: Nothing to emit from!\n");
+			if(G.f & G_DEBUG)
+				fprintf(stderr,"Particle child distribution error: Nothing to emit from!\n");
 			for(p=0,cpa=psys->child; p<totpart; p++,cpa++){
 				cpa->fuv[0]=cpa->fuv[1]=cpa->fuv[2]=cpa->fuv[3]= 0.0;
 				cpa->foffset= 0.0f;
@@ -1126,7 +1127,8 @@
 			}
 		}
 		else {
-			fprintf(stderr,"Particle distribution error: Nothing to emit from!\n");
+			if(G.f & G_DEBUG)
+				fprintf(stderr,"Particle distribution error: Nothing to emit from!\n");
 			for(p=0,pa=psys->particles; p<totpart; p++,pa++){
 				pa->fuv[0]=pa->fuv[1]=pa->fuv[2]= pa->fuv[3]= 0.0;
 				pa->foffset= 0.0f;
@@ -1737,9 +1739,8 @@
 		/* get possible textural influence */
 		psys_get_texture(ob,give_current_material(ob,part->omat),psmd,psys,pa,&ptex,MAP_PA_IVEL);
 
-		if(vg_vel){
+		if(vg_vel && pa->num != -1)
 			ptex.ivel*=psys_interpolate_value_from_verts(psmd->dm,part->from,pa->num,pa->fuv,vg_vel);
-		}
 
 		/* particles live in global space so	*/
 		/* let's convert:						*/





More information about the Bf-blender-cvs mailing list