diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-04-04 16:07:37 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-05-01 17:02:27 +0300 |
commit | 89826e0a0d8ac55881569e021c487ac5541c6612 (patch) | |
tree | c80797e8c804d43fc84a8e91396a8a86cf3a79b7 /source/blender/depsgraph | |
parent | a72a831570822190f782e6bbecfd57b45dc2e872 (diff) |
Alembic: integrate cache file into the dependency graph
* The cache file datablock is now evaluated as part of the dependency graph,
creating/freeing the Alembic file handle matching the current frame.
Modifiers and constraints depend on this evaluation.
* Cache file handles and readers now only exist on COW datablocks, never the
original ones.
* Object data paths are flushed back to the original for the user interface.
* The cache file keeps a list of all readers associated with its handle, and
automatically frees them when the handle is freed. This kind of sharing of
data across datablocks is weak but we have no better mechanism for it.
Fix T62720: Alembic sequences not working and crashing
Differential Revision: https://developer.blender.org/D4774
Diffstat (limited to 'source/blender/depsgraph')
-rw-r--r-- | source/blender/depsgraph/intern/builder/deg_builder_nodes.cc | 8 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/builder/deg_builder_relations.cc | 11 |
2 files changed, 17 insertions, 2 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc index 87bbcef7f01..b6822a89093 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@ -65,6 +65,7 @@ extern "C" { #include "BKE_action.h" #include "BKE_armature.h" #include "BKE_animsys.h" +#include "BKE_cachefile.h" #include "BKE_collection.h" #include "BKE_constraint.h" #include "BKE_curve.h" @@ -1469,11 +1470,16 @@ void DepsgraphNodeBuilder::build_cachefile(CacheFile *cache_file) return; } ID *cache_file_id = &cache_file->id; + add_id_node(cache_file_id); + CacheFile *cache_file_cow = get_cow_datablock(cache_file); /* Animation, */ build_animdata(cache_file_id); build_parameters(cache_file_id); /* Cache evaluation itself. */ - add_operation_node(cache_file_id, NodeType::CACHE, OperationCode::FILE_CACHE_UPDATE); + add_operation_node(cache_file_id, + NodeType::CACHE, + OperationCode::FILE_CACHE_UPDATE, + function_bind(BKE_cachefile_eval, bmain_, _1, cache_file_cow)); } void DepsgraphNodeBuilder::build_mask(Mask *mask) diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index 147d82c5999..d3fd16d889f 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -2222,6 +2222,14 @@ void DepsgraphRelationBuilder::build_cachefile(CacheFile *cache_file) ComponentKey datablock_key(&cache_file->id, NodeType::CACHE); add_relation(animation_key, datablock_key, "Datablock Animation"); } + + /* Cache file updates */ + if (cache_file->is_sequence) { + OperationKey cache_update_key( + &cache_file->id, NodeType::CACHE, OperationCode::FILE_CACHE_UPDATE); + TimeSourceKey time_src_key; + add_relation(time_src_key, cache_update_key, "TimeSrc -> Cache File Eval"); + } } void DepsgraphRelationBuilder::build_mask(Mask *mask) @@ -2329,7 +2337,8 @@ void DepsgraphRelationBuilder::build_copy_on_write_relations(IDNode *id_node) continue; } int rel_flag = (RELATION_FLAG_NO_FLUSH | RELATION_FLAG_GODMODE); - if (id_type == ID_ME && comp_node->type == NodeType::GEOMETRY) { + if ((id_type == ID_ME && comp_node->type == NodeType::GEOMETRY) || + (id_type == ID_CF && comp_node->type == NodeType::CACHE)) { rel_flag &= ~RELATION_FLAG_NO_FLUSH; } /* Notes on exceptions: |