Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ jobs:
strategy:
matrix:
config:
- { cxx: clang++, image: '2026', abi: '13', build: 'Release', cmake: '-DOPENVDB_USE_FUTURE_ABI_13=ON -DOPENVDB_ENABLE_ASSERTS=ON' }
- { cxx: g++, image: '2026', abi: '13', build: 'Release', cmake: '-DOPENVDB_USE_FUTURE_ABI_13=ON' }
- { cxx: clang++, image: '2026', abi: '13', build: 'Debug', cmake: '-DOPENVDB_USE_FUTURE_ABI_13=ON' }
- { cxx: clang++, image: '2026', abi: '13', build: 'Release', cmake: '-DOPENVDB_ENABLE_ASSERTS=ON -DOPENVDB_ENABLE_TREE_IO=ON' }
- { cxx: g++, image: '2026', abi: '13', build: 'Release', cmake: '' }
- { cxx: clang++, image: '2026', abi: '13', build: 'Debug', cmake: '' }
- { cxx: clang++, image: '2025-clang19.1', abi: '12', build: 'Release', cmake: '' }
- { cxx: clang++, image: '2024-clang17.2', abi: '11', build: 'Release', cmake: '-DDISABLE_DEPENDENCY_VERSION_CHECKS=ON' }
fail-fast: false
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ jobs:
- { name: 'asan', image: '2026', build: 'asan', components: 'core,test', cmake: '-DDISABLE_DEPENDENCY_VERSION_CHECKS=ON -DNANOVDB_USE_OPENVDB=ON -DOPENVDB_AX_STATIC=OFF -DOPENVDB_CORE_STATIC=OFF -DUSE_BLOSC=OFF' } # We never called blosc_destroy(), so disable blosc to silence these errors
- { name: 'ubsan', image: '2026', build: 'ubsan', components: 'core,test', cmake: '-DDISABLE_DEPENDENCY_VERSION_CHECKS=ON -DCMAKE_CXX_FLAGS="-Wno-deprecated-declarations" ' }
- { name: 'c++20', image: '2026', build: 'Release', components: 'core,test', cmake: '-DCMAKE_CXX_STANDARD=20' }
- { name: 'io', image: '2026', build: 'Release', components: 'core,test', cmake: '-DOPENVDB_ENABLE_TREE_IO=ON -DOPENVDB_ENABLE_ASSERTS=ON' }
- { name: 'abi14', image: '2026', build: 'Release', components: 'core,test', cmake: '-DOPENVDB_USE_FUTURE_ABI_14=ON -DOPENVDB_ENABLE_ASSERTS=ON' }
- { name: 'conf', image: '2026', build: 'Release', components: 'core,python,bin,view,render,test', cmake: '-DCMAKE_FIND_PACKAGE_PREFER_CONFIG=ON' }
fail-fast: false
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ option(OPENVDB_BUILD_NANOVDB "Build the NanoVDB library. Turns ON if USE_NANOVDB
# Global options
option(OPENVDB_ENABLE_RPATH "Build with RPATH information" ON)
option(OPENVDB_ENABLE_ASSERTS "Build with asserts in OpenVDB code enabled" OFF)
option(OPENVDB_ENABLE_TREE_IO "Build with Tree I/O functionality enabled" ON)
option(OPENVDB_CXX_STRICT "Enable or disable pre-defined compiler warnings" OFF)
cmake_dependent_option(OPENVDB_INSTALL_CMAKE_MODULES
"Install the provided OpenVDB CMake modules when building the core library"
Expand Down
18 changes: 13 additions & 5 deletions openvdb/openvdb/Grid.h
Original file line number Diff line number Diff line change
Expand Up @@ -448,23 +448,23 @@ class OPENVDB_API GridBase: public MetaMap

/// @brief Read the grid topology from a stream.
/// This will read only the grid structure, not the actual data buffers.
virtual void readTopology(std::istream&) = 0;
virtual void readTopology(std::istream&) = OPENVDB_TREE_IO_VIRTUAL;
/// @brief Write the grid topology to a stream.
/// This will write only the grid structure, not the actual data buffers.
virtual void writeTopology(std::ostream&) const = 0;
virtual void writeTopology(std::ostream&) const = OPENVDB_TREE_IO_VIRTUAL;

/// Read all data buffers for this grid.
virtual void readBuffers(std::istream&) = 0;
virtual void readBuffers(std::istream&) = OPENVDB_TREE_IO_VIRTUAL;
/// Read all of this grid's data buffers that intersect the given index-space bounding box.
virtual void readBuffers(std::istream&, const CoordBBox&) = 0;
virtual void readBuffers(std::istream&, const CoordBBox&) = OPENVDB_TREE_IO_VIRTUAL;

#if OPENVDB_ABI_VERSION_NUMBER < 14
OPENVDB_DEPRECATED_MESSAGE("This method is deprecated and will be removed. Delayed loading is no longer supported.")
virtual void readNonresidentBuffers() const = 0;
#endif

/// Write out all data buffers for this grid.
virtual void writeBuffers(std::ostream&) const = 0;
virtual void writeBuffers(std::ostream&) const = OPENVDB_TREE_IO_VIRTUAL;

/// Read in the transform for this grid.
void readTransform(std::istream& is) { transform().read(is); }
Expand Down Expand Up @@ -928,6 +928,7 @@ class Grid: public GridBase
/// @name I/O
/// @{

#ifdef OPENVDB_ENABLE_TREE_IO
/// @brief Read the grid topology from a stream.
/// This will read only the grid structure, not the actual data buffers.
void readTopology(std::istream&) override;
Expand All @@ -939,14 +940,17 @@ class Grid: public GridBase
void readBuffers(std::istream&) override;
/// Read all of this grid's data buffers that intersect the given index-space bounding box.
void readBuffers(std::istream&, const CoordBBox&) override;
#endif // OPENVDB_ENABLE_TREE_IO

#if OPENVDB_ABI_VERSION_NUMBER < 14
OPENVDB_DEPRECATED_MESSAGE("This method is deprecated and will be removed. Delayed loading is no longer supported.")
void readNonresidentBuffers() const override { }
#endif

#ifdef OPENVDB_ENABLE_TREE_IO
/// Write out all data buffers for this grid.
void writeBuffers(std::ostream&) const override;
#endif // OPENVDB_ENABLE_TREE_IO

/// Output a human-readable description of this grid.
void print(std::ostream& = std::cout, int verboseLevel = 1) const override;
Expand Down Expand Up @@ -1625,6 +1629,8 @@ Grid<TreeT>::evalActiveVoxelDim() const
/// @internal Consider using the stream tagging mechanism (see io::Archive)
/// to specify the float precision, but note that the setting is per-grid.

#ifdef OPENVDB_ENABLE_TREE_IO

template<typename TreeT>
inline void
Grid<TreeT>::readTopology(std::istream& is)
Expand Down Expand Up @@ -1717,6 +1723,8 @@ Grid<TreeT>::writeBuffers(std::ostream& os) const
}
}

