[Bf-blender-cvs] [7a467e98e76] temp-vert-normals-cleanup: Merge branch 'master' into temp-vert-normals-cleanup

Hans Goudey noreply at git.blender.org
Sun Nov 7 06:40:21 CET 2021


Commit: 7a467e98e7615ef666e23c1afae3e10079699f78
Author: Hans Goudey
Date:   Sun Nov 7 00:40:15 2021 -0500
Branches: temp-vert-normals-cleanup
https://developer.blender.org/rB7a467e98e7615ef666e23c1afae3e10079699f78

Merge branch 'master' into temp-vert-normals-cleanup

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



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

diff --cc source/blender/blenkernel/intern/mesh.cc
index d25c4e0e1cc,efa8bc31ce3..bd81f24e11e
--- a/source/blender/blenkernel/intern/mesh.cc
+++ b/source/blender/blenkernel/intern/mesh.cc
@@@ -147,15 -142,10 +147,15 @@@ static void mesh_copy_data(Main *bmain
  
    BKE_mesh_update_customdata_pointers(mesh_dst, do_tessface);
  
-   mesh_dst->edit_mesh = NULL;
+   mesh_dst->edit_mesh = nullptr;
  
-   mesh_dst->mselect = MEM_dupallocN(mesh_dst->mselect);
+   mesh_dst->mselect = (MSelect *)MEM_dupallocN(mesh_dst->mselect);
  
 +  /* Copy dirty flags, essential for normal layers to avoid recomputation and
 +   * to ensure that when no normal layers exist, they are marked as dirty. */
 +  mesh_dst->runtime.cd_dirty_poly = mesh_src->runtime.cd_dirty_poly;
 +  mesh_dst->runtime.cd_dirty_vert = mesh_src->runtime.cd_dirty_vert;
 +
    /* TODO: Do we want to add flag to prevent this? */
    if (mesh_src->key && (flag & LIB_ID_COPY_SHAPEKEY)) {
      BKE_id_copy_ex(bmain, &mesh_src->key->id, (ID **)&mesh_dst->key, flag);
@@@ -1930,9 -1912,28 +1926,9 @@@ void BKE_mesh_calc_normals_split_ex(Mes
      CustomData_set_layer_flag(&mesh->ldata, CD_NORMAL, CD_FLAG_TEMPORARY);
    }
  
-   /* may be NULL */
-   clnors = CustomData_get_layer(&mesh->ldata, CD_CUSTOMLOOPNORMAL);
+   /* may be nullptr */
+   clnors = (short(*)[2])CustomData_get_layer(&mesh->ldata, CD_CUSTOMLOOPNORMAL);
  
 -  if (CustomData_has_layer(&mesh->pdata, CD_NORMAL)) {
 -    /* This assume that layer is always up to date, not sure this is the case
 -     * (esp. in Edit mode?)... */
 -    polynors = (float(*)[3])CustomData_get_layer(&mesh->pdata, CD_NORMAL);
 -    free_polynors = false;
 -  }
 -  else {
 -    polynors = (float(*)[3])MEM_malloc_arrayN(mesh->totpoly, sizeof(float[3]), __func__);
 -    BKE_mesh_calc_normals_poly_and_vertex(mesh->mvert,
 -                                          mesh->totvert,
 -                                          mesh->mloop,
 -                                          mesh->totloop,
 -                                          mesh->mpoly,
 -                                          mesh->totpoly,
 -                                          polynors,
 -                                          nullptr);
 -    free_polynors = true;
 -  }
 -
    BKE_mesh_normals_loop_split(mesh->mvert,
                                mesh->totvert,
                                mesh->medge,
@@@ -1948,8 -1948,14 +1944,8 @@@
                                split_angle,
                                r_lnors_spacearr,
                                clnors,
-                               NULL);
+                               nullptr);
  
 -  if (free_polynors) {
 -    MEM_freeN(polynors);
 -  }
 -
 -  mesh->runtime.cd_dirty_vert &= ~CD_MASK_NORMAL;
 -  mesh->runtime.cd_dirty_poly &= ~CD_MASK_NORMAL;
    mesh->runtime.cd_dirty_loop &= ~CD_MASK_NORMAL;
  }



More information about the Bf-blender-cvs mailing list