Moved the create_meshers call from BUILD_PHASE_SETUP to _build. This causes it to run on the main thread. This is the first time I got a crash related to this, also the engine docs suggests that only scenetree manipulation is unsafe from threads, so this might have been caused by something else.

This commit is contained in:
Relintai 2020-07-18 13:12:29 +02:00
parent dee38b1588
commit 18ad178b1e

View File

@ -1158,10 +1158,6 @@ void VoxelChunkDefault::_build_phase(int phase) {
case BUILD_PHASE_DONE:
return;
case BUILD_PHASE_SETUP: {
if (_meshers.size() == 0) {
create_meshers();
}
for (int i = 0; i < _meshers.size(); ++i) {
Ref<VoxelMesher> mesher = _meshers.get(i);
@ -1768,6 +1764,10 @@ void VoxelChunkDefault::_create_meshers() {
void VoxelChunkDefault::_build(bool immediate) {
if (_current_build_phase == BUILD_PHASE_DONE) {
if (_meshers.size() == 0) {
create_meshers();
}
_queued_generation = false;
_build_prioritized = true;