#endif // OPENVDB_ENABLE_TREE_IO


//static
template<typename TreeT>
Expand Down
30 changes: 30 additions & 0 deletions openvdb/openvdb/io/Archive.cc
Original file line number Diff line number Diff line change
Expand Up @@ -973,6 +973,17 @@ Archive::readGrid(const GridDescriptor& gd, std::istream& is, const io::ReadOpti
}
grid->setSaveFloatAsHalf(gd.saveFloatAsHalf());

#ifndef OPENVDB_ENABLE_TREE_IO
if (!codec) {
OPENVDB_THROW(IoError,
"No I/O codec found for " << gd.gridType() << ", "
<< "register the codec for this grid type "
<< "(either explicitly or via openvdb::initialize()). "
<< "Note: Tree I/O is deprecated, "
<< "but can be re-enabled by recompiling with CMake OPENVDB_ENABLE_TREE_IO=ON.");
}
#endif

// Stream metadata varies per grid, and it needs to persist
// in case delayed load is in effect.
io::StreamMetadata::Ptr streamMetadata;
Expand Down Expand Up @@ -1005,12 +1016,15 @@ Archive::readGrid(const GridDescriptor& gd, std::istream& is, const io::ReadOpti
if (codec) {
codec->readTopology(is, *codecData, readOptions, diagnostics);
} else {
#ifdef OPENVDB_ENABLE_TREE_IO
grid->readTopology(is);
#endif
}
// read buffers
if (codec) {
codec->readBuffers(is, *codecData, readOptions, diagnostics);
} else {
#ifdef OPENVDB_ENABLE_TREE_IO
const auto& worldBBox = readOptions.clipBBox;
const bool clip = worldBBox.isSorted();
if (clip) {
Expand All @@ -1019,6 +1033,7 @@ Archive::readGrid(const GridDescriptor& gd, std::istream& is, const io::ReadOpti
} else {
grid->readBuffers(is);
}
#endif
}
}

Expand Down Expand Up @@ -1158,6 +1173,17 @@ Archive::writeGrid(GridDescriptor& gd, GridBase::ConstPtr grid,
// Find the codec for the grid type and options.
io::Codec* codec = findCodec(gd.gridType());

#ifndef OPENVDB_ENABLE_TREE_IO
if (!codec) {
OPENVDB_THROW(IoError,
"No I/O codec found for " << gd.gridType() << ", "
<< "register the codec for this grid type "
<< "(either explicitly or via openvdb::initialize()). "
<< "Note: Tree I/O is deprecated, "
<< "but can be re-enabled by recompiling with CMake OPENVDB_ENABLE_TREE_IO=ON.");
}
#endif

// Stream metadata varies per grid, so make a copy of the file-level stream metadata.
io::StreamMetadata::Ptr streamMetadata;
if (io::StreamMetadata::Ptr meta = io::getStreamMetadataPtr(os)) {
Expand Down Expand Up @@ -1204,7 +1230,9 @@ Archive::writeGrid(GridDescriptor& gd, GridBase::ConstPtr grid,
if (codec) {
codec->writeTopology(os, *grid, writeOptions);
} else {
#ifdef OPENVDB_ENABLE_TREE_IO
grid->writeTopology(os);
#endif
}

// Now we know the grid block storage position.
Expand All @@ -1214,7 +1242,9 @@ Archive::writeGrid(GridDescriptor& gd, GridBase::ConstPtr grid,
if (codec) {
codec->writeBuffers(os, *grid, writeOptions);
} else {
#ifdef OPENVDB_ENABLE_TREE_IO
grid->writeBuffers(os);
#endif
}

// Now we know the end position of this grid.
Expand Down
10 changes: 8 additions & 2 deletions openvdb/openvdb/points/PointDataGrid.h
Original file line number Diff line number Diff line change
Expand Up @@ -362,16 +362,18 @@ class PointDataLeafNode : public tree::LeafNode<T, Log2Dim>, io::PointDataGridMu
//@}

// I/O methods

#ifdef OPENVDB_ENABLE_TREE_IO
void readTopology(std::istream& is, bool fromHalf = false);
void writeTopology(std::ostream& os, bool toHalf = false) const;
#endif // OPENVDB_ENABLE_TREE_IO

Index buffers() const;

#ifdef OPENVDB_ENABLE_TREE_IO
void readBuffers(std::istream& is, bool fromHalf = false);
void readBuffers(std::istream& is, const CoordBBox&, bool fromHalf = false);
void writeBuffers(std::ostream& os, bool toHalf = false) const;

#endif // OPENVDB_ENABLE_TREE_IO

Index64 memUsage() const;
OPENVDB_DEPRECATED_MESSAGE("Use memUsage() instead. This method is deprecated and will be removed. Delayed loading is no longer supported.")
Expand Down Expand Up @@ -987,6 +989,7 @@ PointDataLeafNode<T, Log2Dim>::setOffsetOnly(Index offset, const ValueType& val)
this->buffer().setValue(offset, val);
}

#ifdef OPENVDB_ENABLE_TREE_IO
template<typename T, Index Log2Dim>
inline void
PointDataLeafNode<T, Log2Dim>::readTopology(std::istream& is, bool fromHalf)
Expand All @@ -1000,6 +1003,7 @@ PointDataLeafNode<T, Log2Dim>::writeTopology(std::ostream& os, bool toHalf) cons
{
BaseLeaf::writeTopology(os, toHalf);
}
#endif // OPENVDB_ENABLE_TREE_IO

template<typename T, Index Log2Dim>
inline Index
Expand All @@ -1013,6 +1017,7 @@ PointDataLeafNode<T, Log2Dim>::buffers() const
/*cleanup*/ 1);
}

#ifdef OPENVDB_ENABLE_TREE_IO
template<typename T, Index Log2Dim>
inline void
PointDataLeafNode<T, Log2Dim>::readBuffers(std::istream& is, bool fromHalf)
Expand Down Expand Up @@ -1385,6 +1390,7 @@ PointDataLeafNode<T, Log2Dim>::writeBuffers(std::ostream& os, bool toHalf) const
Local::destroyPagedStream(meta->auxData(), attributeIndex);
}
}
#endif // OPENVDB_ENABLE_TREE_IO

