[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [60499] trunk/blender/source/blender/bmesh /operators/bmo_removedoubles.c: fix [#36913] GHASH_FLAG_ALLOW_DUPES assert and crash in Edge Collapse
Campbell Barton
ideasman42 at gmail.com
Wed Oct 2 06:12:07 CEST 2013
Revision: 60499
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=60499
Author: campbellbarton
Date: 2013-10-02 04:12:06 +0000 (Wed, 02 Oct 2013)
Log Message:
-----------
fix [#36913] GHASH_FLAG_ALLOW_DUPES assert and crash in Edge Collapse
Modified Paths:
--------------
trunk/blender/source/blender/bmesh/operators/bmo_removedoubles.c
Modified: trunk/blender/source/blender/bmesh/operators/bmo_removedoubles.c
===================================================================
--- trunk/blender/source/blender/bmesh/operators/bmo_removedoubles.c 2013-10-01 18:23:39 UTC (rev 60498)
+++ trunk/blender/source/blender/bmesh/operators/bmo_removedoubles.c 2013-10-02 04:12:06 UTC (rev 60499)
@@ -354,7 +354,7 @@
BMEdge *e, **edges = NULL;
BLI_array_declare(edges);
float min[3], max[3], center[3];
- int i, tot;
+ unsigned int i, tot;
BMOpSlot *slot_targetmap;
BMO_op_callf(bm, op->flag, "collapse_uvs edges=%s", op, "edges");
@@ -369,6 +369,8 @@
BMW_NIL_LAY);
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
+ BMVert *v_tar;
+
if (!BMO_elem_flag_test(bm, e, EDGE_MARK))
continue;
@@ -381,19 +383,29 @@
minmax_v3v3_v3(min, max, e->v1->co);
minmax_v3v3_v3(min, max, e->v2->co);
+
+ /* prevent adding to slot_targetmap multiple times */
+ BM_elem_flag_disable(e->v1, BM_ELEM_TAG);
+ BM_elem_flag_disable(e->v2, BM_ELEM_TAG);
}
mid_v3_v3v3(center, min, max);
/* snap edges to a point. for initial testing purposes anyway */
+ v_tar = edges[0]->v1;
+
for (i = 0; i < tot; i++) {
- copy_v3_v3(edges[i]->v1->co, center);
- copy_v3_v3(edges[i]->v2->co, center);
-
- if (edges[i]->v1 != edges[0]->v1)
- BMO_slot_map_elem_insert(&weldop, slot_targetmap, edges[i]->v1, edges[0]->v1);
- if (edges[i]->v2 != edges[0]->v1)
- BMO_slot_map_elem_insert(&weldop, slot_targetmap, edges[i]->v2, edges[0]->v1);
+ unsigned int j;
+
+ for (j = 0; j < 2; j++) {
+ BMVert *v_src = *((&edges[i]->v1) + j);
+
+ copy_v3_v3(v_src->co, center);
+ if ((v_src != v_tar) && !BM_elem_flag_test(v_src, BM_ELEM_TAG)) {
+ BM_elem_flag_enable(v_src, BM_ELEM_TAG);
+ BMO_slot_map_elem_insert(&weldop, slot_targetmap, v_src, v_tar);
+ }
+ }
}
}
More information about the Bf-blender-cvs
mailing list