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

Changed draw_geometries to use default args instead of overload #7097

Merged
merged 2 commits into from
Dec 16, 2024

Conversation

timohl
Copy link
Contributor

@timohl timohl commented Dec 16, 2024

Type

  • Bug fix (non-breaking change which fixes an issue): Fixes #
  • New feature (non-breaking change which adds functionality). Resolves #
  • Breaking change (fix or feature that would cause existing functionality to not work as expected) Resolves #

Motivation and Context

Currently, o3d.visualization.draw_geometries uses overloading to provide default values for lookat, up, front, and zoom.
This causes two problems:

Checklist:

  • I have run python util/check_style.py --apply to apply Open3D code style
    to my code.
  • This PR changes Open3D behavior or adds new functionality.
    • Both C++ (Doxygen) and Python (Sphinx / Google style) documentation is
      updated accordingly.
    • I have added or updated C++ and / or Python unit tests OR included test
      results
      (e.g. screenshots or numbers) here.
  • I will follow up and update the code if CI fails.
  • For fork PRs, I have selected Allow edits from maintainers.

Description

This PR uses utility::optional to provide a single binding function (no overload) with a clean argument list.
The arguments are in line with the cpp implementation (which also uses default args).
This solution avoids named args before positional args.

This is a fix used in #6917 since mypy would complain about non-default argument follows default argument [syntax].

This is in line with the cpp implementation and avoids named args before
positional args.
Copy link

update-docs bot commented Dec 16, 2024

Thanks for submitting this pull request! The maintainers of this repository would appreciate if you could update the CHANGELOG.md based on your changes.

Copy link
Member

@ssheorey ssheorey left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks @timohl !

@ssheorey ssheorey merged commit 8e43455 into isl-org:main Dec 16, 2024
37 of 39 checks passed
fegorsch pushed a commit to fegorsch/Open3D that referenced this pull request Dec 20, 2024
…org#7097)

* Changed lookat, up, front, and zoom to optional args.
This is in line with the cpp implementation and avoids named args before
positional args.
* Removed overload since default args serve this case already
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants