[Bf-blender-cvs] [b9e828d] hair_immediate_fixes: Fix for invalid particle pointer access in mixed particle/child loop.

Lukas Tönne noreply at git.blender.org
Thu Nov 20 17:15:43 CET 2014


Commit: b9e828d16513ff4ee4a477002ca958b1f9e57fad
Author: Lukas Tönne
Date:   Thu Nov 20 17:15:16 2014 +0100
Branches: hair_immediate_fixes
https://developer.blender.org/rBb9e828d16513ff4ee4a477002ca958b1f9e57fad

Fix for invalid particle pointer access in mixed particle/child loop.

===================================================================

M	source/blender/modifiers/intern/MOD_particleinstance.c

===================================================================

diff --git a/source/blender/modifiers/intern/MOD_particleinstance.c b/source/blender/modifiers/intern/MOD_particleinstance.c
index bc3ff7c..f295b94 100644
--- a/source/blender/modifiers/intern/MOD_particleinstance.c
+++ b/source/blender/modifiers/intern/MOD_particleinstance.c
@@ -333,6 +333,12 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 					float hairmat[4][4];
 					float mat[3][3];
 					
+					if (first_particle + p < psys->totpart)
+						pa = psys->particles + first_particle + p;
+					else {
+						ChildParticle *cpa = psys->child + p;
+						pa = psys->particles + cpa->parent;
+					}
 					psys_mat_hair_to_global(sim.ob, sim.psmd->dm, sim.psys->part->from, pa, hairmat);
 					copy_m3_m4(mat, hairmat);
 					/* to quaternion */




More information about the Bf-blender-cvs mailing list