From f27cd94a0c60f0fac87b7736d0b3a18488ed2d4d Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 31 Dec 2024 17:44:27 +0100 Subject: [PATCH] OpenVDB: Support build without delay loading --- extern/mantaflow/preprocessed/fileio/iovdb.cpp | 2 ++ intern/cycles/hydra/field.cpp | 2 ++ source/blender/blenkernel/intern/volume_grid_file_cache.cc | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/extern/mantaflow/preprocessed/fileio/iovdb.cpp b/extern/mantaflow/preprocessed/fileio/iovdb.cpp index 1846ef7ecbb..4b7463782da 100644 --- a/extern/mantaflow/preprocessed/fileio/iovdb.cpp +++ b/extern/mantaflow/preprocessed/fileio/iovdb.cpp @@ -599,7 +599,9 @@ int readObjectsVDB(const string &filename, std::vector *objects, floa registerCustomCodecs(); try { +#ifdef OPENVDB_USE_DELAYED_LOADING file.setCopyMaxBytes(0); +#endif file.open(); gridsVDB = *(file.getGrids()); openvdb::MetaMap::Ptr metadata = file.getMetadata(); diff --git a/intern/cycles/hydra/field.cpp b/intern/cycles/hydra/field.cpp index 284b1e9925c..1ed16a28c8a 100644 --- a/intern/cycles/hydra/field.cpp +++ b/intern/cycles/hydra/field.cpp @@ -31,7 +31,9 @@ class HdCyclesVolumeLoader : public VDBImageLoader { const bool delay_load = false; try { openvdb::io::File file(filePath); +# ifdef OPENVDB_USE_DELAYED_LOADING file.setCopyMaxBytes(0); +# endif if (file.open(delay_load)) { grid = file.readGrid(gridName); } diff --git a/source/blender/blenkernel/intern/volume_grid_file_cache.cc b/source/blender/blenkernel/intern/volume_grid_file_cache.cc index ffbd184c521..cc4eab202cf 100644 --- a/source/blender/blenkernel/intern/volume_grid_file_cache.cc +++ b/source/blender/blenkernel/intern/volume_grid_file_cache.cc @@ -89,7 +89,9 @@ static FileCache create_file_cache(const StringRef file_path) /* Disable delay loading and file copying, this has poor performance * on network drives. */ const bool delay_load = false; +# ifdef OPENVDB_USE_DELAYED_LOADING file.setCopyMaxBytes(0); +# endif file.open(delay_load); vdb_grids = *(file.readAllGridMetadata()); file_cache.meta_data = *file.getMetadata(); @@ -185,7 +187,9 @@ static openvdb::GridBase::Ptr load_single_grid_from_disk(const StringRef file_pa const bool delay_load = false; openvdb::io::File file(file_path); +# ifdef OPENVDB_USE_DELAYED_LOADING file.setCopyMaxBytes(0); +# endif file.open(delay_load); return file.readGrid(grid_name); }