template<typename T, Index Log2Dim>
inline Index64
Expand Down
6 changes: 6 additions & 0 deletions openvdb/openvdb/tools/PointIndexGrid.h
Original file line number Diff line number Diff line change
Expand Up @@ -1485,9 +1485,11 @@ struct PointIndexLeafNode : public tree::LeafNode<T, Log2Dim>

// I/O methods

#ifdef OPENVDB_ENABLE_TREE_IO
void readBuffers(std::istream& is, bool fromHalf = false);
void readBuffers(std::istream& is, const CoordBBox&, bool fromHalf = false);
void writeBuffers(std::ostream& os, bool toHalf = false) const;
#endif // OPENVDB_ENABLE_TREE_IO


Index64 memUsage() const;
Expand Down Expand Up @@ -1718,6 +1720,8 @@ PointIndexLeafNode<T, Log2Dim>::isEmpty(const CoordBBox& bbox) const
}


#ifdef OPENVDB_ENABLE_TREE_IO

template<typename T, Index Log2Dim>
inline void
PointIndexLeafNode<T, Log2Dim>::readBuffers(std::istream& is, bool fromHalf)
Expand Down Expand Up @@ -1791,6 +1795,8 @@ PointIndexLeafNode<T, Log2Dim>::writeBuffers(std::ostream& os, bool toHalf) cons
os.write(reinterpret_cast<const char*>(&auxDataBytes), sizeof(Index64));
}

