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

Add non-const overload for Root::Model() getter #1524

Merged
merged 3 commits into from
Jan 6, 2025

Conversation

jwnimmer-tri
Copy link
Contributor

@jwnimmer-tri jwnimmer-tri commented Dec 31, 2024

🎉 New feature

Closes (N/A).

Summary

Adds a non-const overload for Root::Model() getter. This is consistent with the getters for World which also overload on const-ness.

Test it

Explain how reviewers can test this new feature manually.

There are automated unit tests. Manual testing is unnecessary.

Checklist

  • Signed all commits for DCO
  • Added tests
  • (N/A) Added example and/or tutorial
  • (N/A) Updated documentation (as needed)
  • (N/A) Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

@github-actions github-actions bot added 🏛️ ionic Gazebo Ionic 🪵 jetty Gazebo Jetty labels Dec 31, 2024
This is consistent with the getters for World which also overload on
const-ness.

Co-authored-by: Sean Curtis <[email protected]>

Signed-off-by: Jeremy Nimmer <[email protected]>
@@ -83,7 +83,7 @@ void defineRoot(pybind11::object module)
"Get a world based on an index.")
.def("world_name_exists", &sdf::Root::WorldNameExists,
"Get whether a world name exists.")
.def("model", &sdf::Root::Model,
.def("model", pybind11::overload_cast<sdf::Model *>(&sdf::Root::Model),
Copy link
Member

Choose a reason for hiding this comment

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

there are build failures related to this line. In the binding for World::PhysicsByIndex, the template argument to pybind11::overload_cast is uint64_t, which matches the input argument to that function not its return type. Maybe try reverting this line?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! I added the overload_cast because it has a (different) compilation error without it, but indeed I spelled it wrong. I pushed a tweak that fixes the build now (just remove the template argument).

Signed-off-by: Jeremy Nimmer <[email protected]>
@ahcorde ahcorde merged commit eef861d into gazebosim:sdf15 Jan 6, 2025
15 checks passed
@jwnimmer-tri jwnimmer-tri deleted the model-get-mutable branch January 6, 2025 14:35
Copy link
Member

@scpeters scpeters left a comment

Choose a reason for hiding this comment

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

thanks for these contributions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏛️ ionic Gazebo Ionic 🪵 jetty Gazebo Jetty
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants