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>2021-06-14 15:56:01 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-06-14 15:56:01 +0300
commit8083527f90d1556f576cf102d4143749677c45e0 (patch)
tree347f2be8a4aaa305a8e6a1125dbf5f7fb3174b13 /source/blender/editors/mesh/editmesh_utils.c
parent1d2eb461b528cc309ad6d2fa94ce1e910e93d8be (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_utils.c')
-rw-r--r--source/blender/editors/mesh/editmesh_utils.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c
index 19c9909039c..c8f8f12ba90 100644
--- a/source/blender/editors/mesh/editmesh_utils.c
+++ b/source/blender/editors/mesh/editmesh_utils.c
@@ -1439,20 +1439,25 @@ void EDBM_stats_update(BMEditMesh *em)
}
}
-/* so many tools call these that we better make it a generic function.
+/**
+ * So many tools call these that we better make it a generic function.
*/
-void EDBM_update_generic(Mesh *mesh, const bool do_tessellation, const bool is_destructive)
+void EDBM_update(Mesh *mesh, const struct EDBMUpdate_Params *params)
{
BMEditMesh *em = mesh->edit_mesh;
/* Order of calling isn't important. */
DEG_id_tag_update(&mesh->id, ID_RECALC_GEOMETRY);
WM_main_add_notifier(NC_GEOM | ND_DATA, &mesh->id);
- if (do_tessellation) {
+ if (params->calc_normals) {
+ EDBM_mesh_normals_update(em);
+ }
+
+ if (params->calc_looptri) {
BKE_editmesh_looptri_calc(em);
}
- if (is_destructive) {
+ if (params->is_destructive) {
/* TODO. we may be able to remove this now! - Campbell */
// BM_mesh_elem_table_free(em->bm, BM_ALL_NOLOOP);
}
@@ -1477,6 +1482,17 @@ void EDBM_update_generic(Mesh *mesh, const bool do_tessellation, const bool is_d
#endif
}
+/* Bad level call from Python API. */
+void EDBM_update_extern(struct Mesh *me, const bool do_tessellation, const bool is_destructive)
+{
+ EDBM_update(me,
+ &(const struct EDBMUpdate_Params){
+ .calc_looptri = do_tessellation,
+ .calc_normals = false,
+ .is_destructive = is_destructive,
+ });
+}
+
/** \} */
/* -------------------------------------------------------------------- */