diff options
author | Julian Eisel <julian@blender.org> | 2020-07-01 18:13:57 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2020-07-01 18:13:57 +0300 |
commit | 0829cebeb024095c268f190c34daa8ae9a5a224c (patch) | |
tree | 12ee5a4a1c2a32e12eff47c8eb9bb0ed217791c1 /extern/mantaflow/preprocessed/grid.cpp | |
parent | cfde6ebf450594faa57c4bfeaecff10fe512c91b (diff) | |
parent | 42be3964eb201180f6b0fa1ff6ce43b8c3845bc2 (diff) |
Merge branch 'master' into asset-uuid--archivedasset-uuid--archived
Diffstat (limited to 'extern/mantaflow/preprocessed/grid.cpp')
-rw-r--r-- | extern/mantaflow/preprocessed/grid.cpp | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/extern/mantaflow/preprocessed/grid.cpp b/extern/mantaflow/preprocessed/grid.cpp index 0ea3afb91f4..76716beb1ac 100644 --- a/extern/mantaflow/preprocessed/grid.cpp +++ b/extern/mantaflow/preprocessed/grid.cpp @@ -122,48 +122,52 @@ template<class T> void Grid<T>::swap(Grid<T> &other) mData = dswap; } -template<class T> void Grid<T>::load(string name) +template<class T> int Grid<T>::load(string name) { if (name.find_last_of('.') == string::npos) errMsg("file '" + name + "' does not have an extension"); string ext = name.substr(name.find_last_of('.')); if (ext == ".raw") - readGridRaw(name, this); + return readGridRaw(name, this); else if (ext == ".uni") - readGridUni(name, this); + return readGridUni(name, this); else if (ext == ".vol") - readGridVol(name, this); + return readGridVol(name, this); else if (ext == ".npz") - readGridNumpy(name, this); -#if OPENVDB == 1 - else if (ext == ".vdb") - readGridVDB(name, this); -#endif // OPENVDB==1 + return readGridNumpy(name, this); + else if (ext == ".vdb") { + std::vector<PbClass *> grids; + grids.push_back(this); + return readObjectsVDB(name, &grids); + } else errMsg("file '" + name + "' filetype not supported"); + return 0; } -template<class T> void Grid<T>::save(string name) +template<class T> int Grid<T>::save(string name) { if (name.find_last_of('.') == string::npos) errMsg("file '" + name + "' does not have an extension"); string ext = name.substr(name.find_last_of('.')); if (ext == ".raw") - writeGridRaw(name, this); + return writeGridRaw(name, this); else if (ext == ".uni") - writeGridUni(name, this); + return writeGridUni(name, this); else if (ext == ".vol") - writeGridVol(name, this); -#if OPENVDB == 1 - else if (ext == ".vdb") - writeGridVDB(name, this); -#endif // OPENVDB==1 + return writeGridVol(name, this); else if (ext == ".npz") - writeGridNumpy(name, this); + return writeGridNumpy(name, this); + else if (ext == ".vdb") { + std::vector<PbClass *> grids; + grids.push_back(this); + return writeObjectsVDB(name, &grids); + } else if (ext == ".txt") - writeGridTxt(name, this); + return writeGridTxt(name, this); else errMsg("file '" + name + "' filetype not supported"); + return 0; } //****************************************************************************** |