diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2015-06-03 13:11:15 +0300 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2015-06-03 13:11:15 +0300 |
commit | 44276743cfb31996f90a19c6d98839bea3cc1ce4 (patch) | |
tree | f4dc2ac62399d4b2754fbde1cee522b6b705761b /source/blender/blenkernel | |
parent | 08667e616f560f9d89d7f75c940a6a5ba22469d6 (diff) | |
parent | d3923677821c32d0e67934969ebb698c07f17f51 (diff) |
Merge branch 'alembic' into gooseberry
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_cache_library.h | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/cache_library.c | 33 |
2 files changed, 34 insertions, 2 deletions
diff --git a/source/blender/blenkernel/BKE_cache_library.h b/source/blender/blenkernel/BKE_cache_library.h index 88eb7e986c4..62ec261f123 100644 --- a/source/blender/blenkernel/BKE_cache_library.h +++ b/source/blender/blenkernel/BKE_cache_library.h @@ -69,6 +69,9 @@ eCacheReadSampleResult BKE_cache_read_result(int ptc_result); bool BKE_cache_library_validate_item(struct CacheLibrary *cachelib, struct Object *ob, int type, int index); +struct IDProperty *BKE_cache_library_get_input_metadata(struct CacheLibrary *cachelib, bool create); +struct IDProperty *BKE_cache_library_get_output_metadata(struct CacheLibrary *cachelib, bool create); + /* ========================================================================= */ void BKE_cache_library_get_read_flags(struct CacheLibrary *cachelib, bool use_render, bool for_display, bool *read_strands_motion, bool *read_strands_children); diff --git a/source/blender/blenkernel/intern/cache_library.c b/source/blender/blenkernel/intern/cache_library.c index 37cc45d7f9e..370a2fc1887 100644 --- a/source/blender/blenkernel/intern/cache_library.c +++ b/source/blender/blenkernel/intern/cache_library.c @@ -61,6 +61,7 @@ #include "BKE_effect.h" #include "BKE_global.h" #include "BKE_group.h" +#include "BKE_idprop.h" #include "BKE_key.h" #include "BKE_library.h" #include "BKE_main.h" @@ -271,6 +272,32 @@ void BKE_cache_library_tag_used_objects(CacheLibrary *cachelib) /* ========================================================================= */ +static IDProperty *cache_library_get_metadata(CacheLibrary *cachelib, const char *name, bool create) +{ + IDProperty *idprops = IDP_GetProperties((ID *)cachelib, create); + IDProperty *metadata = NULL; + if (idprops) { + metadata = IDP_GetPropertyFromGroup(idprops, name); + if (!metadata && create) { + IDPropertyTemplate val; + val.i = 0; + metadata = IDP_New(IDP_GROUP, &val, name); + IDP_AddToGroup(idprops, metadata); + } + } + return metadata; +} + +IDProperty *BKE_cache_library_get_input_metadata(CacheLibrary *cachelib, bool create) +{ + return cache_library_get_metadata(cachelib, "input_metadata", create); +} + +IDProperty *BKE_cache_library_get_output_metadata(CacheLibrary *cachelib, bool create) +{ + return cache_library_get_metadata(cachelib, "output_metadata", create); +} + BLI_INLINE bool path_is_dirpath(const char *path) { /* last char is a slash? */ @@ -377,8 +404,10 @@ static struct PTCReaderArchive *find_active_cache(Scene *scene, CacheLibrary *ca else cachelib->archive_info = BKE_cache_archive_info_new(); BLI_strncpy(cachelib->archive_info->filepath, filename, sizeof(cachelib->archive_info->filepath)); - if (archive) - PTC_get_archive_info(archive, cachelib->archive_info); + if (archive) { + IDProperty *metadata = BKE_cache_library_get_input_metadata(cachelib, true); + PTC_get_archive_info(archive, cachelib->archive_info, metadata); + } return archive; } |