[Bf-blender-cvs] [b75a7c2f8fb] master: Fix T75302: GPencil fill does not work on python generated strokes

Antonio Vazquez noreply at git.blender.org
Thu Apr 2 16:48:04 CEST 2020


Commit: b75a7c2f8fb81eb7da067128dd90e3cd11406ab4
Author: Antonio Vazquez
Date:   Thu Apr 2 16:47:52 2020 +0200
Branches: master
https://developer.blender.org/rBb75a7c2f8fb81eb7da067128dd90e3cd11406ab4

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

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

M	source/blender/blenkernel/intern/gpencil.c
M	source/blender/makesrna/intern/rna_gpencil.c

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

diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index fc7f15348bc..b2fc91fd0a6 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -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;
diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index bd08e1c306c..94814003e99 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -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;



More information about the Bf-blender-cvs mailing list