GP: Count all strokes when use multiedit for VBO size
authorAntonioya <blendergit@gmail.com>
Fri, 11 Jan 2019 10:00:30 +0000 (11:00 +0100)
committerAntonioya <blendergit@gmail.com>
Fri, 11 Jan 2019 10:00:30 +0000 (11:00 +0100)
When use multi frame edition, the initial size of the VBO must be bigger than normal edition because the realloc of VBO is very slow.

source/blender/draw/engines/gpencil/gpencil_draw_utils.c

index fa16a00..8bcd1e1 100644 (file)
@@ -79,6 +79,7 @@ static void gpencil_calc_vertex(
                main_onion && DRW_gpencil_onion_active(gpd) && !playing;
 
        const bool time_remap = BKE_gpencil_has_time_modifiers(ob);
+       const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd);
 
        cache_ob->tot_vertex = 0;
        cache_ob->tot_triangles = 0;
@@ -90,9 +91,9 @@ static void gpencil_calc_vertex(
                        continue;
                }
 
-               /* if onion skin need to count all frames of the layer */
-               if (is_onion) {
-                       init_gpf = gpl->actframe;
+               /* if multiedit or onion skin need to count all frames of the layer */
+               if ((is_multiedit) || (is_onion)) {
+                       init_gpf = gpl->frames.first;
                }
                else {
                        /* verify time modifiers */