[Bf-blender-cvs] [22768c2eff3] greasepencil-object: GPencil: Prepare fileds to implement Sculpt with eval data

Antonioya noreply at git.blender.org
Tue May 21 16:14:09 CEST 2019


Commit: 22768c2eff33435354c9daadc853cd5b534bebb1
Author: Antonioya
Date:   Tue May 21 13:26:58 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB22768c2eff33435354c9daadc853cd5b534bebb1

GPencil: Prepare fileds to implement Sculpt with eval data

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

M	source/blender/blenkernel/intern/gpencil_modifier.c
M	source/blender/editors/gpencil/gpencil_brush.c
M	source/blender/makesdna/DNA_gpencil_types.h

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

diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c b/source/blender/blenkernel/intern/gpencil_modifier.c
index d64219cd9a0..669190552df 100644
--- a/source/blender/blenkernel/intern/gpencil_modifier.c
+++ b/source/blender/blenkernel/intern/gpencil_modifier.c
@@ -782,6 +782,7 @@ void BKE_gpencil_subdivide(bGPDstroke *gps, int level, int flag)
       pt_final->time = pt->time;
       pt_final->flag = pt->flag;
       pt_final->runtime.pt_orig = pt->runtime.pt_orig;
+      pt_final->runtime.idx_orig = pt->runtime.idx_orig;
 
       if (gps->dvert != NULL) {
         dvert = &temp_dverts[i];
@@ -873,6 +874,7 @@ static void gpencil_copy_frame(bGPDframe *gpf, bGPDframe *derived_gpf)
     for (int i = 0; i < gps_src->totpoints; i++) {
       bGPDspoint *pt_dst = &gps_dst->points[i];
       pt_dst->runtime.pt_orig = &gps_src->points[i];
+      pt_dst->runtime.idx_orig = i;
     }
 
     BLI_addtail(&derived_gpf->strokes, gps_dst);
diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c
index 9777a8190c1..72e570e065b 100644
--- a/source/blender/editors/gpencil/gpencil_brush.c
+++ b/source/blender/editors/gpencil/gpencil_brush.c
@@ -1641,6 +1641,7 @@ static bool gpsculpt_brush_apply_standard(bContext *C, tGP_BrushEditData *gso)
   ToolSettings *ts = CTX_data_tool_settings(C);
   Depsgraph *depsgraph = CTX_data_depsgraph(C);
   Object *obact = gso->object;
+  Object *ob_eval = DEG_get_evaluated_object(depsgraph, obact);
   bGPdata *gpd = gso->gpd;
   bool changed = false;
 
@@ -1679,6 +1680,12 @@ static bool gpsculpt_brush_apply_standard(bContext *C, tGP_BrushEditData *gso)
     if (gpl->actframe == NULL) {
       continue;
     }
+    /* Get derived frames array data */
+    int derived_idx = BLI_findindex(&gpd->layers, gpl);
+    bGPDframe *derived_gpf = &ob_eval->runtime.derived_frames[derived_idx];
+    if (derived_gpf == NULL) {
+      continue;
+    }
 
     /* calculate difference matrix */
     float diff_mat[4][4];
diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h
index fd42e9b53a5..37e697a7279 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -54,6 +54,9 @@ typedef struct bGPDcontrolpoint {
 typedef struct bGPDspoint_Runtime {
   /** Original point (used to dereference evaluated data) */
   struct bGPDspoint *pt_orig;
+  /** Original index array position */
+  int idx_orig;
+  char _pad0[4];
 } bGPDspoint_Runtime;
 
 /* Grease-Pencil Annotations - 'Stroke Point'



More information about the Bf-blender-cvs mailing list