Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2019-04-04 16:07:37 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-05-01 17:02:27 +0300
commit89826e0a0d8ac55881569e021c487ac5541c6612 (patch)
treec80797e8c804d43fc84a8e91396a8a86cf3a79b7 /source/blender/blenkernel/intern/constraint.c
parenta72a831570822190f782e6bbecfd57b45dc2e872 (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/blenkernel/intern/constraint.c')
-rw-r--r--source/blender/blenkernel/intern/constraint.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index a475a16dd57..0e29f165992 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -4835,13 +4835,9 @@ static void transformcache_evaluate(bConstraint *con, bConstraintOb *cob, ListBa
const float frame = DEG_get_ctime(cob->depsgraph);
const float time = BKE_cachefile_time_offset(cache_file, frame, FPS);
- /* Must always load ABC handle on original. */
- CacheFile *cache_file_orig = (CacheFile *)DEG_get_original_id(&cache_file->id);
- BKE_cachefile_ensure_handle(G.main, cache_file_orig);
-
- if (!data->reader) {
- data->reader = CacheReader_open_alembic_object(
- cache_file_orig->handle, data->reader, cob->ob, data->object_path);
+ if (!data->reader || !STREQ(data->reader_object_path, data->object_path)) {
+ STRNCPY(data->reader_object_path, data->object_path);
+ BKE_cachefile_reader_open(cache_file, &data->reader, cob->ob, data->object_path);
}
ABC_get_transform(data->reader, cob->matrix, time, cache_file->scale);
@@ -4859,12 +4855,8 @@ static void transformcache_copy(bConstraint *con, bConstraint *srccon)
BLI_strncpy(dst->object_path, src->object_path, sizeof(dst->object_path));
dst->cache_file = src->cache_file;
-
-#ifdef WITH_ALEMBIC
- if (dst->reader) {
- CacheReader_incref(dst->reader);
- }
-#endif
+ dst->reader = NULL;
+ dst->reader_object_path[0] = '\0';
}
static void transformcache_free(bConstraint *con)
@@ -4872,10 +4864,8 @@ static void transformcache_free(bConstraint *con)
bTransformCacheConstraint *data = con->data;
if (data->reader) {
-#ifdef WITH_ALEMBIC
- CacheReader_free(data->reader);
-#endif
- data->reader = NULL;
+ BKE_cachefile_reader_free(data->cache_file, &data->reader);
+ data->reader_object_path[0] = '\0';
}
}