[Bf-blender-cvs] [775a128] alembic_pointcache: Skeleton files for all remaining point cache user types, so we can start replacing the old point cache entirely.

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


Commit: 775a1287f5927854e179082e8fbaadec57c729c4
Author: Lukas Tönne
Date:   Sun Dec 8 10:32:37 2013 +0100
Branches: alembic_pointcache
https://developer.blender.org/rB775a1287f5927854e179082e8fbaadec57c729c4

Skeleton files for all remaining point cache user types, so we can start
replacing the old point cache entirely.

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

M	source/blender/makesdna/DNA_pointcache_types.h
M	source/blender/pointcache/CMakeLists.txt
M	source/blender/pointcache/PTC_api.cpp
M	source/blender/pointcache/PTC_api.h
A	source/blender/pointcache/intern/cloth.cpp
A	source/blender/pointcache/intern/cloth.h
A	source/blender/pointcache/intern/dynamicpaint.cpp
A	source/blender/pointcache/intern/dynamicpaint.h
A	source/blender/pointcache/intern/rigidbody.cpp
A	source/blender/pointcache/intern/rigidbody.h
A	source/blender/pointcache/intern/smoke.cpp
A	source/blender/pointcache/intern/smoke.h
A	source/blender/pointcache/intern/softbody.cpp
A	source/blender/pointcache/intern/softbody.h

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

diff --git a/source/blender/makesdna/DNA_pointcache_types.h b/source/blender/makesdna/DNA_pointcache_types.h
index 51e81d7..808f4a7 100644
--- a/source/blender/makesdna/DNA_pointcache_types.h
+++ b/source/blender/makesdna/DNA_pointcache_types.h
@@ -33,6 +33,7 @@
 #define __DNA_POINTCACHE_TYPES_H__
 
 #include "DNA_defs.h"
+#include "DNA_listBase.h" /* XXX only needed for deprecated PTCacheMem, remove once that is replaced */
 
 /* XXX TODO point cache do_versions
  * This needs to be updated until officially included in master
diff --git a/source/blender/pointcache/CMakeLists.txt b/source/blender/pointcache/CMakeLists.txt
index 5b421dd..4f6061b 100644
--- a/source/blender/pointcache/CMakeLists.txt
+++ b/source/blender/pointcache/CMakeLists.txt
@@ -56,14 +56,25 @@ if(WITH_ALEMBIC)
 	list(APPEND SRC
 	intern/export.h
 	intern/export.cpp
-	intern/particles.h
-	intern/particles.cpp
 	intern/reader.h
 	intern/reader.cpp
 	intern/schema.h
 	intern/thread.h
 	intern/writer.h
 	intern/writer.cpp
+
+	intern/particles.h
+	intern/particles.cpp
+	intern/cloth.h
+	intern/cloth.cpp
+	intern/softbody.h
+	intern/softbody.cpp
+	intern/rigidbody.h
+	intern/rigidbody.cpp
+	intern/smoke.h
+	intern/smoke.cpp
+	intern/dynamicpaint.h
+	intern/dynamicpaint.cpp
 	)
 
 	add_definitions(-DWITH_ALEMBIC)
diff --git a/source/blender/pointcache/PTC_api.cpp b/source/blender/pointcache/PTC_api.cpp
index 1524328..a823976 100644
--- a/source/blender/pointcache/PTC_api.cpp
+++ b/source/blender/pointcache/PTC_api.cpp
@@ -23,13 +23,17 @@
 #include "reader.h"
 #include "writer.h"
 #include "export.h"
+
 #include "particles.h"
+#include "cloth.h"
+#include "softbody.h"
+#include "rigidbody.h"
+#include "smoke.h"
+#include "dynamicpaint.h"
 
 extern "C" {
 #include "BLI_math.h"
 
-#include "DNA_object_types.h"
-#include "DNA_particle_types.h"
 #include "DNA_pointcache_types.h"
 
 #include "RNA_access.h"
@@ -119,22 +123,12 @@ PTCReader *PTC_reader_from_rna(Scene *scene, PointerRNA *ptr)
 /* Particles */
 PTCWriter *PTC_writer_particles(Scene *scene, Object *ob, ParticleSystem *psys)
 {
-	PointCache *cache = psys->pointcache;
-	if (!cache)
-		return NULL;
-	
-	PTC::ParticlesWriter *writer = new PTC::ParticlesWriter(scene, ob, psys);
-	return (PTCWriter *)writer;
+	return (PTCWriter *)(new PTC::ParticlesWriter(scene, ob, psys));
 }
 
 PTCReader *PTC_reader_particles(Scene *scene, Object *ob, ParticleSystem *psys)
 {
-	PointCache *cache = psys->pointcache;
-	if (!cache)
-		return NULL;
-
-	PTC::ParticlesReader *reader = new PTC::ParticlesReader(scene, ob, psys);
-	return (PTCReader *)reader;
+	return (PTCReader *)(new PTC::ParticlesReader(scene, ob, psys));
 }
 
 int PTC_reader_particles_totpoint(PTCReader *_reader)
