-
Notifications
You must be signed in to change notification settings - Fork 539
Add Python bindings for meshoptimizer #850
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
base: master
Are you sure you want to change the base?
Conversation
…ify version extraction error handling
…r Windows and macOS
…r clarity and platform-specific support
…y checks and streamline include directory handling
…nd clean up GitHub Actions workflow
…e source file handling; update .gitignore and MANIFEST.in for new structure
…y to generate module file from CMakeLists.txt, and improve memory allocation handling
… file inclusion in setup.py
…dule_file function
Thanks for the PR! Setting expectations: this is a large PR, and I probably won't have enough time to look at this in detail in the next couple weeks as I'm trying to wrap up a few remaining items for a pre-GDC release. It makes sense for Python bindings to exist; meshoptimizer JS bindings are maintained as part of this repository, whereas Rust and .NET bindings are separately developed by other people, but this is more of a historical artifact, so both might be reasonable. For me to maintain these as part of this repository it would help to understand if these are useful for other people; I'm assuming they are useful for you :) but want to confirm this, as while these are fairly lightweight, it's still a lot of extra code to read, understand, and think about for future changes. I only briefly skimmed the patch so a couple high level comments on that front:
|
Gotcha, I actually have another repo called pymeshoptimizer that adds extra functionality. Do you think it would just be a better idea to have meshoptimizer as a Git submodule instead of merging into this repo? |
Sure, I'd be fine with that as well; this makes implementation details highlighted above a little less relevant, and can always be revisited in the future if coordination issues arise or there's more interest in the lower-level access. The submodule approach in a separate repository is the one the Rust bindings take atm. |
This PR introduces complete Python bindings for the meshoptimizer library, allowing Python developers to take advantage of the mesh optimization algorithms directly through a convenient API.
Features
Implementation Details
The bindings are implemented using C types to create a Python module that exposes all the functionality of the C++ library. NumPy arrays are used for data exchange, making it seamless to integrate with existing Python workflows.
All functions follow the same naming convention as the C++ API, with some Python-specific conveniences:
Package Distribution
I've already published this package on PyPI under the name
meshoptimizer
to make it easily accessible to Python users. I'm more than happy to transfer the PyPI ownership to you if you'd like to maintain it going forward.Documentation
Documentation is included in the README.md file, with examples showing how to use all the major features of the library.
Testing
The bindings include comprehensive tests to ensure compatibility with the core C++ library.
Please let me know if you have any questions or if you'd like me to make any changes to the implementation. I'm happy to help with the integration process.