diff options
author | ishbosamiya <ishbosamiya@gmail.com> | 2021-07-27 12:29:21 +0300 |
---|---|---|
committer | ishbosamiya <ishbosamiya@gmail.com> | 2021-07-27 12:29:21 +0300 |
commit | d1c296519ce6efcc5e36995ef898585b229427b1 (patch) | |
tree | 17c4a9ea201099e240a7ee546e6a21354efa02d6 /source/blender/blenkernel | |
parent | 0772a217b93d6c88fee8673b68b3ab583076022f (diff) |
adaptive_cloth: serialize Mesh and store to /tmp/test.msgpack
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_cloth_remesh.hh | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/cloth_remesh.cc | 10 |
2 files changed, 18 insertions, 0 deletions
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 */ { |