Skip to content

Commit

Permalink
Merge pull request #430 from arntanguy/topic/FixScaleV
Browse files Browse the repository at this point in the history
[GUI] Fix display of Visual's scaleV
  • Loading branch information
arntanguy authored Feb 2, 2024
2 parents 585c5db + 81bffd6 commit 15f2b8f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
10 changes: 8 additions & 2 deletions include/mc_rtc/visual_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,20 @@ inline rbd::parsers::Visual makeVisualBox(const Eigen::Vector3d & dim, const mc_
inline constexpr auto getVisualBox = details::getVisualGeometry<rbd::parsers::Geometry::Type::BOX>;

/** 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<rbd::parsers::Geometry::Type::MESH>;

Expand Down
4 changes: 2 additions & 2 deletions src/mc_rbdyn/configuration_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -685,15 +685,15 @@ rbd::parsers::Geometry::Mesh ConfigurationLoader<rbd::parsers::Geometry::Mesh>::
{
rbd::parsers::Geometry::Mesh m;
m.filename = static_cast<std::string>(config("filename"));
m.scale = config("scale");
m.scaleV = config("scaleV");
return m;
}

mc_rtc::Configuration ConfigurationLoader<rbd::parsers::Geometry::Mesh>::save(const rbd::parsers::Geometry::Mesh & m)
{
mc_rtc::Configuration config;
config.add("filename", m.filename);
config.add("scale", m.scale);
config.add("scaleV", m.scaleV);
return config;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/testJsonIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 15f2b8f

Please sign in to comment.