[Bf-blender-cvs] [d1c296519ce] soc-2021-adaptive-cloth: adaptive_cloth: serialize Mesh and store to /tmp/test.msgpack
ishbosamiya
noreply at git.blender.org
Wed Aug 4 11:29:32 CEST 2021
Commit: d1c296519ce6efcc5e36995ef898585b229427b1
Author: ishbosamiya
Date: Tue Jul 27 14:59:21 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rBd1c296519ce6efcc5e36995ef898585b229427b1
adaptive_cloth: serialize Mesh and store to /tmp/test.msgpack
===================================================================
M source/blender/blenkernel/BKE_cloth_remesh.hh
M source/blender/blenkernel/intern/cloth_remesh.cc
===================================================================
diff --git a/source/blender/blenkernel/BKE_cloth_remesh.hh b/source/blender/blenkernel/BKE_cloth_remesh.hh
index 632d831e1f9..d8e693f7c8e 100644
--- a/source/blender/blenkernel/BKE_cloth_remesh.hh
+++ b/source/blender/blenkernel/BKE_cloth_remesh.hh
@@ -2163,6 +2163,14 @@ template<typename END, typename EVD, typename EED, typename EFD> class Mesh {
std::move(deleted_faces));
}
+ std::string serialize() const
+ {
+ std::stringstream ss;
+ msgpack::pack(ss, *this);
+
+ return ss.str();
+ }
+
protected:
/* all protected static methods */
static constexpr inline float3 float3_unknown()
diff --git a/source/blender/blenkernel/intern/cloth_remesh.cc b/source/blender/blenkernel/intern/cloth_remesh.cc
index 1ba948b33fa..2eac85428e2 100644
--- a/source/blender/blenkernel/intern/cloth_remesh.cc
+++ b/source/blender/blenkernel/intern/cloth_remesh.cc
@@ -714,6 +714,16 @@ Mesh *adaptive_remesh(const AdaptiveRemeshParams<END, ExtraData> ¶ms,
internal::AdaptiveMesh<END> adaptive_mesh;
adaptive_mesh.read(meshio_input);
+ {
+ const auto serialized = adaptive_mesh.serialize();
+ const auto *filepath = "/tmp/test.msgpack";
+ std::fstream fout;
+ fout.open(filepath, std::ios::out);
+ if (fout.is_open()) {
+ fout << serialized;
+ fout.close();
+ }
+ }
/* Load up the `NodeData`'s extra_data */
{
More information about the Bf-blender-cvs
mailing list