Merge branch 'master' into blender2.8
[blender.git] / source / blender / modifiers / intern / MOD_softbody.c
index 95aa8f985fac466577b9a1d56dd050313035823c..a62b21df231052a9fa7d64e4f6c4f5da01a4ffc8 100644 (file)
 #include "BLI_utildefines.h"
 
 #include "BKE_cdderivedmesh.h"
+#include "BKE_layer.h"
 #include "BKE_particle.h"
 #include "BKE_softbody.h"
 
-#include "depsgraph_private.h"
+#include "DEG_depsgraph.h"
 #include "DEG_depsgraph_build.h"
 
 #include "MOD_modifiertypes.h"
 
 static void deformVerts(
-        ModifierData *md, Object *ob,
+        ModifierData *md, const ModifierEvalContext *ctx,
         DerivedMesh *UNUSED(derivedData),
         float (*vertexCos)[3],
-        int numVerts,
-        ModifierApplyFlag UNUSED(flag))
+        int numVerts)
 {
-       sbObjectStep(md->scene, ob, (float)md->scene->r.cfra, vertexCos, numVerts);
+       sbObjectStep(ctx->depsgraph, md->scene, ctx->object, (float)md->scene->r.cfra, vertexCos, numVerts);
 }
 
 static bool dependsOnTime(ModifierData *UNUSED(md))
@@ -63,25 +63,11 @@ static bool dependsOnTime(ModifierData *UNUSED(md))
        return true;
 }
 
-static void updateDepgraph(ModifierData *UNUSED(md), const ModifierUpdateDepsgraphContext *ctx)
-{
-       if (ctx->object->soft) {
-#ifdef WITH_LEGACY_DEPSGRAPH
-               /* Actual code uses ccd_build_deflector_hash */
-               dag_add_collision_relations(ctx->forest, ctx->scene, ctx->object, ctx->obNode, ctx->object->soft->collision_group, ctx->object->lay, eModifierType_Collision, NULL, false, "Softbody Collision");
-
-               dag_add_forcefield_relations(ctx->forest, ctx->scene, ctx->object, ctx->obNode, ctx->object->soft->effector_weights, true, 0, "Softbody Field");
-#else
-       (void)ctx;
-#endif
-       }
-}
-
 static void updateDepsgraph(ModifierData *UNUSED(md), const ModifierUpdateDepsgraphContext *ctx)
 {
        if (ctx->object->soft) {
                /* Actual code uses ccd_build_deflector_hash */
-               DEG_add_collision_relations(ctx->node, ctx->scene, ctx->object, ctx->object->soft->collision_group, ctx->object->lay, eModifierType_Collision, NULL, false, "Softbody Collision");
+               DEG_add_collision_relations(ctx->node, ctx->scene, ctx->object, ctx->object->soft->collision_group, eModifierType_Collision, NULL, false, "Softbody Collision");
 
                DEG_add_forcefield_relations(ctx->node, ctx->scene, ctx->object, ctx->object->soft->effector_weights, true, 0, "Softbody Field");
        }
@@ -98,17 +84,25 @@ ModifierTypeInfo modifierType_Softbody = {
                                eModifierTypeFlag_Single,
 
        /* copyData */          NULL,
-       /* deformVerts */       deformVerts,
+
+       /* deformVerts_DM */    deformVerts,
+       /* deformMatrices_DM */ NULL,
+       /* deformVertsEM_DM */  NULL,
+       /* deformMatricesEM_DM*/NULL,
+       /* applyModifier_DM */  NULL,
+       /* applyModifierEM_DM */NULL,
+
+       /* deformVerts */       NULL,
        /* deformMatrices */    NULL,
        /* deformVertsEM */     NULL,
        /* deformMatricesEM */  NULL,
        /* applyModifier */     NULL,
        /* applyModifierEM */   NULL,
+
        /* initData */          NULL,
        /* requiredDataMask */  NULL,
        /* freeData */          NULL,
        /* isDisabled */        NULL,
-       /* updateDepgraph */    updateDepgraph,
        /* updateDepsgraph */   updateDepsgraph,
        /* dependsOnTime */     dependsOnTime,
        /* dependsOnNormals */  NULL,