Merge branch 'master' into blender2.8
[blender.git] / source / blender / modifiers / intern / MOD_meshsequencecache.c
index af3039c..26ea7af 100644 (file)
@@ -37,7 +37,6 @@
 #include "BKE_library_query.h"
 #include "BKE_scene.h"
 
-#include "depsgraph_private.h"
 #include "DEG_depsgraph_build.h"
 
 #include "MOD_modifiertypes.h"
@@ -88,15 +87,14 @@ static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams))
        return (mcmd->cache_file == NULL) || (mcmd->object_path[0] == '\0');
 }
 
-static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
-                                  DerivedMesh *dm,
-                                  ModifierApplyFlag UNUSED(flag))
+static DerivedMesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx,
+                                  DerivedMesh *dm)
 {
 #ifdef WITH_ALEMBIC
        MeshSeqCacheModifierData *mcmd = (MeshSeqCacheModifierData *) md;
 
        /* Only used to check whether we are operating on org data or not... */
-       Mesh *me = (ob->type == OB_MESH) ? ob->data : NULL;
+       Mesh *me = (ctx->object->type == OB_MESH) ? ctx->object->data : NULL;
        DerivedMesh *org_dm = dm;
 
        Scene *scene = md->scene;
@@ -111,7 +109,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
        if (!mcmd->reader) {
                mcmd->reader = CacheReader_open_alembic_object(cache_file->handle,
                                                               NULL,
-                                                              ob,
+                                                              ctx->object,
                                                               mcmd->object_path);
                if (!mcmd->reader) {
                        modifier_setError(md, "Could not create Alembic reader for file %s", cache_file->filepath);
@@ -130,7 +128,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
        }
 
        DerivedMesh *result = ABC_read_mesh(mcmd->reader,
-                                           ob,
+                                           ctx->object,
                                            dm,
                                            time,
                                            &err_str,
@@ -148,7 +146,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
        return result ? result : dm;
 #else
        return dm;
-       UNUSED_VARS(md, ob);
+       UNUSED_VARS(ctx, md);
 #endif
 }
 
@@ -167,18 +165,6 @@ static void foreachIDLink(ModifierData *md, Object *ob,
 }
 
 
-static void updateDepgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
-{
-       MeshSeqCacheModifierData *mcmd = (MeshSeqCacheModifierData *) md;
-
-       if (mcmd->cache_file != NULL) {
-               DagNode *curNode = dag_get_node(ctx->forest, mcmd->cache_file);
-
-               dag_add_relation(ctx->forest, curNode, ctx->obNode,
-                                DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Cache File Modifier");
-       }
-}
-
 static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
 {
        MeshSeqCacheModifierData *mcmd = (MeshSeqCacheModifierData *) md;
@@ -189,28 +175,37 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
 }
 
 ModifierTypeInfo modifierType_MeshSequenceCache = {
-    /* name */              "Mesh Sequence Cache",
-    /* structName */        "MeshSeqCacheModifierData",
-    /* structSize */        sizeof(MeshSeqCacheModifierData),
-    /* type */              eModifierTypeType_Constructive,
-    /* flags */             eModifierTypeFlag_AcceptsMesh |
-                            eModifierTypeFlag_AcceptsCVs,
-    /* copyData */          copyData,
-    /* deformVerts */       NULL,
-    /* deformMatrices */    NULL,
-    /* deformVertsEM */     NULL,
-    /* deformMatricesEM */  NULL,
-    /* applyModifier */     applyModifier,
-    /* applyModifierEM */   NULL,
-    /* initData */          initData,
-    /* requiredDataMask */  NULL,
-    /* freeData */          freeData,
-    /* isDisabled */        isDisabled,
-    /* updateDepgraph */    updateDepgraph,
-    /* updateDepsgraph */   updateDepsgraph,
-    /* dependsOnTime */     dependsOnTime,
-    /* dependsOnNormals */  NULL,
-    /* foreachObjectLink */ NULL,
-    /* foreachIDLink */     foreachIDLink,
-    /* foreachTexLink */    NULL,
+       /* name */              "Mesh Sequence Cache",
+       /* structName */        "MeshSeqCacheModifierData",
+       /* structSize */        sizeof(MeshSeqCacheModifierData),
+       /* type */              eModifierTypeType_Constructive,
+       /* flags */             eModifierTypeFlag_AcceptsMesh |
+                               eModifierTypeFlag_AcceptsCVs,
+
+       /* copyData */          copyData,
+
+       /* deformVerts_DM */    NULL,
+       /* deformMatrices_DM */ NULL,
+       /* deformVertsEM_DM */  NULL,
+       /* deformMatricesEM_DM*/NULL,
+       /* applyModifier_DM */  applyModifier,
+       /* applyModifierEM_DM */NULL,
+
+       /* deformVerts */       NULL,
+       /* deformMatrices */    NULL,
+       /* deformVertsEM */     NULL,
+       /* deformMatricesEM */  NULL,
+       /* applyModifier */     NULL,
+       /* applyModifierEM */   NULL,
+
+       /* initData */          initData,
+       /* requiredDataMask */  NULL,
+       /* freeData */          freeData,
+       /* isDisabled */        isDisabled,
+       /* updateDepsgraph */   updateDepsgraph,
+       /* dependsOnTime */     dependsOnTime,
+       /* dependsOnNormals */  NULL,
+       /* foreachObjectLink */ NULL,
+       /* foreachIDLink */     foreachIDLink,
+       /* foreachTexLink */    NULL,
 };