diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-05-25 14:00:30 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-05-25 14:00:30 +0300 |
commit | dcd2136f958aac95fd19c568581595f6d6cfeb56 (patch) | |
tree | 39ae72db134f7785250aef46db7d4c188545db3f /source/blender | |
parent | 84c7f427f228aadc2dd9e36e3935773aa3ecc25b (diff) |
Depsgraph: Solve wrong datamask calculated by depsgraph
This is a weak concept, but nice t support it for now, so we can enable
new depsgraph by default earlier.
Diffstat (limited to 'source/blender')
5 files changed, 45 insertions, 6 deletions
diff --git a/source/blender/depsgraph/intern/depsgraph_build.h b/source/blender/depsgraph/intern/depsgraph_build.h index c5b04ec299c..14b1b0f643c 100644 --- a/source/blender/depsgraph/intern/depsgraph_build.h +++ b/source/blender/depsgraph/intern/depsgraph_build.h @@ -282,6 +282,9 @@ struct DepsgraphRelationBuilder void build_compositor(Scene *scene); void build_gpencil(ID *owner, bGPdata *gpd); + template <typename KeyType> + OperationDepsNode *find_operation_node(const KeyType &key); + protected: RootDepsNode *find_node(const RootKey &key) const; TimeSourceDepsNode *find_node(const TimeSourceKey &key) const; @@ -323,6 +326,12 @@ struct DepsNodeHandle /* Get unique identifier for FCurves and Drivers */ string deg_fcurve_id_name(const FCurve *fcu); +template <typename KeyType> +OperationDepsNode *DepsgraphRelationBuilder::find_operation_node(const KeyType& key) { + DepsNode *node = find_node(key); + return node != NULL ? node->get_exit_operation() : NULL; +} + template <typename KeyFrom, typename KeyTo> void DepsgraphRelationBuilder::add_relation(const KeyFrom &key_from, const KeyTo &key_to, diff --git a/source/blender/depsgraph/intern/depsgraph_build_nodes.cc b/source/blender/depsgraph/intern/depsgraph_build_nodes.cc index be706ffb338..acb873875da 100644 --- a/source/blender/depsgraph/intern/depsgraph_build_nodes.cc +++ b/source/blender/depsgraph/intern/depsgraph_build_nodes.cc @@ -381,11 +381,11 @@ void DepsgraphNodeBuilder::build_object(Scene *scene, Base *base, Object *ob) IDDepsNode *id_node = add_id_node(&ob->id); id_node->layers = base->lay; + ob->customdata_mask = 0; /* standard components */ build_object_transform(scene, ob); - /* object data */ if (ob->data) { /* type-specific data... */ diff --git a/source/blender/depsgraph/intern/depsgraph_build_relations.cc b/source/blender/depsgraph/intern/depsgraph_build_relations.cc index 52af483d87c..126b34cc9df 100644 --- a/source/blender/depsgraph/intern/depsgraph_build_relations.cc +++ b/source/blender/depsgraph/intern/depsgraph_build_relations.cc @@ -304,6 +304,19 @@ void DepsgraphRelationBuilder::build_scene(Main *bmain, Scene *scene) if (scene->gpd) { build_gpencil(&scene->id, scene->gpd); } + + for (Depsgraph::OperationNodes::const_iterator it_op = m_graph->operations.begin(); + it_op != m_graph->operations.end(); + ++it_op) + { + OperationDepsNode *node = *it_op; + IDDepsNode *id_node = node->owner->owner; + ID *id = id_node->id; + if (GS(id->name) == ID_OB) { + Object *object = (Object *)id; + object->customdata_mask |= node->customdata_mask; + } + } } void DepsgraphRelationBuilder::build_group(Main *bmain, @@ -473,8 +486,12 @@ void DepsgraphRelationBuilder::build_object_parent(Object *ob) { ComponentKey parent_key(&ob->parent->id, DEPSNODE_TYPE_GEOMETRY); add_relation(parent_key, ob_key, DEPSREL_TYPE_GEOMETRY_EVAL, "Vertex Parent"); + /* XXX not sure what this is for or how you could be done properly - lukas */ - //parent_node->customdata_mask |= CD_MASK_ORIGINDEX; + OperationDepsNode *parent_node = find_operation_node(parent_key); + if (parent_node != NULL) { + parent_node->customdata_mask |= CD_MASK_ORIGINDEX; + } ComponentKey transform_key(&ob->parent->id, DEPSNODE_TYPE_TRANSFORM); add_relation(transform_key, ob_key, DEPSREL_TYPE_TRANSFORM, "Vertex Parent TFM"); @@ -625,7 +642,10 @@ void DepsgraphRelationBuilder::build_constraints(Scene *scene, ID *id, eDepsNode add_relation(target_key, constraint_op_key, DEPSREL_TYPE_GEOMETRY_EVAL, cti->name); if (ct->tar->type == OB_MESH) { - //node2->customdata_mask |= CD_MASK_MDEFORMVERT; + OperationDepsNode *node2 = find_operation_node(target_key); + if (node2 != NULL) { + node2->customdata_mask |= CD_MASK_MDEFORMVERT; + } } } else if (con->type == CONSTRAINT_TYPE_SHRINKWRAP) { @@ -1202,7 +1222,10 @@ void DepsgraphRelationBuilder::build_ik_pose(Object *ob, add_relation(target_key, solver_key, DEPSREL_TYPE_GEOMETRY_EVAL, con->name); if (data->tar->type == OB_MESH) { - //node2->customdata_mask |= CD_MASK_MDEFORMVERT; + OperationDepsNode *node2 = find_operation_node(target_key); + if (node2 != NULL) { + node2->customdata_mask |= CD_MASK_MDEFORMVERT; + } } } else { @@ -1234,7 +1257,10 @@ void DepsgraphRelationBuilder::build_ik_pose(Object *ob, add_relation(target_key, solver_key, DEPSREL_TYPE_GEOMETRY_EVAL, con->name); if (data->poletar->type == OB_MESH) { - //node2->customdata_mask |= CD_MASK_MDEFORMVERT; + OperationDepsNode *node2 = find_operation_node(target_key); + if (node2 != NULL) { + node2->customdata_mask |= CD_MASK_MDEFORMVERT; + } } } else { diff --git a/source/blender/depsgraph/intern/depsnode_operation.cc b/source/blender/depsgraph/intern/depsnode_operation.cc index 6aeb163356b..6fe0faef788 100644 --- a/source/blender/depsgraph/intern/depsnode_operation.cc +++ b/source/blender/depsgraph/intern/depsnode_operation.cc @@ -56,7 +56,8 @@ const char *DEG_OPNAMES[] = { OperationDepsNode::OperationDepsNode() : eval_priority(0.0f), - flag(0) + flag(0), + customdata_mask(0) { } diff --git a/source/blender/depsgraph/intern/depsnode_operation.h b/source/blender/depsgraph/intern/depsnode_operation.h index 1119e10805d..8d819319f4a 100644 --- a/source/blender/depsgraph/intern/depsnode_operation.h +++ b/source/blender/depsgraph/intern/depsnode_operation.h @@ -82,6 +82,9 @@ struct OperationDepsNode : public DepsNode { int flag; /* (eDepsOperation_Flag) extra settings affecting evaluation */ + /* Extra customdata mask which needs to be evaluated for the object. */ + uint64_t customdata_mask; + DEG_DEPSNODE_DECLARE; }; |