-
New Feature
-
Resolution: Unresolved
-
Medium
-
None
-
None
-
None
We've talked about this before. Most of the OpenVDB points tools currently assume that the Descriptor is shared and we don't even check to make sure.
I propose we improve this by introducing points::isDescriptorShared() and points::checkDescriptorIsShared() with the latter looking something like this:
template <typename TreeT> void checkDescriptorIsShared(const TreeT& tree) { // checks descriptorPtr.use_count() >= tree.leafCount() if (!points::isDescriptorShared(tree, /*strict=*/false)) { OPENVDB_THROW(RuntimeError, "This method requires a shared Descriptor."); } // checks leaf node pointers when asserts enabled assert(points::isDescriptorShared(tree, /*strict=*/true)); }
The strict check will make sure that all the pointers are the same and the fast check will simply test the reference count.