[Bf-blender-cvs] [44200957dd8] greasepencil-refactor: GPencil: Cleanup old runtime data not used

Antonio Vazquez noreply at git.blender.org
Mon Jan 20 15:47:22 CET 2020


Commit: 44200957dd854f549c605eac8e2bfc14c1d4d5af
Author: Antonio Vazquez
Date:   Mon Jan 20 15:43:29 2020 +0100
Branches: greasepencil-refactor
https://developer.blender.org/rB44200957dd854f549c605eac8e2bfc14c1d4d5af

GPencil: Cleanup old runtime data not used

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

M	source/blender/editors/gpencil/gpencil_paint.c
M	source/blender/editors/gpencil/gpencil_primitive.c
M	source/blender/makesdna/DNA_gpencil_types.h

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

diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index ad30d334040..9b6ca65876e 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1762,53 +1762,12 @@ static void gp_init_colors(tGPsdata *p)
 {
   bGPdata *gpd = p->gpd;
   Brush *brush = p->brush;
-  ToolSettings *ts = p->scene->toolsettings;
-
-  MaterialGPencilStyle *gp_style = NULL;
 
   /* use brush material */
   p->material = BKE_gpencil_object_material_ensure_from_active_input_brush(p->bmain, p->ob, brush);
 
   gpd->runtime.matid = BKE_object_material_slot_find_index(p->ob, p->material);
-
-  /* assign color information to temp tGPsdata */
-  gp_style = p->material->gp_style;
-  if (gp_style) {
-    gpd->runtime.brush_size = brush->size;
-
-    /* set colors */
-    if (gp_style->flag & GP_MATERIAL_STROKE_SHOW) {
-      copy_v4_v4(gpd->runtime.scolor, gp_style->stroke_rgba);
-    }
-    else {
-      /* if no stroke, use fill */
-      copy_v4_v4(gpd->runtime.scolor, gp_style->fill_rgba);
-    }
-    copy_v4_v4(gpd->runtime.sfill, gp_style->fill_rgba);
-    /* add some alpha to make easy the filling without hide strokes */
-    if (gpd->runtime.sfill[3] > 0.8f) {
-      gpd->runtime.sfill[3] = 0.8f;
-    }
-
-    /* Apply the mix color to fill. */
-    if (GPENCIL_USE_VERTEX_COLOR_FILL(ts, brush)) {
-      interp_v3_v3v3(gpd->runtime.sfill,
-                     gpd->runtime.sfill,
-                     brush->rgb,
-                     brush->gpencil_settings->vertex_factor);
-    }
-
-    gpd->runtime.mode = (short)gp_style->mode;
-    gpd->runtime.bfill_style = gp_style->fill_style;
-
-    /* Apply the mix color to stroke. */
-    if (GPENCIL_USE_VERTEX_COLOR_STROKE(ts, brush)) {
-      interp_v3_v3v3(gpd->runtime.scolor,
-                     gpd->runtime.scolor,
-                     brush->rgb,
-                     brush->gpencil_settings->vertex_factor);
-    }
-  }
+  gpd->runtime.brush_size = brush->size;
 }
 
 /* (re)init new painting data */
@@ -2110,7 +2069,7 @@ static void gp_paint_initstroke(tGPsdata *p, eGPencil_PaintModes paintmode, Deps
   if (p->disable_fill == true) {
     p->gpd->runtime.sbuffer_sflag |= GP_STROKE_NOFILL;
     /* replace stroke color with fill color */
-    copy_v4_v4(p->gpd->runtime.scolor, p->gpd->runtime.sfill);
+    /* TODO: Review copy_v4_v4(p->gpd->runtime.scolor, p->gpd->runtime.sfill); */
   }
 
   /* set 'initial run' flag, which is only used to denote when a new stroke is starting */
diff --git a/source/blender/editors/gpencil/gpencil_primitive.c b/source/blender/editors/gpencil/gpencil_primitive.c
index b5d42178a51..6096fdf9466 100644
--- a/source/blender/editors/gpencil/gpencil_primitive.c
+++ b/source/blender/editors/gpencil/gpencil_primitive.c
@@ -134,53 +134,12 @@ static void gp_init_colors(tGPDprimitive *p)
 {
   bGPdata *gpd = p->gpd;
   Brush *brush = p->brush;
-  ToolSettings *ts = p->scene->toolsettings;
-
-  MaterialGPencilStyle *gp_style = NULL;
 
   /* use brush material */
   p->mat = BKE_gpencil_object_material_ensure_from_active_input_brush(p->bmain, p->ob, brush);
 
   gpd->runtime.matid = BKE_object_material_slot_find_index(p->ob, p->mat);
-
-  /* assign color information to temp data */
-  gp_style = p->mat->gp_style;
-  if (gp_style) {
-    gpd->runtime.brush_size = brush->size;
-
-    /* set colors */
-    if (gp_style->flag & GP_MATERIAL_STROKE_SHOW) {
-      copy_v4_v4(gpd->runtime.scolor, gp_style->stroke_rgba);
-    }
-    else {
-      /* if no stroke, use fill */
-      copy_v4_v4(gpd->runtime.scolor, gp_style->fill_rgba);
-    }
-
-    copy_v4_v4(gpd->runtime.sfill, gp_style->fill_rgba);
-    /* add some alpha to make easy the filling without hide strokes */
-    if (gpd->runtime.sfill[3] > 0.8f) {
-      gpd->runtime.sfill[3] = 0.8f;
-    }
-    /* Apply the mix color to fill. */
-    if (GPENCIL_USE_VERTEX_COLOR_FILL(ts, brush)) {
-      interp_v3_v3v3(gpd->runtime.sfill,
-                     gpd->runtime.sfill,
-                     brush->rgb,
-                     brush->gpencil_settings->vertex_factor);
-    }
-
-    gpd->runtime.mode = (short)gp_style->mode;
-    gpd->runtime.bfill_style = gp_style->fill_style;
-
-    /* Apply the mix color to stroke. */
-    if (GPENCIL_USE_VERTEX_COLOR_STROKE(ts, brush)) {
-      interp_v3_v3v3(gpd->runtime.scolor,
-                     gpd->runtime.scolor,
-                     brush->rgb,
-                     brush->gpencil_settings->vertex_factor);
-    }
-  }
+  gpd->runtime.brush_size = brush->size;
 }
 
 /* Helper to square a primitive */
diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h
index 6d89f01e3fa..c6baf48fd2e 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -460,18 +460,12 @@ typedef struct bGPdata_Runtime {
   struct bGPDstroke *sbuffer_gps;
 
   /* GP Object drawing */
-  /** Buffer stroke color. */
-  float scolor[4];
-  /** Buffer fill color. */
-  float sfill[4];
-  /** Settings for color. */
-  short mode;
+  char _pad[2];
   /** Material index of the stroke. */
   short matid;
   /** Brush size of stroke. */
   float brush_size;
-  /** Buffer style for filling areas (used to select shader type). */
-  short bfill_style;
+  char _pad1[2];
 
   /* Stroke Buffer data (only used during paint-session)
    * - buffer must be initialized before use, but freed after



More information about the Bf-blender-cvs mailing list