Merge branch 'master' into blender2.8
[blender.git] / source / blender / modifiers / intern / MOD_shrinkwrap.c
index 5dac420cace3ac884ed86bad05ddfaa0ec76bb32..b2077f62bf4352f5af807b140dbf6f1f870215af 100644 (file)
@@ -45,8 +45,6 @@
 #include "BKE_modifier.h"
 #include "BKE_shrinkwrap.h"
 
-#include "depsgraph_private.h"
-
 #include "MOD_util.h"
 
 static bool dependsOnNormals(ModifierData *md);
@@ -96,57 +94,44 @@ static void foreachObjectLink(ModifierData *md, Object *ob, ObjectWalkFunc walk,
        walk(userData, ob, &smd->auxTarget, IDWALK_CB_NOP);
 }
 
-static void deformVerts(ModifierData *md, Object *ob,
+static void deformVerts(ModifierData *md, const ModifierEvalContext *ctx,
                         DerivedMesh *derivedData,
                         float (*vertexCos)[3],
-                        int numVerts,
-                        ModifierApplyFlag flag)
+                        int numVerts)
 {
        DerivedMesh *dm = derivedData;
-       CustomDataMask dataMask = requiredDataMask(ob, md);
-       bool forRender = (flag & MOD_APPLY_RENDER) != 0;
+       CustomDataMask dataMask = requiredDataMask(ctx->object, md);
+       bool forRender = (ctx->flag & MOD_APPLY_RENDER) != 0;
 
        /* ensure we get a CDDM with applied vertex coords */
        if (dataMask) {
-               dm = get_cddm(ob, NULL, dm, vertexCos, dependsOnNormals(md));
+               dm = get_cddm(ctx->object, NULL, dm, vertexCos, dependsOnNormals(md));
        }
 
-       shrinkwrapModifier_deform((ShrinkwrapModifierData *)md, ob, dm, vertexCos, numVerts, forRender);
+       shrinkwrapModifier_deform((ShrinkwrapModifierData *)md, ctx->object, dm, vertexCos, numVerts, forRender);
 
        if (dm != derivedData)
                dm->release(dm);
 }
 
-static void deformVertsEM(ModifierData *md, Object *ob, struct BMEditMesh *editData, DerivedMesh *derivedData,
+static void deformVertsEM(ModifierData *md, const ModifierEvalContext *ctx,
+                          struct BMEditMesh *editData, DerivedMesh *derivedData,
                           float (*vertexCos)[3], int numVerts)
 {
        DerivedMesh *dm = derivedData;
-       CustomDataMask dataMask = requiredDataMask(ob, md);
+       CustomDataMask dataMask = requiredDataMask(ctx->object, md);
 
        /* ensure we get a CDDM with applied vertex coords */
        if (dataMask) {
-               dm = get_cddm(ob, editData, dm, vertexCos, dependsOnNormals(md));
+               dm = get_cddm(ctx->object, editData, dm, vertexCos, dependsOnNormals(md));
        }
 
-       shrinkwrapModifier_deform((ShrinkwrapModifierData *)md, ob, dm, vertexCos, numVerts, false);
+       shrinkwrapModifier_deform((ShrinkwrapModifierData *)md, ctx->object, dm, vertexCos, numVerts, false);
 
        if (dm != derivedData)
                dm->release(dm);
 }
 
-static void updateDepgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
-{
-       ShrinkwrapModifierData *smd = (ShrinkwrapModifierData *) md;
-
-       if (smd->target)
-               dag_add_relation(ctx->forest, dag_get_node(ctx->forest, smd->target), ctx->obNode,
-                                DAG_RL_OB_DATA | DAG_RL_DATA_DATA, "Shrinkwrap Modifier");
-
-       if (smd->auxTarget)
-               dag_add_relation(ctx->forest, dag_get_node(ctx->forest, smd->auxTarget), ctx->obNode,
-                                DAG_RL_OB_DATA | DAG_RL_DATA_DATA, "Shrinkwrap Modifier");
-}
-
 static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
 {
        ShrinkwrapModifierData *smd = (ShrinkwrapModifierData *)md;
@@ -182,17 +167,25 @@ ModifierTypeInfo modifierType_Shrinkwrap = {
                                eModifierTypeFlag_EnableInEditmode,
 
        /* copyData */          modifier_copyData_generic,
-       /* deformVerts */       deformVerts,
+
+       /* deformVerts_DM */    deformVerts,
+       /* deformMatrices_DM */ NULL,
+       /* deformVertsEM_DM */  deformVertsEM,
+       /* deformMatricesEM_DM*/NULL,
+       /* applyModifier_DM */  NULL,
+       /* applyModifierEM_DM */NULL,
+
+       /* deformVerts */       NULL,
        /* deformMatrices */    NULL,
-       /* deformVertsEM */     deformVertsEM,
+       /* deformVertsEM */     NULL,
        /* deformMatricesEM */  NULL,
        /* applyModifier */     NULL,
        /* applyModifierEM */   NULL,
+
        /* initData */          initData,
        /* requiredDataMask */  requiredDataMask,
        /* freeData */          NULL,
        /* isDisabled */        isDisabled,
-       /* updateDepgraph */    updateDepgraph,
        /* updateDepsgraph */   updateDepsgraph,
        /* dependsOnTime */     NULL,
        /* dependsOnNormals */  dependsOnNormals,