[Bf-blender-cvs] [44ded541549] greasepencil-object: Fix error converting old 2.7 files
Antonio Vazquez
noreply at git.blender.org
Thu May 24 16:42:17 CEST 2018
Commit: 44ded5415499d8685f4d494f64aad039546c711e
Author: Antonio Vazquez
Date: Thu May 24 16:40:54 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rB44ded5415499d8685f4d494f64aad039546c711e
Fix error converting old 2.7 files
The color name was deleted before conversion and the memory allocation was wrong.
===================================================================
M source/blender/blenloader/intern/writefile.c
M source/blender/editors/gpencil/gpencil_data.c
===================================================================
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index a5a255d2fdd..e73a8e45257 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -2684,7 +2684,6 @@ static void write_gpencil(WriteData *wd, bGPdata *gpd)
/* write strokes */
writelist(wd, DATA, bGPDstroke, &gpf->strokes);
for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
- gps->colorname[0] = '\0'; /* field deprecated, clear data */
writestruct(wd, DATA, bGPDspoint, gps->totpoints, gps->points);
write_dverts(wd, gps->totpoints, gps->dvert);
}
diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c
index 17f0bccdce2..05d0a67de29 100644
--- a/source/blender/editors/gpencil/gpencil_data.c
+++ b/source/blender/editors/gpencil/gpencil_data.c
@@ -2442,10 +2442,13 @@ static int gpencil_convert_old_files_exec(bContext *C, wmOperator *op)
for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf->next) {
for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
- if (STREQ(gps->colorname, palcolor->info)) {
+ if ((gps->colorname[0] != '\0') &&
+ (STREQ(gps->colorname, palcolor->info)))
+ {
gps->mat_nr = ob->totcol - 1;
+ gps->colorname[0] = '\0';
/* create weights array */
- gps->dvert = MEM_callocN(sizeof(gps->dvert) * gps->totpoints, "gp_stroke_weights");
+ gps->dvert = MEM_callocN(sizeof(MDeformVert) * gps->totpoints, "gp_stroke_weights");
}
}
}
More information about the Bf-blender-cvs
mailing list