[Bf-blender-cvs] [56166b6ad47] greasepencil-edit-curve: GPencil: Initial code to Write and Read curve data
Antonio Vazquez
noreply at git.blender.org
Mon Jun 1 17:12:43 CEST 2020
Commit: 56166b6ad47f242c64776b0b95f706c20e2cc3c7
Author: Antonio Vazquez
Date: Mon Jun 1 17:12:35 2020 +0200
Branches: greasepencil-edit-curve
https://developer.blender.org/rB56166b6ad47f242c64776b0b95f706c20e2cc3c7
GPencil: Initial code to Write and Read curve data
===================================================================
M source/blender/blenloader/intern/readfile.c
M source/blender/blenloader/intern/writefile.c
===================================================================
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index d3c391a1595..639e0f6099a 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -7295,6 +7295,13 @@ static void direct_link_gpencil(FileData *fd, bGPdata *gpd)
/* Relink geometry*/
gps->triangles = newdataadr(fd, gps->triangles);
+ /* relink stroke edit curve. */
+ gps->editcurve = newdataadr(fd, gps->editcurve);
+ if (gps->editcurve != NULL) {
+ gps->editcurve->curve = newdataadr(fd, gps->editcurve->curve);
+ gps->editcurve->point_index_array = newdataadr(fd, gps->editcurve->point_index_array);
+ }
+
/* relink weight data */
if (gps->dvert) {
gps->dvert = newdataadr(fd, gps->dvert);
@@ -11607,6 +11614,13 @@ static void expand_gpencil(FileData *fd, Main *mainvar, bGPdata *gpd)
{
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
expand_doit(fd, mainvar, gpl->parent);
+ LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) {
+ LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
+ if ((gps->editcurve != NULL) && (gps->editcurve->curve != NULL)) {
+ expand_doit(fd, mainvar, gps->editcurve->curve);
+ }
+ }
+ }
}
for (int a = 0; a < gpd->totcol; a++) {
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index e3b4166a4bf..6604bbd8222 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -2853,6 +2853,13 @@ static void write_gpencil(WriteData *wd, bGPdata *gpd, const void *id_address)
LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
writestruct(wd, DATA, bGPDspoint, gps->totpoints, gps->points);
writestruct(wd, DATA, bGPDtriangle, gps->tot_triangles, gps->triangles);
+ writestruct(wd, DATA, bGPDcurve, 1, gps->editcurve);
+ if (gps->editcurve != NULL) {
+ writedata(wd,
+ DATA,
+ sizeof(int *) * gps->editcurve->tot_index_array,
+ gps->editcurve->point_index_array);
+ }
write_dverts(wd, gps->totpoints, gps->dvert);
}
}
More information about the Bf-blender-cvs
mailing list