[Bf-blender-cvs] [abb4147391d] greasepencil-object: Move update of lattice outside

Antonio Vazquez noreply at git.blender.org
Sat Jul 29 22:41:30 CEST 2017


Commit: abb4147391d013a3d551722a64a21154af59bca9
Author: Antonio Vazquez
Date:   Sat Jul 29 10:31:41 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rBabb4147391d013a3d551722a64a21154af59bca9

Move update of lattice outside

The update of the GPD cache  is moved to the corresponding update functions

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

M	source/blender/blenkernel/intern/lattice.c
M	source/blender/blenkernel/intern/object_update.c
M	source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c

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

diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index d0fb6f58852..b91196ca31d 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -63,6 +63,7 @@
 #include "BKE_main.h"
 #include "BKE_modifier.h"
 #include "BKE_object.h"
+#include "BKE_gpencil.h"
 
 #include "BKE_deform.h"
 
@@ -1225,6 +1226,10 @@ void BKE_lattice_translate(Lattice *lt, float offset[3], bool do_keys)
 void BKE_lattice_eval_geometry(struct EvaluationContext *UNUSED(eval_ctx),
                                Lattice *UNUSED(latt))
 {
+	/* set grease pencil caches to dirty. Maybe we could verify if the lattice is used 
+	 * or not, but this is slower than set all as dirty 
+	 */
+	BKE_gpencil_batch_cache_alldirty();
 }
 
 /* Draw Engine */
diff --git a/source/blender/blenkernel/intern/object_update.c b/source/blender/blenkernel/intern/object_update.c
index 0bbfbb8a4e7..2d7ddc7782d 100644
--- a/source/blender/blenkernel/intern/object_update.c
+++ b/source/blender/blenkernel/intern/object_update.c
@@ -61,6 +61,7 @@
 #include "BKE_material.h"
 #include "BKE_mesh.h"
 #include "BKE_image.h"
+#include "BKE_gpencil.h"
 
 #include "MEM_guardedalloc.h"
 #include "DEG_depsgraph.h"
@@ -324,6 +325,15 @@ void BKE_object_eval_uber_transform(EvaluationContext *UNUSED(eval_ctx),
 	if (ob->data == NULL) {
 		ob->recalc &= ~OB_RECALC_DATA;
 	}
+
+	/* additional updates */
+	switch (ob->type) {
+		case OB_LATTICE:
+		{
+			BKE_gpencil_batch_cache_alldirty();
+			break;
+		}
+	}
 }
 
 void BKE_object_eval_uber_data(EvaluationContext *eval_ctx,
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 1bcbc14ed31..a9b55732b1f 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
@@ -781,20 +781,12 @@ static void gpencil_draw_onionskins(GpencilBatchCache *cache, GPENCIL_e_data *e_
 /* helper for populate a complete grease pencil datablock */
 void DRW_gpencil_populate_datablock(GPENCIL_e_data *e_data, void *vedata, Scene *scene, Object *ob, ToolSettings *ts, bGPdata *gpd)
 {
-	const DRWContextState *draw_ctx = DRW_context_state_get();
-	Object *obact = draw_ctx->obact;
 	bGPDframe *derived_gpf = NULL;
 	bool is_edit = (bool)(gpd->flag & (GP_DATA_STROKE_EDITMODE | GP_DATA_STROKE_SCULPTMODE));
 
 	if (G.debug_value == 668) {
 		printf("DRW_gpencil_populate_datablock: %s\n", gpd->id.name);
 	}
-	/* TODO: can be moved to desgraph? */
-	if ((obact) && (obact->type == OB_LATTICE) && (ob->modifiers.first)) {
-		if (ED_gpencil_use_this_lattice(ob, obact)) {
-			BKE_gpencil_batch_cache_dirty(gpd);
-		}
-	}
 
 	GpencilBatchCache *cache = gpencil_batch_cache_get(ob, CFRA);
 	cache->cache_idx = 0;




More information about the Bf-blender-cvs mailing list