[Bf-blender-cvs] [8083527f90d] master: Edit Mesh: use params arg for update function, add calc_normals arg
Campbell Barton
noreply at git.blender.org
Mon Jun 14 15:04:27 CEST 2021
Commit: 8083527f90d1556f576cf102d4143749677c45e0
Author: Campbell Barton
Date: Mon Jun 14 22:56:01 2021 +1000
Branches: master
https://developer.blender.org/rB8083527f90d1556f576cf102d4143749677c45e0
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.
===================================================================
M source/blender/editors/include/ED_mesh.h
M source/blender/editors/mesh/editmesh_add.c
M source/blender/editors/mesh/editmesh_add_gizmo.c
M source/blender/editors/mesh/editmesh_automerge.c
M source/blender/editors/mesh/editmesh_bevel.c
M source/blender/editors/mesh/editmesh_bisect.c
M source/blender/editors/mesh/editmesh_extrude.c
M source/blender/editors/mesh/editmesh_extrude_screw.c
M source/blender/editors/mesh/editmesh_extrude_spin.c
M source/blender/editors/mesh/editmesh_inset.c
M source/blender/editors/mesh/editmesh_intersect.c
M source/blender/editors/mesh/editmesh_knife.c
M source/blender/editors/mesh/editmesh_loopcut.c
M source/blender/editors/mesh/editmesh_path.c
M source/blender/editors/mesh/editmesh_polybuild.c
M source/blender/editors/mesh/editmesh_rip.c
M source/blender/editors/mesh/editmesh_rip_edge.c
M source/blender/editors/mesh/editmesh_select.c
M source/blender/editors/mesh/editmesh_select_similar.c
M source/blender/editors/mesh/editmesh_tools.c
M source/blender/editors/mesh/editmesh_utils.c
M source/blender/editors/object/object_data_transform.c
M source/blender/editors/uvedit/uvedit_ops.c
M source/blender/python/bmesh/bmesh_py_api.c
===================================================================
diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h
index b8e9f6e8871..b76c35c7d7a 100644
--- a/source/blender/editors/include/ED_mesh.h
+++ b/source/blender/editors/include/ED_mesh.h
@@ -103,7 +103,14 @@ bool EDBM_vert_color_check(struct BMEditMesh *em);
bool EDBM_mesh_hide(struct BMEditMesh *em, bool swap);
bool EDBM_mesh_reveal(struct BMEditMesh *em, bool select);
-void EDBM_update_generic(struct Mesh *me, const bool do_tessellation, const bool is_destructive);
+struct EDBMUpdate_Params {
+ uint calc_looptri : 1;
+ uint calc_normals : 1;
+ uint is_destructive : 1;
+};
+
+void EDBM_update(struct Mesh *me, const struct EDBMUpdate_Params *params);
+void EDBM_update_extern(struct Mesh *me, const bool do_tessellation, const bool is_destructive);
struct UvElementMap *BM_uv_element_map_create(struct BMesh *bm,
const struct Scene *scene,
diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c
index 18e231893d4..a64b90e15a3 100644
--- a/source/blender/editors/mesh/editmesh_add.c
+++ b/source/blender/editors/mesh/editmesh_add.c
@@ -95,7 +95,12 @@ static void make_prim_finish(bContext *C,
EDBM_selectmode_flush_ex(em, SCE_SELECT_VERTEX);
/* only recalc editmode tessface if we are staying in editmode */
- EDBM_update_generic(obedit->data, !exit_editmode, true);
+ EDBM_update(obedit->data,
+ &(const struct EDBMUpdate_Params){
+ .calc_looptri = !exit_editmode,
+ .calc_normals = false,
+ .is_destructive = true,
+ });
/* userdef */
if (exit_editmode) {
diff --git a/source/blender/editors/mesh/editmesh_add_gizmo.c b/source/blender/editors/mesh/editmesh_add_gizmo.c
index e7a99ca9e08..9efcf0963b4 100644
--- a/source/blender/editors/mesh/editmesh_add_gizmo.c
+++ b/source/blender/editors/mesh/editmesh_add_gizmo.c
@@ -357,7 +357,12 @@ static int add_primitive_cube_gizmo_exec(bContext *C, wmOperator *op)
}
EDBM_selectmode_flush_ex(em, SCE_SELECT_VERTEX);
- EDBM_update_generic(obedit->data, true, true);
+ EDBM_update(obedit->data,
+ &(const struct EDBMUpdate_Params){
+ .calc_looptri = true,
+ .calc_normals = false,
+ .is_destructive = true,
+ });
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/mesh/editmesh_automerge.c b/source/blender/editors/mesh/editmesh_automerge.c
index 2bd5b9b26ca..35fff1f8f3a 100644
--- a/source/blender/editors/mesh/editmesh_automerge.c
+++ b/source/blender/editors/mesh/editmesh_automerge.c
@@ -76,7 +76,12 @@ void EDBM_automerge(Object *obedit, bool update, const char hflag, const float d
BMO_op_finish(bm, &weldop);
if ((totvert_prev != bm->totvert) && update) {
- EDBM_update_generic(obedit->data, true, true);
+ EDBM_update(obedit->data,
+ &(const struct EDBMUpdate_Params){
+ .calc_looptri = true,
+ .calc_normals = false,
+ .is_destructive = true,
+ });
}
}
@@ -134,7 +139,12 @@ void EDBM_automerge_and_split(Object *obedit,
#endif
if (LIKELY(ok) && update) {
- EDBM_update_generic(obedit->data, true, true);
+ EDBM_update(obedit->data,
+ &(const struct EDBMUpdate_Params){
+ .calc_looptri = true,
+ .calc_normals = false,
+ .is_destructive = true,
+ });
}
}
diff --git a/source/blender/editors/mesh/editmesh_bevel.c b/source/blender/editors/mesh/editmesh_bevel.c
index 43492cd57af..110f1975d8d 100644
--- a/source/blender/editors/mesh/editmesh_bevel.c
+++ b/source/blender/editors/mesh/editmesh_bevel.c
@@ -403,9 +403,12 @@ static bool edbm_bevel_calc(wmOperator *op)
continue;
}
- 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,
+ });
changed = true;
}
return changed;
@@ -454,7 +457,12 @@ static void edbm_bevel_cancel(bContext *C, wmOperator *op)
Object *obedit = opdata->ob_store[ob_index].ob;
BMEditMesh *em = BKE_editmesh_from_object(obedit);
EDBM_redo_state_free(&opdata->ob_store[ob_index].mesh_backup, em, true);
- EDBM_update_generic(obedit->data, false, true);
+ EDBM_update(obedit->data,
+ &(const struct EDBMUpdate_Params){
+ .calc_looptri = false,
+ .calc_normals = true,
+ .is_destructive = true,
+ });
}
}
diff --git a/source/blender/editors/mesh/editmesh_bisect.c b/source/blender/editors/mesh/editmesh_bisect.c
index ea35d5a9e26..fe627d38f46 100644
--- a/source/blender/editors/mesh/editmesh_bisect.c
+++ b/source/blender/editors/mesh/editmesh_bisect.c
@@ -383,7 +383,12 @@ static int mesh_bisect_exec(bContext *C, wmOperator *op)
bm, bmop.slots_out, "geom_cut.out", BM_VERT | BM_EDGE, BM_ELEM_SELECT, true);
if (EDBM_op_finish(em, &bmop, op, true)) {
- EDBM_update_generic(obedit->data, true, true);
+ EDBM_update(obedit->data,
+ &(const struct EDBMUpdate_Params){
+ .calc_looptri = true,
+ .calc_normals = false,
+ .is_destructive = true,
+ });
EDBM_selectmode_flush(em);
ret = OPERATOR_FINISHED;
}
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_
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list