Don't schedule loadings when streaming is disabled, don't crash when it still happens, log an error instead

This commit is contained in:
Marc Gilleron 2021-09-19 23:10:40 +01:00
parent 2ffc805c77
commit 0838cab251
2 changed files with 6 additions and 6 deletions

View File

@ -40,6 +40,7 @@ Ongoing development - `master`
- `VoxelMesherTransvoxel`: no longer crashes when the input buffer is not cubic
- `VoxelLodTerrain`: fixed errors and crashes when editing voxels near loading borders
- `VoxelLodTerrain`: fixed crash occurring after a few edits when LOD count is set to 1
- `VoxelLodTerrain`: fixed crash when `run stream in editor` is turned off while the terrain is loading in editor
- `VoxelTool` channel no longer defaults to 7 when using `get_voxel_tool` from a terrain with a stream assigned. Instead it picks first used channel of the mesher (fallback order is mesher, then generator, then stream).
- `VoxelInstancer`: fixed error when node visibility changes
- `VoxelInstancer`: fixed no instances generated when density is 1 in vertex emission mode

View File

@ -1106,8 +1106,7 @@ void VoxelLodTerrain::_process(float delta) {
// Eliminate pending blocks that aren't needed
// This vector must be empty at this point.
// Let's assert so it will pop on your face the day that assumption changes
CRASH_COND(!lod.blocks_to_load.empty());
ERR_FAIL_COND(!lod.blocks_to_load.empty());
if (prev_box != new_box) {
VOXEL_PROFILE_SCOPE_NAMED("Unload data");
@ -1317,8 +1316,11 @@ void VoxelLodTerrain::_process(float delta) {
CRASH_COND(_blocks_pending_transition_update.size() != 0);
const bool stream_enabled = (_stream.is_valid() || _generator.is_valid()) &&
(Engine::get_singleton()->is_editor_hint() == false || _run_stream_in_editor);
// Find which blocks we need to load and see, within each octree
{
if (stream_enabled) {
VOXEL_PROFILE_SCOPE_NAMED("Update octrees");
// TODO Maintain a vector to make iteration faster?
@ -1464,9 +1466,6 @@ void VoxelLodTerrain::_process(float delta) {
_stats.time_detect_required_blocks = profiling_clock.restart();
const bool stream_enabled = (_stream.is_valid() || _generator.is_valid()) &&
(Engine::get_singleton()->is_editor_hint() == false || _run_stream_in_editor);
// It's possible the user didn't set a stream yet, or it is turned off
if (stream_enabled) {
send_block_data_requests();