Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2022-07-14 21:05:14 +0300
committerJacques Lucke <jacques@blender.org>2022-07-14 21:05:23 +0300
commit9fedcde750bb1f6fbbdc00f8086b12f1fd523231 (patch)
tree3783c0c4235842f55430fdd4868dea8feedf9f2c
parentbdd0ac5bcebd6deb3d590ada9a3f25c6ddd58ea4 (diff)
Modifiers: fix mesh to volume modifier on non-volume objects
-rw-r--r--source/blender/modifiers/intern/MOD_mesh_to_volume.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/modifiers/intern/MOD_mesh_to_volume.cc b/source/blender/modifiers/intern/MOD_mesh_to_volume.cc
index 01c1875a760..39bd013609b 100644
--- a/source/blender/modifiers/intern/MOD_mesh_to_volume.cc
+++ b/source/blender/modifiers/intern/MOD_mesh_to_volume.cc
@@ -7,6 +7,7 @@
#include <vector>
#include "BKE_geometry_set.hh"
+#include "BKE_lib_id.h"
#include "BKE_lib_query.h"
#include "BKE_mesh_runtime.h"
#include "BKE_mesh_wrapper.h"
@@ -161,7 +162,13 @@ static Volume *mesh_to_volume(ModifierData *md,
mesh_to_own_object_space_transform);
/* Create a new volume. */
- Volume *volume = BKE_volume_new_for_eval(input_volume);
+ Volume *volume;
+ if (input_volume == nullptr) {
+ volume = static_cast<Volume *>(BKE_id_new_nomain(ID_VO, "Volume"));
+ }
+ else {
+ volume = BKE_volume_new_for_eval(input_volume);
+ }
/* Convert mesh to grid and add to volume. */
geometry::volume_grid_add_from_mesh(volume,