diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-06-14 15:56:01 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-06-14 15:56:01 +0300 |
commit | 8083527f90d1556f576cf102d4143749677c45e0 (patch) | |
tree | 347f2be8a4aaa305a8e6a1125dbf5f7fb3174b13 /source/blender/editors/mesh/editmesh_extrude.c | |
parent | 1d2eb461b528cc309ad6d2fa94ce1e910e93d8be (diff) |
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.
Diffstat (limited to 'source/blender/editors/mesh/editmesh_extrude.c')
-rw-r--r-- | source/blender/editors/mesh/editmesh_extrude.c | 68 |
1 files changed, 46 insertions, 22 deletions
diff --git a/source/blender/editors/mesh/editmesh_extrude.c b/source/blender/editors/mesh/editmesh_extrude.c index d5ddb7fc2c4..e03390780f9 100644 --- a/source/blender/editors/mesh/editmesh_extrude.c +++ b/source/blender/editors/mesh/editmesh_extrude.c @@ -319,9 +319,12 @@ static int edbm_extrude_repeat_exec(bContext *C, wmOperator *op) em->bm, BMO_FLAG_DEFAULTS, "translate vec=%v verts=%hv", offset_local, BM_ELEM_SELECT); } - EDBM_mesh_normals_update(em); - - EDBM_update_generic(obedit->data, true, true); + EDBM_update(obedit->data, + &(const struct EDBMUpdate_Params){ + .calc_looptri = true, + .calc_normals = true, + .is_destructive = true, + }); } MEM_freeN(objects); @@ -448,11 +451,13 @@ static int edbm_extrude_region_exec(bContext *C, wmOperator *op) continue; } /* This normally happens when pushing undo but modal operators - * like this one don't push undo data until after modal mode is - * done.*/ - EDBM_mesh_normals_update(em); - - EDBM_update_generic(obedit->data, true, true); + * like this one don't push undo data until after modal mode is done. */ + EDBM_update(obedit->data, + &(const struct EDBMUpdate_Params){ + .calc_looptri = true, + .calc_normals = true, + .is_destructive = true, + }); } MEM_freeN(objects); return OPERATOR_FINISHED; @@ -502,13 +507,15 @@ static int edbm_extrude_context_exec(bContext *C, wmOperator *op) } edbm_extrude_mesh(obedit, em, op); - /* This normally happens when pushing undo but modal operators - * like this one don't push undo data until after modal mode is - * done.*/ - EDBM_mesh_normals_update(em); - - EDBM_update_generic(obedit->data, true, true); + /* This normally happens when pushing undo but modal operators + * like this one don't push undo data until after modal mode is done.*/ + EDBM_update(obedit->data, + &(const struct EDBMUpdate_Params){ + .calc_looptri = true, + .calc_normals = true, + .is_destructive = true, + }); } MEM_freeN(objects); return OPERATOR_FINISHED; @@ -555,7 +562,12 @@ static int edbm_extrude_verts_exec(bContext *C, wmOperator *op) edbm_extrude_verts_indiv(em, op, BM_ELEM_SELECT); - EDBM_update_generic(obedit->data, true, true); + EDBM_update(obedit->data, + &(const struct EDBMUpdate_Params){ + .calc_looptri = true, + .calc_normals = false, + .is_destructive = true, + }); } MEM_freeN(objects); @@ -603,7 +615,12 @@ static int edbm_extrude_edges_exec(bContext *C, wmOperator *op) edbm_extrude_edges_indiv(em, op, BM_ELEM_SELECT, use_normal_flip); - EDBM_update_generic(obedit->data, true, true); + EDBM_update(obedit->data, + &(const struct EDBMUpdate_Params){ + .calc_looptri = true, + .calc_normals = false, + .is_destructive = true, + }); } MEM_freeN(objects); @@ -651,7 +668,12 @@ static int edbm_extrude_faces_exec(bContext *C, wmOperator *op) edbm_extrude_discrete_faces(em, op, BM_ELEM_SELECT); - EDBM_update_generic(obedit->data, true, true); + EDBM_update(obedit->data, + &(const struct EDBMUpdate_Params){ + .calc_looptri = true, + .calc_normals = false, + .is_destructive = true, + }); } MEM_freeN(objects); @@ -884,11 +906,13 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w } /* This normally happens when pushing undo but modal operators - * like this one don't push undo data until after modal mode is - * done. */ - EDBM_mesh_normals_update(vc.em); - - EDBM_update_generic(vc.obedit->data, true, true); + * like this one don't push undo data until after modal mode is done. */ + EDBM_update(vc.obedit->data, + &(const struct EDBMUpdate_Params){ + .calc_looptri = true, + .calc_normals = true, + .is_destructive = true, + }); WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data); |