diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2015-06-02 18:59:47 +0300 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2015-06-02 18:59:47 +0300 |
commit | 3019eff71ea2c178003c21fd8894d13868985cee (patch) | |
tree | 1e42ac1a525da237a0f6095c0efc4a5472c31741 /source/blender/blenkernel/intern | |
parent | 1ae3ffb6c95c6ba4a95e7feba18f7e87580a6c5b (diff) |
Use ID property groups for storing and loading metadata associated to
Alembic archives.
Two separate property groups for metadata are used (so that reading
caches does not overwrite metadata for output caches).
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/cache_library.c | 33 |
1 files changed, 31 insertions, 2 deletions
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; } |