Fix incorrectly deleted elements in array modifier caps.

Add check for merging vertices into vertices that are themselves
marked for merge, was already done for array eleements but not end
caps.

Fixes bug [#31695] Array Modifier: End Cap fails if all vertices are merged

Also corrected some reversed assert arguments.
This commit is contained in:
Nicholas Bishop 2012-06-11 09:41:08 +00:00
parent abfe63d8aa
commit a18b303a76
3 changed files with 11 additions and 3 deletions

View File

@ -458,7 +458,7 @@ static int bm_mesh_flag_count(BMesh *bm, const char htype, const char hflag,
BMIter iter;
int tot = 0;
BLI_assert(ELEM(TRUE, FALSE, test_for_enabled));
BLI_assert(ELEM(test_for_enabled, TRUE, FALSE));
if (htype & BM_VERT) {
for (ele = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL); ele; ele = BM_iter_step(&iter)) {

View File

@ -698,7 +698,7 @@ static void bmo_slot_buffer_from_hflag(BMesh *bm, BMOperator *op, const char *sl
BMOpSlot *output = BMO_slot_get(op, slotname);
int totelement = 0, i = 0;
BLI_assert(ELEM(TRUE, FALSE, test_for_enabled));
BLI_assert(ELEM(test_for_enabled, TRUE, FALSE));
if (test_for_enabled)
totelement = BM_mesh_elem_hflag_count_enabled(bm, htype, hflag, TRUE);

View File

@ -220,9 +220,12 @@ static void bm_merge_dm_transform(BMesh *bm, DerivedMesh *dm, float mat[4][4],
const char *dupe_slot_name,
BMOperator *weld_op)
{
BMVert *v, *v2;
BMVert *v, *v2, *v3;
BMIter iter;
/* Add the DerivedMesh's elements to the BMesh. The pre-existing
elements were already tagged, so the new elements can be
identified by not having the BM_ELEM_TAG flag set. */
DM_to_bmesh_ex(dm, bm);
if (amd->flags & MOD_ARR_MERGE) {
@ -252,6 +255,11 @@ static void bm_merge_dm_transform(BMesh *bm, DerivedMesh *dm, float mat[4][4],
/* add new merge targets to weld operator */
BMO_ITER (v, &oiter, bm, &find_op, "targetmapout", 0) {
v2 = BMO_iter_map_value_p(&oiter);
/* check in case the target vertex (v2) is already marked
* for merging */
while ((v3 = BMO_slot_map_ptr_get(bm, weld_op, "targetmap", v2))) {
v2 = v3;
}
BMO_slot_map_ptr_insert(bm, weld_op, "targetmap", v, v2);
}