Commit: 487775dd873ec5117652848c370ca5562be6e185
Author: Lukas Tönne
Date:   Sat Jun 30 10:56:08 2018 +0100
Branches: tmp_hair_curves
https://developer.blender.org/rB487775dd873ec5117652848c370ca5562be6e185

Simple hair curve generation for testing per-follicle curves.

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

M       source/blender/editors/object/object_modifier.c

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

diff --git a/source/blender/editors/object/object_modifier.c 
b/source/blender/editors/object/object_modifier.c
index 32942ebf5af..d504594fc79 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -37,6 +37,7 @@
 #include "DNA_anim_types.h"
 #include "DNA_armature_types.h"
 #include "DNA_curve_types.h"
+#include "DNA_hair_types.h"
 #include "DNA_key_types.h"
 #include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
@@ -2450,13 +2451,36 @@ static int hair_generate_follicles_exec(bContext *C, 
wmOperator *op)
        
        BLI_assert(ob && ob->type == OB_MESH);
        Mesh *scalp = (Mesh *)DEG_get_evaluated_id(depsgraph, ob->data);
+       HairSystem *hsys = hmd->hair_system;
        
        BKE_hair_generate_follicles(
-                   hmd->hair_system,
+                   hsys,
                    scalp,
                    (unsigned int)hmd->follicle_seed,
                    hmd->follicle_count);
        
+       {
+               const int numverts = 5;
+               const float taper_length = 0.1f;
+               const float taper_thickness = 0.8f;
+               BKE_hair_fiber_curves_begin(hsys, hsys->pattern->num_follicles);
+               for (int i = 0; i < hsys->pattern->num_follicles; ++i)
+               {
+                       BKE_hair_set_fiber_curve(hsys, i, 
&hsys->pattern->follicles[i].mesh_sample, numverts, taper_length, 
taper_thickness);
+               }
+               BKE_hair_fiber_curves_end(hsys);
+               for (int i = 0; i < hsys->pattern->num_follicles; ++i)
+               {
+                       float loc[3], nor[3], tan[3];
+                       BKE_mesh_sample_eval(scalp, 
&hsys->pattern->follicles[i].mesh_sample, loc, nor, tan);
+                       for (int j = 0; j < numverts; ++j)
+                       {
+                               madd_v3_v3fl(loc, nor, 1.0f/(numverts-1));
+                               BKE_hair_set_fiber_vertex(hsys, i, 0, loc);
+                       }
+               }
+       }
+       
        BKE_hair_bind_follicles(hmd->hair_system, scalp);
        
        DEG_id_tag_update(&ob->id, OB_RECALC_DATA);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to