[Bf-blender-cvs] [cc3019600c3] greasepencil-object: GPencil: Use Vertex Color in Fill Tool
Antonio Vazquez
noreply at git.blender.org
Thu Nov 7 19:40:53 CET 2019
Commit: cc3019600c3cac5e14b82bc13242929eb4c93587
Author: Antonio Vazquez
Date: Thu Nov 7 19:40:49 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rBcc3019600c3cac5e14b82bc13242929eb4c93587
GPencil: Use Vertex Color in Fill Tool
===================================================================
M release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M release/scripts/startup/bl_ui/space_view3d.py
M release/scripts/startup/bl_ui/space_view3d_toolbar.py
M source/blender/editors/gpencil/gpencil_fill.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index 33b84f0f791..5f62081dab7 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -933,7 +933,7 @@ class GreasePencilVertexcolorPanel:
ob = context.object
if ob:
- if tool == 'DRAW' and is_vertex is False:
+ if tool in ('DRAW', 'FILL') and is_vertex is False:
row = layout.row(align=True)
row.prop(gpencil_paint, "use_vertex_mode", text="Mode")
row = layout.row(align=True)
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 929620c6122..e3a10b6c82e 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -353,7 +353,7 @@ class _draw_tool_settings_context_mode:
row.prop(gp_settings, "use_material_pin", text="")
- if brush.gpencil_tool == 'DRAW' and ma:
+ if brush.gpencil_tool in ('DRAW', 'FILL') and ma:
gp_style = ma.grease_pencil
if gp_style.stroke_style != 'TEXTURE' or gp_style.use_stroke_pattern:
row.separator(factor=0.4)
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index de231bf9412..0eb147de5fa 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -2041,7 +2041,7 @@ class VIEW3D_PT_tools_grease_pencil_brush_mixcolor(View3DPanel, Panel):
ob = context.object
ts = context.tool_settings
settings = ts.gpencil_paint
- brush = ts.gpencil_paint.brush
+ brush = settings.brush
if ob is None or brush is None:
return False
@@ -2052,7 +2052,7 @@ class VIEW3D_PT_tools_grease_pencil_brush_mixcolor(View3DPanel, Panel):
if brush.gpencil_tool == 'TINT':
return True
- if brush.gpencil_tool != 'DRAW':
+ if brush.gpencil_tool not in ('DRAW', 'FILL'):
return False
gp_settings = brush.gpencil_settings
@@ -2090,7 +2090,7 @@ class VIEW3D_PT_tools_grease_pencil_brush_mixcolor(View3DPanel, Panel):
col = layout.column()
col.enabled = settings.use_vertex_color or brush.gpencil_tool == 'TINT'
- if brush.gpencil_tool == 'DRAW':
+ if brush.gpencil_tool in ('DRAW', 'FILL'):
col.prop(settings, "use_vertex_mode", text="Mode")
col.prop(gp_settings, "vertex_color_factor", slider=True, text="Mix Factor")
@@ -2128,7 +2128,7 @@ class VIEW3D_PT_tools_grease_pencil_brush_mix_palette(View3DPanel, Panel):
if brush.gpencil_tool == 'TINT':
return True
- if brush.gpencil_tool != 'DRAW':
+ if brush.gpencil_tool not in ('DRAW', 'FILL'):
return False
gp_settings = brush.gpencil_settings
diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c
index 993ec15248f..37c8d264d6c 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -1034,6 +1034,12 @@ static void gpencil_stroke_from_buffer(tGPDfill *tgpf)
copy_v2_v2(gps->gradient_s, brush->gpencil_settings->gradient_s);
gps->inittime = 0.0f;
+ /* Apply the mix color to fill. */
+ if (GPENCIL_USE_VERTEX_COLOR_FILL(ts)) {
+ copy_v3_v3(gps->mix_color_fill, brush->rgb);
+ gps->mix_color_fill[3] = brush->gpencil_settings->vertex_factor;
+ }
+
/* the polygon must be closed, so enabled cyclic */
gps->flag |= GP_STROKE_CYCLIC;
gps->flag |= GP_STROKE_3DSPACE;
@@ -1091,6 +1097,12 @@ static void gpencil_stroke_from_buffer(tGPDfill *tgpf)
pt->strength = 1.0f;
pt->time = 0.0f;
+ /* Point mix color. */
+ copy_v3_v3(pt->mix_color, brush->rgb);
+ pt->mix_color[3] = GPENCIL_USE_VERTEX_COLOR_STROKE(ts) ?
+ brush->gpencil_settings->vertex_factor :
+ 0.0f;
+
if ((ts->gpencil_flags & GP_TOOL_FLAG_CREATE_WEIGHTS) && (have_weight)) {
MDeformWeight *dw = defvert_verify_index(dvert, def_nr);
if (dw) {
More information about the Bf-blender-cvs
mailing list