#endif // OPENVDB_ENABLE_TREE_IO


template<typename T, Index Log2Dim>
inline Index64
Expand Down
8 changes: 8 additions & 0 deletions openvdb/openvdb/tree/InternalNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ class InternalNode
/// Mark all values (both tiles and voxels) as active.
void setValuesOn();

#ifdef OPENVDB_ENABLE_TREE_IO
//
// I/O
//
Expand All @@ -463,6 +464,7 @@ class InternalNode
void readBuffers(std::istream&, bool fromHalf = false);
void readBuffers(std::istream&, const CoordBBox&, bool fromHalf = false);

#endif // OPENVDB_ENABLE_TREE_IO

//
// Unsafe methods
Expand Down Expand Up @@ -2388,6 +2390,7 @@ InternalNode<ChildT, Log2Dim>::copyToDense(const CoordBBox& bbox, DenseT& dense)

////////////////////////////////////////

#ifdef OPENVDB_ENABLE_TREE_IO

template<typename ChildT, Index Log2Dim>
inline void
Expand Down Expand Up @@ -2458,6 +2461,7 @@ InternalNode<ChildT, Log2Dim>::readTopology(std::istream& is, bool fromHalf)
}
}

#endif // OPENVDB_ENABLE_TREE_IO

////////////////////////////////////////

