[Bf-blender-cvs] [aa8e249] alembic_pointcache: Writer/Reader classes for the mesh cache modifier.

Lukas Tönne noreply at git.blender.org
Fri Oct 17 11:14:53 CEST 2014


Commit: aa8e249136f62e31b67d394fc27980d4e3fc1316
Author: Lukas Tönne
Date:   Thu Oct 16 19:17:33 2014 +0200
Branches: alembic_pointcache
https://developer.blender.org/rBaa8e249136f62e31b67d394fc27980d4e3fc1316

Writer/Reader classes for the mesh cache modifier.

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

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/mesh.cpp
A	source/blender/pointcache/intern/mesh.h

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

diff --git a/source/blender/pointcache/CMakeLists.txt b/source/blender/pointcache/CMakeLists.txt
index 4f6061b..076be46 100644
--- a/source/blender/pointcache/CMakeLists.txt
+++ b/source/blender/pointcache/CMakeLists.txt
@@ -67,14 +67,16 @@ if(WITH_ALEMBIC)
 	intern/particles.cpp
 	intern/cloth.h
 	intern/cloth.cpp
-	intern/softbody.h
-	intern/softbody.cpp
+	intern/dynamicpaint.h
+	intern/dynamicpaint.cpp
+	intern/mesh.h
+	intern/mesh.cpp
 	intern/rigidbody.h
 	intern/rigidbody.cpp
+	intern/softbody.h
+	intern/softbody.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 f92a493..e2b4ca6 100644
--- a/source/blender/pointcache/PTC_api.cpp
+++ b/source/blender/pointcache/PTC_api.cpp
@@ -26,10 +26,11 @@
 
 #include "particles.h"
 #include "cloth.h"
+#include "dynamicpaint.h"
+#include "mesh.h"
+#include "smoke.h"
 #include "softbody.h"
 #include "rigidbody.h"
-#include "smoke.h"
-#include "dynamicpaint.h"
 
 extern "C" {
 #include "BLI_math.h"
@@ -132,6 +133,11 @@ PTCWriter *PTC_writer_from_rna(Scene *scene, PointerRNA *ptr)
 		DynamicPaintSurface *surface = (DynamicPaintSurface *)ptr->data;
 		return PTC_writer_dynamicpaint(scene, ob, surface);
 	}
+	if (RNA_struct_is_a(ptr->type, &RNA_MeshCacheModifier)) {
+		Object *ob = (Object *)ptr->id.data;
+		MeshCacheModifierData *mcmd = (MeshCacheModifierData *)ptr->data;
+		return PTC_writer_mesh_cache(scene, ob, mcmd);
+	}
 	return NULL;
 }
 
@@ -167,6 +173,11 @@ PTCReader *PTC_reader_from_rna(Scene *scene, PointerRNA *ptr)
 		DynamicPaintSurface *surface = (DynamicPaintSurface *)ptr->data;
 		return PTC_reader_dynamicpaint(scene, ob, surface);
 	}
+	if (RNA_struct_is_a(ptr->type, &RNA_MeshCacheModifier)) {
+		Object *ob = (Object *)ptr->id.data;
+		MeshCacheModifierData *mcmd = (MeshCacheModifierData *)ptr->data;
+		return PTC_reader_mesh_cache(scene, ob, mcmd);
+	}
 	return NULL;
 }
 
@@ -243,14 +254,14 @@ PTCReader *PTC_reader_dynamicpaint(Scene *scene, Object *ob, DynamicPaintSurface
 }
 
 /* DerivedMesh */
-PTCWriter *PTC_writer_derived_mesh(Scene *scene, Object *ob, DerivedMesh *dm)
+PTCWriter *PTC_writer_mesh_cache(Scene *scene, Object *ob, MeshCacheModifierData *mcmd)
 {
-	return NULL;
+	return (PTCWriter *)(new PTC::MeshCacheWriter(scene, ob, mcmd));
 }
 
-PTCReader *PTC_reader_derived_mesh(Scene *scene, Object *ob, DerivedMesh *dm)
+PTCReader *PTC_reader_mesh_cache(Scene *scene, Object *ob, MeshCacheModifierData *mcmd)
 {
-	return NULL;
+	return (PTCReader *)(new PTC::MeshCacheReader(scene, ob, mcmd));
 }
 
 #else
diff --git a/source/blender/pointcache/PTC_api.h b/source/blender/pointcache/PTC_api.h
index ad86456..94a09fa 100644
--- a/source/blender/pointcache/PTC_api.h
+++ b/source/blender/pointcache/PTC_api.h
@@ -32,8 +32,8 @@ struct PointCache;
 struct PointerRNA;
 
 struct ClothModifierData;
