diff --git a/source/blender/bmesh/intern/bmesh_core.c b/source/blender/bmesh/intern/bmesh_core.c index 4e178686144..d507cbee9cc 100644 --- a/source/blender/bmesh/intern/bmesh_core.c +++ b/source/blender/bmesh/intern/bmesh_core.c @@ -206,6 +206,11 @@ BMEdge *BM_edge_create( return e; } +/** + * \note In most cases a \a l_example should be NULL, + * since this is a low level API and we shouldn't attempt to be clever and guess whats intended. + * In cases where copying adjacent loop-data is useful, see #BM_face_copy_shared. + */ static BMLoop *bm_loop_create( BMesh *bm, BMVert *v, BMEdge *e, BMFace *f, const BMLoop *l_example, const eBMCreateFlag create_flag) @@ -215,7 +220,15 @@ static BMLoop *bm_loop_create( l = BLI_mempool_alloc(bm->lpool); BLI_assert((l_example == NULL) || (l_example->head.htype == BM_LOOP)); - BLI_assert(!(create_flag & 1)); + BLI_assert(!(create_flag & BM_CREATE_NO_DOUBLE)); + +#ifndef NDEBUG + if (l_example) { + /* ensure passing a loop is either sharing the same vertex, or entirely disconnected + * use to catch mistake passing in loop offset-by-one. */ + BLI_assert((v == l_example->v) || !ELEM(v, l_example->prev->v, l_example->next->v)); + } +#endif /* --- assign all members --- */ l->head.data = NULL; @@ -267,7 +280,7 @@ static BMLoop *bm_face_boundary_add( #ifdef USE_BMESH_HOLES BMLoopList *lst = BLI_mempool_calloc(bm->looplistpool); #endif - BMLoop *l = bm_loop_create(bm, startv, starte, f, starte->l, create_flag); + BMLoop *l = bm_loop_create(bm, startv, starte, f, NULL /* starte->l */, create_flag); bmesh_radial_append(starte, l); @@ -442,7 +455,7 @@ BMFace *BM_face_create( startl->v = verts[0]; startl->e = edges[0]; for (i = 1; i < len; i++) { - l = bm_loop_create(bm, verts[i], edges[i], f, edges[i]->l, create_flag); + l = bm_loop_create(bm, verts[i], edges[i], f, NULL /* edges[i]->l */, create_flag); l->f = f; bmesh_radial_append(edges[i], l); diff --git a/source/blender/bmesh/operators/bmo_create.c b/source/blender/bmesh/operators/bmo_create.c index 1c054e89e39..a1e20dab63e 100644 --- a/source/blender/bmesh/operators/bmo_create.c +++ b/source/blender/bmesh/operators/bmo_create.c @@ -291,6 +291,7 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op) if (use_smooth) { BM_elem_flag_enable(f, BM_ELEM_SMOOTH); } + BM_face_copy_shared(bm, f, NULL, NULL); BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "faces.out", BM_FACE, ELE_OUT); } diff --git a/source/blender/bmesh/operators/bmo_edgenet.c b/source/blender/bmesh/operators/bmo_edgenet.c index 4423123f65e..f348014cead 100644 --- a/source/blender/bmesh/operators/bmo_edgenet.c +++ b/source/blender/bmesh/operators/bmo_edgenet.c @@ -73,8 +73,8 @@ void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op) /* --- Attribute Fill --- */ /* may as well since we have the faces already in a buffer */ BMO_op_initf(bm, &op_attr, op->flag, - "face_attribute_fill faces=%S use_normals=%b", - op, "faces.out", true); + "face_attribute_fill faces=%S use_normals=%b use_data=%b", + op, "faces.out", true, true); BMO_op_exec(bm, &op_attr);