From 8083527f90d1556f576cf102d4143749677c45e0 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 14 Jun 2021 22:56:01 +1000 Subject: Edit Mesh: use params arg for update function, add calc_normals arg Rename function EDBM_update_generic to EDBM_update, use a parameters argument for better readability. Also add calc_normals argument, which will have benefits when calculating normals and tessellation together is optimized. --- source/blender/editors/mesh/editmesh_polybuild.c | 40 ++++++++++++++++++------ 1 file changed, 30 insertions(+), 10 deletions(-) (limited to 'source/blender/editors/mesh/editmesh_polybuild.c') diff --git a/source/blender/editors/mesh/editmesh_polybuild.c b/source/blender/editors/mesh/editmesh_polybuild.c index 4d37b78c9b7..92d97f76509 100644 --- a/source/blender/editors/mesh/editmesh_polybuild.c +++ b/source/blender/editors/mesh/editmesh_polybuild.c @@ -154,8 +154,12 @@ static int edbm_polybuild_transform_at_cursor_invoke(bContext *C, BM_face_select_set(bm, (BMFace *)ele_act, true); } - EDBM_mesh_normals_update(em); - EDBM_update_generic(vc.obedit->data, true, true); + EDBM_update(vc.obedit->data, + &(const struct EDBMUpdate_Params){ + .calc_looptri = true, + .calc_normals = true, + .is_destructive = true, + }); if (basact != NULL) { if (vc.view_layer->basact != basact) { ED_object_base_activate(C, basact); @@ -237,8 +241,12 @@ static int edbm_polybuild_delete_at_cursor_invoke(bContext *C, } if (changed) { - EDBM_mesh_normals_update(em); - EDBM_update_generic(vc.obedit->data, true, true); + EDBM_update(vc.obedit->data, + &(const struct EDBMUpdate_Params){ + .calc_looptri = true, + .calc_normals = true, + .is_destructive = true, + }); if (basact != NULL) { if (vc.view_layer->basact != basact) { ED_object_base_activate(C, basact); @@ -400,8 +408,12 @@ static int edbm_polybuild_face_at_cursor_invoke(bContext *C, wmOperator *op, con } if (changed) { - EDBM_mesh_normals_update(em); - EDBM_update_generic(vc.obedit->data, true, true); + EDBM_update(vc.obedit->data, + &(const struct EDBMUpdate_Params){ + .calc_looptri = true, + .calc_normals = true, + .is_destructive = true, + }); if (basact != NULL) { if (vc.view_layer->basact != basact) { @@ -488,8 +500,12 @@ static int edbm_polybuild_split_at_cursor_invoke(bContext *C, } if (changed) { - EDBM_mesh_normals_update(em); - EDBM_update_generic(vc.obedit->data, true, true); + EDBM_update(vc.obedit->data, + &(const struct EDBMUpdate_Params){ + .calc_looptri = true, + .calc_normals = true, + .is_destructive = true, + }); WM_event_add_mousemove(vc.win); @@ -578,8 +594,12 @@ static int edbm_polybuild_dissolve_at_cursor_invoke(bContext *C, if (changed) { edbm_flag_disable_all_multi(vc.view_layer, vc.v3d, BM_ELEM_SELECT); - EDBM_mesh_normals_update(em); - EDBM_update_generic(vc.obedit->data, true, true); + EDBM_update(vc.obedit->data, + &(const struct EDBMUpdate_Params){ + .calc_looptri = true, + .calc_normals = true, + .is_destructive = true, + }); if (vc.view_layer->basact != basact) { ED_object_base_activate(C, basact); -- cgit v1.2.3