Commit: dfe61958a7e50e2d290589faa07ca3b0c243cb1a
Author: Lukas Tönne
Date:   Thu Jun 28 06:13:54 2018 +0100
Branches: hair_guides_grooming
https://developer.blender.org/rBdfe61958a7e50e2d290589faa07ca3b0c243cb1a

Fix crashes when creating multiple scalp regions.

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

M       source/blender/blenkernel/intern/groom.c
M       source/blender/draw/intern/draw_cache_impl_groom.c

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

diff --git a/source/blender/blenkernel/intern/groom.c 
b/source/blender/blenkernel/intern/groom.c
index 699b4894519..4d43864dc4d 100644
--- a/source/blender/blenkernel/intern/groom.c
+++ b/source/blender/blenkernel/intern/groom.c
@@ -1381,7 +1381,7 @@ void BKE_groom_hair_update_guide_curves(const Depsgraph 
*depsgraph, Groom *groom
                                        
                                        BKE_hair_set_guide_curve(
                                                    hsys,
-                                                   i,
+                                                   guide_idx,
                                                    &bundle->guides[i].root,
                                                    numverts[guide_idx],
                                                    taper_length,
diff --git a/source/blender/draw/intern/draw_cache_impl_groom.c 
b/source/blender/draw/intern/draw_cache_impl_groom.c
index c6b4521abfb..216a8ac7bc5 100644
--- a/source/blender/draw/intern/draw_cache_impl_groom.c
+++ b/source/blender/draw/intern/draw_cache_impl_groom.c
@@ -378,7 +378,6 @@ typedef struct GroomRenderData
        int curve_res;
        
        int tri_len;                    /* Total mlooptri array length */
-       int section_tri_len;        /* Number of looptri per section polygon */
        struct MLoopTri *mlooptri;      /* Triangulation data for sections */
 } GroomRenderData;
 
@@ -404,10 +403,11 @@ static GroomRenderData* groom_render_data_create(Groom 
*groom)
                                totpoly += numpolys;
                                totvert += region->numverts * numpolys;
                                
-                               rdata->section_tri_len = poly_to_tri_count(1, 
region->numverts);
-                               rdata->tri_len = rdata->section_tri_len * 
numpolys;
-                               /* Polygons are unconnected, no shared vertices 
*/
-                               BLI_assert(rdata->tri_len == 
poly_to_tri_count(numpolys, region->numverts * numpolys));
+                               /* Polygons are unconnected, no shared vertices,
+                                * same vertex number for each section polygon.
+                                */
+                               int section_tri_len = poly_to_tri_count(1, 
region->numverts);
+                               rdata->tri_len += section_tri_len * numpolys;
                        }
                }
                
@@ -733,10 +733,11 @@ static void groom_get_faces(
                        if (numshapeverts > 1)
                        {
                                const MLoopTri *mtri = rdata->mlooptri;
+                               int section_tri_len = poly_to_tri_count(1, 
region->numverts);
                                /* Skip the root section */
                                for (int i = 1; i < bundle->totsections; ++i)
                                {
-                                       for (int j = 0; j < 
rdata->section_tri_len; ++j, ++mtri)
+                                       for (int j = 0; j < section_tri_len; 
++j, ++mtri)
                                        {
                                                GWN_indexbuf_add_tri_verts(
                                                            &elb,

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to