[Bf-blender-cvs] [3096fa7f02f] soc-2020-greasepencil-curve: GPencil: Change bGPDcurve struct to hold array of BezTriple
Falk David
noreply at git.blender.org
Wed Jun 3 10:04:55 CEST 2020
Commit: 3096fa7f02f0ea173fe3fdab2470ab763344ab1e
Author: Falk David
Date: Wed Jun 3 10:00:59 2020 +0200
Branches: soc-2020-greasepencil-curve
https://developer.blender.org/rB3096fa7f02f0ea173fe3fdab2470ab763344ab1e
GPencil: Change bGPDcurve struct to hold array of BezTriple
===================================================================
M source/blender/blenloader/intern/readfile.c
M source/blender/blenloader/intern/writefile.c
M source/blender/makesdna/DNA_gpencil_types.h
M source/blender/makesrna/intern/rna_gpencil.c
===================================================================
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 639e0f6099a..d0c979f71ec 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -7298,7 +7298,7 @@ static void direct_link_gpencil(FileData *fd, bGPdata *gpd)
/* relink stroke edit curve. */
gps->editcurve = newdataadr(fd, gps->editcurve);
if (gps->editcurve != NULL) {
- gps->editcurve->curve = newdataadr(fd, gps->editcurve->curve);
+ gps->editcurve->curve_points = newdataadr(fd, gps->editcurve->curve_points);
gps->editcurve->point_index_array = newdataadr(fd, gps->editcurve->point_index_array);
}
@@ -11616,8 +11616,8 @@ static void expand_gpencil(FileData *fd, Main *mainvar, bGPdata *gpd)
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);
+ if ((gps->editcurve != NULL) && (gps->editcurve->curve_points != NULL)) {
+ expand_doit(fd, mainvar, gps->editcurve->curve_points);
}
}
}
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 6604bbd8222..f6011687b5c 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -2853,11 +2853,11 @@ 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) {
+ writestruct(wd, DATA, BezTriple, gps->editcurve->tot_curve_points, gps->editcurve->curve_points);
writedata(wd,
DATA,
- sizeof(int *) * gps->editcurve->tot_index_array,
+ sizeof(int *) * gps->editcurve->tot_curve_points,
gps->editcurve->point_index_array);
}
write_dverts(wd, gps->totpoints, gps->dvert);
diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h
index e0d93e9148b..34d280cd849 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -169,13 +169,13 @@ typedef enum eGPDpalette_Flag {
/* Curve for Bezier Editing. */
typedef struct bGPDcurve {
- /** Bezier curve. */
- Curve *curve;
+ /** Array of BezTriple. */
+ BezTriple *curve_points;
/** Array of indexes of nearest stroke points. */
int *point_index_array;
- /* Total elements in the point index array. */
- int tot_index_array;
- /** General flag */
+ /** Total number of curve points. */
+ int tot_curve_points;
+ /** General flag. */
short flag;
char _pad[2];
} bGPDcurve;
diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index b8f49ad6c4c..073e559ecd5 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -1081,11 +1081,11 @@ static void rna_def_gpencil_curve(BlenderRNA *brna)
RNA_def_struct_sdna(srna, "bGPDcurve");
RNA_def_struct_ui_text(srna, "Edit Curve", "Edition Curve");
- /* Curve. */
- prop = RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "curve");
- RNA_def_property_struct_type(prop, "Curve");
- RNA_def_property_ui_text(prop, "Curve", "Curve data");
+ /* Curve. TODO: make BezTriple collection */
+ // prop = RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
+ // RNA_def_property_pointer_sdna(prop, NULL, "curve");
+ // RNA_def_property_struct_type(prop, "Curve");
+ // RNA_def_property_ui_text(prop, "Curve", "Curve data");
}
static void rna_def_gpencil_mvert_group(BlenderRNA *brna)
More information about the Bf-blender-cvs
mailing list