[Bf-blender-cvs] [fc74cd5] alembic_basic_io: Implement CacheFile in the legacy dependency graph.

Kévin Dietrich noreply at git.blender.org
Thu Jul 21 16:17:24 CEST 2016


Commit: fc74cd55886fe6232ab14be9e44fb78b512f5e8e
Author: Kévin Dietrich
Date:   Thu Jul 21 15:05:37 2016 +0200
Branches: alembic_basic_io
https://developer.blender.org/rBfc74cd55886fe6232ab14be9e44fb78b512f5e8e

Implement CacheFile in the legacy dependency graph.

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

M	source/blender/blenkernel/intern/depsgraph.c
M	source/blender/makesrna/intern/rna_cachefile.c
M	source/blender/modifiers/intern/MOD_meshsequencecache.c

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

diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index c445c9c..986c1d8 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -46,6 +46,7 @@
 
 #include "DNA_anim_types.h"
 #include "DNA_camera_types.h"
+#include "DNA_cachefile_types.h"
 #include "DNA_group_types.h"
 #include "DNA_lamp_types.h"
 #include "DNA_lattice_types.h"
@@ -3006,6 +3007,33 @@ void DAG_id_tag_update_ex(Main *bmain, ID *id, short flag)
 			/* BLI_assert(!"invalid flag for this 'idtype'"); */
 		}
 	}
+	else if (GS(id->name) == ID_CF) {
+		for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
+			ModifierData *md = modifiers_findByType(ob, eModifierType_MeshSequenceCache);
+
+			if (md) {
+				MeshSeqCacheModifierData *mcmd = (MeshSeqCacheModifierData *)md;
+
+				if (mcmd->cache_file && (&mcmd->cache_file->id == id)) {
+					ob->recalc |= OB_RECALC_DATA;
+					continue;
+				}
+			}
+
+			for (bConstraint *con = ob->constraints.first; con; con = con->next) {
+				if (con->type != CONSTRAINT_TYPE_TRANSFORM_CACHE) {
+					continue;
+				}
+
+				bTransformCacheConstraint *data = con->data;
+
+				if (data->cache_file && (&data->cache_file->id == id)) {
+					ob->recalc |= OB_RECALC_DATA;
+					break;
+				}
+			}
+		}
+	}
 }
 
 void DAG_id_tag_update(ID *id, short flag)
diff --git a/source/blender/makesrna/intern/rna_cachefile.c b/source/blender/makesrna/intern/rna_cachefile.c
index 37cfe01..574c9e4 100644
--- a/source/blender/makesrna/intern/rna_cachefile.c
+++ b/source/blender/makesrna/intern/rna_cachefile.c
@@ -50,18 +50,12 @@ static void rna_CacheFile_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
 	CacheFile *cache_file = (CacheFile *)ptr->data;
 
-	if (!DEG_depsgraph_use_legacy()) {
-		DAG_id_tag_update(&cache_file->id, 0);
-		/* XXX - how to tag the whole scene for redraw?
-		 * (NC_SCENE | ND_DRAW, scene) doesn't seem to work. */
-		WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
-	}
-	else {
-		/* TODO(kevin): implement in old dependency graph. */
-		WM_main_add_notifier(NC_SCENE | ND_FRAME, scene);
-	}
-
-	UNUSED_VARS(bmain);
+	DAG_id_tag_update(&cache_file->id, 0);
+	/* XXX - how to tag the whole scene for redraw?
+	 * (NC_SCENE | ND_DRAW, scene) doesn't seem to work. */
+	WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
+
+	UNUSED_VARS(bmain, scene);
 }
 
 static void rna_CacheFile_update_handle(Main *bmain, Scene *scene, PointerRNA *ptr)
diff --git a/source/blender/modifiers/intern/MOD_meshsequencecache.c b/source/blender/modifiers/intern/MOD_meshsequencecache.c
index d088ce0..d894aa7 100644
--- a/source/blender/modifiers/intern/MOD_meshsequencecache.c
+++ b/source/blender/modifiers/intern/MOD_meshsequencecache.c
@@ -35,6 +35,7 @@
 #include "BKE_library_query.h"
 #include "BKE_scene.h"
 
+#include "depsgraph_private.h"
 #include "DEG_depsgraph_build.h"
 
 #include "MOD_modifiertypes.h"
@@ -128,6 +129,24 @@ static void foreachIDLink(ModifierData *md, Object *ob,
 	walk(userData, ob, (ID **)&mcmd->cache_file, IDWALK_USER);
 }
 
+
+static void updateDepgraph(ModifierData *md, DagForest *forest,
+                           struct Main *bmain,
+                           struct Scene *scene,
+                           Object *ob, DagNode *obNode)
+{
+	MeshSeqCacheModifierData *mcmd = (MeshSeqCacheModifierData *) md;
+
+	if (mcmd->cache_file != NULL) {
+		DagNode *curNode = dag_get_node(forest, mcmd->cache_file);
+
+		dag_add_relation(forest, curNode, obNode,
+		                 DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Cache File Modifier");
+	}
+
+	UNUSED_VARS(bmain, scene, ob);
+}
+
 static void updateDepsgraph(ModifierData *md,
                             struct Main *bmain,
                             struct Scene *scene,
@@ -161,7 +180,7 @@ ModifierTypeInfo modifierType_MeshSequenceCache = {
     /* requiredDataMask */  NULL,
     /* freeData */          freeData,
     /* isDisabled */        isDisabled,
-    /* updateDepgraph */    NULL,
+    /* updateDepgraph */    updateDepgraph,
     /* updateDepsgraph */   updateDepsgraph,
     /* dependsOnTime */     dependsOnTime,
     /* dependsOnNormals */  NULL,




More information about the Bf-blender-cvs mailing list