diff options
author | Nicholas Bishop <nicholasbishop@gmail.com> | 2012-05-22 19:30:05 +0400 |
---|---|---|
committer | Nicholas Bishop <nicholasbishop@gmail.com> | 2012-05-22 19:30:05 +0400 |
commit | ec29e2620ea41a14fbf2ee78389bcd7e3649a87f (patch) | |
tree | eb1fc7cf48774f8c1bdb697f10ccbf4e3b5a9c9b /source/blender | |
parent | 45265b326a2854a59327c3d171a3f4797944cc79 (diff) |
Clear skin root flag on new vertices created by extruding.
Skin modifier documentation:
http://wiki.blender.org/index.php/User:Nicholasbishop/SkinModifier
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/bmesh/operators/bmo_extrude.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/source/blender/bmesh/operators/bmo_extrude.c b/source/blender/bmesh/operators/bmo_extrude.c index 4bac54794bf..09b79376ff6 100644 --- a/source/blender/bmesh/operators/bmo_extrude.c +++ b/source/blender/bmesh/operators/bmo_extrude.c @@ -26,9 +26,13 @@ #include "MEM_guardedalloc.h" +#include "DNA_meshdata_types.h" + #include "BLI_math.h" #include "BLI_array.h" +#include "BKE_customdata.h" + #include "bmesh.h" #include "intern/bmesh_operators_private.h" /* own include */ @@ -167,6 +171,16 @@ static void bm_extrude_copy_face_loop_attributes(BMesh *bm, BMFace *f, BMEdge *e BM_elem_attrs_copy(bm, bm, l_src_1, l_dst_b); } +/* Disable the skin root flag on the input vert, assumes that the vert + data includes an CD_MVERT_SKIN layer */ +static void bm_extrude_disable_skin_root(BMesh *bm, BMVert *v) +{ + MVertSkin *vs; + + vs = CustomData_bmesh_get(&bm->vdata, v->head.data, CD_MVERT_SKIN); + vs->flag &= ~MVERT_SKIN_ROOT; +} + void bmo_extrude_edge_only_exec(BMesh *bm, BMOperator *op) { BMOIter siter; @@ -184,6 +198,13 @@ void bmo_extrude_edge_only_exec(BMesh *bm, BMOperator *op) BMO_op_initf(bm, &dupeop, "dupe geom=%fve", EXT_INPUT); BMO_op_exec(bm, &dupeop); + /* disable root flag on all new skin nodes */ + if (CustomData_has_layer(&bm->vdata, CD_MVERT_SKIN)) { + BMO_ITER(v1, &siter, bm, &dupeop, "newout", BM_VERT) { + bm_extrude_disable_skin_root(bm, v1); + } + } + for (e = BMO_iter_new(&siter, bm, &dupeop, "boundarymap", 0); e; e = BMO_iter_step(&siter)) { e2 = BMO_iter_map_value(&siter); e2 = *(BMEdge **)e2; @@ -224,9 +245,12 @@ void bmo_extrude_vert_indiv_exec(BMesh *bm, BMOperator *op) BMOIter siter; BMVert *v, *dupev; BMEdge *e; + const int has_vskin = CustomData_has_layer(&bm->vdata, CD_MVERT_SKIN); for (v = BMO_iter_new(&siter, bm, op, "verts", BM_VERT); v; v = BMO_iter_step(&siter)) { dupev = BM_vert_create(bm, v->co, v); + if (has_vskin) + bm_extrude_disable_skin_root(bm, v); e = BM_edge_create(bm, v, dupev, NULL, FALSE); @@ -324,6 +348,13 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op) BMO_slot_copy(op, &dupeop, "edgefacein", "geom"); BMO_op_exec(bm, &dupeop); + /* disable root flag on all new skin nodes */ + if (CustomData_has_layer(&bm->vdata, CD_MVERT_SKIN)) { + BMO_ITER(v, &siter, bm, &dupeop, "newout", BM_VERT) { + bm_extrude_disable_skin_root(bm, v); + } + } + if (bm->act_face && BMO_elem_flag_test(bm, bm->act_face, EXT_INPUT)) bm->act_face = BMO_slot_map_ptr_get(bm, &dupeop, "facemap", bm->act_face); |