[Bf-blender-cvs] [d219fb11f25] temp-vert-normals-cleanup: Fix issue sculpting with smooth shading

Hans Goudey noreply at git.blender.org
Sat Nov 6 18:28:20 CET 2021


Commit: d219fb11f256eb77157dfb547609b7be731ca65f
Author: Hans Goudey
Date:   Sat Nov 6 12:28:13 2021 -0500
Branches: temp-vert-normals-cleanup
https://developer.blender.org/rBd219fb11f256eb77157dfb547609b7be731ca65f

Fix issue sculpting with smooth shading

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

M	source/blender/blenkernel/intern/pbvh.c

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

diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c
index 32089670022..46fd3c66485 100644
--- a/source/blender/blenkernel/intern/pbvh.c
+++ b/source/blender/blenkernel/intern/pbvh.c
@@ -582,6 +582,7 @@ void BKE_pbvh_build_mesh(PBVH *pbvh,
   pbvh->mloop = mloop;
   pbvh->looptri = looptri;
   pbvh->verts = verts;
+  pbvh->vert_normals = (float(*)[3])BKE_mesh_ensure_vertex_normals(mesh);
   pbvh->vert_bitmap = BLI_BITMAP_NEW(totvert, "bvh->vert_bitmap");
   pbvh->totvert = totvert;
   pbvh->leaf_limit = LEAF_LIMIT;
@@ -1099,8 +1100,6 @@ static void pbvh_faces_update_normals(PBVH *pbvh, PBVHNode **nodes, int totnode)
 {
   /* could be per node to save some memory, but also means
    * we have to store for each vertex which node it is in */
-  MEM_SAFE_FREE(pbvh->vert_normals);
-  pbvh->vert_normals = MEM_calloc_arrayN(pbvh->totvert, sizeof(float[3]), __func__);
 
   /* subtle assumptions:
    * - We know that for all edited vertices, the nodes with faces



More information about the Bf-blender-cvs mailing list