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/alembic | |
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/alembic')
-rw-r--r-- | source/blender/alembic/intern/abc_object.cc | 3 | ||||
-rw-r--r-- | source/blender/alembic/intern/alembic_capi.cc | 7 |
2 files changed, 5 insertions, 5 deletions
diff --git a/source/blender/alembic/intern/abc_object.cc b/source/blender/alembic/intern/abc_object.cc index 36daa50e095..e437273c1be 100644 --- a/source/blender/alembic/intern/abc_object.cc +++ b/source/blender/alembic/intern/abc_object.cc @@ -364,9 +364,6 @@ void AbcObjectReader::addCacheModifier() id_us_plus(&mcmd->cache_file->id); BLI_strncpy(mcmd->object_path, m_iobject.getFullName().c_str(), FILE_MAX); - - mcmd->reader = reinterpret_cast<CacheReader *>(this); - this->incref(); } chrono_t AbcObjectReader::minTime() const diff --git a/source/blender/alembic/intern/alembic_capi.cc b/source/blender/alembic/intern/alembic_capi.cc index 3ff3fbe2001..b502692d0e5 100644 --- a/source/blender/alembic/intern/alembic_capi.cc +++ b/source/blender/alembic/intern/alembic_capi.cc @@ -627,6 +627,7 @@ struct ImportJobData { char filename[1024]; ImportSettings settings; + ArchiveReader *archive; std::vector<AbcObjectReader *> readers; short *stop; @@ -672,9 +673,9 @@ static void import_startjob(void *user_data, short *stop, short *do_update, floa cache_file->is_sequence = data->settings.is_sequence; cache_file->scale = data->settings.scale; - cache_file->handle = handle_from_archive(archive); - BLI_strncpy(cache_file->filepath, data->filename, 1024); + STRNCPY(cache_file->filepath, data->filename); + data->archive = archive; data->settings.cache_file = cache_file; *data->do_update = true; @@ -855,6 +856,7 @@ static void import_endjob(void *user_data) static void import_freejob(void *user_data) { ImportJobData *data = static_cast<ImportJobData *>(user_data); + delete data->archive; delete data; } @@ -886,6 +888,7 @@ bool ABC_import(bContext *C, job->settings.validate_meshes = validate_meshes; job->error_code = ABC_NO_ERROR; job->was_cancelled = false; + job->archive = NULL; G.is_break = false; |