[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [20767] trunk/blender/source/blender/ blenkernel/intern/particle_system.c: Fix for bug #18710: a crash with hair emitted from vertices.

Brecht Van Lommel brecht at blender.org
Tue Jun 9 20:50:03 CEST 2009


Revision: 20767
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20767
Author:   blendix
Date:     2009-06-09 20:50:02 +0200 (Tue, 09 Jun 2009)

Log Message:
-----------
Fix for bug #18710: a crash with hair emitted from vertices.

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

Modified: trunk/blender/source/blender/blenkernel/intern/particle_system.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/particle_system.c	2009-06-09 18:25:57 UTC (rev 20766)
+++ trunk/blender/source/blender/blenkernel/intern/particle_system.c	2009-06-09 18:50:02 UTC (rev 20767)
@@ -1307,9 +1307,23 @@
 	/* for hair, sort by origindex, allows optimizations in rendering */
 	/* however with virtual parents the children need to be in random order */
 	if(part->type == PART_HAIR && !(part->childtype==PART_CHILD_FACES && part->parents!=0.0)) {
-		COMPARE_ORIG_INDEX= dm->getFaceDataArray(dm, CD_ORIGINDEX);
-		if(COMPARE_ORIG_INDEX)
-			qsort(index, totpart, sizeof(int), compare_orig_index);
+		if(from != PART_FROM_PARTICLE) {
+			COMPARE_ORIG_INDEX = NULL;
+
+			if(from == PART_FROM_VERT) {
+				if(dm->numVertData)
+					COMPARE_ORIG_INDEX= dm->getVertDataArray(dm, CD_ORIGINDEX);
+			}
+			else {
+				if(dm->numFaceData)
+					COMPARE_ORIG_INDEX= dm->getFaceDataArray(dm, CD_ORIGINDEX);
+			}
+
+			if(COMPARE_ORIG_INDEX) {
+				qsort(index, totpart, sizeof(int), compare_orig_index);
+				COMPARE_ORIG_INDEX = NULL;
+			}
+		}
 	}
 
 	/* weights are no longer used except for FROM_PARTICLE, which needs them zeroed for indexing */





More information about the Bf-blender-cvs mailing list