Fix Editor crash when MeshLibrary gets replaced while used in an open GridMap scene

(cherry picked from commit d6805e8c33)
This commit is contained in:
smix8 2022-10-09 17:19:26 +02:00 committed by Haoyu Qiu
parent d08b312984
commit 5476554d5e
1 changed files with 6 additions and 4 deletions

View File

@ -561,11 +561,13 @@ bool GridMap::_octant_update(const OctantKey &p_key) {
NavigationServer::get_singleton()->region_set_navigation_layers(region, navigation_layers); NavigationServer::get_singleton()->region_set_navigation_layers(region, navigation_layers);
NavigationServer::get_singleton()->region_set_navmesh(region, navmesh); NavigationServer::get_singleton()->region_set_navmesh(region, navmesh);
NavigationServer::get_singleton()->region_set_transform(region, get_global_transform() * nm.xform); NavigationServer::get_singleton()->region_set_transform(region, get_global_transform() * nm.xform);
if (is_inside_tree()) {
if (navigation) { if (navigation) {
NavigationServer::get_singleton()->region_set_map(region, navigation->get_rid()); NavigationServer::get_singleton()->region_set_map(region, navigation->get_rid());
} else { } else {
NavigationServer::get_singleton()->region_set_map(region, get_world()->get_navigation_map()); NavigationServer::get_singleton()->region_set_map(region, get_world()->get_navigation_map());
} }
}
nm.region = region; nm.region = region;
// add navigation debugmesh visual instances if debug is enabled // add navigation debugmesh visual instances if debug is enabled