From fed191fd895c31cfa68c0b60354cb4a4ce5428cd Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Tue, 2 Feb 2021 13:17:38 +0100 Subject: Cleanup: take grid reference instead of shared pointer as parameter This makes the function usable in more contexts. --- source/blender/blenkernel/BKE_volume.h | 2 +- source/blender/blenkernel/intern/volume.cc | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/source/blender/blenkernel/BKE_volume.h b/source/blender/blenkernel/BKE_volume.h index 12c37ec56e0..53626dbeb1b 100644 --- a/source/blender/blenkernel/BKE_volume.h +++ b/source/blender/blenkernel/BKE_volume.h @@ -170,7 +170,7 @@ openvdb::GridBase::Ptr BKE_volume_grid_openvdb_for_write(const struct Volume *vo struct VolumeGrid *grid, const bool clear); -VolumeGridType BKE_volume_grid_type_openvdb(const openvdb::GridBase::Ptr &grid); +VolumeGridType BKE_volume_grid_type_openvdb(const openvdb::GridBase &grid); template auto BKE_volume_grid_type_operation(const VolumeGridType grid_type, OpType &&op) diff --git a/source/blender/blenkernel/intern/volume.cc b/source/blender/blenkernel/intern/volume.cc index d2722adc831..77cfb3ffea5 100644 --- a/source/blender/blenkernel/intern/volume.cc +++ b/source/blender/blenkernel/intern/volume.cc @@ -128,7 +128,7 @@ static struct VolumeFileCache { std::lock_guard lock(mutex); return simplified_grids.lookup_or_add_cb(simplify_level, [&]() { const float resolution_factor = 1.0f / (1 << simplify_level); - const VolumeGridType grid_type = BKE_volume_grid_type_openvdb(grid); + const VolumeGridType grid_type = BKE_volume_grid_type_openvdb(*grid); return BKE_volume_grid_create_with_changed_resolution(grid_type, *grid, resolution_factor); }); } @@ -1237,39 +1237,39 @@ const char *BKE_volume_grid_name(const VolumeGrid *volume_grid) } #ifdef WITH_OPENVDB -VolumeGridType BKE_volume_grid_type_openvdb(const openvdb::GridBase::Ptr &grid) +VolumeGridType BKE_volume_grid_type_openvdb(const openvdb::GridBase &grid) { - if (grid->isType()) { + if (grid.isType()) { return VOLUME_GRID_FLOAT; } - if (grid->isType()) { + if (grid.isType()) { return VOLUME_GRID_VECTOR_FLOAT; } - if (grid->isType()) { + if (grid.isType()) { return VOLUME_GRID_BOOLEAN; } - if (grid->isType()) { + if (grid.isType()) { return VOLUME_GRID_DOUBLE; } - if (grid->isType()) { + if (grid.isType()) { return VOLUME_GRID_INT; } - if (grid->isType()) { + if (grid.isType()) { return VOLUME_GRID_INT64; } - if (grid->isType()) { + if (grid.isType()) { return VOLUME_GRID_VECTOR_INT; } - if (grid->isType()) { + if (grid.isType()) { return VOLUME_GRID_VECTOR_DOUBLE; } - if (grid->isType()) { + if (grid.isType()) { return VOLUME_GRID_STRING; } - if (grid->isType()) { + if (grid.isType()) { return VOLUME_GRID_MASK; } - if (grid->isType()) { + if (grid.isType()) { return VOLUME_GRID_POINTS; } return VOLUME_GRID_UNKNOWN; @@ -1280,7 +1280,7 @@ VolumeGridType BKE_volume_grid_type(const VolumeGrid *volume_grid) { #ifdef WITH_OPENVDB const openvdb::GridBase::Ptr grid = volume_grid->grid(); - return BKE_volume_grid_type_openvdb(grid); + return BKE_volume_grid_type_openvdb(*grid); #else UNUSED_VARS(volume_grid); #endif -- cgit v1.2.3