Fix #153837: Grease Pencil: Remove vertex_mode from Draw tool menu

This removes the `vertex_mode` from the Draw tool and replaces
it with the `stroke_type`.

This also adds the `stroke_type` to the `right-click` menu.

Pull Request: https://projects.blender.org/blender/blender/pulls/153988
This commit is contained in:
Casey Bianco-Davis 2026-02-10 17:35:24 +01:00 • committed by Falk David
parent 5bbb840875
commit ae6f0be3a5
6 changed files with 19 additions and 27 deletions

View file

@ -8522,16 +8522,13 @@ class VIEW3D_PT_greasepencil_draw_context_menu(Panel):
is_pin_vertex = gp_settings.brush_draw_mode == 'VERTEXCOLOR'
is_vertex = settings.color_mode == 'VERTEXCOLOR' or brush.gpencil_brush_type == 'TINT' or is_pin_vertex
layout.prop(gp_settings, "stroke_type", expand=True)
if brush.gpencil_brush_type not in {'ERASE', 'CUTTER', 'EYEDROPPER'} and is_vertex:
split = layout.split(factor=0.1)
split.prop(brush, "color", text="")
split.template_color_picker(brush, "color", value_slider=True)
col = layout.column()
col.separator()
col.prop(gp_settings, "vertex_mode", text="")
col.separator()
if brush.gpencil_brush_type not in {'FILL', 'CUTTER', 'ERASE'}:
if brush.use_locked_size == 'VIEW':
row = layout.row(align=True)
@ -9020,8 +9017,9 @@ class TOPBAR_PT_grease_pencil_vertex_color(Panel):
gp_settings = brush.gpencil_settings
if brush.gpencil_brush_type in {'DRAW', 'FILL'}:
row = layout.row(align=True)
row.prop(gp_settings, "vertex_mode", text="Mode")
if ob.mode == 'VERTEX_GREASE_PENCIL':
row = layout.row(align=True)
row.prop(gp_settings, "vertex_mode", text="Mode")
row = layout.row(align=True)
row.prop(gp_settings, "vertex_color_factor", slider=True, text="Mix Factor")

View file

@ -2231,7 +2231,6 @@ class VIEW3D_PT_tools_grease_pencil_v3_brush_mixcolor(View3DPanel, Panel):
sub_row.operator("paint.brush_colors_flip", icon='FILE_REFRESH', text="")
if brush.gpencil_brush_type in {'DRAW', 'FILL'}:
col.prop(gp_settings, "vertex_mode", text="Mode")
col.prop(gp_settings, "vertex_color_factor", slider=True, text="Mix Factor")

View file

@ -831,12 +831,11 @@ static wmOperatorStatus grease_pencil_primitive_invoke(bContext *C,
ColorGeometry4f color_base;
copy_v3_v3(color_base, ptd.brush->color);
color_base.a = ptd.settings->vertex_factor;
ptd.vertex_color = ELEM(ptd.settings->vertex_mode, GPPAINT_MODE_STROKE, GPPAINT_MODE_BOTH) ?
ptd.vertex_color = (ptd.settings->flag2 & GP_BRUSH_USE_STROKE) ?
std::make_optional(color_base) :
std::nullopt;
ptd.fill_color = ELEM(ptd.settings->vertex_mode, GPPAINT_MODE_FILL, GPPAINT_MODE_BOTH) ?
std::make_optional(color_base) :
std::nullopt;
ptd.fill_color = ptd.use_fill ? std::make_optional(color_base) : std::nullopt;
}
else {
ptd.vertex_color = std::nullopt;

View file

@ -640,15 +640,14 @@ static bke::CurvesGeometry boundary_to_curves(const Scene &scene,
copy_v3_v3(vertex_color, brush.color);
vertex_color.a = brush.gpencil_settings->vertex_factor;
if (ELEM(brush.gpencil_settings->vertex_mode, GPPAINT_MODE_FILL, GPPAINT_MODE_BOTH)) {
skip_curve_attributes.add("fill_color");
bke::SpanAttributeWriter<ColorGeometry4f> fill_colors =
attributes.lookup_or_add_for_write_span<ColorGeometry4f>("fill_color",
bke::AttrDomain::Curve);
fill_colors.span.fill(vertex_color);
fill_colors.finish();
}
if (ELEM(brush.gpencil_settings->vertex_mode, GPPAINT_MODE_STROKE, GPPAINT_MODE_BOTH)) {
skip_curve_attributes.add("fill_color");
bke::SpanAttributeWriter<ColorGeometry4f> fill_colors =
attributes.lookup_or_add_for_write_span<ColorGeometry4f>("fill_color",
bke::AttrDomain::Curve);
fill_colors.span.fill(vertex_color);
fill_colors.finish();
if (brush.gpencil_settings->flag2 & GP_BRUSH_USE_STROKE) {
skip_point_attributes.add("vertex_color");
bke::SpanAttributeWriter<ColorGeometry4f> vertex_colors =
attributes.lookup_or_add_for_write_span<ColorGeometry4f>("vertex_color",

View file

@ -296,10 +296,10 @@ struct PaintOperationExecutor {
ColorGeometry4f color_base;
copy_v3_v3(color_base, brush_->color);
color_base.a = settings_->vertex_factor;
if (ELEM(settings_->vertex_mode, GPPAINT_MODE_STROKE, GPPAINT_MODE_BOTH)) {
if (settings_->flag2 & GP_BRUSH_USE_STROKE) {
vertex_color_ = color_base;
}
if (ELEM(settings_->vertex_mode, GPPAINT_MODE_FILL, GPPAINT_MODE_BOTH)) {
if (settings_->flag2 & GP_BRUSH_USE_FILL) {
fill_color_ = color_base;
}
}

View file

@ -1658,10 +1658,7 @@ static void grease_pencil_brush_cursor_draw(PaintCursorContext &pcontext)
const bool use_vertex_color = ed::sculpt_paint::greasepencil::brush_using_vertex_color(
pcontext.scene->toolsettings->gp_paint, brush);
const bool use_vertex_color_stroke = use_vertex_color &&
ELEM(brush->gpencil_settings->vertex_mode,
GPPAINT_MODE_STROKE,
GPPAINT_MODE_BOTH);
const bool use_vertex_color_stroke = use_vertex_color;
if (use_vertex_color_stroke) {
IMB_colormanagement_scene_linear_to_srgb_v3(color, brush->color);
}