Merge branch 'master' into blender28
authorCampbell Barton <ideasman42@gmail.com>
Fri, 15 Jun 2018 13:42:42 +0000 (15:42 +0200)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 15 Jun 2018 13:42:42 +0000 (15:42 +0200)
release/scripts/addons
release/scripts/addons_contrib
source/blender/bmesh/intern/bmesh_core.c
source/blender/bmesh/intern/bmesh_core.h
source/blender/bmesh/intern/bmesh_polygon_edgenet.c
source/blender/bmesh/tools/bmesh_intersect.c
source/blender/bmesh/tools/bmesh_intersect.h
source/blender/editors/mesh/editmesh_intersect.c
source/blender/modifiers/intern/MOD_boolean.c
source/tools

index 8f2fd7e23f0b5ce023440182f51c40e88d663325..ebd058d7a6438d137522063bb3286c8acc325ca6 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 8f2fd7e23f0b5ce023440182f51c40e88d663325
+Subproject commit ebd058d7a6438d137522063bb3286c8acc325ca6
index 34a27a42d781d80f9f1833bad8cc5b2abcac2933..474702157831f1a58bb50f5240ab8b1b02b6ba37 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 34a27a42d781d80f9f1833bad8cc5b2abcac2933
+Subproject commit 474702157831f1a58bb50f5240ab8b1b02b6ba37
index c6836187eeec5ff05c48c1a131580c15557d27bd..97f1bad08b7d6cd98fa833cd0d7a845c1e648e2d 100644 (file)
@@ -2508,19 +2508,17 @@ void BM_vert_separate_hflag(
        }
 }
 
