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>2012-04-21 17:58:29 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-04-21 17:58:29 +0400
commit1c54eaecd89ba30500e7b83adaf1c1a8a85c0b43 (patch)
treef31bf87f58f4360adaeac7b9d0c72b5a7baefe68 /source/blender/editors/mesh
parent1615b46963f79e90621c155a5d85925a4b5171a3 (diff)
fix [#31049] New Faces (F) always solid shaded
Diffstat (limited to 'source/blender/editors/mesh')
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index a0fcae860f6..4b064d8bcc6 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -1020,14 +1020,37 @@ void MESH_OT_edge_collapse_loop(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
+static int edbm_add_edge_face__smooth_get(BMesh *bm)
+{
+ BMEdge *e;
+ BMIter iter;
+
+ unsigned int vote_on_smooth[2] = {0, 0};
+
+ BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
+ if (BM_elem_flag_test(e, BM_ELEM_SELECT) && e->l)
+ {
+ vote_on_smooth[BM_elem_flag_test_bool(e->l->f, BM_ELEM_SMOOTH)]++;
+ }
+ }
+
+ return (vote_on_smooth[0] < vote_on_smooth[1]);
+}
+
static int edbm_add_edge_face_exec(bContext *C, wmOperator *op)
{
BMOperator bmop;
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
-
- if (!EDBM_op_init(em, &bmop, op, "contextual_create geom=%hfev mat_nr=%i", BM_ELEM_SELECT, em->mat_nr))
+ const short use_smooth = edbm_add_edge_face__smooth_get(em->bm);
+ /* when this is used to dissolve we could avoid this, but checking isnt too slow */
+
+ if (!EDBM_op_init(em, &bmop, op,
+ "contextual_create geom=%hfev mat_nr=%i use_smooth=%b",
+ BM_ELEM_SELECT, em->mat_nr, use_smooth))
+ {
return OPERATOR_CANCELLED;
+ }
BMO_op_exec(em->bm, &bmop);
BMO_slot_buffer_hflag_enable(em->bm, &bmop, "faceout", BM_FACE, BM_ELEM_SELECT, TRUE);