mirror of
https://github.com/Relintai/voxelman.git
synced 2025-01-25 15:09:18 +01:00
Apparently, calling emit signal and set_process_internal form a separate thread is not smart.
This commit is contained in:
parent
3689371503
commit
87d387388c
@ -293,7 +293,6 @@ void VoxelChunkDefault::next_phase() {
|
||||
if (_abort_build) {
|
||||
_current_build_phase = BUILD_PHASE_DONE;
|
||||
_is_generating = false;
|
||||
set_process_internal(false);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -303,13 +302,8 @@ void VoxelChunkDefault::next_phase() {
|
||||
if (_current_build_phase >= _max_build_phases) {
|
||||
_current_build_phase = BUILD_PHASE_DONE;
|
||||
_is_generating = false;
|
||||
set_process_internal(false);
|
||||
|
||||
emit_signal("mesh_generation_finished", this);
|
||||
|
||||
if (_voxel_world != NULL) {
|
||||
_voxel_world->on_chunk_mesh_generation_finished(this);
|
||||
}
|
||||
call_deferred("emit_build_finished");
|
||||
}
|
||||
}
|
||||
|
||||
@ -317,6 +311,14 @@ void VoxelChunkDefault::clear() {
|
||||
_voxel_lights.clear();
|
||||
}
|
||||
|
||||
void VoxelChunkDefault::emit_build_finished() {
|
||||
emit_signal("mesh_generation_finished", this);
|
||||
|
||||
if (_voxel_world != NULL) {
|
||||
_voxel_world->on_chunk_mesh_generation_finished(this);
|
||||
}
|
||||
}
|
||||
|
||||
void VoxelChunkDefault::create_colliders() {
|
||||
ERR_FAIL_COND(_voxel_world == NULL);
|
||||
|
||||
@ -1069,6 +1071,10 @@ void VoxelChunkDefault::_notification(int p_what) {
|
||||
|
||||
} break;
|
||||
case NOTIFICATION_INTERNAL_PROCESS: {
|
||||
if (!get_is_generating()) {
|
||||
set_process_internal(false);
|
||||
}
|
||||
|
||||
if (!get_is_generating() || !has_next_phase() || _build_step_in_progress) {
|
||||
return;
|
||||
}
|
||||
|
@ -209,6 +209,8 @@ public:
|
||||
//free
|
||||
void free_chunk();
|
||||
|
||||
void emit_build_finished();
|
||||
|
||||
VoxelChunkDefault();
|
||||
~VoxelChunkDefault();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user