diff options
5 files changed, 42 insertions, 8 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index dde8555ab9e..077bdd94f56 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -1201,7 +1201,8 @@ void DepsgraphRelationBuilder::build_driver_variables(ID *id, FCurve *fcu) continue; } if (is_same_bone_dependency(variable_key, self_key) || - is_nodetree_node_dependency(variable_key, self_key)) + is_same_nodetree_node_dependency(variable_key, self_key) || + is_same_shapekey_dependency(variable_key, self_key)) { continue; } diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.h b/source/blender/depsgraph/intern/builder/deg_builder_relations.h index 920f115a175..30b3219f989 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.h @@ -297,6 +297,8 @@ protected: DepsNodeHandle create_node_handle(const KeyType& key, const char *default_name = ""); + /* TODO(sergey): All those is_same* functions are to be generalized. */ + /* Check whether two keys correponds to the same bone from same armature. * * This is used by drivers relations builder to avoid possible fake @@ -310,7 +312,14 @@ protected: * the same node tree as a driver variable. */ template <typename KeyFrom, typename KeyTo> - bool is_nodetree_node_dependency(const KeyFrom& key_from, + bool is_same_nodetree_node_dependency(const KeyFrom& key_from, + const KeyTo& key_to); + + /* Similar to above, but used to check whether driver is using key from + * the same key datablock as a driver variable. + */ + template <typename KeyFrom, typename KeyTo> + bool is_same_shapekey_dependency(const KeyFrom& key_from, const KeyTo& key_to); private: diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_impl.h b/source/blender/depsgraph/intern/builder/deg_builder_relations_impl.h index 7853bb9ca70..d55f00ae7e4 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_impl.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_impl.h @@ -164,7 +164,7 @@ bool DepsgraphRelationBuilder::is_same_bone_dependency(const KeyFrom& key_from, } template <typename KeyFrom, typename KeyTo> -bool DepsgraphRelationBuilder::is_nodetree_node_dependency( +bool DepsgraphRelationBuilder::is_same_nodetree_node_dependency( const KeyFrom& key_from, const KeyTo& key_to) { @@ -196,4 +196,31 @@ bool DepsgraphRelationBuilder::is_nodetree_node_dependency( return true; } +template <typename KeyFrom, typename KeyTo> +bool DepsgraphRelationBuilder::is_same_shapekey_dependency( + const KeyFrom& key_from, + const KeyTo& key_to) +{ + /* Get operations for requested keys. */ + DepsNode *node_from = get_node(key_from); + DepsNode *node_to = get_node(key_to); + if (node_from == NULL || node_to == NULL) { + return false; + } + OperationDepsNode *op_from = node_from->get_exit_operation(); + OperationDepsNode *op_to = node_to->get_entry_operation(); + if (op_from == NULL || op_to == NULL) { + return false; + } + /* Check if this is actually a shape key datablock. */ + if (GS(op_from->owner->owner->id->name) != ID_KE) { + return false; + } + /* Different key data blocks. */ + if (op_from->owner->owner != op_to->owner->owner) { + return false; + } + return true; +} + } // namespace DEG diff --git a/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc b/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc index 827bb4d10ad..8fc4c0bcec1 100644 --- a/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc +++ b/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc @@ -467,6 +467,7 @@ static void deg_debug_graphviz_node_relations(const DebugContext &ctx, deg_debug_fprintf(ctx, "["); /* Note: without label an id seem necessary to avoid bugs in graphviz/dot */ deg_debug_fprintf(ctx, "id=\"%s\"", rel->name); + deg_debug_fprintf(ctx, "label=\"%s\"", rel->name); deg_debug_fprintf(ctx, ",color="); deg_debug_graphviz_relation_color(ctx, rel); deg_debug_fprintf(ctx, ",penwidth=\"%f\"", penwidth); /* NOTE: edge from node to own cluster is not possible and gives graphviz diff --git a/source/blender/depsgraph/intern/depsgraph.cc b/source/blender/depsgraph/intern/depsgraph.cc index 45013bb1bcd..128dfd0e556 100644 --- a/source/blender/depsgraph/intern/depsgraph.cc +++ b/source/blender/depsgraph/intern/depsgraph.cc @@ -204,11 +204,7 @@ static bool pointer_to_component_node_criteria( } } else if (ptr->type == &RNA_ShapeKey) { - Key *key = (Key *)ptr->id.data; - /* ShapeKeys are currently handled as geometry on the geometry that - * owns it. - */ - *id = key->from; + *id = (ID *)ptr->id.data; *type = DEG_NODE_TYPE_GEOMETRY; return true; } |