[Bf-blender-cvs] [e1180bfdb29] master: GPencil: Use Material or Vertex Color for Brush cursor

Antonio Vazquez noreply at git.blender.org
Sat Dec 24 11:38:18 CET 2022


Commit: e1180bfdb2965ba76daef223efdf5600bddba0ca
Author: Antonio Vazquez
Date:   Sat Dec 24 11:37:13 2022 +0100
Branches: master
https://developer.blender.org/rBe1180bfdb2965ba76daef223efdf5600bddba0ca

GPencil: Use Material or Vertex Color for Brush cursor

The color of the brush cursor is changed depending
of the mode selected.

If the mode is stroke vertex color, use vertex color, otherwise
it uses material stroke color.

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

M	source/blender/editors/gpencil/gpencil_utils.c

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

diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c
index 3abb04c6360..9f6b17b66e2 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -1736,6 +1736,7 @@ static bool gpencil_brush_cursor_poll(bContext *C)
 static void gpencil_brush_cursor_draw(bContext *C, int x, int y, void *customdata)
 {
   Scene *scene = CTX_data_scene(C);
+  ToolSettings *ts = scene->toolsettings;
   Object *ob = CTX_data_active_object(C);
   ARegion *region = CTX_wm_region(C);
   Paint *paint = BKE_paint_get_active_from_context(C);
@@ -1800,10 +1801,16 @@ static void gpencil_brush_cursor_draw(bContext *C, int x, int y, void *customdat
         /* 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, gp_style->stroke_rgba);
+          copy_v3_v3(color, is_vertex_stroke ? brush->rgb : gp_style->stroke_rgba);
         }
         else {
           /* Show brush size. */
@@ -1841,7 +1848,7 @@ static void gpencil_brush_cursor_draw(bContext *C, int x, int y, void *customdat
             radius = (1 / distance) * 2.0f * gpd->pixfactor * (brush_size / 64);
           }
 
-          copy_v3_v3(color, brush->rgb);
+          copy_v3_v3(color, is_vertex_stroke ? brush->rgb : gp_style->stroke_rgba);
         }
       }
       else {



More information about the Bf-blender-cvs mailing list