Merge branch 'master' into blender2.8
[blender.git] / source / blender / depsgraph / intern / builder / deg_builder_relations_impl.h
index 7853bb9ca70b01dca18ba48f5409bba73716391e..d55f00ae7e4f4d90879f89b07c363fbf9115aaac 100644 (file)
@@ -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