OpenVDB: Support build without delay loading

This commit is contained in:
Brecht Van Lommel
2024-12-31 17:44:27 +01:00
parent d42dd79bdd
commit f27cd94a0c
3 changed files with 8 additions and 0 deletions

View File

@@ -599,7 +599,9 @@ int readObjectsVDB(const string &filename, std::vector<PbClass *> *objects, floa
registerCustomCodecs();
try {
#ifdef OPENVDB_USE_DELAYED_LOADING
file.setCopyMaxBytes(0);
#endif
file.open();
gridsVDB = *(file.getGrids());
openvdb::MetaMap::Ptr metadata = file.getMetadata();

View File

@@ -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);
}

View File

@@ -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);
}