[Bf-blender-cvs] [7fae3e375a6] master: GPencil: Cleanup code to avoid double matrix copy

Antonioya noreply at git.blender.org
Wed May 29 19:52:05 CEST 2019


Commit: 7fae3e375a6c3804dc986371d488675d0d4869cd
Author: Antonioya
Date:   Wed May 29 19:50:23 2019 +0200
Branches: master
https://developer.blender.org/rB7fae3e375a6c3804dc986371d488675d0d4869cd

GPencil: Cleanup code to avoid double matrix copy

Thanks @fclem for catching the problem.

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

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

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

diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index 7f979c4fed1..58cae5888a2 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -1021,7 +1021,6 @@ static void gpencil_draw_strokes(GpencilBatchCache *cache,
   Scene *scene = draw_ctx->scene;
   View3D *v3d = draw_ctx->v3d;
   bGPDstroke *gps, *src_gps;
-  float viewmatrix[4][4];
   const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd);
   const bool playing = stl->storage->is_playing;
   const bool is_render = (bool)stl->storage->is_render;
@@ -1035,12 +1034,13 @@ static void gpencil_draw_strokes(GpencilBatchCache *cache,
   Depsgraph *depsgraph = DRW_context_state_get()->depsgraph;
 
   /* get parent matrix and save as static data */
-  ED_gpencil_parent_location(depsgraph, ob, gpd, gpl, viewmatrix);
-  copy_m4_m4(derived_gpf->runtime.viewmatrix, viewmatrix);
-
   if ((cache_ob != NULL) && (cache_ob->is_dup_ob)) {
     copy_m4_m4(derived_gpf->runtime.viewmatrix, cache_ob->obmat);
   }
+  else {
+    /* get parent matrix and save as static data */
+    ED_gpencil_parent_location(depsgraph, ob, gpd, gpl, derived_gpf->runtime.viewmatrix);
+  }
 
   /* apply geometry modifiers */
   if ((cache->is_dirty) && (ob->greasepencil_modifiers.first) && (!is_multiedit)) {



More information about the Bf-blender-cvs mailing list