Commit: cf946dfbb802cc4d7800122f895a88bce81ed790
Author: Campbell Barton
Date:   Sat Nov 22 15:01:06 2014 +0100
Branches: bmesh-boolean-experiment
https://developer.blender.org/rBcf946dfbb802cc4d7800122f895a88bce81ed790

remove bmesh islands

quick test until we have proper test for which parts to remove.

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

M       source/blender/modifiers/intern/MOD_boolean.c

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

diff --git a/source/blender/modifiers/intern/MOD_boolean.c 
b/source/blender/modifiers/intern/MOD_boolean.c
index 6a31fbc..87eff87 100644
--- a/source/blender/modifiers/intern/MOD_boolean.c
+++ b/source/blender/modifiers/intern/MOD_boolean.c
@@ -213,6 +213,47 @@ static DerivedMesh *applyModifier(ModifierData *md, Object 
*ob,
                                MEM_freeN(looptris);
                        }
 
+                       {
+                               /* group vars */
+                               int *groups_array;
+                               int (*group_index)[2];
+                               int group_tot;
+                               int i;
+                               bool is_inside;
+                               BMFace **ftable;
+
+                               BM_mesh_elem_table_ensure(bm, BM_FACE);
+                               ftable = bm->ftable;
+
+                               groups_array = 
MEM_mallocN(sizeof(*groups_array) * bm->totface, __func__);
+                               group_tot = BM_mesh_calc_face_groups(
+                                       bm, groups_array, &group_index,
+                                       NULL, NULL,
+                                       0, BM_EDGE);
+
+                               /* first check if island is inside */
+
+                               /* TODO, find if islands are inside/outside,
+                                * for now remove alternate islands, as simple 
testcase */
+                               is_inside = false;
+
+
+                               for (i = 0; i < group_tot; i++) {
+                                       int fg     = group_index[i][0];
+                                       int fg_end = group_index[i][1] + fg;
+
+                                       if (is_inside) {
+                                               for (; fg != fg_end; fg++) {
+                                                       BM_face_kill(bm, 
ftable[groups_array[fg]]);
+                                               }
+                                       }
+                                       is_inside = !is_inside;
+                               }
+
+                               MEM_freeN(groups_array);
+                               MEM_freeN(group_index);
+                       }
+
                        result = CDDM_from_bmesh(bm, true);
 
                        BM_mesh_free(bm);

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

Reply via email to