[Bf-blender-cvs] [a2cf9a8647f] master: GPencil: Display real brush cursor size always

Antonio Vazquez noreply at git.blender.org
Tue Dec 27 10:26:42 CET 2022


Commit: a2cf9a8647fda2b9b2e51e23c04f0b1e74922bbc
Author: Antonio Vazquez
Date:   Tue Dec 27 10:25:54 2022 +0100
Branches: master
https://developer.blender.org/rBa2cf9a8647fda2b9b2e51e23c04f0b1e74922bbc

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.

===================================================================

M	release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M	source/blender/editors/gpencil/gpencil_utils.c
M	source/blender/makesdna/DNA_brush_enums.h
M	source/blender/makesrna/intern/rna_brush.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 1e68b2df97d..a3a69835a19 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -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")
diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c
index f8e2a8fd080..e378c35516e 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -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);
diff --git a/source/blender/makesdna/DNA_brush_enums.h b/source/blender/makesdna/DNA_brush_enums.h
index ce90a8e05c1..72357ea6734 100644
--- a/source/blender/makesdna/DNA_brush_enums.h
+++ b/source/blender/makesdna/DNA_brush_enums.h
@@ -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 {
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index 1d2adc386cf..ce51b52de39 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -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");



More information about the Bf-blender-cvs mailing list