1
1

Modifiers: fix mesh to volume modifier on non-volume objects

This commit is contained in:
2022-07-14 20:05:14 +02:00
parent bdd0ac5bce
commit 9fedcde750

View File

@@ -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,