Depsgraph: completely move customdata_mask to the ID node.
authorAlexander Gavrilov <angavrilov@gmail.com>
Mon, 3 Dec 2018 15:09:45 +0000 (18:09 +0300)
committerAlexander Gavrilov <angavrilov@gmail.com>
Mon, 3 Dec 2018 15:29:06 +0000 (18:29 +0300)
Move all mask-related fields from Object and OperationDepsNode
to Object_Runtime and IDDepsNode. Auto-apply DEG_TAG_GEOMETRY
if the mask changes after DEG rebuild. Update DEG API and all
code that uses it.

This fixes "source mesh data is not ready" errors from Data
Transfer modifier when parameters are changed in the UI after
the recent mesh_get_eval_final fix.

Reviewers: sergey

Differential Revision: https://developer.blender.org/D4025

22 files changed:
source/blender/blenkernel/intern/DerivedMesh.c
source/blender/blenkernel/intern/data_transfer.c
source/blender/blenloader/intern/readfile.c
source/blender/depsgraph/DEG_depsgraph_build.h
source/blender/depsgraph/DEG_depsgraph_query.h
source/blender/depsgraph/intern/builder/deg_builder.cc
source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
source/blender/depsgraph/intern/builder/deg_builder_nodes.h
source/blender/depsgraph/intern/builder/deg_builder_relations.cc
source/blender/depsgraph/intern/builder/deg_builder_relations.h
source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc
source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc
source/blender/depsgraph/intern/depsgraph_build.cc
source/blender/depsgraph/intern/depsgraph_query.cc
source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
source/blender/depsgraph/intern/nodes/deg_node_id.cc
source/blender/depsgraph/intern/nodes/deg_node_id.h
source/blender/depsgraph/intern/nodes/deg_node_operation.cc
source/blender/depsgraph/intern/nodes/deg_node_operation.h
source/blender/makesdna/DNA_object_types.h
source/blender/modifiers/intern/MOD_datatransfer.c
source/blender/modifiers/intern/MOD_shrinkwrap.c

