[Bf-blender-cvs] [81973547824] greasepencil-object: GPencil: Cleanup previous fix and use object as parameter

Antonio Vazquez noreply at git.blender.org
Wed Feb 12 16:34:58 CET 2020


Commit: 81973547824be2de64def5feda94c29b255f4df8
Author: Antonio Vazquez
Date:   Wed Feb 12 16:20:27 2020 +0100
Branches: greasepencil-object
https://developer.blender.org/rB81973547824be2de64def5feda94c29b255f4df8

GPencil: Cleanup previous fix and use object as parameter

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

M	source/blender/editors/gpencil/gpencil_paint.c
M	source/blender/editors/gpencil/gpencil_primitive.c
M	source/blender/editors/gpencil/gpencil_utils.c
M	source/blender/editors/include/ED_gpencil.h

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

diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 7469279b3f7..7a876392a1a 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -738,7 +738,7 @@ static short gp_stroke_addpoint(tGPsdata *p, const float mval[2], float pressure
     }
 
     /* Set vertex colors for buffer. */
-    ED_gpencil_sbuffer_vertex_color_set(p->depsgraph, p->scene->toolsettings, p->brush, gpd);
+    ED_gpencil_sbuffer_vertex_color_set(p->depsgraph, p->ob, p->scene->toolsettings, p->brush);
 
     /* get pointer to destination point */
     pt = ((tGPspoint *)(gpd->runtime.sbuffer) + gpd->runtime.sbuffer_used);
diff --git a/source/blender/editors/gpencil/gpencil_primitive.c b/source/blender/editors/gpencil/gpencil_primitive.c
index 87375b856b8..01e9bbd7c84 100644
--- a/source/blender/editors/gpencil/gpencil_primitive.c
+++ b/source/blender/editors/gpencil/gpencil_primitive.c
@@ -123,7 +123,7 @@ static void gp_session_validatebuffer(tGPDprimitive *p)
   gpd->runtime.sbuffer_sflag |= GP_STROKE_3DSPACE;
 
   /* Set vertex colors for buffer. */
-  ED_gpencil_sbuffer_vertex_color_set(p->depsgraph, p->scene->toolsettings, p->brush, gpd);
+  ED_gpencil_sbuffer_vertex_color_set(p->depsgraph, p->ob, p->scene->toolsettings, p->brush);
 
   if (ELEM(p->type, GP_STROKE_BOX, GP_STROKE_CIRCLE)) {
     gpd->runtime.sbuffer_sflag |= GP_STROKE_CYCLIC;
diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c
index 10e14466774..de53f23e815 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -2531,10 +2531,14 @@ void ED_gpencil_point_vertex_color_set(ToolSettings *ts, Brush *brush, bGPDspoin
 }
 
 void ED_gpencil_sbuffer_vertex_color_set(Depsgraph *depsgraph,
+                                         Object *ob,
                                          ToolSettings *ts,
-                                         Brush *brush,
-                                         bGPdata *gpd)
+                                         Brush *brush)
 {
+  bGPdata *gpd = (bGPdata *)ob->data;
+  Object *ob_eval = (Object *)DEG_get_evaluated_id(depsgraph, &ob->id);
+  bGPdata *gpd_eval = (bGPdata *)ob_eval->data;
+
   float vertex_color[4];
   copy_v3_v3(vertex_color, brush->rgb);
   vertex_color[3] = brush->gpencil_settings->vertex_factor;
@@ -2556,7 +2560,6 @@ void ED_gpencil_sbuffer_vertex_color_set(Depsgraph *depsgraph,
   }
 
   /* Copy to eval data because paint operators don't tag refresh until end for speedup painting. */
-  bGPdata *gpd_eval = (bGPdata *)DEG_get_evaluated_id(depsgraph, &gpd->id);
   if (gpd_eval != NULL) {
     copy_v4_v4(gpd_eval->runtime.vert_color, gpd->runtime.vert_color);
     copy_v4_v4(gpd_eval->runtime.vert_color_fill, gpd->runtime.vert_color_fill);
diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h
index a04033d3a9c..77bfd07f80b 100644
--- a/source/blender/editors/include/ED_gpencil.h
+++ b/source/blender/editors/include/ED_gpencil.h
@@ -301,9 +301,9 @@ void ED_gpencil_point_vertex_color_set(struct ToolSettings *ts,
                                        struct Brush *brush,
                                        struct bGPDspoint *pt);
 void ED_gpencil_sbuffer_vertex_color_set(struct Depsgraph *depsgraph,
+                                         struct Object *ob,
                                          struct ToolSettings *ts,
-                                         struct Brush *brush,
-                                         struct bGPdata *gpd);
+                                         struct Brush *brush);
 
 bool ED_gpencil_stroke_check_collision(struct GP_SpaceConversion *gsc,
                                        struct bGPDstroke *gps,



More information about the Bf-blender-cvs mailing list