[Bf-blender-cvs] [0d0bfd3c365] greasepencil-refactor: GPencil: Fix slow calculation in Edit transformations

Antonio Vazquez noreply at git.blender.org
Sat Jan 18 16:31:59 CET 2020


Commit: 0d0bfd3c365289d4e1ee7a688b2f684a2db1e94e
Author: Antonio Vazquez
Date:   Sat Jan 18 16:31:47 2020 +0100
Branches: greasepencil-refactor
https://developer.blender.org/rB0d0bfd3c365289d4e1ee7a688b2f684a2db1e94e

GPencil: Fix slow calculation in Edit transformations

Now the triangulation is only calculated once by stroke, not for each point.

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

M	source/blender/editors/transform/transform_generics.c

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

diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 575b39490a5..8142f9f99c2 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -1215,13 +1215,15 @@ static void recalcData_sequencer(TransInfo *t)
 static void recalcData_gpencil_strokes(TransInfo *t)
 {
   TransDataContainer *tc = TRANS_DATA_CONTAINER_FIRST_SINGLE(t);
+  bGPDstroke *gps_prev = NULL;
 
   TransData *td = tc->data;
   for (int i = 0; i < tc->data_len; i++, td++) {
     bGPDstroke *gps = td->extra;
-    if (gps != NULL) {
+    if ((gps != NULL) && (gps != gps_prev)) {
       /* Calc geometry data. */
       BKE_gpencil_stroke_geometry_update(gps);
+      gps_prev = gps;
     }
   }
 }



More information about the Bf-blender-cvs mailing list