[Bf-blender-cvs] [8b4d22db997] greasepencil-object: GP Lattice Modifier - Define updateDepsgraph() callback to add needed relations and remove manula updates
Joshua Leung
noreply at git.blender.org
Sat Nov 4 05:47:22 CET 2017
Commit: 8b4d22db997b8330fa835b729b58886bbb89e38b
Author: Joshua Leung
Date: Thu Oct 26 18:51:33 2017 +1300
Branches: greasepencil-object
https://developer.blender.org/rB8b4d22db997b8330fa835b729b58886bbb89e38b
GP Lattice Modifier - Define updateDepsgraph() callback to add needed relations
and remove manula updates
===================================================================
M source/blender/blenkernel/intern/lattice.c
M source/blender/blenkernel/intern/object_update.c
M source/blender/modifiers/intern/MOD_gpencillattice.c
===================================================================
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index 1fea18b61b5..99223bff789 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -1234,10 +1234,7 @@ void BKE_lattice_translate(Lattice *lt, float offset[3], bool do_keys)
void BKE_lattice_eval_geometry(const 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 b07a6de9bab..3bd14ae2079 100644
--- a/source/blender/blenkernel/intern/object_update.c
+++ b/source/blender/blenkernel/intern/object_update.c
@@ -301,15 +301,6 @@ void BKE_object_eval_uber_transform(const 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(const EvaluationContext *eval_ctx,
diff --git a/source/blender/modifiers/intern/MOD_gpencillattice.c b/source/blender/modifiers/intern/MOD_gpencillattice.c
index c9135ffed91..68ddf665a22 100644
--- a/source/blender/modifiers/intern/MOD_gpencillattice.c
+++ b/source/blender/modifiers/intern/MOD_gpencillattice.c
@@ -49,6 +49,7 @@
#include "MOD_modifiertypes.h"
#include "DEG_depsgraph.h"
+#include "DEG_depsgraph_build.h"
static void initData(ModifierData *md)
{
@@ -129,6 +130,20 @@ static bool isDisabled(ModifierData *md, int UNUSED(userRenderParams))
return !mmd->object;
}
+static void updateDepsgraph(ModifierData *md,
+ struct Main *UNUSED(bmain),
+ struct Scene *UNUSED(scene),
+ Object *object,
+ struct DepsNodeHandle *node)
+{
+ GpencilLatticeModifierData *lmd = (GpencilLatticeModifierData *)md;
+ if (lmd->object != NULL) {
+ DEG_add_object_relation(node, lmd->object, DEG_OB_COMP_GEOMETRY, "Lattice Modifier");
+ DEG_add_object_relation(node, lmd->object, DEG_OB_COMP_TRANSFORM, "Lattice Modifier");
+ }
+ DEG_add_object_relation(node, object, DEG_OB_COMP_TRANSFORM, "Lattice Modifier");
+}
+
static void foreachObjectLink(
ModifierData *md, Object *ob,
ObjectWalkFunc walk, void *userData)
@@ -156,7 +171,7 @@ ModifierTypeInfo modifierType_GpencilLattice = {
/* requiredDataMask */ NULL,
/* freeData */ freeData,
/* isDisabled */ isDisabled,
- /* updateDepsgraph */ NULL,
+ /* updateDepsgraph */ updateDepsgraph,
/* dependsOnTime */ NULL,
/* dependsOnNormals */ NULL,
/* foreachObjectLink */ foreachObjectLink,
More information about the Bf-blender-cvs
mailing list