[Bf-blender-cvs] [67269b82b24] soc-2020-greasepencil-curve: GPencil: Add BKE function to free editcurve
Falk David
noreply at git.blender.org
Wed Jun 3 10:04:55 CEST 2020
Commit: 67269b82b248284d2e2fd002063f71304fe9b885
Author: Falk David
Date: Wed Jun 3 09:57:20 2020 +0200
Branches: soc-2020-greasepencil-curve
https://developer.blender.org/rB67269b82b248284d2e2fd002063f71304fe9b885
GPencil: Add BKE function to free editcurve
===================================================================
M source/blender/blenkernel/BKE_gpencil.h
M source/blender/blenkernel/intern/gpencil.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_gpencil.h b/source/blender/blenkernel/BKE_gpencil.h
index faa331aa02d..3190c2b9dde 100644
--- a/source/blender/blenkernel/BKE_gpencil.h
+++ b/source/blender/blenkernel/BKE_gpencil.h
@@ -47,6 +47,7 @@ struct bGPDlayer;
struct bGPDlayer_Mask;
struct bGPDspoint;
struct bGPDstroke;
+struct bGPDcurve;
struct bGPdata;
#define GPENCIL_SIMPLIFY(scene) ((scene->r.simplify_gpencil & SIMPLIFY_GPENCIL_ENABLE))
@@ -88,6 +89,7 @@ struct bGPdata;
void BKE_gpencil_free_point_weights(struct MDeformVert *dvert);
void BKE_gpencil_free_stroke_weights(struct bGPDstroke *gps);
+void BKE_gpencil_free_editcurve(struct bGPDcurve *editcurve);
void BKE_gpencil_free_stroke(struct bGPDstroke *gps);
bool BKE_gpencil_free_strokes(struct bGPDframe *gpf);
void BKE_gpencil_free_frames(struct bGPDlayer *gpl);
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 4311e425abf..2ea84a152d6 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -177,6 +177,16 @@ void BKE_gpencil_free_stroke_weights(bGPDstroke *gps)
}
}
+void BKE_gpencil_free_editcurve(bGPDcurve *editcurve)
+{
+ if (editcurve == NULL) {
+ return;
+ }
+ MEM_freeN(editcurve->curve_points);
+ MEM_freeN(editcurve->point_index_array);
+ MEM_freeN(editcurve);
+}
+
/* free stroke, doesn't unlink from any listbase */
void BKE_gpencil_free_stroke(bGPDstroke *gps)
{
@@ -194,6 +204,9 @@ void BKE_gpencil_free_stroke(bGPDstroke *gps)
if (gps->triangles) {
MEM_freeN(gps->triangles);
}
+ if (gps->editcurve) {
+ BKE_gpencil_free_editcurve(gps->editcurve);
+ }
MEM_freeN(gps);
}
More information about the Bf-blender-cvs
mailing list