[Bf-blender-cvs] [9fedcde750b] master: Modifiers: fix mesh to volume modifier on non-volume objects

Jacques Lucke noreply at git.blender.org
Thu Jul 14 20:05:59 CEST 2022


Commit: 9fedcde750bb1f6fbbdc00f8086b12f1fd523231
Author: Jacques Lucke
Date:   Thu Jul 14 20:05:14 2022 +0200
Branches: master
https://developer.blender.org/rB9fedcde750bb1f6fbbdc00f8086b12f1fd523231

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

===================================================================

M	source/blender/modifiers/intern/MOD_mesh_to_volume.cc

===================================================================

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,



More information about the Bf-blender-cvs mailing list