[Bf-blender-cvs] [af2e780ddfe] refactor-mesh-position-generic: Merge branch 'master' into refactor-mesh-position-generic

Hans Goudey noreply at git.blender.org
Mon Dec 5 06:08:27 CET 2022


Commit: af2e780ddfe25d1bf5351d25e692e115ed457788
Author: Hans Goudey
Date:   Sun Dec 4 23:01:05 2022 -0600
Branches: refactor-mesh-position-generic
https://developer.blender.org/rBaf2e780ddfe25d1bf5351d25e692e115ed457788

Merge branch 'master' into refactor-mesh-position-generic

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



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

diff --cc source/blender/blenkernel/intern/key.cc
index 66aa6751467,37b2d14133c..d7da899a9bc
--- a/source/blender/blenkernel/intern/key.cc
+++ b/source/blender/blenkernel/intern/key.cc
@@@ -2226,8 -2248,8 +2232,8 @@@ void BKE_keyblock_mesh_calc_normals(con
      return;
    }
  
-   float(*positions)[3] = MEM_dupallocN(BKE_mesh_positions(mesh));
 -  MVert *verts = static_cast<MVert *>(MEM_dupallocN(BKE_mesh_verts(mesh)));
 -  BKE_keyblock_convert_to_mesh(kb, verts, mesh->totvert);
++  float(*positions)[3] = static_cast<float(*)[3]>(MEM_dupallocN(BKE_mesh_positions(mesh)));
 +  BKE_keyblock_convert_to_mesh(kb, positions, mesh->totvert);
    const MEdge *edges = BKE_mesh_edges(mesh);
    const MPoly *polys = BKE_mesh_polys(mesh);
    const MLoop *loops = BKE_mesh_loops(mesh);
