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:
authorErik <ecke101@gmail.com>2022-06-20 21:12:44 +0300
committerErik <ecke101@gmail.com>2022-06-20 21:12:44 +0300
commit522dcc54af3564d30cf0db3ec277a14c6c7046e6 (patch)
tree10e1de63216975faeb0a6e7c4ceb6eb2d9d968c3
parent9f8cc1bc349cb3e48af71e95b60693dfccfe2c82 (diff)
Fix T94969: Crash in Volume to Mesh with 0 voxels
Checks if voxel amount or -size is <= 0 and if so, returns early. Differential Revision: https://developer.blender.org/D15241
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_volume_to_mesh.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_volume_to_mesh.cc b/source/blender/nodes/geometry/nodes/node_geo_volume_to_mesh.cc
index 8770fa2b74b..e1d1c67b8c8 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_volume_to_mesh.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_volume_to_mesh.cc
@@ -153,6 +153,16 @@ static Mesh *create_mesh_from_volume(GeometrySet &geometry_set, GeoNodeExecParam
}
const bke::VolumeToMeshResolution resolution = get_resolution_param(params);
+
+ if (resolution.mode == VOLUME_TO_MESH_RESOLUTION_MODE_VOXEL_SIZE &&
+ resolution.settings.voxel_size <= 0.0f) {
+ return nullptr;
+ }
+ if (resolution.mode == VOLUME_TO_MESH_RESOLUTION_MODE_VOXEL_AMOUNT &&
+ resolution.settings.voxel_amount <= 0) {
+ return nullptr;
+ }
+
const Main *bmain = DEG_get_bmain(params.depsgraph());
BKE_volume_load(volume, bmain);