Zylann / godot_voxel

Voxel module for Godot Engine
Other
2.47k stars 230 forks source link

Assertion printed when previewing last VoxelMeshSDF layer in editor #653

Closed Piratux closed 3 weeks ago

Piratux commented 3 weeks ago

Describe the bug When previewing SDF layers of VoxelMeshSDF using a mouse or entering a high value, an assertion is printed to output:

modules\voxel\editor\mesh_sdf\voxel_mesh_sdf_viewer.cpp:115 - Assertion failed: "slice_y >= 0 && slice_y < _mesh_sdf->get_voxel_buffer()->get_size().y" is false.

See video:

https://github.com/Zylann/godot_voxel/assets/58703216/5b935726-ea04-4ab3-82ea-f5a49d1ae9ad

To Reproduce Steps to reproduce the behavior:

  1. Create scene with just VoxelModifierMesh scene.
  2. Create new VoxelMeshSDF in mesh_sdf field of VoxelModifierMesh.
  3. Create new mesh (can be just sphere).
  4. Click Bake.
  5. Above Bake button where input field shows SDF slices, enter 100 (alternatively, use mouse to scroll through values).
  6. See assertion appear.

Expected behavior No assertion should appear in console.

Environment

MRP Test bake layer scroll issue.zip

Zylann commented 3 weeks ago

Fixed in 044d6bffc2a95d03a658bc14091cd4ff92be3037