Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-08-18 19:14:55 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-08-18 19:14:55 +0400
commitc5e14f62a673507a6298bf9f676f6de11d193f07 (patch)
tree566e8f7fe07f0713f1667b236998cbb9dd94f492 /source/blender/bmesh/operators/bmo_edgenet.c
parenta71f84606a383801d4e6ceb8106bcc33857a5322 (diff)
bmesh improvements to face creation.
* fill-holes operator now takes advantage of new edge-net fill, works in many more cases then it did before. * face-create that uses edge-net now initializes the normals based on surrounding geometry, only running normal calculation if there are no connected faces for a reference.
Diffstat (limited to 'source/blender/bmesh/operators/bmo_edgenet.c')
-rw-r--r--source/blender/bmesh/operators/bmo_edgenet.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/source/blender/bmesh/operators/bmo_edgenet.c b/source/blender/bmesh/operators/bmo_edgenet.c
index 6c88161ca35..0d9521a6ad4 100644
--- a/source/blender/bmesh/operators/bmo_edgenet.c
+++ b/source/blender/bmesh/operators/bmo_edgenet.c
@@ -50,19 +50,23 @@
void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op)
{
+ BMOperator op_attr;
BMOIter siter;
BMFace *f;
const short mat_nr = BMO_slot_int_get(op->slots_in, "mat_nr");
const bool use_smooth = BMO_slot_bool_get(op->slots_in, "use_smooth");
+// const int sides = BMO_slot_int_get(op->slots_in, "sides");
if (!bm->totvert || !bm->totedge)
return;
+ BM_mesh_elem_hflag_disable_all(bm, BM_EDGE, BM_ELEM_TAG, false);
BMO_slot_buffer_hflag_enable(bm, op->slots_in, "edges", BM_EDGE, BM_ELEM_TAG, false);
- BM_mesh_edgenet(bm, true, FACE_NEW);
+ BM_mesh_elem_hflag_disable_all(bm, BM_FACE, BM_ELEM_TAG, false);
+ BM_mesh_edgenet(bm, true, true); // TODO, sides
- BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "faces.out", BM_FACE, FACE_NEW);
+ BMO_slot_buffer_from_enabled_hflag(bm, op, op->slots_out, "faces.out", BM_FACE, BM_ELEM_TAG);
BMO_ITER (f, &siter, op->slots_out, "faces.out", BM_FACE) {
f->mat_nr = mat_nr;
@@ -73,13 +77,20 @@ void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op)
BM_face_normal_update(f);
}
- /* recalc normals,
- * TODO, could do checks to make normals consistent */
- {
- BMO_op_callf(bm, op->flag,
- "recalc_face_normals faces=%S",
- op, "faces.out");
+ /* --- 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);
+
+ BMO_op_exec(bm, &op_attr);
+
+ /* check if some faces couldn't be touched */
+ if (BMO_slot_buffer_count(op_attr.slots_out, "faces_fail.out")) {
+ BMO_op_callf(bm, op->flag, "recalc_face_normals faces=%S", &op_attr, "faces_fail.out");
}
+ BMO_op_finish(bm, &op_attr);
+
}
static BMEdge *edge_next(BMesh *bm, BMEdge *e)