AcademySoftwareFoundation / openvdb

OpenVDB - Sparse volume data structure and tools
http://www.openvdb.org/
Mozilla Public License 2.0
2.62k stars 647 forks source link

Cleanup several aspects of the Python bindings (copy of PR #1693) #1696

Closed kmuseth closed 11 months ago

kmuseth commented 11 months ago

Copy of PR#1693 by @matthewdcong

This MR cleans up several aspects of the pybind11 Python bindings. It's intended to have no change in outward user-facing functionality, but provides future-proofing for the bindings as pybind11 evolves.

The redundant explicit bindings for the Math types have been removed. These are not used (and should not be exposed) since we have typecasters implemented for the functionality which take precedence. Implemented type casters for TypedMetadata. This means that Vec3SMetadata values in the MetaMap will call the Vec3SMetadata type caster which will subsequently call the Vec3f typecaster resulting in re-usable functionality. This also enables us to pass TypedMetadata values between C++ and Python more explicitly. Removed Python 2 support Switched from obj.cast() to the equivalent but preferred py::cast(obj).