[Bf-blender-cvs] [677aa38b0fe] greasepencil-object: Proof of concept to duplicate stroke

Antonio Vazquez noreply at git.blender.org
Sun Jul 16 17:43:21 CEST 2017


Commit: 677aa38b0fe9828bddcf347dd08c99aa19c58ba8
Author: Antonio Vazquez
Date:   Thu Jul 6 17:03:48 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rB677aa38b0fe9828bddcf347dd08c99aa19c58ba8

Proof of concept to duplicate stroke

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

M	source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c

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

diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
index ee7a12ae46e..01ee830d451 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
@@ -521,13 +521,24 @@ static void gpencil_add_stroke_shgroup(GpencilBatchCache *cache, DRWShadingGroup
 	short sthickness = gps->thickness + gpl->thickness;
 	if (sthickness > 0) {
 		if (cache->is_dirty) {
+			/* apply modifiers */
+			bGPDstroke *gps_mod;
+			gps_mod = MEM_dupallocN(gps);
+			gps_mod->points = MEM_dupallocN(gps->points);
+			gps_mod->triangles = MEM_dupallocN(gps->triangles);
+
 			gpencil_batch_cache_check_free_slots(gpd);
 			if ((gps->totpoints > 1) && (gps->palcolor->stroke_style != STROKE_STYLE_VOLUMETRIC)) {
-				cache->batch_stroke[cache->cache_idx] = DRW_gpencil_get_stroke_geom(gpf, gps, sthickness, ink);
+				cache->batch_stroke[cache->cache_idx] = DRW_gpencil_get_stroke_geom(gpf, gps_mod, sthickness, ink);
 			}
 			else {
-				cache->batch_stroke[cache->cache_idx] = DRW_gpencil_get_point_geom(gps, sthickness, ink);
+				cache->batch_stroke[cache->cache_idx] = DRW_gpencil_get_point_geom(gps_mod, sthickness, ink);
 			}
+
+			/* free modifier temp data */
+			MEM_SAFE_FREE(gps_mod->triangles);
+			MEM_SAFE_FREE(gps_mod->points);
+			MEM_SAFE_FREE(gps_mod);
 		}
 		DRW_shgroup_call_add(strokegrp, cache->batch_stroke[cache->cache_idx], gpf->viewmatrix);
 	}




More information about the Bf-blender-cvs mailing list