Skip to content

Commit

Permalink
Fix error when visualizing the last slice of VoxelMeshSDF
Browse files Browse the repository at this point in the history
  • Loading branch information
Zylann committed Jun 12, 2024
1 parent 30d6b73 commit 044d6bf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions doc/source/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Primarily developped with Godot 4.3.
- Fixed `set_key_cache_enabled(true)` caused nothing to load
- Fixed slow loading when the database path contains `res:https://` or `user:https://`
- `VoxelInstancer`: Fixed instances with LOD > 0 were generated on `VoxelTerrain` even though LOD isn't supported (ending up in weird positions). No instances should generate.
- `VoxelMeshSDF`: Fixed error in the editor when trying to visualize the last slice (which turns out to be off by 1)
- `VoxelModifierMesh`: Fixed setting `isolevel` had no effect

- Breaking changes
Expand Down
6 changes: 3 additions & 3 deletions editor/mesh_sdf/voxel_mesh_sdf_viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ void VoxelMeshSDFViewer::_on_slice_spinbox_value_changed(float value) {
if (_slice_spinbox_ignored) {
return;
}
int slice_y = value;
const int slice_y = value;
ZN_ASSERT_RETURN(_mesh_sdf.is_valid() && _mesh_sdf->is_baked());
ZN_ASSERT_RETURN(slice_y >= 0 && slice_y < _mesh_sdf->get_voxel_buffer()->get_size().y);
_slice_y = value;
_slice_y = slice_y;
update_view();
}

Expand Down Expand Up @@ -151,7 +151,7 @@ void VoxelMeshSDFViewer::update_slice_spinbox() {
_slice_spinbox->set_editable(true);
_slice_spinbox->set_min(0);
Ref<godot::VoxelBuffer> vb = _mesh_sdf->get_voxel_buffer();
_slice_spinbox->set_max(vb->get_size().y);
_slice_spinbox->set_max(vb->get_size().y - 1);
_slice_spinbox->set_step(1);
_slice_spinbox->set_value(_slice_y);

Expand Down

0 comments on commit 044d6bf

Please sign in to comment.