@@ -143,6 +137,61 @@ int PTC_reader_particles_totpoint(PTCReader *_reader)
 	return reader->totpoint();
 }
 
+/* Cloth */
+PTCWriter *PTC_writer_cloth(Scene *scene, Object *ob, ClothModifierData *clmd)
+{
+	return (PTCWriter *)(new PTC::ClothWriter(scene, ob, clmd));
+}
+
+PTCReader *PTC_reader_cloth(Scene *scene, Object *ob, ClothModifierData *clmd)
+{
+	return (PTCReader *)(new PTC::ClothReader(scene, ob, clmd));
+}
+
+/* SoftBody */
+PTCWriter *PTC_writer_softbody(Scene *scene, Object *ob, SoftBody *softbody)
+{
+	return (PTCWriter *)(new PTC::SoftBodyWriter(scene, ob, softbody));
+}
+
+PTCReader *PTC_reader_softbody(Scene *scene, Object *ob, SoftBody *softbody)
+{
+	return (PTCReader *)(new PTC::SoftBodyReader(scene, ob, softbody));
+}
+
+/* Rigid Bodies */
+PTCWriter *PTC_writer_rigidbody(Scene *scene, RigidBodyWorld *rbw)
+{
+	return (PTCWriter *)(new PTC::RigidBodyWriter(scene, rbw));
+}
+
+PTCReader *PTC_reader_rigidbody(Scene *scene, RigidBodyWorld *rbw)
+{
+	return (PTCReader *)(new PTC::RigidBodyReader(scene, rbw));
+}
+
+/* Smoke */
+PTCWriter *PTC_writer_smoke(Scene *scene, Object *ob, SmokeModifierData *smd)
+{
+	return (PTCWriter *)(new PTC::SmokeWriter(scene, ob, smd));
+}
+
+PTCReader *PTC_reader_smoke(Scene *scene, Object *ob, SmokeModifierData *smd)
+{
+	return (PTCReader *)(new PTC::SmokeReader(scene, ob, smd));
+}
+
+/* Dynamic Paint */
+PTCWriter *PTC_writer_dynamicpaint(Scene *scene, Object *ob, DynamicPaintSurface *surface)
+{
+	return (PTCWriter *)(new PTC::DynamicPaintWriter(scene, ob, surface));
+}
+
+PTCReader *PTC_reader_dynamicpaint(Scene *scene, Object *ob, DynamicPaintSurface *surface)
+{
+	return (PTCReader *)(new PTC::DynamicPaintReader(scene, ob, surface));
+}
+
 #else
 
 void PTC_writer_free(PTCWriter *_writer)
