Merge branch 'master' into blender2.8
[blender.git] / source / blender / modifiers / intern / MOD_datatransfer.c
index 3a8887296f2a1c53de2bda44246d6dbeea79835d..21d1a6a865ddaf20699849509a088f08a7f42ec6 100644 (file)
@@ -50,8 +50,6 @@
 #include "MEM_guardedalloc.h"
 #include "MOD_util.h"
 
-#include "depsgraph_private.h"
-
 /**************************************
  * Modifiers functions.               *
  **************************************/
@@ -127,19 +125,6 @@ static void foreachObjectLink(
        walk(userData, ob, &dtmd->ob_source, IDWALK_CB_NOP);
 }
 
-static void updateDepgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
-{
-       DataTransferModifierData *dtmd = (DataTransferModifierData *) md;
-       DagNode *curNode;
-
-       if (dtmd->ob_source) {
-               curNode = dag_get_node(ctx->forest, dtmd->ob_source);
-
-               dag_add_relation(ctx->forest, curNode, ctx->obNode, DAG_RL_DATA_DATA | DAG_RL_OB_DATA,
-                                "DataTransfer Modifier");
-       }
-}
-
 static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
 {
        DataTransferModifierData *dtmd = (DataTransferModifierData *) md;
@@ -163,15 +148,14 @@ static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams))
        DT_TYPE_SHARP_FACE \
 )
 
-static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *derivedData,
-                                  ModifierApplyFlag UNUSED(flag))
+static DerivedMesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, DerivedMesh *derivedData)
 {
        DataTransferModifierData *dtmd = (DataTransferModifierData *) md;
        DerivedMesh *dm = derivedData;
        ReportList reports;
 
        /* Only used to check wehther we are operating on org data or not... */
-       Mesh *me = ob->data;
+       Mesh *me = ctx->object->data;
 
        const bool invert_vgroup = (dtmd->flags & MOD_DATATRANSFER_INVERT_VGROUP) != 0;
 
@@ -181,7 +165,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
        SpaceTransform *space_transform = (dtmd->flags & MOD_DATATRANSFER_OBSRC_TRANSFORM) ? &space_transform_data : NULL;
 
        if (space_transform) {
-               BLI_SPACE_TRANSFORM_SETUP(space_transform, ob, dtmd->ob_source);
+               BLI_SPACE_TRANSFORM_SETUP(space_transform, ctx->object, dtmd->ob_source);
        }
 
        MVert *mvert = dm->getVertArray(dm);
@@ -195,7 +179,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
        BKE_reports_init(&reports, RPT_STORE);
 
        /* Note: no islands precision for now here. */
-       BKE_object_data_transfer_dm(md->scene, dtmd->ob_source, ob, dm, dtmd->data_types, false,
+       BKE_object_data_transfer_dm(ctx->depsgraph, md->scene, dtmd->ob_source, ctx->object, dm, dtmd->data_types, false,
                             dtmd->vmap_mode, dtmd->emap_mode, dtmd->lmap_mode, dtmd->pmap_mode,
                             space_transform, false, max_dist, dtmd->map_ray_radius, 0.0f,
                             dtmd->layers_select_src, dtmd->layers_select_dst,
@@ -228,17 +212,25 @@ ModifierTypeInfo modifierType_DataTransfer = {
                                eModifierTypeFlag_UsesPreview,
 
        /* copyData */          modifier_copyData_generic,
+
+       /* 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 */     applyModifier,
+       /* applyModifier */     NULL,
        /* applyModifierEM */   NULL,
+
        /* initData */          initData,
        /* requiredDataMask */  requiredDataMask,
        /* freeData */          NULL,
        /* isDisabled */        isDisabled,
-       /* updateDepgraph */    updateDepgraph,
        /* updateDepsgraph */   updateDepsgraph,
        /* dependsOnTime */     NULL,
        /* dependsOnNormals */  dependsOnNormals,