[Bf-blender-cvs] [1cb31e54ef7] temp-gpencil-bezier-stroke-type: GPencil: Free polyline weights before regenerate

Falk David noreply at git.blender.org
Fri Apr 30 08:45:16 CEST 2021


Commit: 1cb31e54ef716dfbac4445ab82b1aef897a4a0e5
Author: Falk David
Date:   Thu Apr 29 16:47:58 2021 +0200
Branches: temp-gpencil-bezier-stroke-type
https://developer.blender.org/rB1cb31e54ef716dfbac4445ab82b1aef897a4a0e5

GPencil: Free polyline weights before regenerate

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

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

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

diff --git a/source/blender/blenkernel/intern/gpencil_curve.c b/source/blender/blenkernel/intern/gpencil_curve.c
index f441c578de4..82c890f5680 100644
--- a/source/blender/blenkernel/intern/gpencil_curve.c
+++ b/source/blender/blenkernel/intern/gpencil_curve.c
@@ -1622,6 +1622,9 @@ void BKE_gpencil_stroke_update_geometry_from_editcurve(bGPDstroke *gps,
     return;
   }
 
+  /* We have to free all of the old weight data and replace it completely. */
+  BKE_gpencil_free_stroke_weights(gps);
+
   /* resize stroke point array */
   gps->totpoints = points_len;
   gps->points = MEM_recallocN(gps->points, sizeof(bGPDspoint) * gps->totpoints);
@@ -1657,7 +1660,7 @@ void BKE_gpencil_stroke_update_geometry_from_editcurve(bGPDstroke *gps,
 
   /* Interpolate weights. */
   if (gpc->dvert != NULL && (update_all_attributes || (flag & GP_GEO_UPDATE_POLYLINE_WEIGHT))) {
-    gps->dvert = MEM_recallocN(gps->dvert, sizeof(MDeformVert) * gps->totpoints);
+    gps->dvert = MEM_callocN(sizeof(MDeformVert) * gps->totpoints, __func__);
 
     idx = 0;
     for (int i = 0; i < gpc->tot_curve_points - 1; i++) {



More information about the Bf-blender-cvs mailing list