diff --git a/source/blender/pointcache/PTC_api.h b/source/blender/pointcache/PTC_api.h
index 6edb3a6..94edde1 100644
--- a/source/blender/pointcache/PTC_api.h
+++ b/source/blender/pointcache/PTC_api.h
@@ -27,11 +27,17 @@ extern "C" {
 
 struct Main;
 struct Scene;
-struct Object;
-struct ParticleSystem;
 struct PointCache;
 struct PointerRNA;
 
+struct ClothModifierData;
+struct DynamicPaintSurface;
+struct Object;
+struct ParticleSystem;
+struct RigidBodyWorld;
+struct SmokeModifierData;
+struct SoftBody;
+
 struct PTCWriter;
 struct PTCReader;
 
@@ -60,6 +66,26 @@ struct PTCWriter *PTC_writer_particles(struct Scene *scene, struct Object *ob, s
 struct PTCReader *PTC_reader_particles(struct Scene *scene, struct Object *ob, struct ParticleSystem *psys);
 int PTC_reader_particles_totpoint(struct PTCReader *reader);
 
+/* Cloth */
+struct PTCWriter *PTC_writer_cloth(struct Scene *scene, struct Object *ob, struct ClothModifierData *clmd);
+struct PTCReader *PTC_reader_cloth(struct Scene *scene, struct Object *ob, struct ClothModifierData *clmd);
+
+/* SoftBody */
+struct PTCWriter *PTC_writer_softbody(struct Scene *scene, struct Object *ob, struct SoftBody *softbody);
+struct PTCReader *PTC_reader_softbody(struct Scene *scene, struct Object *ob, struct SoftBody *softbody);
+
+/* Rigid Bodies */
+struct PTCWriter *PTC_writer_rigidbody(struct Scene *scene, struct RigidBodyWorld *rbw);
+struct PTCReader *PTC_reader_rigidbody(struct Scene *scene, struct RigidBodyWorld *rbw);
+
+/* Smoke */
+struct PTCWriter *PTC_writer_smoke(struct Scene *scene, struct Object *ob, struct SmokeModifierData *smd);
+struct PTCReader *PTC_reader_smoke(struct Scene *scene, struct Object *ob, struct SmokeModifierData *smd);
+
+/* Dynamic Paint */
+struct PTCWriter *PTC_writer_dynamicpaint(struct Scene *scene, struct Object *ob, struct DynamicPaintSurface *surface);
+struct PTCReader *PTC_reader_dynamicpaint(struct Scene *scene, struct Object *ob, struct DynamicPaintSurface *surface);
+
 #ifdef __cplusplus
 } /* extern C */
 #endif
diff --git a/source/blender/pointcache/intern/cloth.cpp b/source/blender/pointcache/intern/cloth.cpp
new file mode 100644
index 0000000..0c15078
--- /dev/null
+++ b/source/blender/pointcache/intern/cloth.cpp
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2013, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "cloth.h"
+
+extern "C" {
+#include "DNA_object_types.h"
+#include "DNA_modifier_types.h"
+}
+
+namespace PTC {
+
+using namespace Abc;
+using namespace AbcGeom;
+
+ClothWriter::ClothWriter(Scene *scene, Object *ob, ClothModifierData *clmd) :
+    Writer(scene, &ob->id, clmd->point_cache),
+    m_ob(ob),
+    m_clmd(clmd)
+{
+	uint32_t fs = add_frame_sampling();
+	
+	OObject root = m_archive.getTop();
+//	m_points = OPoints(root, m_psys->name, fs);
+}
+
+ClothWriter::~ClothWriter()
+{
+}
+
+void ClothWriter::write_sample()
+{
+}
+
+
+ClothReader::ClothReader(Scene *scene, Object *ob, ClothModifierData *clmd) :
+    Reader(scene, &ob->id, clmd->point_cache),
+    m_ob(ob),
+    m_clmd(clmd)
+{
+	if (m_archive.valid()) {
+		IObject root = m_archive.getTop();
+//		m_points = IPoints(root, m_psys->name);
+	}
+}
+
+ClothReader::~ClothReader()
+{
+}
+
+PTCReadSampleResult ClothReader::read_sample(float frame)
+{
+	return PTC_READ_SAMPLE_INVALID;
+}
+
+} /* namespace PTC */
diff --git a/source/blender/pointcache/intern/cloth.h b/source/blender/pointcache/intern/cloth.h
new file mode 100644
index 0000000..89f2d42
--- /dev/null
+++ b/source/blender/pointcache/intern/cloth.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2013, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef PTC_CLOTH_H
+#define PTC_CLOTH_H
+
+//#include <Alembic/AbcGeom/IPoints.h>
+//#include <Alembic/AbcGeom/OPoints.h>
+
+#include "reader.h"
+#include "schema.h"
+#include "writer.h"
+
+struct Object;
+struct ClothModifierData;
+
+namespace PTC {
+
+class ClothWriter : public Writer {
+public:
+	ClothWriter(Scene *scene, Object *ob, ClothModifierData *clmd);
+	~ClothWriter();
+	
+	void write_sample();
+	
+private:
+	Object *m_ob;
+	ClothModifierData *m_clmd;
+	
+//	AbcGeom::OPoints m_points;
+};
+
+class ClothReader : public Reader {
+public:
+	ClothReader(Scene *scene, Object *ob, ClothModifierData *clmd);
+	~ClothReader();
+	
+	PTCReadSampleResult read_sample(float frame);
+	
+pri

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list