@@@ -2265,8 -2289,9 +2273,9 @@@
                                            vert_normals);
    }
    if (loop_normals_needed) {
-     short(*clnors)[2] = CustomData_get_layer(&mesh->ldata, CD_CUSTOMLOOPNORMAL); /* May be NULL. */
+     short(*clnors)[2] = static_cast<short(*)[2]>(
+         CustomData_get_layer(&mesh->ldata, CD_CUSTOMLOOPNORMAL)); /* May be nullptr. */
 -    BKE_mesh_normals_loop_split(verts,
 +    BKE_mesh_normals_loop_split(positions,
                                  vert_normals,
                                  mesh->totvert,
                                  edges,
diff --cc source/blender/makesdna/DNA_mesh_types.h
index 269f7374b86,7a28485c768..7e0911a9968
--- a/source/blender/makesdna/DNA_mesh_types.h
+++ b/source/blender/makesdna/DNA_mesh_types.h
@@@ -13,12 -13,11 +13,15 @@@
  #include "DNA_meshdata_types.h"
  #include "DNA_session_uuid_types.h"
  
 +#ifdef __cplusplus
 +#  include "BLI_math_vec_types.hh"
 +#endif
 +
  /** Workaround to forward-declare C++ type in C header. */
  #ifdef __cplusplus
+ 
+ #  include "BLI_math_vec_types.hh"
+ 
  namespace blender {
  template<typename T> class Span;
  template<typename T> class MutableSpan;
diff --cc source/blender/modifiers/intern/MOD_displace.cc
index 6436bf29bdc,84ede5fdd2a..47f9cb492ae
--- a/source/blender/modifiers/intern/MOD_displace.cc
+++ b/source/blender/modifiers/intern/MOD_displace.cc
@@@ -282,9 -284,10 +282,9 @@@ static void displaceModifier_do(Displac
      return;
    }
  
 -  mvert = BKE_mesh_verts_for_write(mesh);
    MOD_get_vgroup(ob, mesh, dmd->defgrp_name, &dvert, &defgrp_index);
  
-   if (defgrp_index >= 0 && dvert == NULL) {
+   if (defgrp_index >= 0 && dvert == nullptr) {
      /* There is a vertex group, but it has no vertices. */
      return;
    }
diff --cc source/blender/nodes/geometry/nodes/node_geo_input_mesh_face_is_planar.cc
index 0bd1cf968df,be98f53d161..59cc7f0424c
--- a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_face_is_planar.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_face_is_planar.cc
@@@ -37,11 -37,10 +37,10 @@@ class PlanarFieldInput final : public b
                                   const eAttrDomain domain,
                                   IndexMask /*mask*/) const final
    {
 -    const Span<MVert> verts = mesh.verts();
 +    const Span<float3> positions = mesh.positions();
      const Span<MPoly> polys = mesh.polys();
      const Span<MLoop> loops = mesh.loops();
-     const Span<float3> poly_normals{
-         reinterpret_cast<const float3 *>(BKE_mesh_poly_normals_ensure(&mesh)), mesh.totpoly};
+     const Span<float3> poly_normals = mesh.poly_normals();
  
      bke::MeshFieldContext context{mesh, ATTR_DOMAIN_FACE};
      fn::FieldEvaluator evaluator{context, polys.size()};
diff --cc source/blender/render/intern/bake.cc
index 8e413d3b80a,cab3dbf54bc..fa0e03c6bec
--- a/source/blender/render/intern/bake.cc
+++ b/source/blender/render/intern/bake.cc
@@@ -471,16 -472,16 +472,16 @@@ static TriTessFace *mesh_calc_tri_tessf
                                               BKE_mesh_poly_normals_ensure(me);
    const bool calculate_normal = precomputed_normals ? false : true;
  
-   if (precomputed_normals != NULL) {
+   if (precomputed_normals != nullptr) {
      BKE_mesh_recalc_looptri_with_normals(
 -        loops, polys, verts, me->totloop, me->totpoly, looptri, precomputed_normals);
 +        loops, polys, positions, me->totloop, me->totpoly, looptri, precomputed_normals);
    }
    else {
 -    BKE_mesh_recalc_looptri(loops, polys, verts, me->totloop, me->totpoly, looptri);
 +    BKE_mesh_recalc_looptri(loops, polys, positions, me->totloop, me->totpoly, looptri);
    }
  
-   const TSpace *tspace = NULL;
-   const float(*loop_normals)[3] = NULL;
+   const TSpace *tspace = nullptr;
+   const float(*loop_normals)[3] = nullptr;
    if (tangent) {
      BKE_mesh_ensure_normals_for_display(me_eval);
      BKE_mesh_calc_normals_split(me_eval);
@@@ -739,12 -742,12 +742,12 @@@ void RE_bake_pixels_populate(Mesh *me
    }
  
    const int tottri = poly_to_tri_count(me->totpoly, me->totloop);
-   MLoopTri *looptri = MEM_mallocN(sizeof(*looptri) * tottri, __func__);
+   MLoopTri *looptri = static_cast<MLoopTri *>(MEM_mallocN(sizeof(*looptri) * tottri, __func__));
  
 -  const MVert *verts = BKE_mesh_verts(me);
 +  const float(*positions)[3] = BKE_mesh_positions(me);
    const MPoly *polys = BKE_mesh_polys(me);
    const MLoop *loops = BKE_mesh_loops(me);
 -  BKE_mesh_recalc_looptri(loops, polys, verts, me->totloop, me->totpoly, looptri);
 +  BKE_mesh_recalc_looptri(loops, polys, positions, me->totloop, me->totpoly, looptri);
  
    const int *material_indices = BKE_mesh_material_indices(me);
    const int materials_num = targets->materials_num;
diff --cc source/blender/render/intern/multires_bake.cc
index 1239595ea10,270f2fb22f2..d8b84da474f
--- a/source/blender/render/intern/multires_bake.cc
+++ b/source/blender/render/intern/multires_bake.cc
@@@ -472,11 -472,11 +472,11 @@@ static void do_multires_bake(MultiresBa
    MultiresBakeThread *handles;
    MultiresBakeQueue queue;
  
 -  MVert *mvert = dm->getVertArray(dm);
 +  const float(*positions)[3] = (float(*)[3])dm->getVertArray(dm);
    MPoly *mpoly = dm->getPolyArray(dm);
    MLoop *mloop = dm->getLoopArray(dm);
-   MLoopUV *mloopuv = dm->getLoopDataArray(dm, CD_MLOOPUV);
-   float *pvtangent = NULL;
+   MLoopUV *mloopuv = static_cast<MLoopUV *>(dm->getLoopDataArray(dm, CD_MLOOPUV));
+   float *pvtangent = nullptr;
  
    ListBase threads;
    int i, tot_thread = bkr->threads > 0 ? bkr->threads : BLI_system_thread_count();
@@@ -552,9 -553,9 +552,9 @@@
      handle->queue = &queue;
  
      handle->data.mpoly = mpoly;
-     handle->data.material_indices = CustomData_get_layer_named(
-         &dm->polyData, CD_PROP_INT32, "material_index");
+     handle->data.material_indices = static_cast<const int *>(
+         CustomData_get_layer_named(&dm->polyData, CD_PROP_INT32, "material_index"));
 -    handle->data.mvert = mvert;
 +    handle->data.positions = positions;
      handle->data.vert_normals = vert_normals;
      handle->data.mloopuv = mloopuv;
      BKE_image_get_tile_uv(ima, tile->tile_number, handle->data.uv_offset);



More information about the Bf-blender-cvs mailing list