diff options
author | Martin Felke <martin.felke@googlemail.com> | 2019-04-11 16:01:00 +0300 |
---|---|---|
committer | Martin Felke <martin.felke@googlemail.com> | 2019-04-11 16:01:00 +0300 |
commit | 9f371c5ca306d8562fae4ac7c7597e669be71e73 (patch) | |
tree | fc2e12a61abaf802a841b8d24798ec052a859fb4 /intern/openvdb | |
parent | d050badf122b6d14a5b90ca4013bb15593011d15 (diff) |
fix crash with openvdb filters in case the openvdb grid is invalid
invalid can mean the grid is empty or the grid class is not "LevelSet",
happens usually when the volume is empty
Diffstat (limited to 'intern/openvdb')
-rw-r--r-- | intern/openvdb/intern/openvdb_level_set.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/intern/openvdb/intern/openvdb_level_set.cc b/intern/openvdb/intern/openvdb_level_set.cc index c95cbceb10f..0205d142108 100644 --- a/intern/openvdb/intern/openvdb_level_set.cc +++ b/intern/openvdb/intern/openvdb_level_set.cc @@ -91,6 +91,15 @@ void OpenVDBLevelSet::OpenVDB_volume_to_mesh(OpenVDBVolumeToMeshData *mesh, cons } void OpenVDBLevelSet::OpenVDB_level_set_filter(OpenVDBLevelSet_FilterType filter_type, int width, int iterations, int filter_bias){ + + if (!this->grid) { + return; + } + + if (this->grid && this->grid->getGridClass() != openvdb::GRID_LEVEL_SET) { + return; + } + openvdb::tools::LevelSetFilter<openvdb::FloatGrid> filter(*this->grid); filter.setSpatialScheme((openvdb::math::BiasedGradientScheme)filter_bias); switch (filter_type) { |