[Bf-blender-cvs] [3d1f5570d0e] refactor-mesh-position-generic: Add "vert_" prefix to more variables

Hans Goudey noreply at git.blender.org
Mon Jan 9 16:30:01 CET 2023


Commit: 3d1f5570d0eb5eb535de8b0cdd68643a09743204
Author: Hans Goudey
Date:   Mon Jan 9 10:29:51 2023 -0500
Branches: refactor-mesh-position-generic
https://developer.blender.org/rB3d1f5570d0eb5eb535de8b0cdd68643a09743204

Add "vert_" prefix to more variables

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

M	source/blender/blenkernel/BKE_mesh.h
M	source/blender/blenkernel/BKE_mesh_tangent.h
M	source/blender/blenkernel/BKE_paint.h
M	source/blender/blenkernel/intern/bvhutils.cc
M	source/blender/blenkernel/intern/mesh_legacy_convert.cc
M	source/blender/blenkernel/intern/mesh_tangent.cc
M	source/blender/blenkernel/intern/paint.cc
M	source/blender/editors/sculpt_paint/paint_vertex.cc
M	source/blender/editors/sculpt_paint/sculpt.cc
M	source/blender/editors/sculpt_paint/sculpt_paint_image.cc
M	source/blender/editors/sculpt_paint/sculpt_undo.c
M	source/blender/editors/transform/transform_snap_object.cc
M	source/blender/render/intern/multires_bake.cc

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

diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h
index 7869299779e..045ff6d6a99 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -1056,7 +1056,8 @@ inline blender::Span<blender::float3> Mesh::vert_positions() const
 }
 inline blender::MutableSpan<blender::float3> Mesh::vert_positions_for_write()
 {
-  return {reinterpret_cast<blender::float3 *>(BKE_mesh_vert_positions_for_write(this)), this->totvert};
+  return {reinterpret_cast<blender::float3 *>(BKE_mesh_vert_positions_for_write(this)),
+          this->totvert};
 }
 
 inline blender::Span<MEdge> Mesh::edges() const
diff --git a/source/blender/blenkernel/BKE_mesh_tangent.h b/source/blender/blenkernel/BKE_mesh_tangent.h
index 88c69122e9c..cec98da5ef6 100644
--- a/source/blender/blenkernel/BKE_mesh_tangent.h
+++ b/source/blender/blenkernel/BKE_mesh_tangent.h
@@ -17,7 +17,7 @@ struct ReportList;
  * split normals can be used to recreate the full tangent space.
  * NOTE: * The mesh should be made of only tris and quads!
  */
