[Bf-blender-cvs] [928e0258fea] master: GPencil: Set fill material when curve is 2D and has filling

Antonio Vazquez noreply at git.blender.org
Sun Sep 1 22:47:33 CEST 2019


Commit: 928e0258fea7c51f07ac4214f6aa87a7e4eea1ff
Author: Antonio Vazquez
Date:   Sun Sep 1 22:47:23 2019 +0200
Branches: master
https://developer.blender.org/rB928e0258fea7c51f07ac4214f6aa87a7e4eea1ff

GPencil: Set fill material when curve is 2D and has filling

Now the material is set as fill if the curve is 2D and is filled with a material. This is done in the Convert operator only, because the SVG add-on works totally different due the SVG has more parameters to determine the type of filling.

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

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

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

diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 240ae4756a6..0244f11b6f8 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -2788,10 +2788,15 @@ static void gpencil_convert_spline(Main *bmain,
         mat_curve = give_current_material(ob_cu, 1);
         linearrgb_to_srgb_v3_v3(mat_gp->gp_style->stroke_rgba, &mat_curve->r);
         mat_gp->gp_style->stroke_rgba[3] = mat_curve->a;
-        /* Set stroke to on. */
-        mat_gp->gp_style->flag |= GP_STYLE_STROKE_SHOW;
-        /* Set fill to off. */
-        mat_gp->gp_style->flag &= ~GP_STYLE_FILL_SHOW;
+        /* Set fill and stroke depending of curve type (3D or 2D). */
+        if ((cu->flag & CU_3D) || ((cu->flag & (CU_FRONT | CU_BACK)) == 0)) {
+          mat_gp->gp_style->flag |= GP_STYLE_STROKE_SHOW;
+          mat_gp->gp_style->flag &= ~GP_STYLE_FILL_SHOW;
+        }
+        else {
+          mat_gp->gp_style->flag &= ~GP_STYLE_STROKE_SHOW;
+          mat_gp->gp_style->flag |= GP_STYLE_FILL_SHOW;
+        }
       }
     }
   }



More information about the Bf-blender-cvs mailing list