VDBObject bindings : Adapt for OpenVDB 12#1531
Open
murraystevenson wants to merge 3 commits intoImageEngine:mainfrom
Open
VDBObject bindings : Adapt for OpenVDB 12#1531murraystevenson wants to merge 3 commits intoImageEngine:mainfrom
murraystevenson wants to merge 3 commits intoImageEngine:mainfrom
Conversation
This ends up quite similar to the existing PyBindConverter class, but the trick is the need to initialise the nanobind internals before use. Nanobind keeps a type registry that is initialised by the `NB_MODULE` macro which expands to include a call to `nanobind::detail::nb_module_exec()` which performs the initialisation. As the point of our converter is to call `nanobind::cast()` from within a `BOOST_PYTHON_MODULE` rather than a `NB_MODULE`, we first have to manually call `nanobind::detail::nb_module_exec()` ourselves to ensure the nanobind internals are initialised before we attempt to cast. Otherwise nanobind::cast() will attempt to look up into an invalid or null type registry and crash. It's a little unfortunate to be calling into `nanobind::detail`, but there appears to be no other way of doing this...
OpenVDB 12 switched from PyBind11 to Nanobind for its bindings, so we now provide three different ways of binding...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
OpenVDB 12 switched from PyBind11 to Nanobind for its bindings, so VDBObject needs another update to support the change. Rather than maintain three sets of bindings, I've gone ahead and removed the Boost bindings required for OpenVDB <= 10.0 in the last commit, but this could be dropped if there's a compelling argument for keeping it...
This should unlock the final part of the VFX Platform 2025 update.