From 1c54eaecd89ba30500e7b83adaf1c1a8a85c0b43 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 21 Apr 2012 13:58:29 +0000 Subject: fix [#31049] New Faces (F) always solid shaded --- source/blender/bmesh/intern/bmesh_opdefines.c | 10 ++++++---- source/blender/bmesh/operators/bmo_create.c | 19 +++++++++++++++---- 2 files changed, 21 insertions(+), 8 deletions(-) (limited to 'source/blender/bmesh') diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c b/source/blender/bmesh/intern/bmesh_opdefines.c index 98d2b31e57c..f850f6aa46a 100644 --- a/source/blender/bmesh/intern/bmesh_opdefines.c +++ b/source/blender/bmesh/intern/bmesh_opdefines.c @@ -404,8 +404,9 @@ static BMOpDefine bmo_join_triangles_def = { static BMOpDefine bmo_contextual_create_def = { "contextual_create", {{BMO_OP_SLOT_ELEMENT_BUF, "geom"}, //input geometry. - {BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, //newly-made face(s) - {BMO_OP_SLOT_INT, "mat_nr"}, /* material to use */ + {BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, /* newly-made face(s) */ + {BMO_OP_SLOT_INT, "mat_nr"}, /* material to use */ + {BMO_OP_SLOT_BOOL, "use_smooth"}, /* material to use */ {0, /* null-terminating sentinel */}}, bmo_contextual_create_exec, BMO_OP_FLAG_UNTAN_MULTIRES, @@ -431,8 +432,9 @@ static BMOpDefine bmo_edgenet_fill_def = { {BMO_OP_SLOT_BOOL, "use_fill_check"}, {BMO_OP_SLOT_ELEMENT_BUF, "excludefaces"}, /* list of faces to ignore for manifold check */ {BMO_OP_SLOT_MAPPING, "faceout_groupmap"}, /* maps new faces to the group numbers they came fro */ - {BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, /* new face */ - {BMO_OP_SLOT_INT, "mat_nr"}, /* material to use */ + {BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, /* new face */ + {BMO_OP_SLOT_INT, "mat_nr"}, /* material to use */ + {BMO_OP_SLOT_BOOL, "use_smooth"}, /* material to use */ {0, /* null-terminating sentinel */}}, bmo_edgenet_fill_exec, 0, diff --git a/source/blender/bmesh/operators/bmo_create.c b/source/blender/bmesh/operators/bmo_create.c index 6272c43d0c5..f2ba110b43d 100644 --- a/source/blender/bmesh/operators/bmo_create.c +++ b/source/blender/bmesh/operators/bmo_create.c @@ -896,9 +896,10 @@ void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op) BMEdge **edges = NULL; PathBase *pathbase; BLI_array_declare(edges); - int use_restrict = BMO_slot_bool_get(op, "use_restrict"); - int use_fill_check = BMO_slot_bool_get(op, "use_fill_check"); - const short mat_nr = BMO_slot_int_get(op, "mat_nr"); + int use_restrict = BMO_slot_bool_get(op, "use_restrict"); + int use_fill_check = BMO_slot_bool_get(op, "use_fill_check"); + const short mat_nr = BMO_slot_int_get(op, "mat_nr"); + const short use_smooth = BMO_slot_bool_get(op, "use_smooth"); int i, j, group = 0; unsigned int winding[2]; /* accumulte winding directions for each edge which has a face */ @@ -1049,6 +1050,9 @@ void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op) if (f && !BMO_elem_flag_test(bm, f, ELE_ORIG)) { BMO_elem_flag_enable(bm, f, FACE_NEW); f->mat_nr = mat_nr; + if (use_smooth) { + BM_elem_flag_enable(f, BM_ELEM_SMOOTH); + } } if (use_restrict) { @@ -1278,6 +1282,7 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op) BMFace *f; int totv = 0, tote = 0, totf = 0, amount; const short mat_nr = BMO_slot_int_get(op, "mat_nr"); + const short use_smooth = BMO_slot_bool_get(op, "use_smooth"); /* count number of each element type we were passe */ BMO_ITER (h, &oiter, bm, op, "geom", BM_VERT|BM_EDGE|BM_FACE) { @@ -1365,7 +1370,10 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op) BMO_slot_buffer_flag_enable(bm, &op2, "edgeout", BM_EDGE, ELE_NEW); BMO_op_finish(bm, &op2); - BMO_op_initf(bm, &op2, "edgenet_fill edges=%fe use_fill_check=%b mat_nr=%i", ELE_NEW, TRUE, mat_nr); + BMO_op_initf(bm, &op2, + "edgenet_fill edges=%fe use_fill_check=%b mat_nr=%i use_smooth=%b", + ELE_NEW, TRUE, mat_nr, use_smooth); + BMO_op_exec(bm, &op2); /* return if edge net create did something */ @@ -1469,6 +1477,9 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op) if (f) { BMO_elem_flag_enable(bm, f, ELE_OUT); f->mat_nr = mat_nr; + if (use_smooth) { + BM_elem_flag_enable(f, BM_ELEM_SMOOTH); + } } MEM_freeN(vert_arr); -- cgit v1.2.3