Fix T75302: GPencil fill does not work on python generated strokes

This commit is contained in:
Antonio Vazquez 2020-04-02 16:47:52 +02:00
parent e6c732e0cb
commit b75a7c2f8f
Notes: blender-bot 2023-02-13 23:00:17 +01:00
Referenced by issue #75302, Grease Pencil: fill does not work on python generated strokes
2 changed files with 7 additions and 5 deletions

View File

@ -541,7 +541,12 @@ bGPDstroke *BKE_gpencil_stroke_new(int mat_idx, int totpoints, short thickness)
gps->flag = GP_STROKE_3DSPACE;
gps->totpoints = totpoints;
gps->points = MEM_callocN(sizeof(bGPDspoint) * gps->totpoints, "gp_stroke_points");
if (gps->totpoints > 0) {
gps->points = MEM_callocN(sizeof(bGPDspoint) * gps->totpoints, "gp_stroke_points");
}
else {
gps->points = NULL;
}
/* initialize triangle memory to dummy data */
gps->triangles = NULL;

View File

@ -710,10 +710,7 @@ static void rna_GPencil_stroke_point_pop(ID *id,
static bGPDstroke *rna_GPencil_stroke_new(bGPDframe *frame)
{
bGPDstroke *stroke = MEM_callocN(sizeof(bGPDstroke), "gp_stroke");
stroke->hardeness = 1.0f;
ARRAY_SET_ITEMS(stroke->aspect_ratio, 1.0f, 1.0f);
stroke->uv_scale = 1.0f;
bGPDstroke *stroke = BKE_gpencil_stroke_new(0, 0, 1.0f);
BLI_addtail(&frame->strokes, stroke);
return stroke;