[Bf-blender-cvs] [bd89367bd2e] greasepencil-object: GPencil: New parameter for Vertex Paint mix
Antonio Vazquez
noreply at git.blender.org
Tue Nov 12 16:32:49 CET 2019
Commit: bd89367bd2e6ef5ad91b70671a9ce630567c3af1
Author: Antonio Vazquez
Date: Tue Nov 12 16:32:31 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rBbd89367bd2e6ef5ad91b70671a9ce630567c3af1
GPencil: New parameter for Vertex Paint mix
Also some cleanup.
===================================================================
M release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M release/scripts/startup/bl_ui/properties_paint_common.py
M release/scripts/startup/bl_ui/space_view3d.py
M release/scripts/startup/bl_ui/space_view3d_toolbar.py
M source/blender/blenloader/intern/versioning_280.c
M source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
M source/blender/draw/engines/gpencil/gpencil_draw_utils.c
M source/blender/makesdna/DNA_view3d_types.h
M source/blender/makesrna/intern/rna_space.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 0270e973346..147ec27f6de 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 in ('DRAW', 'FILL') and is_vertex is False:
+ if tool in {'DRAW', 'FILL'} and is_vertex is False:
row = layout.row(align=True)
row.prop(gp_settings, "vertex_mode", text="Mode")
row = layout.row(align=True)
diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py
index fac1cec9b2a..8607c2e5e34 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -505,7 +505,7 @@ def brush_basic_gpencil_vertex_settings(layout, _context, brush, tool, *, compac
row.prop(brush, "size", text="Radius")
row.prop(gp_settings, "use_pressure", text="", icon='STYLUS_PRESSURE')
- if brush.gpencil_vertex_tool in ('DRAW', 'BLUR', 'SMEAR'):
+ if brush.gpencil_vertex_tool in {'DRAW', 'BLUR', 'SMEAR'}:
row = layout.row(align=True)
row.prop(gp_settings, "pen_strength", slider=True)
row.prop(gp_settings, "use_strength_pressure", text="", icon='STYLUS_PRESSURE')
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 4ccf94ef760..3a6d5523916 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 in ('DRAW', 'FILL') 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)
@@ -432,7 +432,7 @@ class _draw_tool_settings_context_mode:
settings = tool_settings.gpencil_vertex_paint
row.template_ID_preview(settings, "brush", rows=3, cols=8, hide_buttons=True)
- if brush.gpencil_vertex_tool not in ('BLUR', 'AVERAGE', 'SMEAR'):
+ if brush.gpencil_vertex_tool not in {'BLUR', 'AVERAGE', 'SMEAR'}:
row.separator(factor=0.4)
row.prop(brush, "color", text="")
@@ -6356,6 +6356,10 @@ class VIEW3D_PT_overlay_gpencil_options(Panel):
layout.prop(overlay, "use_gpencil_multiedit_line_only", text="Show Edit Lines only in multiframe")
layout.prop(overlay, "vertex_opacity", text="Vertex Opacity", slider=True)
+ if context.object.mode in {'PAINT_GPENCIL', 'EDIT_GPENCIL', 'SCULPT_GPENCIL', 'VERTEX_GPENCIL'}:
+ layout.label(text="Vertex Paint")
+ layout.prop(overlay, "gpencil_vertex_paint_opacity", text="Opacity", slider=True)
+
class VIEW3D_PT_quad_view(Panel):
bl_space_type = 'VIEW_3D'
@@ -6727,7 +6731,7 @@ class VIEW3D_PT_gpencil_vertex_context_menu(Panel):
col = layout.column()
- if brush.gpencil_vertex_tool in ('DRAW', 'REPLACE'):
+ if brush.gpencil_vertex_tool in {'DRAW', 'REPLACE'}:
col.template_color_picker(brush, "color", value_slider=True)
col.separator()
col.prop_menu_enum(gp_settings, "vertex_mode", text="Mode")
@@ -6737,7 +6741,7 @@ class VIEW3D_PT_gpencil_vertex_context_menu(Panel):
row.prop(brush, "size", text="Radius")
row.prop(gp_settings, "use_pressure", text="", icon='STYLUS_PRESSURE')
- if brush.gpencil_vertex_tool in ('DRAW', 'BLUR', 'SMEAR'):
+ if brush.gpencil_vertex_tool in {'DRAW', 'BLUR', 'SMEAR'}:
row = layout.row(align=True)
row.prop(gp_settings, "pen_strength", slider=True)
row.prop(gp_settings, "use_strength_pressure", text="", icon='STYLUS_PRESSURE')
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index bfcaf894d4f..30bde0a8038 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -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 not in ('DRAW', 'FILL'):
+ 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 in ('DRAW', 'FILL'):
+ if brush.gpencil_tool in {'DRAW', 'FILL'}:
col.prop(gp_settings, "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 not in ('DRAW', 'FILL'):
+ if brush.gpencil_tool not in {'DRAW', 'FILL'}:
return False
gp_settings = brush.gpencil_settings
@@ -2290,7 +2290,7 @@ class VIEW3D_PT_tools_grease_pencil_brush_vertex(View3DPanel, Panel):
if ob is None or brush is None:
return False
- if context.region.type == 'TOOL_HEADER' or brush.gpencil_vertex_tool in ('BLUR', 'AVERAGE', 'SMEAR'):
+ if context.region.type == 'TOOL_HEADER' or brush.gpencil_vertex_tool in {'BLUR', 'AVERAGE', 'SMEAR'}:
return False
return True
@@ -2370,7 +2370,7 @@ class VIEW3D_PT_tools_grease_pencil_brush_vertex_palette(View3DPanel, Panel):
if ob is None or brush is None:
return False
- if brush.gpencil_vertex_tool in ('BLUR', 'AVERAGE', 'SMEAR'):
+ if brush.gpencil_vertex_tool in {'BLUR', 'AVERAGE', 'SMEAR'}:
return False
return True
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index e8f656abf31..a96ad004b95 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -3992,5 +3992,24 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
BKE_paint_toolslots_init_from_main(bmain);
}
+
+ /* Init default Vertex paint mix factor for Viewport. */
+ {
+ if (!DNA_struct_elem_find(fd->filesdna,
+ "gpencil_vertex_paint_opacity",
+ "float",
+ "gpencil_vertex_paint_opacity")) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
+ for (ScrArea *area = screen->areabase.first; area; area = area->next) {
+ for (SpaceLink *sl = area->spacedata.first; sl; sl = sl->next) {
+ if (sl->spacetype == SPACE_VIEW3D) {
+ View3D *v3d = (View3D *)sl;
+ v3d->overlay.gpencil_vertex_paint_opacity = 1.0f;
+ }
+ }
+ }
+ }
+ }
+ }
}
}
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
index 615de34da4c..90aa7428183 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
@@ -152,11 +152,14 @@ void gpencil_get_point_geom(GpencilBatchCacheElem *be,
const bool onion)
{
const DRWContextState *draw_ctx = DRW_context_state_get();
+ View3D *v3d = draw_ctx->v3d;
ToolSettings *ts = draw_ctx->scene->toolsettings;
Object *ob = draw_ctx->obact;
bGPdata *gpd = ob ? (bGPdata *)ob->data : NULL;
int totvertex = gps->totpoints;
float mix_color[4];
+
+ const float vpaint_mix = v3d ? v3d->overlay.gpencil_vertex_paint_opacity : 1.0f;
const bool attenuate = (GPENCIL_VERTEX_MODE(gpd) &&
GPENCIL_ANY_VERTEX_MASK(ts->gpencil_selectmode_vertex));
@@ -190,7 +193,7 @@ void gpencil_get_point_geom(GpencilBatchCacheElem *be,
if (!onion) {
float mixtint[3];
interp_v3_v3v3(mixtint, pt->mix_color, tintcolor, tintcolor[3]);
- interp_v3_v3v3(mix_color, ink, mixtint, pt->mix_color[3]);
+ interp_v3_v3v3(mix_color, ink, mixtint, pt->mix_color[3] * vpaint_mix);
}
/* If using vertex paint mask, attenuate not selected. */
if ((attenuate) && ((pt->flag & GP_SPOINT_SELECT) == 0)) {
@@ -261,10 +264,12 @@ void gpencil_get_stroke_geom(struct GpencilBatchCacheElem *be,
float mix_color[4];
const DRWContextState *draw_ctx = DRW_context_state_get();
+ View3D *v3d = draw_ctx->v3d;
ToolSettings *ts = draw_ctx->scene->toolsettings;
Object *ob = draw_ctx->obact;
bGPdata *gpd = ob ? (bGPdata *)ob->data : NULL;
+ const float vpaint_mix = v3d ? v3d->overlay.gpencil_vertex_paint_opacity : 1.0f;
const bool attenuate = (GPENCIL_VERTEX_MODE(gpd) &&
GPENCIL_ANY_VERTEX_MASK(ts->gpencil_selectmode_vertex));
@@ -291,7 +296,7 @@ void gpencil_get_stroke_geom(struct GpencilBatchCacheElem *be,
if (!onion) {
float mixtint[3];
interp_v3_v3v3(mixtint, pt->mix_color, tintcolor, tintcolor[3]);
- interp_v3_v3v3(mix_color, ink, mixtint, pt->mix_color[3]);
+ interp_v3_v3v3(mix_color, ink, mixtint, pt->mix_color[3] * vpaint_mix);
}
/* first point for adjacency (not drawn) */
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index f96678a8477..7ebfd6fc44a
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list