[Bf-blender-cvs] [a37a93dc52e] soc-2020-greasepencil-curve: GPencil: Fix writing of bGPDcurve struct.

Falk David noreply at git.blender.org
Fri Jun 5 16:14:52 CEST 2020


Commit: a37a93dc52e210d3a78fff4baa255a87394aa2e2
Author: Falk David
Date:   Fri Jun 5 16:14:36 2020 +0200
Branches: soc-2020-greasepencil-curve
https://developer.blender.org/rBa37a93dc52e210d3a78fff4baa255a87394aa2e2

GPencil: Fix writing of bGPDcurve struct.

Previously, the bGPDcurve struct itself was not written,
only the data that is referenced inside the struct

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

M	source/blender/blenloader/intern/writefile.c

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

diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 275f219edea..6c5705ddd11 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -2905,8 +2905,15 @@ static void write_gpencil(BlendWriter *writer, bGPdata *gpd, const void *id_addr
         /* write strokes */
         BLO_write_struct_list(writer, bGPDstroke, &gpf->strokes);
         LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
-          BLO_write_struct(writer, bGPDspoint, gps->points);
-          BLO_write_struct(writer, bGPDtriangle, gps->triangles);
+          BLO_write_struct_array(writer, bGPDspoint, gps->totpoints, gps->points);
+          BLO_write_struct_array(writer, bGPDtriangle, gps->tot_triangles, gps->triangles);
+          if (gps->editcurve != NULL) {
+            BLO_write_struct(writer, bGPDcurve, gps->editcurve);
+            BLO_write_struct_array(
+                writer, BezTriple, gps->editcurve->tot_curve_points, gps->editcurve->curve_points);
+            BLO_write_int32_array(
+                writer, gps->editcurve->tot_curve_points, gps->editcurve->point_index_array);
+          }
           write_dverts(writer->wd, gps->totpoints, gps->dvert);
         }
       }



More information about the Bf-blender-cvs mailing list