Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/extern
diff options
context:
space:
mode:
authorSebastián Barschkis <sebbas@sebbas.org>2021-01-10 21:08:56 +0300
committerSebastián Barschkis <sebbas@sebbas.org>2021-01-10 21:16:44 +0300
commit5b90ed6c06bf79f41d56666158f660513d8e1f04 (patch)
treef9539a166a5165f6a8aea98db1b651b7d603ce5f /extern
parent544e37190846cc077981f69a15fccf3aa3a590b5 (diff)
Fluid: Fix cache saving issue with OpenVDB IO
Fixes issue where files would not be written when 'resumable' option was checked.
Diffstat (limited to 'extern')
-rw-r--r--extern/mantaflow/preprocessed/fileio/iovdb.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/extern/mantaflow/preprocessed/fileio/iovdb.cpp b/extern/mantaflow/preprocessed/fileio/iovdb.cpp
index 8aca19ade04..3641577beca 100644
--- a/extern/mantaflow/preprocessed/fileio/iovdb.cpp
+++ b/extern/mantaflow/preprocessed/fileio/iovdb.cpp
@@ -423,13 +423,14 @@ int writeObjectsVDB(const string &filename,
if (GridBase *mantaGrid = dynamic_cast<GridBase *>(*iter)) {
- if (clipGrid) {
- assertMsg(clipGrid->getSize() == mantaGrid->getSize(),
- "writeObjectsVDB: Clip grid and exported grid must have the same size");
- }
if (mantaGrid->getType() & GridBase::TypeInt) {
debMsg("Writing int grid '" << mantaGrid->getName() << "' to vdb file " << filename, 1);
Grid<int> *mantaIntGrid = (Grid<int> *)mantaGrid;
+ if (clipGrid && mantaIntGrid->saveSparse()) {
+ assertMsg(clipGrid->getSize() == mantaGrid->getSize(),
+ "writeObjectsVDB: Clip grid and exported grid must have the same size "
+ << clipGrid->getSize() << " vs " << mantaGrid->getSize());
+ }
vdbGrid = exportVDB<int, openvdb::Int32Grid>(mantaIntGrid, clip, vdbClipGrid);
gridsVDB.push_back(vdbGrid);
}
@@ -440,6 +441,11 @@ int writeObjectsVDB(const string &filename,
Grid<Real> *mantaRealGrid = (Grid<Real> *)mantaGrid;
// Only supply clip grid if real grid is not equal to the clip grid
openvdb::FloatGrid::Ptr tmpClipGrid = (mantaRealGrid == clipGrid) ? nullptr : vdbClipGrid;
+ if (clipGrid && mantaRealGrid->saveSparse()) {
+ assertMsg(clipGrid->getSize() == mantaGrid->getSize(),
+ "writeObjectsVDB: Clip grid and exported grid must have the same size "
+ << clipGrid->getSize() << " vs " << mantaGrid->getSize());
+ }
vdbGrid = exportVDB<Real, openvdb::FloatGrid>(mantaRealGrid, clip, tmpClipGrid);
gridsVDB.push_back(vdbGrid);
}
@@ -448,6 +454,11 @@ int writeObjectsVDB(const string &filename,
gClass = (mantaGrid->getType() & GridBase::TypeMAC) ? openvdb::GRID_STAGGERED :
openvdb::GRID_UNKNOWN;
Grid<Vec3> *mantaVec3Grid = (Grid<Vec3> *)mantaGrid;
+ if (clipGrid && mantaVec3Grid->saveSparse()) {
+ assertMsg(clipGrid->getSize() == mantaGrid->getSize(),
+ "writeObjectsVDB: Clip grid and exported grid must have the same size "
+ << clipGrid->getSize() << " vs " << mantaGrid->getSize());
+ }
vdbGrid = exportVDB<Vec3, openvdb::Vec3SGrid>(mantaVec3Grid, clip, vdbClipGrid);
gridsVDB.push_back(vdbGrid);
}