From 2684b766d83aa72aa61f5159a770cb270e8dc099 Mon Sep 17 00:00:00 2001 From: Alexis Duburcq Date: Wed, 20 Nov 2024 17:00:05 +0100 Subject: [PATCH] [core] Fix serialization of geometry meshes. --- core/src/io/serialization.cc | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/core/src/io/serialization.cc b/core/src/io/serialization.cc index 57fdb6491..92e055ed0 100644 --- a/core/src/io/serialization.cc +++ b/core/src/io/serialization.cc @@ -160,14 +160,17 @@ namespace boost::serialization } ar & make_nvp("nodeType", nodeType); -#define UPCAST_FROM_TYPENAME(TYPENAME, CLASS) \ - case hpp::fcl::NODE_TYPE::TYPENAME: \ - if (Archive::is_loading::value) \ - { \ - geom.geometry = std::make_shared(); \ - } \ - ar & make_nvp("geometry", static_cast(*geom.geometry)); \ - break; +#define UPCAST_FROM_TYPENAME(TYPENAME, CLASS) \ + case hpp::fcl::NODE_TYPE::TYPENAME: \ + { \ + if (Archive::is_loading::value) \ + { \ + geom.geometry = std::make_shared(); \ + } \ + auto geometryDerived = std::dynamic_pointer_cast(geom.geometry); \ + ar & make_nvp("geometry", geometryDerived); \ + break; \ + } switch (nodeType) { // clang-format off