[Bf-blender-cvs] [2fd48935346] greasepencil-refactor: Fix Vertex Paint to use Eval data

Antonio Vazquez noreply at git.blender.org
Sat Jan 18 11:55:23 CET 2020


Commit: 2fd48935346304c16818d5b0b5dc7f0b849b6e1a
Author: Antonio Vazquez
Date:   Wed Jan 15 18:13:39 2020 +0100
Branches: greasepencil-refactor
https://developer.blender.org/rB2fd48935346304c16818d5b0b5dc7f0b849b6e1a

Fix Vertex Paint to use Eval data

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

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

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

diff --git a/source/blender/editors/gpencil/gpencil_vertex_paint.c b/source/blender/editors/gpencil/gpencil_vertex_paint.c
index cf4de152407..a9b99632a82 100644
--- a/source/blender/editors/gpencil/gpencil_vertex_paint.c
+++ b/source/blender/editors/gpencil/gpencil_vertex_paint.c
@@ -832,8 +832,7 @@ static void gp_vertexpaint_select_stroke(tGP_BrushVertexpaintData *gso,
   Brush *brush = gso->brush;
   const int radius = (brush->flag & GP_BRUSH_USE_PRESSURE) ? gso->brush->size * gso->pressure :
                                                              gso->brush->size;
-  const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gso->gpd);
-  bGPDstroke *gps_active = (!is_multiedit) ? gps->runtime.gps_orig : gps;
+  bGPDstroke *gps_active = (gps->runtime.gps_orig) ? gps->runtime.gps_orig : gps;
   bGPDspoint *pt_active = NULL;
 
   bGPDspoint *pt1, *pt2;
@@ -850,7 +849,7 @@ static void gp_vertexpaint_select_stroke(tGP_BrushVertexpaintData *gso,
     gp_point_to_parent_space(gps->points, diff_mat, &pt_temp);
     gp_point_to_xy(gsc, gps, &pt_temp, &pc1[0], &pc1[1]);
 
-    pt_active = (!is_multiedit) ? pt->runtime.pt_orig : pt;
+    pt_active = (pt->runtime.pt_orig) ? pt->runtime.pt_orig : pt;
     /* do boundbox check first */
     if ((!ELEM(V2D_IS_CLIPPED, pc1[0], pc1[1])) && BLI_rcti_isect_pt(rect, pc1[0], pc1[1])) {
       /* only check if point is inside */
@@ -901,8 +900,8 @@ static void gp_vertexpaint_select_stroke(tGP_BrushVertexpaintData *gso,
 
           /* To each point individually... */
           pt = &gps->points[i];
-          pt_active = (!is_multiedit) ? pt->runtime.pt_orig : pt;
-          index = (!is_multiedit) ? pt->runtime.idx_orig : i;
+          pt_active = (pt->runtime.pt_orig) ? pt->runtime.pt_orig : pt;
+          index = (pt->runtime.pt_orig) ? pt->runtime.idx_orig : i;
           if (pt_active != NULL) {
             gp_save_selected_point(gso, gps_active, index, pc1);
           }
@@ -917,8 +916,8 @@ static void gp_vertexpaint_select_stroke(tGP_BrushVertexpaintData *gso,
            */
           if (i + 1 == gps->totpoints - 1) {
             pt = &gps->points[i + 1];
-            pt_active = (!is_multiedit) ? pt->runtime.pt_orig : pt;
-            index = (!is_multiedit) ? pt->runtime.idx_orig : i + 1;
+            pt_active = (pt->runtime.pt_orig) ? pt->runtime.pt_orig : pt;
+            index = (pt->runtime.pt_orig) ? pt->runtime.idx_orig : i + 1;
             if (pt_active != NULL) {
               gp_save_selected_point(gso, gps_active, index, pc2);
               include_last = false;
@@ -935,8 +934,8 @@ static void gp_vertexpaint_select_stroke(tGP_BrushVertexpaintData *gso,
            * (but wasn't added then, to avoid double-ups).
            */
           pt = &gps->points[i];
-          pt_active = (!is_multiedit) ? pt->runtime.pt_orig : pt;
-          index = (!is_multiedit) ? pt->runtime.idx_orig : i;
+          pt_active = (pt->runtime.pt_orig) ? pt->runtime.pt_orig : pt;
+          index = (pt->runtime.pt_orig) ? pt->runtime.idx_orig : i;
           if (pt_active != NULL) {
             gp_save_selected_point(gso, gps_active, index, pc1);
 
@@ -1067,11 +1066,13 @@ static bool gp_vertexpaint_brush_apply_to_layers(bContext *C, tGP_BrushVertexpai
   ToolSettings *ts = CTX_data_tool_settings(C);
   Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
   Object *obact = gso->object;
-  bGPdata *gpd = gso->gpd;
   bool changed = false;
 
+  Object *ob_eval = (Object *)DEG_get_evaluated_id(depsgraph, &obact->id);
+  bGPdata *gpd = (bGPdata *)ob_eval->data;
+
   /* Find visible strokes, and perform operations on those if hit */
-  CTX_DATA_BEGIN (C, bGPDlayer *, gpl, editable_gpencil_layers) {
+  for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
     /* If no active frame, don't do anything... */
     if (gpl->actframe == NULL) {
       continue;
@@ -1120,7 +1121,6 @@ static bool gp_vertexpaint_brush_apply_to_layers(bContext *C, tGP_BrushVertexpai
       }
     }
   }
-  CTX_DATA_END;
 
   return changed;
 }



More information about the Bf-blender-cvs mailing list