diff options
-rw-r--r-- | doc/classes/ProjectSettings.xml | 3 | ||||
-rw-r--r-- | modules/navigation/3d/nav_mesh_generator_3d.cpp | 13 | ||||
-rw-r--r-- | servers/navigation_server_3d.cpp | 1 |
3 files changed, 12 insertions, 5 deletions
diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index 98e8939c3f..d39722cdd0 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -2082,6 +2082,9 @@ <member name="navigation/baking/thread_model/baking_use_multiple_threads" type="bool" setter="" getter="" default="true"> If enabled the async navmesh baking uses multiple threads. </member> + <member name="navigation/baking/use_crash_prevention_checks" type="bool" setter="" getter="" default="true"> + If enabled, and baking would potentially lead to an engine crash, the baking will be interrupted and an error message with explanation will be raised. + </member> <member name="network/limits/debugger/max_chars_per_second" type="int" setter="" getter="" default="32768"> Maximum number of characters allowed to send as output from the debugger. Over this value, content is dropped. This helps not to stall the debugger connection. </member> diff --git a/modules/navigation/3d/nav_mesh_generator_3d.cpp b/modules/navigation/3d/nav_mesh_generator_3d.cpp index b3391398a6..8b43eba080 100644 --- a/modules/navigation/3d/nav_mesh_generator_3d.cpp +++ b/modules/navigation/3d/nav_mesh_generator_3d.cpp @@ -750,11 +750,14 @@ void NavMeshGenerator3D::generator_bake_from_source_geometry_data(Ref<Navigation rcCalcGridSize(cfg.bmin, cfg.bmax, cfg.cs, &cfg.width, &cfg.height); // ~30000000 seems to be around sweetspot where Editor baking breaks - if ((cfg.width * cfg.height) > 30000000) { - WARN_PRINT("NavigationMesh baking process will likely fail." - "\nSource geometry is suspiciously big for the current Cell Size and Cell Height in the NavMesh Resource bake settings." - "\nIf baking does not fail, the resulting NavigationMesh will create serious pathfinding performance issues." - "\nIt is advised to increase Cell Size and/or Cell Height in the NavMesh Resource bake settings or reduce the size / scale of the source geometry."); + if ((cfg.width * cfg.height) > 30000000 && GLOBAL_GET("navigation/baking/use_crash_prevention_checks")) { + ERR_FAIL_MSG("Baking interrupted." + "\nNavigationMesh baking process would likely crash the engine." + "\nSource geometry is suspiciously big for the current Cell Size and Cell Height in the NavMesh Resource bake settings." + "\nIf baking does not crash the engine or fail, the resulting NavigationMesh will create serious pathfinding performance issues." + "\nIt is advised to increase Cell Size and/or Cell Height in the NavMesh Resource bake settings or reduce the size / scale of the source geometry." + "\nIf you would like to try baking anyway, disable the 'navigation/baking/use_crash_prevention_checks' project setting."); + return; } bake_state = "Creating heightfield..."; // step #3 diff --git a/servers/navigation_server_3d.cpp b/servers/navigation_server_3d.cpp index a8e36a615f..c12659fe7a 100644 --- a/servers/navigation_server_3d.cpp +++ b/servers/navigation_server_3d.cpp @@ -235,6 +235,7 @@ NavigationServer3D::NavigationServer3D() { GLOBAL_DEF("navigation/avoidance/thread_model/avoidance_use_multiple_threads", true); GLOBAL_DEF("navigation/avoidance/thread_model/avoidance_use_high_priority_threads", true); + GLOBAL_DEF("navigation/baking/use_crash_prevention_checks", true); GLOBAL_DEF("navigation/baking/thread_model/baking_use_multiple_threads", true); GLOBAL_DEF("navigation/baking/thread_model/baking_use_high_priority_threads", true); |