GPencil: Display real brush cursor size always

Remove the option to display the real size of the cursor
and set as default. Now the cursor is displayed or not using
show_cursor option, but if it's displayed always use the real size.
This commit is contained in:
Antonio Vazquez 2022-12-27 10:25:54 +01:00
parent 3adbe82e07
commit a2cf9a8647
4 changed files with 8 additions and 38 deletions

View File

@ -118,9 +118,6 @@ class GreasePencilDisplayPanel:
row.prop(settings, "show_brush", text="Display Cursor")
if brush.gpencil_tool == 'DRAW':
row = layout.row(align=True)
row.active = settings.show_brush
row.prop(gp_settings, "show_brush_size", text="Show Brush Size")
row = layout.row(align=True)
row.active = settings.show_brush
row.prop(gp_settings, "show_lasso", text="Show Fill Color While Drawing")

View File

@ -1801,7 +1801,6 @@ static void gpencil_brush_cursor_draw(bContext *C, int x, int y, void *customdat
float color[3] = {1.0f, 1.0f, 1.0f};
float darkcolor[3];
float radius = 3.0f;
bool fixed_radius = true;
const int mval_i[2] = {x, y};
/* Check if cursor is in drawing region and has valid data-block. */
@ -1848,32 +1847,22 @@ static void gpencil_brush_cursor_draw(bContext *C, int x, int y, void *customdat
((brush->gpencil_settings->flag & GP_BRUSH_STABILIZE_MOUSE_TEMP) == 0) &&
(brush->gpencil_tool == GPAINT_TOOL_DRAW)) {
/* Check user setting for cursor size. */
fixed_radius = ((brush->gpencil_settings->flag & GP_BRUSH_SHOW_DRAW_SIZE) == 0);
const bool is_vertex_stroke =
(GPENCIL_USE_VERTEX_COLOR_STROKE(ts, brush) &&
(brush->gpencil_settings->brush_draw_mode != GP_BRUSH_MODE_MATERIAL)) ||
(!GPENCIL_USE_VERTEX_COLOR_STROKE(ts, brush) &&
(brush->gpencil_settings->brush_draw_mode == GP_BRUSH_MODE_VERTEXCOLOR));
if (fixed_radius) {
/* Show fixed radius. */
radius = 2.0f;
copy_v3_v3(color, is_vertex_stroke ? brush->rgb : gp_style->stroke_rgba);
/* Strokes in screen space or world space? */
if ((gpd->flag & GP_DATA_STROKE_KEEPTHICKNESS) != 0) {
/* In screen space the cursor radius matches the brush size. */
radius = (float)brush->size * 0.5f;
}
else {
/* Strokes in screen space or world space? */
if ((gpd->flag & GP_DATA_STROKE_KEEPTHICKNESS) != 0) {
/* In screen space the cursor radius matches the brush size. */
radius = (float)brush->size * 0.5f;
}
else {
radius = ED_gpencil_cursor_radius(C, x, y);
}
copy_v3_v3(color, is_vertex_stroke ? brush->rgb : gp_style->stroke_rgba);
radius = ED_gpencil_cursor_radius(C, x, y);
}
copy_v3_v3(color, is_vertex_stroke ? brush->rgb : gp_style->stroke_rgba);
}
else {
/* Only Tint tool must show big cursor. */
@ -1953,15 +1942,7 @@ static void gpencil_brush_cursor_draw(bContext *C, int x, int y, void *customdat
/* Inner Ring: Color from UI panel */
immUniformColor4f(color[0], color[1], color[2], 0.8f);
if ((gp_style) && GPENCIL_PAINT_MODE(gpd) && (fixed_radius) &&
((brush->gpencil_settings->flag & GP_BRUSH_STABILIZE_MOUSE) == 0) &&
((brush->gpencil_settings->flag & GP_BRUSH_STABILIZE_MOUSE_TEMP) == 0) &&
(brush->gpencil_tool == GPAINT_TOOL_DRAW)) {
imm_draw_circle_fill_2d(pos, x, y, radius, 40);
}
else {
imm_draw_circle_wire_2d(pos, x, y, radius, 40);
}
imm_draw_circle_wire_2d(pos, x, y, radius, 40);
/* Outer Ring: Dark color for contrast on light backgrounds (e.g. gray on white) */
mul_v3_v3fl(darkcolor, color, 0.40f);

View File

@ -91,8 +91,6 @@ typedef enum eGPDbrush_Flag {
GP_BRUSH_OUTLINE_STROKE = (1 << 17),
/* Collide with stroke. */
GP_BRUSH_FILL_STROKE_COLLIDE = (1 << 18),
/* Show brush size */
GP_BRUSH_SHOW_DRAW_SIZE = (1 << 19),
} eGPDbrush_Flag;
typedef enum eGPDbrush_Flag2 {

View File

@ -2005,12 +2005,6 @@ static void rna_def_gpencil_options(BlenderRNA *brna)
prop, "Show Lasso", "Do not display fill color while drawing the stroke");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
prop = RNA_def_property(srna, "show_brush_size", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_SHOW_DRAW_SIZE);
RNA_def_property_boolean_default(prop, true);
RNA_def_property_ui_text(prop, "Show Brush Size", "Show the real size of the draw brush");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
prop = RNA_def_property(srna, "use_occlude_eraser", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_OCCLUDE_ERASER);
RNA_def_property_ui_text(prop, "Occlude Eraser", "Erase only strokes visible and not occluded");