[Bf-blender-cvs] [f7d9c6a59bf] temp-geometry-nodes-extrude-mesh: Fix bug with vertex groups on mesh

Hans Goudey noreply at git.blender.org
Tue Jan 4 19:53:31 CET 2022


Commit: f7d9c6a59bfa8453c133ff761121c2c6826be2b8
Author: Hans Goudey
Date:   Tue Jan 4 12:28:48 2022 -0600
Branches: temp-geometry-nodes-extrude-mesh
https://developer.blender.org/rBf7d9c6a59bfa8453c133ff761121c2c6826be2b8

Fix bug with vertex groups on mesh

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

M	source/blender/blenkernel/intern/customdata.cc
M	source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc

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

diff --git a/source/blender/blenkernel/intern/customdata.cc b/source/blender/blenkernel/intern/customdata.cc
index 30ba3500c5d..6e0f35611a6 100644
--- a/source/blender/blenkernel/intern/customdata.cc
+++ b/source/blender/blenkernel/intern/customdata.cc
@@ -2227,7 +2227,7 @@ void CustomData_realloc(CustomData *data, int totelem)
       continue;
     }
     typeInfo = layerType_getInfo(layer->type);
-    layer->data = MEM_reallocN(layer->data, (size_t)totelem * typeInfo->size);
+    layer->data = MEM_recallocN(layer->data, (size_t)totelem * typeInfo->size);
   }
 }
 
diff --git a/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc b/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc
index 21bb1bd0b7f..1346ca92a31 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc
@@ -98,8 +98,8 @@ static void expand_mesh_size(Mesh &mesh,
                              const int loop_expand)
 {
   if (vert_expand != 0) {
-    mesh.totvert += vert_expand;
     CustomData_duplicate_referenced_layers(&mesh.vdata, mesh.totvert);
+    mesh.totvert += vert_expand;
     CustomData_realloc(&mesh.vdata, mesh.totvert);
   }
   else {
@@ -107,18 +107,18 @@ static void expand_mesh_size(Mesh &mesh,
     CustomData_duplicate_referenced_layer(&mesh.vdata, CD_MVERT, mesh.totvert);
   }
   if (edge_expand != 0) {
-    mesh.totedge += edge_expand;
     CustomData_duplicate_referenced_layers(&mesh.edata, mesh.totedge);
+    mesh.totedge += edge_expand;
     CustomData_realloc(&mesh.edata, mesh.totedge);
   }
   if (poly_expand != 0) {
-    mesh.totpoly += poly_expand;
     CustomData_duplicate_referenced_layers(&mesh.pdata, mesh.totpoly);
+    mesh.totpoly += poly_expand;
     CustomData_realloc(&mesh.pdata, mesh.totpoly);
   }
   if (loop_expand != 0) {
-    mesh.totloop += loop_expand;
     CustomData_duplicate_referenced_layers(&mesh.ldata, mesh.totloop);
+    mesh.totloop += loop_expand;
     CustomData_realloc(&mesh.ldata, mesh.totloop);
   }
   BKE_mesh_update_customdata_pointers(&mesh, false);



More information about the Bf-blender-cvs mailing list