-void BM_vert_separate_wire_hflag(
+void BM_vert_separate_tested_edges(
         BMesh *UNUSED(bm), BMVert *v_dst, BMVert *v_src,
-        const char hflag)
+        bool (*testfn)(BMEdge *, void *arg), void *arg)
 {
        LinkNode *edges_hflag = NULL;
        BMEdge *e_iter, *e_first;
 
        e_iter = e_first = v_src->e;
        do {
-               if (BM_elem_flag_test(e_iter, hflag)) {
-                       if (BM_edge_is_wire(e_iter)) {
-                               BLI_linklist_prepend_alloca(&edges_hflag, e_iter);
-                       }
+               if (testfn(e_iter, arg)) {
+                       BLI_linklist_prepend_alloca(&edges_hflag, e_iter);
                }
        } while ((e_iter = BM_DISK_EDGE_NEXT(e_iter, v_src)) != e_first);
 
index fb6b66809f3c045fd61c054e6944f311c82013dd..93bb12fe74254d2a514f684042d1db827f3b6323 100644 (file)
@@ -81,9 +81,9 @@ void    BM_vert_separate(
 void BM_vert_separate_hflag(
         BMesh *bm, BMVert *v, const char hflag, const bool copy_select,
         BMVert ***r_vout, int *r_vout_len);
-void BM_vert_separate_wire_hflag(
+void BM_vert_separate_tested_edges(
         BMesh *bm, BMVert *v_dst, BMVert *v_src,
-        const char hflag);
+        bool (*testfn)(BMEdge *, void *arg), void *arg);
 
 /**
  * BMesh Kernel: For modifying structure.
index 85dfd3f58e28348498664d38bb005a2fd06ab56f..4703dbf3bcd05f3bc254c0f023cb9219c6091c90 100644 (file)
@@ -1050,6 +1050,16 @@ static int bm_face_split_edgenet_find_connection(
  */
 #ifdef USE_PARTIAL_CONNECT
 
+/**
+ * Used to identify edges that  get split off when making island from partial connection.
+ * fptr should be a BMFace*, but is a void* for general interface to BM_vert_separate_tested_edges
+ */
+static bool test_tagged_and_notface(BMEdge *e, void *fptr)
+{
+       BMFace *f = (BMFace *)fptr;
+       return BM_elem_flag_test(e, BM_ELEM_INTERNAL_TAG) && !BM_edge_in_face(e, f);
+}
+
 /**
  * Split vertices which are part of a partial connection
  * (only a single vertex connecting an island).
@@ -1058,7 +1068,7 @@ static int bm_face_split_edgenet_find_connection(
  * This function leaves all the flags set as well.
  *
  */
-static BMVert *bm_face_split_edgenet_partial_connect(BMesh *bm, BMVert *v_delimit)
+static BMVert *bm_face_split_edgenet_partial_connect(BMesh *bm, BMVert *v_delimit, BMFace *f)
 {
        /* -------------------------------------------------------------------- */
        /* Initial check that we may be a delimiting vert (keep this fast) */
@@ -1084,7 +1094,7 @@ static BMVert *bm_face_split_edgenet_partial_connect(BMesh *bm, BMVert *v_delimi
                        BLI_assert(BM_elem_flag_test(BM_edge_other_vert(e_iter, v_delimit), VERT_NOT_IN_STACK));
                        BLI_linklist_prepend_alloca(&e_delimit_list, e_iter);
                        e_delimit_list_len++;
-                       if (e_iter->l != NULL) {
+                       if (e_iter->l != NULL && BM_edge_in_face(e_iter, f)) {
                                e_face_init = e_iter;
                        }
                }
@@ -1133,7 +1143,7 @@ static BMVert *bm_face_split_edgenet_partial_connect(BMesh *bm, BMVert *v_delimi
        bool is_delimit = false;
        FOREACH_VERT_EDGE(v_delimit, e_iter, {
                BMVert *v_step = BM_edge_other_vert(e_iter, v_delimit);
-               if (BM_elem_flag_test(v_step, VERT_NOT_IN_STACK) && BM_edge_is_wire(e_iter)) {
+               if (BM_elem_flag_test(v_step, VERT_NOT_IN_STACK) && !BM_edge_in_face(e_iter, f)) {
                        is_delimit = true;  /* if one vertex is valid - we have a mix */
                }
                else {
@@ -1148,7 +1158,7 @@ static BMVert *bm_face_split_edgenet_partial_connect(BMesh *bm, BMVert *v_delimi
        BMVert *v_split = NULL;
        if (is_delimit) {
                v_split = BM_vert_create(bm, v_delimit->co, NULL, 0);
-               BM_vert_separate_wire_hflag(bm, v_split, v_delimit, EDGE_NOT_IN_STACK);
+               BM_vert_separate_tested_edges(bm, v_split, v_delimit, test_tagged_and_notface, f);
                BM_elem_flag_enable(v_split, VERT_NOT_IN_STACK);
 
                BLI_assert(v_delimit->e != NULL);
@@ -1224,6 +1234,7 @@ bool BM_face_split_edgenet_connect_islands(
        const uint edge_arr_len = (uint)edge_net_init_len + (uint)f->len;
        BMEdge **edge_arr = BLI_array_alloca(edge_arr, edge_arr_len);
        bool ok = false;
+       uint edge_net_new_len = (uint)edge_net_init_len;
 
        memcpy(edge_arr, edge_net_init, sizeof(*edge_arr) * (size_t)edge_net_init_len);
 
@@ -1272,7 +1283,7 @@ bool BM_face_split_edgenet_connect_islands(
                                BMVert *v_other;
 
                                /* note, remapping will _never_ map a vertex to an already mapped vertex */
-                               while (UNLIKELY((v_other = bm_face_split_edgenet_partial_connect(bm, v_delimit)))) {
+                               while (UNLIKELY((v_other = bm_face_split_edgenet_partial_connect(bm, v_delimit, f)))) {
                                        struct TempVertPair *tvp = BLI_memarena_alloc(mem_arena, sizeof(*tvp));
                                        tvp->next = temp_vert_pairs.list;
                                        tvp->v_orig = v_delimit;
@@ -1509,7 +1520,7 @@ bool BM_face_split_edgenet_connect_islands(
        /* Create connections between groups */
 
        /* may be an over-alloc, but not by much */
-       uint edge_net_new_len = (uint)edge_net_init_len + ((group_arr_len - 1) * 2);
+       edge_net_new_len = (uint)edge_net_init_len + ((group_arr_len - 1) * 2);
        BMEdge **edge_net_new = BLI_memarena_alloc(mem_arena, sizeof(*edge_net_new) * edge_net_new_len);
        memcpy(edge_net_new, edge_net_init, sizeof(*edge_net_new) * (size_t)edge_net_init_len);
 
index cc8511c65f1b48f80db4b889ce12ff5c2131319a..fba2aac087b402afa7d4b41ab5f17a2a977e8d7e 100644 (file)
@@ -237,7 +237,7 @@ static void face_edges_add(
 #ifdef USE_NET
 static void face_edges_split(
         BMesh *bm, BMFace *f, struct LinkBase *e_ls_base,
-        bool use_island_connect,
+        bool use_island_connect, bool use_partial_connect,
         MemArena *mem_arena_edgenet)
 {
        uint i;
@@ -262,7 +262,7 @@ static void face_edges_split(
                if (BM_face_split_edgenet_connect_islands(
                        bm, f,
                        edge_arr, edge_arr_len,
-                       false,
+                       use_partial_connect,
                        mem_arena_edgenet,
                        &edge_arr_holes, &edge_arr_holes_len))
                {
@@ -980,7 +980,7 @@ bool BM_mesh_intersect(
         struct BMLoop *(*looptris)[3], const int looptris_tot,
         int (*test_fn)(BMFace *f, void *user_data), void *user_data,
         const bool use_self, const bool use_separate, const bool use_dissolve, const bool use_island_connect,
-        const bool use_edge_tag, const int boolean_mode,
+        const bool use_partial_connect, const bool use_edge_tag, const int boolean_mode,
         const float eps)
 {
        struct ISectState s;
@@ -1491,7 +1491,7 @@ bool BM_mesh_intersect(
 
                        BLI_assert(BM_elem_index_get(f) == f_index);
 
-                       face_edges_split(bm, f, e_ls_base, use_island_connect, mem_arena_edgenet);
+                       face_edges_split(bm, f, e_ls_base, use_island_connect, use_partial_connect, mem_arena_edgenet);
 
                        BLI_memarena_clear(mem_arena_edgenet);
                }
index 51926a01710c4aed60d51db093aeee9e13189694..82910a5df806f59bf9b8ca04eedb8c2fc84a7dca 100644 (file)
@@ -30,7 +30,7 @@ bool BM_mesh_intersect(
         struct BMLoop *(*looptris)[3], const int looptris_tot,
         int (*test_fn)(BMFace *f, void *user_data), void *user_data,
         const bool use_self, const bool use_separate, const bool use_dissolve, const bool use_island_connect,
-        const bool use_edge_tag, const int boolean_mode,
+        const bool use_partial_connect, const bool use_edge_tag, const int boolean_mode,
         const float eps);
 
 enum {
index ad76f0c66f1173c17634058a7d79ffeae8e03131..9af700aa6bf1d053cd09b09752ce3727618c8d92 100644 (file)
@@ -197,18 +197,18 @@ static int edbm_intersect_exec(bContext *C, wmOperator *op)
                }
 
                has_isect = BM_mesh_intersect(
-                       em->bm,
-                       em->looptris, em->tottri,
-                       test_fn, NULL,
-                       use_self, use_separate_all, true, true, true,
-                       -1,
-                       eps);
+                       em->bm,
+                       em->looptris, em->tottri,
+                       test_fn, NULL,
+                       use_self, use_separate_all, true, true, true, true,
+                       -1,
+                       eps);
 
                if (use_separate_cut) {
                        /* detach selected/un-selected faces */
                        BM_mesh_separate_faces(
-                               em->bm,
-                               BM_elem_cb_check_hflag_enabled_simple(const BMFace *, BM_ELEM_SELECT));
+                               em->bm,
+                               BM_elem_cb_check_hflag_enabled_simple(const BMFace *, BM_ELEM_SELECT));
                }
 
                if (has_isect) {
@@ -300,12 +300,12 @@ static int edbm_intersect_boolean_exec(bContext *C, wmOperator *op)
                }
 
                has_isect = BM_mesh_intersect(
-                       em->bm,
-                       em->looptris, em->tottri,
-                       test_fn, NULL,
-                       false, false, true, true, true,
-                       boolean_operation,
-                       eps);
+                       em->bm,
+                       em->looptris, em->tottri,
+                       test_fn, NULL,
+                       false, false, true, true, false, true,
+                       boolean_operation,
+                       eps);
 
 
                if (has_isect) {
index a2b300b40dcb0e496de232ed235ff0fb2ea42034..712b6254722bdd8c4e7b3744f87cca1990e02081 100644 (file)
@@ -310,6 +310,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
                                        use_dissolve,
                                        use_island_connect,
                                        false,
+                                       false,
                                        bmd->operation,
                                        bmd->double_threshold);
 
index f35d8e55afffb9da50cc13b14615ed280f9e558c..ca3e38d89666c422d6681bb06967a59ef1a4a7df 160000 (submodule)
@@ -1 +1 @@
-Subproject commit f35d8e55afffb9da50cc13b14615ed280f9e558c
+Subproject commit ca3e38d89666c422d6681bb06967a59ef1a4a7df