-struct DerivedMesh;
 struct DynamicPaintSurface;
+struct MeshCacheModifierData;
 struct Object;
 struct ParticleSystem;
 struct RigidBodyWorld;
@@ -88,9 +88,9 @@ struct PTCReader *PTC_reader_smoke(struct Scene *scene, struct Object *ob, struc
 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);
 
-/* DerivedMesh */
-struct PTCWriter *PTC_writer_derived_mesh(struct Scene *scene, struct Object *ob, struct DerivedMesh *dm);
-struct PTCReader *PTC_reader_derived_mesh(struct Scene *scene, struct Object *ob, struct DerivedMesh *dm);
+/* Mesh Cache Modifier */
+struct PTCWriter *PTC_writer_mesh_cache(struct Scene *scene, struct Object *ob, struct MeshCacheModifierData *mcmd);
+struct PTCReader *PTC_reader_mesh_cache(struct Scene *scene, struct Object *ob, struct MeshCacheModifierData *mcmd);
 
 #ifdef __cplusplus
 } /* extern C */
diff --git a/source/blender/pointcache/intern/mesh.cpp b/source/blender/pointcache/intern/mesh.cpp
new file mode 100644
index 0000000..f27e184
--- /dev/null
+++ b/source/blender/pointcache/intern/mesh.cpp
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2014, 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 "mesh.h"
+
+extern "C" {
+#include "DNA_object_types.h"
+#include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
+#include "DNA_modifier_types.h"
+
+#include "BKE_DerivedMesh.h"
+}
+
+namespace PTC {
+
+using namespace Abc;
+using namespace AbcGeom;
+
+MeshCacheWriter::MeshCacheWriter(Scene *scene, Object *ob, MeshCacheModifierData *mcmd) :
+    Writer(scene, &ob->id, mcmd->point_cache),
+    m_ob(ob),
+    m_mcmd(mcmd)
+{
+	uint32_t fs = add_frame_sampling();
+	
+	OObject root = m_archive.getTop();
+//	m_points = OPoints(root, m_psys->name, fs);
+}
+
+MeshCacheWriter::~MeshCacheWriter()
+{
+}
+
+void MeshCacheWriter::write_sample()
+{
+}
+
+
+MeshCacheReader::MeshCacheReader(Scene *scene, Object *ob, MeshCacheModifierData *mcmd) :
+    Reader(scene, &ob->id, mcmd->point_cache),
+    m_ob(ob),
+    m_mcmd(mcmd)
+{
+	if (m_archive.valid()) {
+		IObject root = m_archive.getTop();
+//		m_points = IPoints(root, m_psys->name);
+	}
+}
+
+MeshCacheReader::~MeshCacheReader()
+{
+}
+
+PTCReadSampleResult MeshCacheReader::read_sample(float frame)
+{
+	return PTC_READ_SAMPLE_INVALID;
+}
+
+} /* namespace PTC */
diff --git a/source/blender/pointcache/intern/mesh.h b/source/blender/pointcache/intern/mesh.h
new file mode 100644
index 0000000..775ca59
--- /dev/null
+++ b/source/blender/pointcache/intern/mesh.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2014, 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_MESH_H
+#define PTC_MESH_H
+
+//#include <Alembic/AbcGeom/IPoints.h>
+//#include <Alembic/AbcGeom/OPoints.h>
+
+#include "reader.h"
+#include "schema.h"
+#include "writer.h"
+
+struct Object;
+struct MeshCacheModifierData;
+
+namespace PTC {
+
+class MeshCacheWriter : public Writer {
+public:
+	MeshCacheWriter(Scene *scene, Object *ob, MeshCacheModifierData *mcmd);
+	~MeshCacheWriter();
+	
+	void write_sample();
+	
+private:
+	Object *m_ob;
+	MeshCacheModifierData *m_mcmd;
+	
+//	AbcGeom::OPoints m_points;
+};
+
+class MeshCacheReader : public Reader {
+public:
+	MeshCacheReader(Scene *scene, Object *ob, MeshCacheModifierData *mcmd);
+	~MeshCacheReader();
+	
+	PTCReadSampleResult read_sample(float frame);
+	
+private:
+	Object *m_ob;
+	MeshCacheModifierData *m_mcmd;
+	
+//	AbcGeom::IPoints m_points;
+};
+
+} /* namespace PTC */
+
+#endif  /* PTC_MESH_H */




More information about the Bf-blender-cvs mailing list