[Bf-blender-cvs] [da4de6a] hair_immediate_fixes: Fix for particle-to-bmesh: only was looping over totvert instead of pa->totkey.

Lukas Tönne noreply at git.blender.org
Thu Nov 27 22:49:41 CET 2014


Commit: da4de6a047ca2abaafcb757d7b73f3896ac64022
Author: Lukas Tönne
Date:   Thu Nov 27 22:40:03 2014 +0100
Branches: hair_immediate_fixes
https://developer.blender.org/rBda4de6a047ca2abaafcb757d7b73f3896ac64022

Fix for particle-to-bmesh: only was looping over totvert instead of
pa->totkey.

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

M	source/blender/bmesh/intern/bmesh_strands_conv.c

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

diff --git a/source/blender/bmesh/intern/bmesh_strands_conv.c b/source/blender/bmesh/intern/bmesh_strands_conv.c
index 22e529e..e052d54 100644
--- a/source/blender/bmesh/intern/bmesh_strands_conv.c
+++ b/source/blender/bmesh/intern/bmesh_strands_conv.c
@@ -138,7 +138,7 @@ static KeyBlock *bm_set_shapekey_from_psys(BMesh *bm, ParticleSystem *psys, int
 }
 
 /* create vertex and edge data for BMesh based on particle hair keys */
-static void bm_make_particles(BMesh *bm, ParticleSystem *psys, int totvert, float (*keyco)[3], int cd_shape_keyindex_offset)
+static void bm_make_particles(BMesh *bm, ParticleSystem *psys, float (*keyco)[3], int cd_shape_keyindex_offset)
 {
 	KeyBlock *block;
 	ParticleData *pa;
@@ -151,7 +151,7 @@ static void bm_make_particles(BMesh *bm, ParticleSystem *psys, int totvert, floa
 	vindex = 0;
 	for (p = 0, pa = psys->particles; p < psys->totpart; ++p, ++pa) {
 		
-		for (k = 0, hkey = pa->hair; k < totvert; ++k, ++hkey, ++vindex) {
+		for (k = 0, hkey = pa->hair; k < pa->totkey; ++k, ++hkey, ++vindex) {
 		
 			v_prev = v;
 			v = BM_vert_create(bm, keyco ? keyco[vindex] : hkey->co, NULL, BM_CREATE_SKIP_CD);
@@ -257,7 +257,7 @@ void BM_strands_bm_from_psys(BMesh *bm, ParticleSystem *psys,
 
 	cd_shape_keyindex_offset = psys->key ? CustomData_get_offset(&bm->vdata, CD_SHAPE_KEYINDEX) : -1;
 
-	bm_make_particles(bm, psys, totvert, set_key ? keyco : NULL, cd_shape_keyindex_offset);
+	bm_make_particles(bm, psys, set_key ? keyco : NULL, cd_shape_keyindex_offset);
 
 
 #if 0 /* TODO */




More information about the Bf-blender-cvs mailing list