[Bf-blender-cvs] [66bfa1e] alembic_pointcache: Store an untyped archive pointer in the DNA PointCache struct. This is used to store an alembic archive which constitutes the point cache output.

Lukas Tönne noreply at git.blender.org
Thu Oct 16 16:52:36 CEST 2014


Commit: 66bfa1e35c8a148ce5f44210e8c138af8e505235
Author: Lukas Tönne
Date:   Fri Oct 4 17:36:11 2013 +0200
Branches: alembic_pointcache
https://developer.blender.org/rB66bfa1e35c8a148ce5f44210e8c138af8e505235

Store an untyped archive pointer in the DNA PointCache struct. This is used to store an alembic archive which constitutes the point cache output.

===================================================================

M	source/blender/blenkernel/CMakeLists.txt
M	source/blender/blenkernel/intern/pointcache.c
M	source/blender/makesdna/DNA_object_force.h
M	source/blender/pointcache/CMakeLists.txt
A	source/blender/pointcache/PTC_api.cpp
M	source/blender/pointcache/PTC_api.h
A	source/blender/pointcache/PTC_archive.cpp
A	source/blender/pointcache/PTC_archive.h

===================================================================

diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index 437956f..c4a3540 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -36,6 +36,7 @@ set(INC
 	../bmesh
 	../modifiers
 	../nodes
+	../pointcache
 	../render/extern/include
 	../../../intern/guardedalloc
 	../../../intern/iksolver/extern
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index 9891a8c..27d7e40 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -76,6 +76,8 @@
 
 #include "BIK_api.h"
 
+#include "PTC_api.h"
+
 #ifdef WITH_BULLET
 #  include "RBI_api.h"
 #endif
@@ -3004,6 +3006,8 @@ PointCache *BKE_ptcache_add(ListBase *ptcaches)
 	cache->step= 10;
 	cache->index = -1;
 
+	cache->archive = NULL;
+
 	BLI_addtail(ptcaches, cache);
 
 	return cache;
@@ -3029,6 +3033,10 @@ void BKE_ptcache_free(PointCache *cache)
 		cache->free_edit(cache->edit);
 	if (cache->cached_frames)
 		MEM_freeN(cache->cached_frames);
+
+	if (cache->archive)
+		PTC_archive_free(cache->archive);
+
 	MEM_freeN(cache);
 }
 void BKE_ptcache_free_list(ListBase *ptcaches)
@@ -3082,6 +3090,8 @@ static PointCache *ptcache_copy(PointCache *cache, int copy_data)
 	/* hmm, should these be copied over instead? */
 	ncache->edit = NULL;
 
+	ncache->archive = NULL;
+
 	return ncache;
 }
 
diff --git a/source/blender/makesdna/DNA_object_force.h b/source/blender/makesdna/DNA_object_force.h
index 5cc56d8..e9fdb68 100644
--- a/source/blender/makesdna/DNA_object_force.h
+++ b/source/blender/makesdna/DNA_object_force.h
@@ -206,6 +206,8 @@ typedef struct PointCache {
 
 	struct PTCacheEdit *edit;
 	void (*free_edit)(struct PTCacheEdit *edit);	/* free callback */
+
+	void *archive;
 } PointCache;
 
 typedef struct SBVertex {
diff --git a/source/blender/pointcache/CMakeLists.txt b/source/blender/pointcache/CMakeLists.txt
index 1d05fb5..a9f4ac1 100644
--- a/source/blender/pointcache/CMakeLists.txt
+++ b/source/blender/pointcache/CMakeLists.txt
@@ -37,6 +37,8 @@ set(SRC
 	PTC_api.h
 	PTC_schema.h
 
+	PTC_archive.h
+	PTC_archive.cpp
 	PTC_particles.h
 	PTC_particles.cpp
 )
diff --git a/source/blender/pointcache/PTC_api.h b/source/blender/pointcache/PTC_api.cpp
similarity index 64%
copy from source/blender/pointcache/PTC_api.h
copy to source/blender/pointcache/PTC_api.cpp
index 4a01f4d..d073b0d 100644
--- a/source/blender/pointcache/PTC_api.h
+++ b/source/blender/pointcache/PTC_api.cpp
@@ -16,17 +16,24 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
-#ifndef PTC_API_H
-#define PTC_API_H
+#include "PTC_api.h"
+#include "PTC_archive.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
-void test_archive();
+void *PTC_archive_create(const char *filename)
+{
+	OArchive *archive = new OArchive(Alembic::AbcCoreHDF5::WriteArchive(),
+	                                 std::string(filename),
+	                                 ErrorHandler::kThrowPolicy);
+	
+	return archive;
+}
 
-#ifdef __cplusplus
+void PTC_archive_free(void *_archive)
+{
+	OArchive *archive = static_cast<OArchive *>(_archive);
+	delete archive;
 }
-#endif
 
-#endif  /* PTC_API_H */
+} /* extern C */
diff --git a/source/blender/pointcache/PTC_api.h b/source/blender/pointcache/PTC_api.h
index 4a01f4d..19d3c1f 100644
--- a/source/blender/pointcache/PTC_api.h
+++ b/source/blender/pointcache/PTC_api.h
@@ -25,8 +25,11 @@ extern "C" {
 
 void test_archive();
 
+void *PTC_archive_create(const char *filename);
+void PTC_archive_free(void *archive);
+
 #ifdef __cplusplus
-}
+} /* extern C */
 #endif
 
 #endif  /* PTC_API_H */
diff --git a/source/blender/pointcache/PTC_api.h b/source/blender/pointcache/PTC_archive.cpp
similarity index 83%
copy from source/blender/pointcache/PTC_api.h
copy to source/blender/pointcache/PTC_archive.cpp
index 4a01f4d..8595678 100644
--- a/source/blender/pointcache/PTC_api.h
+++ b/source/blender/pointcache/PTC_archive.cpp
@@ -16,17 +16,3 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
-#ifndef PTC_API_H
-#define PTC_API_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void test_archive();
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif  /* PTC_API_H */
diff --git a/source/blender/pointcache/PTC_api.h b/source/blender/pointcache/PTC_archive.h
similarity index 78%
copy from source/blender/pointcache/PTC_api.h
copy to source/blender/pointcache/PTC_archive.h
index 4a01f4d..5315dc4 100644
--- a/source/blender/pointcache/PTC_api.h
+++ b/source/blender/pointcache/PTC_archive.h
@@ -16,17 +16,13 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
-#ifndef PTC_API_H
-#define PTC_API_H
+#ifndef PTC_ARCHIVE_H
+#define PTC_ARCHIVE_H
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+#include <Alembic/Abc/OArchive.h>
+#include <Alembic/AbcCoreHDF5/ReadWrite.h>
 
-void test_archive();
+using namespace Alembic::Abc;
+namespace Util = Alembic::Util;
 
-#ifdef __cplusplus
-}
-#endif
-
-#endif  /* PTC_API_H */
+#endif  /* PTC_ARCHIVE_H */




More information about the Bf-blender-cvs mailing list