diff options
-rw-r--r-- | source/blender/blenkernel/intern/volume.cc | 1 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_volume_to_mesh.cc | 3 |
2 files changed, 4 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/volume.cc b/source/blender/blenkernel/intern/volume.cc index 5e6f0bb42ef..87993695486 100644 --- a/source/blender/blenkernel/intern/volume.cc +++ b/source/blender/blenkernel/intern/volume.cc @@ -1154,6 +1154,7 @@ VolumeGrid *BKE_volume_grid_active_get(const Volume *volume) return BKE_volume_grid_get(volume, index); } +/* Tries to find a grid with the given name. Make sure that that the volume has been loaded. */ VolumeGrid *BKE_volume_grid_find(const Volume *volume, const char *name) { int num_grids = BKE_volume_num_grids(volume); diff --git a/source/blender/modifiers/intern/MOD_volume_to_mesh.cc b/source/blender/modifiers/intern/MOD_volume_to_mesh.cc index 8146c4ca84a..11d30c1f173 100644 --- a/source/blender/modifiers/intern/MOD_volume_to_mesh.cc +++ b/source/blender/modifiers/intern/MOD_volume_to_mesh.cc @@ -45,6 +45,8 @@ #include "BLI_span.hh" #include "BLI_timeit.hh" +#include "DEG_depsgraph_query.h" + #ifdef WITH_OPENVDB # include <openvdb/tools/GridTransformer.h> # include <openvdb/tools/VolumeToMesh.h> @@ -281,6 +283,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * Volume *volume = static_cast<Volume *>(vmmd->object->data); + BKE_volume_load(volume, DEG_get_bmain(ctx->depsgraph)); VolumeGrid *volume_grid = BKE_volume_grid_find(volume, vmmd->grid_name); if (volume_grid == nullptr) { BKE_modifier_set_error(md, "Cannot find '%s' grid", vmmd->grid_name); |