-void BKE_mesh_calc_loop_tangent_single_ex(const float (*positions)[3],
+void BKE_mesh_calc_loop_tangent_single_ex(const float (*vert_positions)[3],
                                           int numVerts,
                                           const struct MLoop *mloops,
                                           float (*r_looptangent)[4],
@@ -41,7 +41,7 @@ void BKE_mesh_calc_loop_tangent_single(struct Mesh *mesh,
 /**
  * See: #BKE_editmesh_loop_tangent_calc (matching logic).
  */
-void BKE_mesh_calc_loop_tangent_ex(const float (*positions)[3],
+void BKE_mesh_calc_loop_tangent_ex(const float (*vert_positions)[3],
                                    const struct MPoly *mpoly,
                                    uint mpoly_len,
                                    const struct MLoop *mloop,
diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h
index 8daca849e63..55c89e2d6b1 100644
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@ -576,7 +576,7 @@ typedef struct SculptSession {
   struct Depsgraph *depsgraph;
 
   /* These are always assigned to base mesh data when using PBVH_FACES and PBVH_GRIDS. */
-  float (*positions)[3];
+  float (*vert_positions)[3];
   const struct MPoly *mpoly;
   const struct MLoop *mloop;
 
diff --git a/source/blender/blenkernel/intern/bvhutils.cc b/source/blender/blenkernel/intern/bvhutils.cc
index b2e6426f0fa..791e19c8764 100644
--- a/source/blender/blenkernel/intern/bvhutils.cc
+++ b/source/blender/blenkernel/intern/bvhutils.cc
@@ -586,7 +586,7 @@ static void bvhtree_from_mesh_setup_data(BVHTree *tree,
 
   r_data->tree = tree;
 
-  r_data->positions = reinterpret_cast<const float(*)[3]>(positions);
+  r_data->vert_positions = positions;
   r_data->edge = edge;
   r_data->face = face;
   r_data->loop = loop;
diff --git a/source/blender/blenkernel/intern/mesh_legacy_convert.cc b/source/blender/blenkernel/intern/mesh_legacy_convert.cc
index 13c67c57ad5..e0a7cd1830e 100644
--- a/source/blender/blenkernel/intern/mesh_legacy_convert.cc
+++ b/source/blender/blenkernel/intern/mesh_legacy_convert.cc
@@ -1628,6 +1628,7 @@ void BKE_mesh_legacy_convert_verts_to_positions(Mesh *mesh)
   });
 
   CustomData_free_layers(&mesh->vdata, CD_MVERT, mesh->totvert);
+  mesh->mvert = nullptr;
 }
 
 /** \} */
diff --git a/source/blender/blenkernel/intern/mesh_tangent.cc b/source/blender/blenkernel/intern/mesh_tangent.cc
index f47350dd46a..4a9155914a3 100644
--- a/source/blender/blenkernel/intern/mesh_tangent.cc
+++ b/source/blender/blenkernel/intern/mesh_tangent.cc
@@ -76,7 +76,7 @@ struct BKEMeshToTangent {
   int num_polys;                  /* number of polygons */
 };
 
-void BKE_mesh_calc_loop_tangent_single_ex(const float (*positions)[3],
+void BKE_mesh_calc_loop_tangent_single_ex(const float (*vert_positions)[3],
                                           const int /*numVerts*/,
                                           const MLoop *mloops,
                                           float (*r_looptangent)[4],
@@ -91,7 +91,7 @@ void BKE_mesh_calc_loop_tangent_single_ex(const float (*positions)[3],
   BKEMeshToTangent mesh_to_tangent;
   mesh_to_tangent.mpolys = mpolys;
   mesh_to_tangent.mloops = mloops;
-  mesh_to_tangent.positions = positions;
+  mesh_to_tangent.positions = vert_positions;
   mesh_to_tangent.luvs = loopuvs;
   mesh_to_tangent.loop_normals = loop_normals;
   mesh_to_tangent.tangents = r_looptangent;
@@ -385,7 +385,7 @@ void BKE_mesh_calc_loop_tangent_step_0(const CustomData *loopData,
   }
 }
 
-void BKE_mesh_calc_loop_tangent_ex(const float (*positions)[3],
+void BKE_mesh_calc_loop_tangent_ex(const float (*vert_positions)[3],
                                    const MPoly *mpoly,
                                    const uint mpoly_len,
                                    const MLoop *mloop,
@@ -490,7 +490,7 @@ void BKE_mesh_calc_loop_tangent_ex(const float (*positions)[3],
         mesh2tangent->face_as_quad_map = face_as_quad_map;
         mesh2tangent->num_face_as_quad_map = num_face_as_quad_map;
 #endif
-        mesh2tangent->positions = positions;
+        mesh2tangent->positions = vert_positions;
         mesh2tangent->vert_normals = vert_normals;
         mesh2tangent->mpoly = mpoly;
         mesh2tangent->mloop = mloop;
diff --git a/source/blender/blenkernel/intern/paint.cc b/source/blender/blenkernel/intern/paint.cc
index ac4027446a5..c8e182c183e 100644
--- a/source/blender/blenkernel/intern/paint.cc
+++ b/source/blender/blenkernel/intern/paint.cc
@@ -1695,7 +1695,7 @@ static void sculpt_update_object(
 
     /* These are assigned to the base mesh in Multires. This is needed because Face Sets operators
      * and tools use the Face Sets data from the base mesh when Multires is active. */
-    ss->positions = BKE_mesh_vert_positions_for_write(me);
+    ss->vert_positions = BKE_mesh_vert_positions_for_write(me);
     ss->mpoly = BKE_mesh_polys(me);
     ss->mloop = BKE_mesh_loops(me);
   }
@@ -1703,7 +1703,7 @@ static void sculpt_update_object(
     ss->totvert = me->totvert;
     ss->totpoly = me->totpoly;
     ss->totfaces = me->totpoly;
-    ss->positions = BKE_mesh_vert_positions_for_write(me);
+    ss->vert_positions = BKE_mesh_vert_positions_for_write(me);
     ss->mpoly = BKE_mesh_polys(me);
     ss->mloop = BKE_mesh_loops(me);
     ss->multires.active = false;
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.cc b/source/blender/editors/sculpt_paint/paint_vertex.cc
index f1b76ad3c4f..4469e4ca647 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.cc
+++ b/source/blender/editors/sculpt_paint/paint_vertex.cc
@@ -2072,7 +2072,7 @@ static void do_wpaint_brush_smear_task_cb_ex(void *__restrict userdata,
          * Otherwise, take the current vert. */
         const int v_index = has_grids ? ss->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i];
         const float grid_alpha = has_grids ? 1.0f / vd.gridsize : 1.0f;
-        const float3 &mv_curr = ss->positions[v_index];
+        const float3 &mv_curr = ss->vert_positions[v_index];
 
         /* If the vertex is selected */
         if (!(use_face_sel || use_vert_sel) || select_vert[v_index]) {
@@ -2099,7 +2099,7 @@ static void do_wpaint_brush_smear_task_cb_ex(void *__restrict userdata,
               for (int k = 0; k < mp->totloop; k++, ml_other++) {
                 const uint v_other_index = ml_other->v;
                 if (v_other_index != v_index) {
-                  const float3 &mv_other = ss->positions[v_other_index];
+                  const float3 &mv_other = ss->vert_positions[v_other_index];
 
                   /* Get the direction from the selected vert to the neighbor. */
                   float other_dir[3];
@@ -3307,7 +3307,7 @@ static void do_vpaint_brush_smear(bContext *C,
             const int v_index = has_grids ? ss->mloop[vd.grid_indices[vd.g]].v :
                                             vd.vert_indices[vd.i];
             const float grid_alpha = has_grids ? 1.0f / vd.gridsize : 1.0f;
-            const float3 &mv_curr = &ss->positions[v_index];
+            const float3 &mv_curr = &ss->vert_positions[v_index];
 
             /* if the vertex is selected for painting. */
             if (!use_vert_sel || select_vert[v_index]) {
@@ -3344,7 +3344,7 @@ static void do_vpaint_brush_smear(bContext *C,
                     for (int k = 0; k < mp->totloop; k++, ml_other++) {
                       const uint v_other_index = ml_other->v;
                       if (v_other_index != v_index) {
-                        const float3 &mv_other = &ss->positions[v_other_index];
+                        const float3 &mv_other = &ss->vert_positions[v_other_index];
 
                         /* Get the direction from the
                          * selected vert to the neighbor. */
diff --git a/source/blender/editors/sculpt_paint/sculpt.cc b/source/blender/editors/sculpt_paint/sculpt.cc
index fa17dcea41c..5cc390f360f 100644
--- a/source/blender/editors/sculpt_paint/sculpt.cc
+++ b/source/blender/editors/sculpt_paint/sculpt.cc
@@ -116,7 +116,7 @@ const float *SCULPT_vertex_co_get(SculptSession *ss, PBVHVertRef vertex)
         const float(*positions)[3] = BKE_pbvh_get_positions(ss->pbvh);
         return positions[vertex.i];
       }
-      return ss->positions[vertex.i];
+      return ss->vert_positions[vertex.i];
     }
     case PBVH_BMESH:
       return ((BMVert *)vertex.i)->co;
@@ -207,7 +207,7 @@ const float *SCULPT_vertex_co_for_grab_active_get(SculptSession *ss, PBVHVertRef
     }
 
     /* Sculpting on the base mesh. */
-    return ss->positions[vertex.i];
+    return ss->vert_positions[vertex.i];
   }
 
   /* Everything else, such as sculpting on multires. */
@@ -295,7 +295,7 @@ float (*SCULPT_mesh_deformed_positions_get(SculptSession *ss))[3]
       if (ss->shapekey_active || ss->deform_modifiers_active) {
         return BKE_pbvh_get_positions(ss->pbvh);
       }
-      return ss->positions;
+      return ss->vert_positions;
     case PBVH_BMESH:
     case PBVH_GRIDS:
       return nullptr;
diff --git a/source/blender/editors/sculpt_paint/sculpt_paint_image.cc b/so

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list