index 98d2e77c62f5b310dc9add9a3fe620e80454b903..de2cd5603a6bb802f79c0456305bd08d91811fb7 100644 (file)
@@ -2035,8 +2035,8 @@ static void mesh_build_data(
        ob->derivedFinal->needsFree = 0;
        ob->derivedDeform->needsFree = 0;
 #endif
-       ob->lastDataMask = dataMask;
-       ob->lastNeedMapping = need_mapping;
+       ob->runtime.last_data_mask = dataMask;
+       ob->runtime.last_need_mapping = need_mapping;
 
        if ((ob->mode & OB_MODE_ALL_SCULPT) && ob->sculpt) {
                /* create PBVH immediately (would be created on the fly too,
@@ -2080,7 +2080,7 @@ static CustomDataMask object_get_datamask(const Depsgraph *depsgraph, Object *ob
 {
        ViewLayer *view_layer = DEG_get_evaluated_view_layer(depsgraph);
        Object *actob = view_layer->basact ? DEG_get_original_object(view_layer->basact->object) : NULL;
-       CustomDataMask mask = ob->customdata_mask;
+       CustomDataMask mask = DEG_get_customdata_mask_for_object(depsgraph, ob);
 
        if (r_need_mapping) {
                *r_need_mapping = false;
@@ -2171,10 +2171,11 @@ Mesh *mesh_get_eval_final(
        dataMask |= object_get_datamask(depsgraph, ob, &need_mapping);
 
        if (!ob->runtime.mesh_eval ||
-           ((dataMask & ob->lastDataMask) != dataMask) ||
-           (need_mapping && !ob->lastNeedMapping))
+           ((dataMask & ob->runtime.last_data_mask) != dataMask) ||
+           (need_mapping && !ob->runtime.last_need_mapping))
        {
-               mesh_build_data(depsgraph, scene, ob, dataMask | ob->lastDataMask, false, need_mapping || ob->lastNeedMapping);
+               mesh_build_data(depsgraph, scene, ob, dataMask | ob->runtime.last_data_mask,
+                               false, need_mapping || ob->runtime.last_need_mapping);
        }
 
        if (ob->runtime.mesh_eval) { BLI_assert(!(ob->runtime.mesh_eval->runtime.cd_dirty_vert & CD_MASK_NORMAL)); }
@@ -2219,10 +2220,11 @@ Mesh *mesh_get_eval_deform(struct Depsgraph *depsgraph, Scene *scene, Object *ob
        dataMask |= object_get_datamask(depsgraph, ob, &need_mapping);
 
        if (!ob->runtime.mesh_deform_eval ||
-           ((dataMask & ob->lastDataMask) != dataMask) ||
-           (need_mapping && !ob->lastNeedMapping))
+           ((dataMask & ob->runtime.last_data_mask) != dataMask) ||
+           (need_mapping && !ob->runtime.last_need_mapping))
        {
-               mesh_build_data(depsgraph, scene, ob, dataMask | ob->lastDataMask, false, need_mapping || ob->lastNeedMapping);
+               mesh_build_data(depsgraph, scene, ob, dataMask | ob->runtime.last_data_mask,
+                               false, need_mapping || ob->runtime.last_need_mapping);
        }
 
        return ob->runtime.mesh_deform_eval;
index 7ac9d2d985c9a05683df44d3cbedba0507967774..9ee27a29c8be31d61193026aa2b4356a148aae1e 100644 (file)
@@ -1118,7 +1118,7 @@ bool BKE_object_data_transfer_ex(
        if (is_modifier) {
                me_src = ob_src->runtime.mesh_eval;
 
-               if (me_src == NULL || (me_src_mask & ~ob_src->lastDataMask) != 0) {
+               if (me_src == NULL || (me_src_mask & ~ob_src->runtime.last_data_mask) != 0) {
                        printf("Data Transfer: source mesh data is not ready - dependency cycle?\n");
                        return changed;
                }
index 076370c887743fc376d40b2f0d598430b6a5cf53..75abdf15bc0129e28dac85397d3c0e1cb756cd01 100644 (file)
@@ -5692,7 +5692,6 @@ static void direct_link_object(FileData *fd, Object *ob)
                BKE_object_empty_draw_type_set(ob, ob->empty_drawtype);
        }
 
-       ob->customdata_mask = 0;
        ob->bb = NULL;
        ob->derivedDeform = NULL;
        ob->derivedFinal = NULL;
index 93e9b5be2cccc53c29b7ce1727e6079cccceafd9..14468b33822360241d9a9a9660b07967572ae226 100644 (file)
@@ -139,11 +139,6 @@ void DEG_add_object_relation(struct DepsNodeHandle *node_handle,
                              struct Object *object,
                              eDepsObjectComponentType component,
                              const char *description);
-void DEG_add_object_relation_with_customdata(struct DepsNodeHandle *node_handle,
-                                             struct Object *object,
-                                             eDepsObjectComponentType component,
-                                             uint64_t customdata_mask,
-                                             const char *description);
 void DEG_add_bone_relation(struct DepsNodeHandle *handle,
                            struct Object *object,
                            const char *bone_name,
@@ -163,6 +158,7 @@ void DEG_add_object_pointcache_relation(struct DepsNodeHandle *node_handle,
                                         const char *description);
 
 void DEG_add_special_eval_flag(struct DepsNodeHandle *handle, struct ID *id, uint32_t flag);
+void DEG_add_customdata_mask(struct DepsNodeHandle *handle, struct Object *object, uint64_t mask);
 
 struct ID *DEG_get_id_from_handle(struct DepsNodeHandle *node_handle);
 struct Depsgraph *DEG_get_graph_from_handle(struct DepsNodeHandle *node_handle);
index e3fa30cf6883edf2ecdc21d67c67bd7c03801b74..c9fa6b0a03542eddd3f7eea48fe3575b964a90f8 100644 (file)
@@ -73,6 +73,10 @@ bool DEG_id_type_any_updated(const struct Depsgraph *depsgraph);
 /* Get additional evaluation flags for the given ID. */
 uint32_t DEG_get_eval_flags_for_id(const struct Depsgraph *graph, struct ID *id);
 
+/* Get additional mesh CustomDataMask flags for the given object. */
+uint64_t DEG_get_customdata_mask_for_object(const struct Depsgraph *graph,
+                                            struct Object *object);
+
 /* Get scene the despgraph is created for. */
 struct Scene *DEG_get_evaluated_scene(const struct Depsgraph *graph);
 
index f7b2b482b1ffb0f48ea4934e75aafd903a0d5002..3fc54fed62370c2786dd0123e1932e7a33e45680 100644 (file)
@@ -142,6 +142,10 @@ void deg_graph_build_finalize(Main *bmain, Depsgraph *graph)
                if (id_node->eval_flags != id_node->previous_eval_flags) {
                        flag |= DEG_TAG_TRANSFORM | DEG_TAG_GEOMETRY;
                }
+               /* Tag rebuild if the custom data mask changed. */
+               if (id_node->customdata_mask != id_node->previous_customdata_mask) {
+                       flag |= DEG_TAG_GEOMETRY;
+               }
                if (!deg_copy_on_write_is_expanded(id_node->id_cow)) {
                        flag |= DEG_TAG_COPY_ON_WRITE;
                        /* This means ID is being added to the dependency graph first
index 55de6110b3bc5e0121fc250dce172b4b5e701dd0..8726f51012ed41a560c7345c2626197ace5f6d1c 100644 (file)
@@ -163,12 +163,14 @@ IDDepsNode *DepsgraphNodeBuilder::add_id_node(ID *id)
        ID *id_cow = NULL;
        IDComponentsMask previously_visible_components_mask = 0;
        uint32_t previous_eval_flags = 0;
+       uint64_t previous_customdata_mask = 0;
        IDInfo *id_info = (IDInfo *)BLI_ghash_lookup(id_info_hash_, id);
        if (id_info != NULL) {
                id_cow = id_info->id_cow;
                previously_visible_components_mask =
                        id_info->previously_visible_components_mask;
                previous_eval_flags = id_info->previous_eval_flags;
+               previous_customdata_mask = id_info->previous_customdata_mask;
                /* Tag ID info to not free the CoW ID pointer. */
                id_info->id_cow = NULL;
        }
@@ -176,6 +178,7 @@ IDDepsNode *DepsgraphNodeBuilder::add_id_node(ID *id)
        id_node->previously_visible_components_mask =
                previously_visible_components_mask;
        id_node->previous_eval_flags = previous_eval_flags;
+       id_node->previous_customdata_mask = previous_customdata_mask;
        /* Currently all ID nodes are supposed to have copy-on-write logic.
         *
         * NOTE: Zero number of components indicates that ID node was just created.
@@ -358,6 +361,7 @@ void DepsgraphNodeBuilder::begin_build()
                id_info->previously_visible_components_mask =
                        id_node->visible_components_mask;
                id_info->previous_eval_flags = id_node->eval_flags;
+               id_info->previous_customdata_mask = id_node->customdata_mask;
                BLI_ghash_insert(id_info_hash_, id_node->id_orig, id_info);
                id_node->id_cow = NULL;
        }
@@ -582,7 +586,6 @@ void DepsgraphNodeBuilder::build_object(int base_index,
        else {
                id_node->is_directly_visible = is_visible;
        }
-       object->customdata_mask = 0;
        /* Various flags, flushing from bases/collections. */
        build_object_flags(base_index, object, linked_state);
        /* Transform. */
index 3b795bf9d5816da092c717f3372371ee2ec4db04..cdf1f6ed03d2fd49e5f6417ceb88a35a08ffc7ea 100644 (file)
@@ -235,6 +235,8 @@ struct DepsgraphNodeBuilder {
                IDComponentsMask previously_visible_components_mask;
                /* Special evaluation flag mask from the previous depsgraph. */
                uint32_t previous_eval_flags;
+               /* Mesh CustomData mask from the previous depsgraph. */
+               uint64_t previous_customdata_mask;
        };
 
 protected:
index b45d25d4b70e545fced9d7a2c4c561e58bef93cf..649bc1a427536c0e3f98d93253c892d52fba1d57 100644 (file)
@@ -289,13 +289,16 @@ bool DepsgraphRelationBuilder::has_node(const OperationKey &key) const
        return find_node(key) != NULL;
 }
 
-void DepsgraphRelationBuilder::add_customdata_mask(const ComponentKey &key, uint64_t mask)
+void DepsgraphRelationBuilder::add_customdata_mask(Object *object, uint64_t mask)
 {
-       if (mask != 0) {
-               OperationDepsNode *node = find_operation_node(key);
+       if (mask != 0 && object != NULL && object->type == OB_MESH) {
+               DEG::IDDepsNode *id_node = graph_->find_id_node(&object->id);
 
-               if (node != NULL) {
-                       node->customdata_mask |= mask;
+               if (id_node == NULL) {
+                       BLI_assert(!"ID should always be valid");
+               }
+               else {
+                       id_node->customdata_mask |= mask;
                }
        }
 }
@@ -828,7 +831,7 @@ void DepsgraphRelationBuilder::build_object_parent(Object *object)
                        add_relation(parent_key, ob_key, "Vertex Parent");
 
                        /* XXX not sure what this is for or how you could be done properly - lukas */
-                       add_customdata_mask(parent_key, CD_MASK_ORIGINDEX);
+                       add_customdata_mask(object->parent, CD_MASK_ORIGINDEX);
 
                        ComponentKey transform_key(&object->parent->id, DEG_NODE_TYPE_TRANSFORM);
                        add_relation(transform_key, ob_key, "Vertex Parent TFM");
@@ -1056,9 +1059,7 @@ void DepsgraphRelationBuilder::build_constraints(ID *id,
                                         */
                                        ComponentKey target_key(&ct->tar->id, DEG_NODE_TYPE_GEOMETRY);
                                        add_relation(target_key, constraint_op_key, cti->name);
-                                       if (ct->tar->type == OB_MESH) {
-                                               add_customdata_mask(target_key, CD_MASK_MDEFORMVERT);
-                                       }
+                                       add_customdata_mask(ct->tar, CD_MASK_MDEFORMVERT);
                                }
                                else if (con->type == CONSTRAINT_TYPE_SHRINKWRAP) {
                                        bShrinkwrapConstraint *scon = (bShrinkwrapConstraint *) con->data;
@@ -1071,7 +1072,7 @@ void DepsgraphRelationBuilder::build_constraints(ID *id,
                                        if (ct->tar->type == OB_MESH && scon->shrinkType != MOD_SHRINKWRAP_NEAREST_VERTEX) {
                                                bool track = (scon->flag & CON_SHRINKWRAP_TRACK_NORMAL) != 0;
                                                if (track || BKE_shrinkwrap_needs_normals(scon->shrinkType, scon->shrinkMode)) {
-                                                       add_customdata_mask(target_key, CD_MASK_NORMAL | CD_MASK_CUSTOMLOOPNORMAL);
+                                                       add_customdata_mask(ct->tar, CD_MASK_NORMAL | CD_MASK_CUSTOMLOOPNORMAL);
                                                }
                                                if (scon->shrinkType == MOD_SHRINKWRAP_TARGET_PROJECT) {
                                                        add_special_eval_flag(&ct->tar->id, DAG_EVAL_NEED_SHRINKWRAP_BOUNDARY);
index c6db975c6c2907e21b453d37b518a32c44966d0d..face2a1d43fbbcfef951ba3ed3010ef4384abadb 100644 (file)
@@ -210,7 +210,7 @@ struct DepsgraphRelationBuilder
                                               bool check_unique = false,
                                               int flags = 0);
 
-       void add_customdata_mask(const ComponentKey &key, uint64_t mask);
+       void add_customdata_mask(Object *object, uint64_t mask);
        void add_special_eval_flag(ID *object, uint32_t flag);
 
        void build_id(ID *id);
index ff8b13b4442e1b9bfb885925ba43f06abf75aff6..8de4a1cca074352486aa2a10d57d7a6bae62be8b 100644 (file)
@@ -140,9 +140,7 @@ void DepsgraphRelationBuilder::build_ik_pose(Object *object,
                         * separately. */
                        ComponentKey target_key(&data->tar->id, DEG_NODE_TYPE_GEOMETRY);
                        add_relation(target_key, solver_key, con->name);
-                       if (data->tar->type == OB_MESH) {
-                               add_customdata_mask(target_key, CD_MASK_MDEFORMVERT);
-                       }
+                       add_customdata_mask(data->tar, CD_MASK_MDEFORMVERT);
                }
                else {
                        /* Standard Object Target. */
@@ -172,9 +170,7 @@ void DepsgraphRelationBuilder::build_ik_pose(Object *object,
                         * separately. */
                        ComponentKey target_key(&data->poletar->id, DEG_NODE_TYPE_GEOMETRY);
                        add_relation(target_key, solver_key, con->name);
-                       if (data->poletar->type == OB_MESH) {
-                               add_customdata_mask(target_key, CD_MASK_MDEFORMVERT);
-                       }
+                       add_customdata_mask(data->poletar, CD_MASK_MDEFORMVERT);
                }
                else {
                        ComponentKey target_key(&data->poletar->id, DEG_NODE_TYPE_TRANSFORM);
index 999508cffed7bbb6543f92e455edb5789ad7794e..866b5e6303176521bc71a6e079745f1ab34a42f6 100644 (file)
@@ -132,15 +132,6 @@ void DepsgraphRelationBuilder::build_view_layer(Scene *scene, ViewLayer *view_la
        LISTBASE_FOREACH (MovieClip *, clip, &bmain_->movieclip) {
                build_movieclip(clip);
        }
-       /* TODO(sergey): Do this flush on CoW object? */
-       foreach (OperationDepsNode *node, graph_->operations) {
-               IDDepsNode *id_node = node->owner->owner;
-               ID *id = id_node->id_orig;
-               if (GS(id->name) == ID_OB) {
-                       Object *object = (Object *)id;
-                       object->customdata_mask |= node->customdata_mask;
-               }
-       }
        /* Build all set scenes. */
        if (scene->set != NULL) {
                ViewLayer *set_view_layer = BKE_view_layer_default_render(scene->set);
index d56c47a0d2ac0858e06351c9fd3c36c569c89c0c..408c6abb0c9214a957ac689e5269e185e18ae390 100644 (file)
@@ -130,23 +130,6 @@ void DEG_add_object_relation(DepsNodeHandle *node_handle,
                                                           description);
 }
 
-void DEG_add_object_relation_with_customdata(DepsNodeHandle *node_handle,
-                                             Object *object,
-                                             eDepsObjectComponentType component,
-                                             uint64_t customdata_mask,
-                                             const char *description)
-{
-       DEG::eDepsNode_Type type = deg_build_object_component_type(component);
-       DEG::ComponentKey comp_key(&object->id, type);
-       DEG::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle);
-       deg_node_handle->builder->add_node_handle_relation(comp_key,
-                                                          deg_node_handle,
-                                                          description);
-       if (object->type == OB_MESH) {
-               deg_node_handle->builder->add_customdata_mask(comp_key, customdata_mask);
-       }
-}
-
 void DEG_add_object_cache_relation(DepsNodeHandle *node_handle,
                                    CacheFile *cache_file,
                                    eDepsObjectComponentType component,
@@ -210,6 +193,14 @@ void DEG_add_special_eval_flag(struct DepsNodeHandle *node_handle,
        deg_node_handle->builder->add_special_eval_flag(id, flag);
 }
 
+void DEG_add_customdata_mask(struct DepsNodeHandle *node_handle,
+                             struct Object *object,
+                             uint64_t mask)
+{
+       DEG::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle);
+       deg_node_handle->builder->add_customdata_mask(object, mask);
+}
+
 struct ID *DEG_get_id_from_handle(struct DepsNodeHandle *node_handle)
 {
        DEG::DepsNodeHandle *deg_handle = get_node_handle(node_handle);
index 946917afb26d8182c409d48737a7d5d9de393c11..c6ade6ac4c30ba815a1bd1ff0d825d94edb047aa 100644 (file)
@@ -122,6 +122,28 @@ uint32_t DEG_get_eval_flags_for_id(const Depsgraph *graph, ID *id)
        return id_node->eval_flags;
 }
 
+uint64_t DEG_get_customdata_mask_for_object(const Depsgraph *graph, Object *ob)
+{
+       if (graph == NULL) {
+               /* Happens when converting objects to mesh from a python script
+                * after modifying scene graph.
+                *
+                * Currently harmless because it's only called for temporary
+                * objects which are out of the DAG anyway.
+                */
+               return 0;
+       }
+
+       const DEG::Depsgraph *deg_graph = reinterpret_cast<const DEG::Depsgraph *>(graph);
+       const DEG::IDDepsNode *id_node = deg_graph->find_id_node(DEG_get_original_id(&ob->id));
+       if (id_node == NULL) {
+               /* TODO(sergey): Does it mean we need to check set scene? */
+               return 0;
+       }
+
+       return id_node->customdata_mask;
+}
+
 Scene *DEG_get_evaluated_scene(const Depsgraph *graph)
 {
        const DEG::Depsgraph *deg_graph =
index 89d3740c43e36572d39035677b66697987f49c35..21ca1636880ad9d5c69eb015bb24d2f02195856e 100644 (file)
@@ -812,7 +812,6 @@ static void deg_update_copy_on_write_animation(const Depsgraph *depsgraph,
 typedef struct ObjectRuntimeBackup {
        Object_Runtime runtime;
        short base_flag;
-       CustomDataMask lastDataMask;
 } ObjectRuntimeBackup;
 
 /* Make a backup of object's evaluation runtime data, additionally
@@ -836,7 +835,6 @@ static void deg_backup_object_runtime(
        }
        /* Make a backup of base flags. */
        object_runtime_backup->base_flag = object->base_flag;
-       object_runtime_backup->lastDataMask = object->lastDataMask;
 }
 
 static void deg_restore_object_runtime(
@@ -871,7 +869,6 @@ static void deg_restore_object_runtime(
                }
        }
        object->base_flag = object_runtime_backup->base_flag;
-       object->lastDataMask = object_runtime_backup->lastDataMask;
 }
 
 ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph,
index b194e304e990947dc07bdd8c07ca013312c16f56..d431e68f904020d6e61fd9faea5d3547a6dfec3c 100644 (file)
@@ -104,6 +104,8 @@ void IDDepsNode::init(const ID *id, const char *UNUSED(subdata))
        id_orig = (ID *)id;
        eval_flags = 0;
        previous_eval_flags = 0;
+       customdata_mask = 0;
+       previous_customdata_mask = 0;
        linked_state = DEG_ID_LINKED_INDIRECTLY;
        is_directly_visible = true;
        is_collection_fully_expanded = false;
index f8d05eddffd952000d37440952d8f70c2cf01e07..a968794e3b25fa3010f8e21a2984f523273f8f55 100644 (file)
@@ -81,6 +81,10 @@ struct IDDepsNode : public DepsNode {
        uint32_t eval_flags;
        uint32_t previous_eval_flags;
 
+       /* Extra customdata mask which needs to be evaluated for the mesh object. */
+       uint64_t customdata_mask;
+       uint64_t previous_customdata_mask;
+
        eDepsNode_LinkedState_Type linked_state;
 
        /* Indicates the datablock is visible in the evaluated scene. */
index ef1882dd7151291d8264e3bd53a08910fa50c6b3..f6fee6acf233698743f8465f87174dc77a8a1de0 100644 (file)
@@ -46,8 +46,7 @@ namespace DEG {
 
 OperationDepsNode::OperationDepsNode() :
     name_tag(-1),
-    flag(0),
-    customdata_mask(0)
+    flag(0)
 {
 }
 
index 71c03945d489864fad25d6715442dfacd24adaf9..9ba3a0b4864a68d472c8ab2db9e1ded1d85724e1 100644 (file)
@@ -93,9 +93,6 @@ struct OperationDepsNode : public DepsNode {
        /* (eDepsOperation_Flag) extra settings affecting evaluation. */
        int flag;
 
-       /* Extra customdata mask which needs to be evaluated for the object. */
-       uint64_t customdata_mask;
-
        DEG_DEPSNODE_DECLARE;
 };
 
index 631bb26feecec5f3a5f94d71f610a9c73d16fd87..9df511fab2edff17c1f6276bacf9677484ee5dd5 100644 (file)
@@ -156,6 +156,13 @@ typedef struct Object_Runtime {
        struct GpencilBatchCache *gpencil_cache;
 
        struct ObjectBBoneDeform *cached_bbone_deformation;
+
+       /* The custom data layer mask that was last used to calculate mesh_eval and mesh_deform_eval. */
+       uint64_t last_data_mask;
+
+       /* Did last modifier stack generation need mapping support? */
+       char last_need_mapping;
+       char pad[7];
 } Object_Runtime;
 
 typedef struct Object {
@@ -236,8 +243,7 @@ typedef struct Object {
        short nlaflag;                          /* used for DopeSheet filtering settings (expanded/collapsed) */
        short pad[2];
 
-       /* did last modifier stack generation need mapping support? */
-       char lastNeedMapping;  /* bool */
+       char pad12;
        char duplicator_visibility_flag;
 
        /* dupli-frame settings */
@@ -293,8 +299,6 @@ typedef struct Object {
 
        struct DerivedMesh *derivedDeform, *derivedFinal;
        void *pad7;
-       uint64_t lastDataMask;   /* the custom data layer mask that was last used to calculate derivedDeform and derivedFinal */
-       uint64_t customdata_mask; /* (extra) custom data layer mask to use for creating derivedmesh, set by depsgraph */
 
        ListBase pc_ids;
 
index b2cb82d6be3f17ccb2b8f976a5104b6643c28a19..71e2c7c3e09c49c9b3cf98304f1029399fcb660f 100644 (file)
@@ -131,7 +131,8 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
        if (dtmd->ob_source != NULL) {
                CustomDataMask mask = BKE_object_data_transfer_dttypes_to_cdmask(dtmd->data_types);
 
-               DEG_add_object_relation_with_customdata(ctx->node, dtmd->ob_source, DEG_OB_COMP_GEOMETRY, mask, "DataTransfer Modifier");
+               DEG_add_object_relation(ctx->node, dtmd->ob_source, DEG_OB_COMP_GEOMETRY, "DataTransfer Modifier");
+               DEG_add_customdata_mask(ctx->node, dtmd->ob_source, mask);
 
                if (dtmd->flags & MOD_DATATRANSFER_OBSRC_TRANSFORM) {
                        DEG_add_object_relation(ctx->node, dtmd->ob_source, DEG_OB_COMP_TRANSFORM, "DataTransfer Modifier");
index dd4530b066f6145bdeefe7fec74da35ed8f437be..cff5853b66ea92e8dc235d7bfc7af02cd9e2297b 100644 (file)
@@ -156,14 +156,16 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
 
        if (smd->target != NULL) {
                DEG_add_object_relation(ctx->node, smd->target, DEG_OB_COMP_TRANSFORM, "Shrinkwrap Modifier");
-               DEG_add_object_relation_with_customdata(ctx->node, smd->target, DEG_OB_COMP_GEOMETRY, mask, "Shrinkwrap Modifier");
+               DEG_add_object_relation(ctx->node, smd->target, DEG_OB_COMP_GEOMETRY, "Shrinkwrap Modifier");
+               DEG_add_customdata_mask(ctx->node, smd->target, mask);
                if (smd->shrinkType == MOD_SHRINKWRAP_TARGET_PROJECT) {
                        DEG_add_special_eval_flag(ctx->node, &smd->target->id, DAG_EVAL_NEED_SHRINKWRAP_BOUNDARY);
                }
        }
        if (smd->auxTarget != NULL) {
                DEG_add_object_relation(ctx->node, smd->auxTarget, DEG_OB_COMP_TRANSFORM, "Shrinkwrap Modifier");
-               DEG_add_object_relation_with_customdata(ctx->node, smd->auxTarget, DEG_OB_COMP_GEOMETRY, mask, "Shrinkwrap Modifier");
+               DEG_add_object_relation(ctx->node, smd->auxTarget, DEG_OB_COMP_GEOMETRY, "Shrinkwrap Modifier");
+               DEG_add_customdata_mask(ctx->node, smd->auxTarget, mask);
                if (smd->shrinkType == MOD_SHRINKWRAP_TARGET_PROJECT) {
                        DEG_add_special_eval_flag(ctx->node, &smd->auxTarget->id, DAG_EVAL_NEED_SHRINKWRAP_BOUNDARY);
                }