diff options
Diffstat (limited to 'intern/openvdb/intern/openvdb_dense_convert.h')
-rw-r--r-- | intern/openvdb/intern/openvdb_dense_convert.h | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/intern/openvdb/intern/openvdb_dense_convert.h b/intern/openvdb/intern/openvdb_dense_convert.h index 284fd1ceeae..7882cafa06e 100644 --- a/intern/openvdb/intern/openvdb_dense_convert.h +++ b/intern/openvdb/intern/openvdb_dense_convert.h @@ -40,6 +40,10 @@ namespace internal { +/* Verify that the name does not correspond to the old format, in which case we + * need to replace the '_low' ending with ' low'. See T53802. */ +openvdb::Name do_name_versionning(const openvdb::Name &name); + openvdb::Mat4R convertMatrix(const float mat[4][4]); template <typename GridType, typename T> @@ -87,13 +91,19 @@ void OpenVDB_import_grid( { using namespace openvdb; - if (!reader->hasGrid(name)) { - std::fprintf(stderr, "OpenVDB grid %s not found in file!\n", name.c_str()); - memset(*data, 0, sizeof(T) * res[0] * res[1] * res[2]); - return; + openvdb::Name temp_name = name; + + if (!reader->hasGrid(temp_name)) { + temp_name = do_name_versionning(temp_name); + + if (!reader->hasGrid(temp_name)) { + std::fprintf(stderr, "OpenVDB grid %s not found in file!\n", temp_name.c_str()); + memset(*data, 0, sizeof(T) * res[0] * res[1] * res[2]); + return; + } } - typename GridType::Ptr grid = gridPtrCast<GridType>(reader->getGrid(name)); + typename GridType::Ptr grid = gridPtrCast<GridType>(reader->getGrid(temp_name)); typename GridType::ConstAccessor acc = grid->getConstAccessor(); math::Coord xyz; |