Disable thread-unsafe EditorProgress for navmesh baking

Disables navmesh baking EditorProgress for now until fixed as EditorProgress is not thread-safe and uses hacks and Main::iteration() for steps which can result in random crashes when baking navmesh.

(cherry picked from commit 24bb0af4a9ae7d2c9f56c20f3d3c6a4568fc9bf5)
This commit is contained in:
smix8 2022-06-22 00:49:02 +02:00 committed by Relintai
parent fef163cd57
commit 149baac627

View File

@ -490,7 +490,14 @@ void NavigationMeshGenerator::bake(Ref<NavigationMesh> p_nav_mesh, Node *p_node)
ERR_FAIL_COND_MSG(!p_nav_mesh.is_valid(), "Invalid Navigation Mesh"); ERR_FAIL_COND_MSG(!p_nav_mesh.is_valid(), "Invalid Navigation Mesh");
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
EditorProgress *ep(NULL); EditorProgress *ep(nullptr);
// FIXME
#endif
#if 0
// After discussion on devchat disabled EditorProgress for now as it is not thread-safe and uses hacks and Main::iteration() for steps.
// EditorProgress randomly crashes the Engine when the bake function is used with a thread e.g. inside Editor with a tool script and procedural navigation
// This was not a problem in older versions as previously Godot was unable to (re)bake NavigationMesh at runtime.
// If EditorProgress is fixed and made thread-safe this should be enabled again.
if (Engine::get_singleton()->is_editor_hint()) { if (Engine::get_singleton()->is_editor_hint()) {
ep = memnew(EditorProgress("bake", TTR("Navigation Mesh Generator Setup:"), 11)); ep = memnew(EditorProgress("bake", TTR("Navigation Mesh Generator Setup:"), 11));
} }