Expand Down Expand Up @@ -3213,6 +3217,8 @@ InternalNode<ChildT, Log2Dim>::combine2(const InternalNode& other, const OtherVa
////////////////////////////////////////


#ifdef OPENVDB_ENABLE_TREE_IO

template<typename ChildT, Index Log2Dim>
inline void
InternalNode<ChildT, Log2Dim>::writeBuffers(std::ostream& os, bool toHalf) const
Expand Down Expand Up @@ -3254,6 +3260,8 @@ InternalNode<ChildT, Log2Dim>::readBuffers(std::istream& is,
this->clip(clipBBox, background);
}

#endif // OPENVDB_ENABLE_TREE_IO


////////////////////////////////////////

Expand Down
8 changes: 8 additions & 0 deletions openvdb/openvdb/tree/LeafNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ class LeafNode
const Buffer& buffer() const { return mBuffer; }
Buffer& buffer() { return mBuffer; }

#ifdef OPENVDB_ENABLE_TREE_IO
//
// I/O methods
//
Expand All @@ -403,6 +404,7 @@ class LeafNode
/// @param os the stream to which to write
/// @param toHalf if true, output floating-point values as 16-bit half floats
void writeBuffers(std::ostream& os, bool toHalf = false) const;
#endif // OPENVDB_ENABLE_TREE_IO

size_t streamingSize(bool toHalf = false) const;

Expand Down Expand Up @@ -921,7 +923,9 @@ class LeafNode
void setValueMaskOn(Index n) { mValueMask.setOn(n); }
void setValueMaskOff(Index n) { mValueMask.setOff(n); }

#ifdef OPENVDB_ENABLE_TREE_IO
inline void skipCompressedValues(bool seekable, std::istream&, bool fromHalf);
#endif // OPENVDB_ENABLE_TREE_IO

/// Compute the origin of the leaf node that contains the voxel with the given coordinates.
static void evalNodeOrigin(Coord& xyz) { xyz &= ~(DIM - 1); }
Expand Down Expand Up @@ -1319,6 +1323,8 @@ LeafNode<T, Log2Dim>::copyFromDense(const CoordBBox& bbox, const DenseT& dense,
////////////////////////////////////////


#ifdef OPENVDB_ENABLE_TREE_IO

template<typename T, Index Log2Dim>
inline void
LeafNode<T, Log2Dim>::readTopology(std::istream& is, bool /*fromHalf*/)
Expand Down Expand Up @@ -1433,6 +1439,8 @@ LeafNode<T, Log2Dim>::writeBuffers(std::ostream& os, bool toHalf) const
mValueMask, /*childMask=*/NodeMaskType(), toHalf);
}

#endif // OPENVDB_ENABLE_TREE_IO


////////////////////////////////////////

Expand Down
5 changes: 5 additions & 0 deletions openvdb/openvdb/tree/LeafNodeBool.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ class LeafNode<bool, Log2Dim>
const Buffer& buffer() const { return mBuffer; }
Buffer& buffer() { return mBuffer; }

#ifdef OPENVDB_ENABLE_TREE_IO
//
// I/O methods
//
Expand All @@ -213,6 +214,7 @@ class LeafNode<bool, Log2Dim>
void readBuffers(std::istream& is, const CoordBBox&, bool fromHalf = false);
/// Write out the topology and the origin.
void writeBuffers(std::ostream&, bool toHalf = false) const;
#endif // OPENVDB_ENABLE_TREE_IO

//
// Accessor methods
Expand Down Expand Up @@ -976,6 +978,8 @@ LeafNode<bool, Log2Dim>::offsetToGlobalCoord(Index n) const
////////////////////////////////////////


#ifdef OPENVDB_ENABLE_TREE_IO

template<Index Log2Dim>
inline void
LeafNode<bool, Log2Dim>::readTopology(std::istream& is, bool /*fromHalf*/)
Expand Down Expand Up @@ -1038,6 +1042,7 @@ LeafNode<bool, Log2Dim>::writeBuffers(std::ostream& os, bool /*toHalf*/) const
mBuffer.mData.save(os);
}

#endif // OPENVDB_ENABLE_TREE_IO

////////////////////////////////////////

Expand Down
Loading
Loading