[Bf-blender-cvs] [20d24a9995f] soc-2021-adaptive-cloth: adaptive_cloth: msgpack: store more information for easier debugging

ishbosamiya noreply at git.blender.org
Wed Aug 4 11:29:33 CEST 2021


Commit: 20d24a9995f67b01c1159077c12a1cdd77158102
Author: ishbosamiya
Date:   Mon Aug 2 11:15:26 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rB20d24a9995f67b01c1159077c12a1cdd77158102

adaptive_cloth: msgpack: store more information for easier debugging

Ideally this wouldn't be needed. This makes it easier to debug the
deserialization part. In case msgpack is used for final caching this
information needs to be removed.

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

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 900d6728937..1e46df2c0d3 100644
--- a/source/blender/blenkernel/BKE_cloth_remesh.hh
+++ b/source/blender/blenkernel/BKE_cloth_remesh.hh
@@ -157,8 +157,6 @@ class EmptyExtraData {
   {
     return other;
   }
-
-  MSGPACK_DEFINE_ARRAY();
 };
 
 namespace ga = blender::generational_arena;
@@ -3019,22 +3017,43 @@ MSGPACK_API_VERSION_NAMESPACE(MSGPACK_DEFAULT_API_NS)
 
       /* Need to store the arenas and the corresponding mappings
        * between the arena index and positional index of that element */
-      o.pack_array(8);
+      o.pack_array(16);
 
+      o.pack(std::string("nodes"));
       o.pack(mesh.get_nodes());
+      o.pack(std::string("verts"));
       o.pack(mesh.get_verts());
+      o.pack(std::string("edges"));
       o.pack(mesh.get_edges());
+      o.pack(std::string("faces"));
       o.pack(mesh.get_faces());
 
+      o.pack(std::string("node_map"));
       o.pack(node_pos_index_map);
+      o.pack(std::string("vert_map"));
       o.pack(vert_pos_index_map);
+      o.pack(std::string("edge_map"));
       o.pack(edge_pos_index_map);
+      o.pack(std::string("face_map"));
       o.pack(face_pos_index_map);
 
       return o;
     }
   };
 
+  template<> struct pack<blender::bke::internal::EmptyExtraData> {
+    template<typename Stream>
+    msgpack::packer<Stream> &operator()(msgpack::packer<Stream> &o,
+                                        blender::bke::internal::EmptyExtraData /*unused*/) const
+    {
+      o.pack_array(1);
+
+      o.pack("EmptyExtraData");
+
+      return o;
+    }
+  };
+
   }  // namespace adaptor
 }  // MSGPACK_API_VERSION_NAMESPACE(MSGPACK_DEFAULT_API_NS)
 }  // namespace msgpack
diff --git a/source/blender/blenkernel/intern/cloth_remesh.cc b/source/blender/blenkernel/intern/cloth_remesh.cc
index 91fa6c6d212..6cebc346095 100644
--- a/source/blender/blenkernel/intern/cloth_remesh.cc
+++ b/source/blender/blenkernel/intern/cloth_remesh.cc
@@ -642,8 +642,9 @@ MSGPACK_API_VERSION_NAMESPACE(MSGPACK_DEFAULT_API_NS)
     msgpack::packer<Stream> &operator()(msgpack::packer<Stream> &o,
                                         const blender::bke::internal::NodeData<T> &v) const
     {
-      o.pack_array(1);
+      o.pack_array(2);
 
+      o.pack(std::string("node_data"));
       o.pack(v.get_extra_data());
 
       return o;
@@ -655,8 +656,9 @@ MSGPACK_API_VERSION_NAMESPACE(MSGPACK_DEFAULT_API_NS)
     msgpack::packer<Stream> &operator()(msgpack::packer<Stream> &o,
                                         const blender::bke::internal::ClothNodeData &v) const
     {
-      o.pack_array(1);
+      o.pack_array(2);
 
+      o.pack(std::string("cloth_node_data"));
       o.pack(v.get_cloth_node_data());
 
       return o;
@@ -668,8 +670,9 @@ MSGPACK_API_VERSION_NAMESPACE(MSGPACK_DEFAULT_API_NS)
     msgpack::packer<Stream> &operator()(msgpack::packer<Stream> &o,
                                         const blender::bke::internal::VertData &v) const
     {
-      o.pack_array(2);
+      o.pack_array(3);
 
+      o.pack(std::string("vert_data"));
       o.pack(v.get_sizing());
       o.pack(v.get_flag());
 
@@ -682,8 +685,9 @@ MSGPACK_API_VERSION_NAMESPACE(MSGPACK_DEFAULT_API_NS)
     msgpack::packer<Stream> &operator()(msgpack::packer<Stream> &o,
                                         const blender::bke::internal::EdgeData &v) const
     {
-      o.pack_array(1);
+      o.pack_array(2);
 
+      o.pack(std::string("edge_data"));
       o.pack(v.get_size());
 
       return o;
@@ -711,8 +715,9 @@ MSGPACK_API_VERSION_NAMESPACE(MSGPACK_DEFAULT_API_NS)
     msgpack::packer<Stream> &operator()(msgpack::packer<Stream> &o,
                                         const blender::bke::internal::Sizing &v) const
     {
-      o.pack_array(1);
+      o.pack_array(2);
 
+      o.pack(std::string("sizing"));
       o.pack(v.get_m());
 
       return o;



More information about the Bf-blender-cvs mailing list