[Bf-blender-cvs] [7280410] master: Editmesh: extruding end-point verts now maintains edge-direction
Campbell Barton
noreply at git.blender.org
Sun Jun 22 10:41:47 CEST 2014
Commit: 728041019e8ee30a939a521c251d60e1f996a313
Author: Campbell Barton
Date: Sun Jun 22 18:38:17 2014 +1000
https://developer.blender.org/rB728041019e8ee30a939a521c251d60e1f996a313
Editmesh: extruding end-point verts now maintains edge-direction
Resolves T40745, where faces from extruded edges had flipped normals.
===================================================================
M source/blender/bmesh/intern/bmesh_queries_inline.h
M source/blender/bmesh/operators/bmo_extrude.c
===================================================================
diff --git a/source/blender/bmesh/intern/bmesh_queries_inline.h b/source/blender/bmesh/intern/bmesh_queries_inline.h
index a2a0a15..0856b98 100644
--- a/source/blender/bmesh/intern/bmesh_queries_inline.h
+++ b/source/blender/bmesh/intern/bmesh_queries_inline.h
@@ -137,4 +137,17 @@ BLI_INLINE bool BM_loop_is_adjacent(const BMLoop *l_a, const BMLoop *l_b)
return (ELEM(l_b, l_a->next, l_a->prev));
}
+/**
+ * Check if we have a single wire edge user.
+ */
+BLI_INLINE bool BM_vert_is_wire_endpoint(const BMVert *v)
+{
+ const BMEdge *e = v->e;
+ if (e && e->l == NULL) {
+ const BMDiskLink *dl = (e->v1 == v) ? &e->v1_disk_link : &e->v2_disk_link;
+ return (dl->next == e);
+ }
+ return false;
+}
+
#endif /* __BMESH_QUERIES_INLINE_H__ */
diff --git a/source/blender/bmesh/operators/bmo_extrude.c b/source/blender/bmesh/operators/bmo_extrude.c
index f924d47..d174769 100644
--- a/source/blender/bmesh/operators/bmo_extrude.c
+++ b/source/blender/bmesh/operators/bmo_extrude.c
@@ -212,13 +212,20 @@ void bmo_extrude_vert_indiv_exec(BMesh *bm, BMOperator *op)
for (v = BMO_iter_new(&siter, op->slots_in, "verts", BM_VERT); v; v = BMO_iter_step(&siter)) {
dupev = BM_vert_create(bm, v->co, v, BM_CREATE_NOP);
+ BMO_elem_flag_enable(bm, dupev, EXT_KEEP);
+
if (has_vskin)
bm_extrude_disable_skin_root(bm, v);
- e = BM_edge_create(bm, v, dupev, NULL, BM_CREATE_NOP);
+ /* not essentuial, but ensures face normals from extruded edges are contiguous */
+ if (BM_vert_is_wire_endpoint(v)) {
+ if (v->e->v1 == v) {
+ SWAP(BMVert *, v, dupev);
+ }
+ }
+ e = BM_edge_create(bm, v, dupev, NULL, BM_CREATE_NOP);
BMO_elem_flag_enable(bm, e, EXT_KEEP);
- BMO_elem_flag_enable(bm, dupev, EXT_KEEP);
}
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "verts.out", BM_VERT, EXT_KEEP);
More information about the Bf-blender-cvs
mailing list