Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/constraint.c
| Show First 20 Lines • Show All 4,829 Lines • ▼ Show 20 Lines | #ifdef WITH_ALEMBIC | ||||
| if (!cache_file) { | if (!cache_file) { | ||||
| return; | return; | ||||
| } | } | ||||
| const float frame = DEG_get_ctime(cob->depsgraph); | const float frame = DEG_get_ctime(cob->depsgraph); | ||||
| const float time = BKE_cachefile_time_offset(cache_file, frame, FPS); | const float time = BKE_cachefile_time_offset(cache_file, frame, FPS); | ||||
| /* Must always load ABC handle on original. */ | if (!data->reader || !STREQ(data->reader_object_path, data->object_path)) { | ||||
| CacheFile *cache_file_orig = (CacheFile *)DEG_get_original_id(&cache_file->id); | STRNCPY(data->reader_object_path, data->object_path); | ||||
| BKE_cachefile_ensure_handle(G.main, cache_file_orig); | BKE_cachefile_reader_open(cache_file, &data->reader, cob->ob, data->object_path); | ||||
| if (!data->reader) { | |||||
| data->reader = CacheReader_open_alembic_object( | |||||
| cache_file_orig->handle, data->reader, cob->ob, data->object_path); | |||||
| } | } | ||||
| ABC_get_transform(data->reader, cob->matrix, time, cache_file->scale); | ABC_get_transform(data->reader, cob->matrix, time, cache_file->scale); | ||||
| #else | #else | ||||
| UNUSED_VARS(con, cob); | UNUSED_VARS(con, cob); | ||||
| #endif | #endif | ||||
| UNUSED_VARS(targets); | UNUSED_VARS(targets); | ||||
| } | } | ||||
| static void transformcache_copy(bConstraint *con, bConstraint *srccon) | static void transformcache_copy(bConstraint *con, bConstraint *srccon) | ||||
| { | { | ||||
| bTransformCacheConstraint *src = srccon->data; | bTransformCacheConstraint *src = srccon->data; | ||||
| bTransformCacheConstraint *dst = con->data; | bTransformCacheConstraint *dst = con->data; | ||||
| BLI_strncpy(dst->object_path, src->object_path, sizeof(dst->object_path)); | BLI_strncpy(dst->object_path, src->object_path, sizeof(dst->object_path)); | ||||
| dst->cache_file = src->cache_file; | dst->cache_file = src->cache_file; | ||||
| dst->reader = NULL; | |||||
| #ifdef WITH_ALEMBIC | dst->reader_object_path[0] = '\0'; | ||||
| if (dst->reader) { | |||||
| CacheReader_incref(dst->reader); | |||||
| } | |||||
| #endif | |||||
| } | } | ||||
| static void transformcache_free(bConstraint *con) | static void transformcache_free(bConstraint *con) | ||||
| { | { | ||||
| bTransformCacheConstraint *data = con->data; | bTransformCacheConstraint *data = con->data; | ||||
| if (data->reader) { | if (data->reader) { | ||||
| #ifdef WITH_ALEMBIC | BKE_cachefile_reader_free(data->cache_file, &data->reader); | ||||
| CacheReader_free(data->reader); | data->reader_object_path[0] = '\0'; | ||||
| #endif | |||||
| data->reader = NULL; | |||||
| } | } | ||||
| } | } | ||||
| static void transformcache_new_data(void *cdata) | static void transformcache_new_data(void *cdata) | ||||
| { | { | ||||
| bTransformCacheConstraint *data = (bTransformCacheConstraint *)cdata; | bTransformCacheConstraint *data = (bTransformCacheConstraint *)cdata; | ||||
| data->cache_file = NULL; | data->cache_file = NULL; | ||||
| ▲ Show 20 Lines • Show All 831 Lines • Show Last 20 Lines | |||||