[Bf-blender-cvs] [25de2710080] greasepencil-refactor: GPencil: Recalc triangulation for active frame and delay others

Antonio Vazquez noreply at git.blender.org
Sun Feb 2 16:43:59 CET 2020


Commit: 25de27100807769b2eabd8814d4d80093f93da1a
Author: Antonio Vazquez
Date:   Sun Feb 2 16:24:34 2020 +0100
Branches: greasepencil-refactor
https://developer.blender.org/rB25de27100807769b2eabd8814d4d80093f93da1a

GPencil: Recalc triangulation for active frame and delay others

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

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

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

diff --git a/source/blender/editors/gpencil/gpencil_sculpt_paint.c b/source/blender/editors/gpencil/gpencil_sculpt_paint.c
index 00b0d84f20c..68b0d06736c 100644
--- a/source/blender/editors/gpencil/gpencil_sculpt_paint.c
+++ b/source/blender/editors/gpencil/gpencil_sculpt_paint.c
@@ -348,8 +348,6 @@ static bool gp_brush_smooth_apply(tGP_BrushEditData *gso,
     BKE_gpencil_stroke_smooth_uv(gps, pt_index, inf);
   }
 
-  gpencil_recalc_geometry_tag(gps);
-
   return true;
 }
 
@@ -594,7 +592,6 @@ static void gp_brush_grab_apply_cached(tGP_BrushEditData *gso,
     /* compute lock axis */
     gpsculpt_compute_lock_axis(gso, pt, save_pt);
   }
-  gpencil_recalc_geometry_tag(gps);
 }
 
 /* free customdata used for handling this stroke */
@@ -730,8 +727,6 @@ static bool gp_brush_pinch_apply(tGP_BrushEditData *gso,
   /* compute lock axis */
   gpsculpt_compute_lock_axis(gso, pt, save_pt);
 
-  gpencil_recalc_geometry_tag(gps);
-
   /* done */
   return true;
 }
@@ -818,8 +813,6 @@ static bool gp_brush_twist_apply(tGP_BrushEditData *gso,
     }
   }
 
-  gpencil_recalc_geometry_tag(gps);
-
   /* done */
   return true;
 }
@@ -932,8 +925,6 @@ static bool gp_brush_randomize_apply(tGP_BrushEditData *gso,
     CLAMP(pt->uv_rot, -M_PI_2, M_PI_2);
   }
 
-  gpencil_recalc_geometry_tag(gps);
-
   /* done */
   return true;
 }
@@ -1704,8 +1695,19 @@ static bool gpsculpt_brush_do_frame(bContext *C,
         printf("ERROR: Unknown type of GPencil Sculpt brush \n");
         break;
     }
-    /* Triangulation must be calculated if changed */
-    gpencil_recalc_geometry_tag(gps);
+
+    /* Triangulation must be calculated. */
+    if (changed) {
+      bGPDstroke *gps_active = (gps->runtime.gps_orig) ? gps->runtime.gps_orig : gps;
+      if (gpl->actframe == gpf) {
+        BKE_gpencil_stroke_geometry_update(gps_active);
+        gps->flag &= ~GP_STROKE_TAG;
+      }
+      else {
+        /* Delay calculation for non active frames. */
+        gpencil_recalc_geometry_tag(gps_active);
+      }
+    }
   }
 
   return changed;



More information about the Bf-blender-cvs mailing list