[Bf-blender-cvs] [72d7709] gooseberry: Fix for broken particle stuff when using particle instance modifier with children.

Lukas Tönne noreply at git.blender.org
Thu Jun 25 12:04:05 CEST 2015


Commit: 72d7709ae6d3c7284bf19aaf4edf8059c7e7119c
Author: Lukas Tönne
Date:   Thu Jun 25 12:03:37 2015 +0200
Branches: gooseberry
https://developer.blender.org/rB72d7709ae6d3c7284bf19aaf4edf8059c7e7119c

Fix for broken particle stuff when using particle instance modifier with
children.

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

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

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

diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index a928ed6..e753474 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -2633,7 +2633,7 @@ static void psys_face_mat(Object *ob, DerivedMesh *dm, ParticleData *pa, float m
 	triatomat(v[0], v[1], v[2], (osface) ? osface->uv : NULL, mat);
 }
 
-void psys_mat_hair_to_object(Object *UNUSED(ob), DerivedMesh *dm, short from, ParticleData *pa, float hairmat[4][4])
+void psys_mat_hair_to_object(Object *ob, DerivedMesh *dm, short from, ParticleData *pa, float hairmat[4][4])
 {
 	float vec[3];
 
@@ -2643,7 +2643,7 @@ void psys_mat_hair_to_object(Object *UNUSED(ob), DerivedMesh *dm, short from, Pa
 		return;
 	}
 	
-	psys_face_mat(0, dm, pa, hairmat, 0);
+	psys_face_mat(ob, dm, pa, hairmat, 0);
 	psys_particle_on_dm(dm, from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, vec, 0, 0, 0, 0, 0);
 	copy_v3_v3(hairmat[3], vec);
 }
diff --git a/source/blender/modifiers/intern/MOD_particleinstance.c b/source/blender/modifiers/intern/MOD_particleinstance.c
index 218a74e..d1bdf8a 100644
--- a/source/blender/modifiers/intern/MOD_particleinstance.c
+++ b/source/blender/modifiers/intern/MOD_particleinstance.c
@@ -227,6 +227,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 	float spacemat[4][4];
 	int *cd_index = NULL;
 	float *cd_value = NULL;
+	bool between;
 
 	trackneg = ((ob->trackflag > 2) ? 1 : 0);
 
@@ -259,6 +260,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 	sim.ob = pimd->ob;
 	sim.psys = psys;
 	sim.psmd = psys_get_modifier(pimd->ob, psys);
+	between = (psys->part->childtype == PART_CHILD_FACES);
 
 	if (pimd->flag & eParticleInstanceFlag_UseSize) {
 		float *si;
@@ -404,8 +406,8 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 					if (first_particle + p < psys->totpart)
 						pa = psys->particles + first_particle + p;
 					else {
-						ChildParticle *cpa = psys->child + (p - psys->totpart);
-						pa = psys->particles + cpa->parent;
+						ChildParticle *cpa = psys->child + p;
+						pa = psys->particles + (between? cpa->pa[0]: cpa->parent);
 					}
 					psys_mat_hair_to_global(sim.ob, sim.psmd->dm, sim.psys->part->from, pa, hairmat);
 					copy_m3_m4(mat, hairmat);




More information about the Bf-blender-cvs mailing list