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:
authorLukas Tönne <lukas.toenne@gmail.com>2015-06-02 18:59:47 +0300
committerLukas Tönne <lukas.toenne@gmail.com>2015-06-02 18:59:47 +0300
commit3019eff71ea2c178003c21fd8894d13868985cee (patch)
tree1e42ac1a525da237a0f6095c0efc4a5472c31741 /source/blender/blenkernel
parent1ae3ffb6c95c6ba4a95e7feba18f7e87580a6c5b (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')
-rw-r--r--source/blender/blenkernel/BKE_cache_library.h3
-rw-r--r--source/blender/blenkernel/intern/cache_library.c33
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;
}