Make NavigationRegion3D baking NavMesh on the main thread not finish deferred
Makes NavigationRegion3D baking NavMesh on the main thread not finish deferred.
(cherry picked from commit bb5f16033d
)
This commit is contained in:
parent
663f45ba4e
commit
605f1c0936
|
@ -273,11 +273,19 @@ void _bake_navigation_mesh(void *p_user_data) {
|
||||||
Ref<NavigationMeshSourceGeometryData3D> source_geometry_data = args->source_geometry_data;
|
Ref<NavigationMeshSourceGeometryData3D> source_geometry_data = args->source_geometry_data;
|
||||||
|
|
||||||
NavigationServer3D::get_singleton()->bake_from_source_geometry_data(nav_mesh, source_geometry_data);
|
NavigationServer3D::get_singleton()->bake_from_source_geometry_data(nav_mesh, source_geometry_data);
|
||||||
|
if (!Thread::is_main_thread()) {
|
||||||
args->nav_region->call_deferred(SNAME("_bake_finished"), nav_mesh);
|
args->nav_region->call_deferred(SNAME("_bake_finished"), nav_mesh);
|
||||||
|
} else {
|
||||||
|
args->nav_region->_bake_finished(nav_mesh);
|
||||||
|
}
|
||||||
memdelete(args);
|
memdelete(args);
|
||||||
} else {
|
} else {
|
||||||
ERR_PRINT("Can't bake the navigation mesh if the `NavigationMesh` resource doesn't exist");
|
ERR_PRINT("Can't bake the navigation mesh if the `NavigationMesh` resource doesn't exist");
|
||||||
|
if (!Thread::is_main_thread()) {
|
||||||
args->nav_region->call_deferred(SNAME("_bake_finished"), Ref<NavigationMesh>());
|
args->nav_region->call_deferred(SNAME("_bake_finished"), Ref<NavigationMesh>());
|
||||||
|
} else {
|
||||||
|
args->nav_region->_bake_finished(Ref<NavigationMesh>());
|
||||||
|
}
|
||||||
memdelete(args);
|
memdelete(args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue