Commit: 1676fcded0ff5a93988444f4d3189a398b004a79
Author: Campbell Barton
Date:   Wed Jun 24 20:42:02 2015 +1000
Branches: master
https://developer.blender.org/rB1676fcded0ff5a93988444f4d3189a398b004a79

WeightPaint Blend: don't stack mem for dverts

Bad assumption since this could be a large list

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

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

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

diff --git a/source/blender/editors/object/object_vgroup.c 
b/source/blender/editors/object/object_vgroup.c
index 46b6a054..4c1e223 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -1649,7 +1649,7 @@ static void vgroup_blend_subset(Object *ob, const bool 
*vgroup_validmap, const i
        MeshElemMap *emap;
        int *emap_mem;
 
-       BLI_SMALLSTACK_DECLARE(dv_stack, MDeformVert *);
+       BLI_LINKSTACK_DECLARE(dv_stack, MDeformVert *);
 
        BKE_object_defgroup_subset_to_index_array(vgroup_validmap, vgroup_tot, 
vgroup_subset_map);
        ED_vgroup_parray_alloc(ob->data, &dvert_array, &dvert_tot, false);
@@ -1666,6 +1666,7 @@ static void vgroup_blend_subset(Object *ob, const bool 
*vgroup_validmap, const i
                                              me->medge, me->totvert, 
me->totedge);
        }
 
+       BLI_LINKSTACK_INIT(dv_stack);
 
        for (i = 0; i < dvert_tot; i++) {
                MDeformVert *dv;
@@ -1684,7 +1685,7 @@ static void vgroup_blend_subset(Object *ob, const bool 
*vgroup_validmap, const i
 
                                        if (BM_elem_flag_test(v_other, 
BM_ELEM_SELECT) == 0) {
                                                dv = dvert_array[i_other];
-                                               BLI_SMALLSTACK_PUSH(dv_stack, 
dv);
+                                               BLI_LINKSTACK_PUSH(dv_stack, 
dv);
                                                dv_stack_tot++;
                                        }
                                }
@@ -1700,7 +1701,7 @@ static void vgroup_blend_subset(Object *ob, const bool 
*vgroup_validmap, const i
 
                                        if ((v_other->flag & SELECT) == 0) {
                                                dv = dvert_array[i_other];
-                                               BLI_SMALLSTACK_PUSH(dv_stack, 
dv);
+                                               BLI_LINKSTACK_PUSH(dv_stack, 
dv);
                                                dv_stack_tot++;
                                        }
                                }
@@ -1711,7 +1712,7 @@ static void vgroup_blend_subset(Object *ob, const bool 
*vgroup_validmap, const i
                        const float dv_mul = 1.0f / (float)dv_stack_tot;
 
                        /* vgroup_subset_weights is zero'd at this point */
-                       while ((dv = BLI_SMALLSTACK_POP(dv_stack))) {
+                       while ((dv = BLI_LINKSTACK_POP(dv_stack))) {
                                for (j = 0; j < subset_count; j++) {
                                        vgroup_subset_weights[j] += dv_mul * 
defvert_find_weight(dv, vgroup_subset_map[j]);
                                }
@@ -1738,6 +1739,8 @@ static void vgroup_blend_subset(Object *ob, const bool 
*vgroup_validmap, const i
                }
        }
 
+       BLI_LINKSTACK_FREE(dv_stack);
+
        if (bm) {
                /* pass */
        }

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

Reply via email to