From e5cabaa8dea8e6acea5a3f420064e8d043af3c1b Mon Sep 17 00:00:00 2001 From: Arnaud TANGUY Date: Thu, 1 Feb 2024 18:06:35 +0100 Subject: [PATCH 1/2] [GUI] Fix publishing of Visual scaleV --- src/mc_rbdyn/configuration_io.cpp | 4 ++-- tests/testJsonIO.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mc_rbdyn/configuration_io.cpp b/src/mc_rbdyn/configuration_io.cpp index 53291c6e4d..23282b415d 100644 --- a/src/mc_rbdyn/configuration_io.cpp +++ b/src/mc_rbdyn/configuration_io.cpp @@ -685,7 +685,7 @@ rbd::parsers::Geometry::Mesh ConfigurationLoader:: { rbd::parsers::Geometry::Mesh m; m.filename = static_cast(config("filename")); - m.scale = config("scale"); + m.scaleV = config("scaleV"); return m; } @@ -693,7 +693,7 @@ mc_rtc::Configuration ConfigurationLoader::save(co { mc_rtc::Configuration config; config.add("filename", m.filename); - config.add("scale", m.scale); + config.add("scaleV", m.scaleV); return config; } diff --git a/tests/testJsonIO.cpp b/tests/testJsonIO.cpp index 6f351063df..77bfd33dd3 100644 --- a/tests/testJsonIO.cpp +++ b/tests/testJsonIO.cpp @@ -274,7 +274,7 @@ bool operator==(const Geometry::Sphere & lhs, const Geometry::Sphere & rhs) bool operator==(const Geometry::Mesh & lhs, const Geometry::Mesh & rhs) { - return lhs.filename == rhs.filename && lhs.scale == rhs.scale; + return lhs.filename == rhs.filename && lhs.scaleV == rhs.scaleV; } bool operator==(const Geometry::Superellipsoid & lhs, const Geometry::Superellipsoid & rhs) From 81bffd6eefa0d29396c7ee1440e2565c6ec0796e Mon Sep 17 00:00:00 2001 From: Arnaud TANGUY Date: Fri, 2 Feb 2024 10:56:59 +0100 Subject: [PATCH 2/2] [GUI/Visual] Adapt visual_utils to scale removal --- include/mc_rtc/visual_utils.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/include/mc_rtc/visual_utils.h b/include/mc_rtc/visual_utils.h index ef71f63e8d..e6932855d6 100644 --- a/include/mc_rtc/visual_utils.h +++ b/include/mc_rtc/visual_utils.h @@ -103,14 +103,20 @@ inline rbd::parsers::Visual makeVisualBox(const Eigen::Vector3d & dim, const mc_ inline constexpr auto getVisualBox = details::getVisualGeometry; /** Returns a new Visual that holds a Mesh object */ -inline rbd::parsers::Visual makeVisualMesh(const std::string & path, double scale) +inline rbd::parsers::Visual makeVisualMesh(const std::string & path, Eigen::Vector3d scaleV) { rbd::parsers::Geometry::Mesh m; m.filename = path; - m.scale = scale; + m.scaleV = scaleV; return details::makeVisual(m, {}); } +/** Returns a new Visual that holds a Mesh object */ +inline rbd::parsers::Visual makeVisualMesh(const std::string & path, double scale) +{ + return makeVisualMesh(path, Eigen::Vector3d(scale, scale, scale)); +} + /** Get the mesh data if the visual is a mesh, throws otherwise */ inline constexpr auto getVisualMesh = details::getVisualGeometry;