Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-06-09 22:50:02 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-06-09 22:50:02 +0400
commit9a54ca9af79012354e91424d3b434ea23bc053ad (patch)
tree1c3eafbf2bd26420633ed0d19ab7929c76e86840 /source/blender/blenkernel
parente917b1043ebe6201c89e3c4960280fee484161b8 (diff)
Fix for bug #18710: a crash with hair emitted from vertices.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/intern/particle_system.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 3445556b53b..31e246f66b9 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -1307,9 +1307,23 @@ int psys_threads_init_distribution(ParticleThread *threads, DerivedMesh *finaldm
/* 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 */