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.
This commit is contained in:
Antonio Vazquez
2019-09-01 22:47:23 +02:00
parent 35bc4c2cf4
commit 928e0258fe

View File

@@ -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;
}
}
}
}