[Bf-blender-cvs] [9ba1a842f22] temp-gpencil-bezier-stroke-type: GPencil: Free poly weights when curve is updated

Falk David noreply at git.blender.org
Wed Apr 7 08:46:28 CEST 2021


Commit: 9ba1a842f22c7d6d2057d5cc5d6790342bcebce0
Author: Falk David
Date:   Wed Apr 7 08:46:18 2021 +0200
Branches: temp-gpencil-bezier-stroke-type
https://developer.blender.org/rB9ba1a842f22c7d6d2057d5cc5d6790342bcebce0

GPencil: Free poly weights when curve is updated

The poly weights should be freed when the stroke is converted to type
bezier or when the curve is refitted. This makes sure that we do not
leak the weight memory later.

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

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 b4d41844887..b0a7e2c99d1 100644
--- a/source/blender/blenkernel/intern/gpencil_curve.c
+++ b/source/blender/blenkernel/intern/gpencil_curve.c
@@ -1169,11 +1169,15 @@ void BKE_gpencil_stroke_editcurve_update(bGPDstroke *gps,
     return;
   }
 
+  /* Assign pointer. This makes the stroke a bezier stroke. */
   gps->editcurve = editcurve;
   if (prev_flag) {
     gps->editcurve->flag = prev_flag;
   }
 
+  /* Free the poly weights (if not null). Should no longer be used. */
+  BKE_gpencil_free_stroke_weights(gps);
+
   if (do_partial_update) {
     BKE_gpencil_editcurve_recalculate_handles(gps);
   }



More information about the Bf-blender-cvs mailing list