[Bf-blender-cvs] [579e4ee8df6] refactor-mesh-position-generic: Remove some references to MVert/mvert

Hans Goudey noreply at git.blender.org
Thu Sep 15 18:44:14 CEST 2022


Commit: 579e4ee8df61a22f7fe4b61a898bef0a19dd347b
Author: Hans Goudey
Date:   Wed Sep 14 22:02:51 2022 -0500
Branches: refactor-mesh-position-generic
https://developer.blender.org/rB579e4ee8df61a22f7fe4b61a898bef0a19dd347b

Remove some references to MVert/mvert

===================================================================

M	source/blender/blenkernel/intern/mesh_boolean_convert.cc
M	source/blender/blenkernel/intern/multires.c
M	source/blender/blenkernel/intern/particle_distribute.c
M	source/blender/bmesh/intern/bmesh_mesh_convert.cc
M	source/blender/editors/sculpt_paint/sculpt_undo.c
M	source/blender/makesdna/DNA_mesh_types.h
M	source/blender/makesdna/DNA_meshdata_types.h

===================================================================

diff --git a/source/blender/blenkernel/intern/mesh_boolean_convert.cc b/source/blender/blenkernel/intern/mesh_boolean_convert.cc
index ae0de900d20..4d671ff5be0 100644
--- a/source/blender/blenkernel/intern/mesh_boolean_convert.cc
+++ b/source/blender/blenkernel/intern/mesh_boolean_convert.cc
@@ -189,7 +189,6 @@ void MeshesToIMeshInfo::input_mvert_for_orig_index(int orig_index,
   int orig_mesh_index = input_mesh_for_imesh_vert(orig_index);
   BLI_assert(0 <= orig_mesh_index && orig_mesh_index < meshes.size());
   const Mesh *me = meshes[orig_mesh_index];
-  const Span<float3> positions = me->positions();
   int index_in_mesh = orig_index - mesh_vert_offset[orig_mesh_index];
   BLI_assert(0 <= index_in_mesh && index_in_mesh < me->totvert);
   if (r_orig_mesh) {
diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c
index 28c18d0f81e..62df98d1200 100644
--- a/source/blender/blenkernel/intern/multires.c
+++ b/source/blender/blenkernel/intern/multires.c
@@ -1597,7 +1597,7 @@ int mdisp_rot_face_to_crn(                          struct MPoly *mpoly,
     float mindist = FLT_MAX;
 
     for (i = 0; i < mpoly->totloop; i++) {
-      float len = len_v3v3(NULL, mvert[mloop[mpoly->loopstart + i].v].co);
+      float len = len_v3v3(NULL, positions[mloop[mpoly->loopstart + i].v].co);
       if (len < mindist) {
         mindist = len;
         minS = i;
diff --git a/source/blender/blenkernel/intern/particle_distribute.c b/source/blender/blenkernel/intern/particle_distribute.c
index 97247f77fdb..e7ce7ba2c42 100644
--- a/source/blender/blenkernel/intern/particle_distribute.c
+++ b/source/blender/blenkernel/intern/particle_distribute.c
@@ -97,7 +97,7 @@ static void distribute_grid(Mesh *mesh, ParticleSystem *psys)
 {
   ParticleData *pa = NULL;
   float min[3], max[3], delta[3], d;
-  float(*positions)[3] = BKE_mesh_positions_for_write(mesh);
+  const float(*positions)[3] = BKE_mesh_positions(mesh);
   int totvert = mesh->totvert, from = psys->part->from;
   int i, j, k, p, res = psys->part->grid_res, size[3], axis;
 
diff --git a/source/blender/bmesh/intern/bmesh_mesh_convert.cc b/source/blender/bmesh/intern/bmesh_mesh_convert.cc
index ea6b1a70552..780430b91d5 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_convert.cc
+++ b/source/blender/bmesh/intern/bmesh_mesh_convert.cc
@@ -654,9 +654,9 @@ static int bm_to_mesh_shape_layer_index_from_kb(BMesh *bm, KeyBlock *currkey)
  *
  * \param bm: The source BMesh.
  * \param key: The destination key.
- * \param mvert: The destination vertex array (in some situations it's coordinates are updated).
+ * \param positions: The destination vertex array (in some situations its coordinates are updated).
  * \param active_shapekey_to_mvert: When editing a non-basis shape key, the coordinates for the
- * basis are typically copied into the `mvert` array since it makes sense for the meshes
+ * basis are typically copied into the `positions` array since it makes sense for the meshes
  * vertex coordinates to match the "Basis" key.
  * When enabled, skip this step and copy #BMVert.co directly to the mesh position.
  * See #BMeshToMeshParams.active_shapekey_to_mvert doc-string.
@@ -743,7 +743,7 @@ static void bm_to_mesh_shape(BMesh *bm,
    * while users might not notice since the shape-key is applied in the viewport,
    * exporters for example may still use the underlying coordinates, see: T30771 & T96135.
    *
-   * Needed when editing any shape that isn't the (`key->refkey`), the vertices in `me->mvert`
+   * Needed when editing any shape that isn't the (`key->refkey`), the vertices in mesh positions
    * currently have vertex coordinates set from the current-shape (initialized from #BMVert.co).
    * In this case it's important to overwrite these coordinates with the basis-keys coordinates. */
   bool update_vertex_coords_from_refkey = false;
diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c
index 101965035eb..2b9c3d8cbe9 100644
--- a/source/blender/editors/sculpt_paint/sculpt_undo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_undo.c
@@ -310,7 +310,7 @@ static bool sculpt_undo_restore_coords(bContext *C, Depsgraph *depsgraph, Sculpt
       /* Propagate new coords to keyblock. */
       SCULPT_vertcos_to_key(ob, ss->shapekey_active, vertCos);
 
-      /* PBVH uses its own mvert array, so coords should be */
+      /* PBVH uses its own vertex array, so coords should be */
       /* propagated to PBVH here. */
       BKE_pbvh_vert_coords_apply(ss->pbvh, vertCos, ss->shapekey_active->totelem);
 
diff --git a/source/blender/makesdna/DNA_mesh_types.h b/source/blender/makesdna/DNA_mesh_types.h
index d44fa86910d..f3cdbd1ae88 100644
--- a/source/blender/makesdna/DNA_mesh_types.h
+++ b/source/blender/makesdna/DNA_mesh_types.h
@@ -384,7 +384,7 @@ typedef struct TFace {
 
 /** #Mesh_Runtime.wrapper_type */
 typedef enum eMeshWrapperType {
-  /** Use mesh data (#Mesh.mvert, #Mesh.medge, #Mesh.mloop, #Mesh.mpoly). */
+  /** Use mesh data (#positions, #Mesh.medge, #Mesh.mloop, #Mesh.mpoly). */
   ME_WRAPPER_TYPE_MDATA = 0,
   /** Use edit-mesh data (#Mesh.edit_mesh, #Mesh_Runtime.edit_data). */
   ME_WRAPPER_TYPE_BMESH = 1,
diff --git a/source/blender/makesdna/DNA_meshdata_types.h b/source/blender/makesdna/DNA_meshdata_types.h
index 05e6b074576..32f12fd1e18 100644
--- a/source/blender/makesdna/DNA_meshdata_types.h
+++ b/source/blender/makesdna/DNA_meshdata_types.h
@@ -19,9 +19,7 @@ extern "C" {
  * \{ */
 
 /**
- * Mesh Vertices.
- *
- * Typically accessed from #Mesh.mvert
+ * Deprecated mesh vertex data structure. Now stored with generic attributes.
  */
 #ifdef DNA_DEPRECATED_ALLOW
 typedef struct MVert {
@@ -178,9 +176,9 @@ enum {
  *
  * // access vertex locations.
  * float *vtri_co[3] = {
- *     mvert[mloop[lt->tri[0]].v].co,
- *     mvert[mloop[lt->tri[1]].v].co,
- *     mvert[mloop[lt->tri[2]].v].co,
+ *     positions[mloop[lt->tri[0]].v],
+ *     positions[mloop[lt->tri[1]].v],
+ *     positions[mloop[lt->tri[2]].v],
  * };
  *
  * // access UV coordinates (works for all loop data, vertex colors... etc).



More information about the Bf-blender-cvs mailing list