From 9fedcde750bb1f6fbbdc00f8086b12f1fd523231 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Thu, 14 Jul 2022 20:05:14 +0200 Subject: Modifiers: fix mesh to volume modifier on non-volume objects --- source/blender/modifiers/intern/MOD_mesh_to_volume.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'source/blender/modifiers') 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 #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(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, -- cgit v1.2.3