[Bf-blender-cvs] [82f96db] hair_immediate_fixes: 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
Sat Dec 27 11:32:45 CET 2014


Commit: 82f96db8a6f98c595a2f1de2d8281aff26e8c000
Author: Lukas Tönne
Date:   Fri Dec 5 16:00:03 2014 +0100
Branches: hair_immediate_fixes
https://developer.blender.org/rB82f96db8a6f98c595a2f1de2d8281aff26e8c000

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