Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GUI] Fix display of Visual's scaleV #430

Merged
merged 2 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To keep it compatible if people update mc_rtc without updating the GUI implementations

Suggested change
m.scaleV = config("scaleV");
if(auto scale = config.find("scale"))
{
m.scale = scale->operator<double>();
m.scaleV.setConstant(m.scale);
}
else
{
m.scaleV = config("scaleV");
m.scale = m.scaleV(0);
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m.scale won't exist after the RBDyn PR, so I'm not sure what you are suggesting here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes. I guess we can skip this then release a new version of mc_rtc that does not require scale and then release a version of RBDyn without scale?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes as is it works without updating RBDyn, it's just less confusing not to have both properties in the future ;)

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
Loading