[Bf-blender-cvs] [1e04723] strand_editmode: Fix for hair-to-particle export: need to set weight=1.0 for hair roots, since the particle system uses this for pinning them to the mesh.

Lukas Tönne noreply at git.blender.org
Mon Apr 20 14:23:58 CEST 2015


Commit: 1e047231c67e755c058176e9481a898cb1728935
Author: Lukas Tönne
Date:   Fri Dec 5 16:00:03 2014 +0100
Branches: strand_editmode
https://developer.blender.org/rB1e047231c67e755c058176e9481a898cb1728935

Fix for hair-to-particle export: need to set weight=1.0 for hair roots,
since the particle system uses this for pinning them to the mesh.

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

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 b23dbbd..79871a5 100644
--- a/source/blender/bmesh/intern/bmesh_strands_conv.c
+++ b/source/blender/bmesh/intern/bmesh_strands_conv.c
@@ -473,9 +473,16 @@ static void make_particle_hair(BMesh *bm, BMVert *root, Object *ob, ParticleSyst
 		}
 		
 		mul_v3_m4v3(hkey->co, inv_hairmat, v->co);
+		mul_v3_m4v3(hkey->world_co, ob->obmat, v->co);
 		
 		hkey->time = totkey > 0 ? (float)k / (float)(totkey - 1) : 0.0f;
-		hkey->weight = BM_elem_float_data_named_get(&bm->vdata, v, CD_PROP_FLT, CD_HAIR_WEIGHT);
+		if (k == 0) {
+			/* weight 1.0 is used for pinning hair roots in particles */
+			hkey->weight = 1.0f;
+		}
+		else {
+			hkey->weight = BM_elem_float_data_named_get(&bm->vdata, v, CD_PROP_FLT, CD_HAIR_WEIGHT);
+		}
 		
 		++hkey;
 		++k;




More information about the Bf-blender-cvs mailing list