You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-19 14:31:59 +00:00
Various improvements to NavigationMesh generation
* Expose EditorNavigationMeshGenerator as an engine singleton so users can generate navmesehes from `tool` scripts. * Add support for generating navmeshes from static colliders. All collision shapes are supported except for Plane (since Plane is an infinite collider and navmeshes need to have finite geometry). * When using static colliders as a geometry source, a layer mask can be specified to ignore certain colliders. * Don't rely on global transform. It still should give the exact same results but allows for building navmeshes on nodes that are not in the tree (useful in `tool` scripts). * Update navigation gizmos after every new bake. This work has been kindly sponsored by IMVU.
This commit is contained in:
@@ -54,26 +54,28 @@ void NavigationMeshEditor::_notification(int p_option) {
|
||||
}
|
||||
|
||||
void NavigationMeshEditor::_bake_pressed() {
|
||||
button_bake->set_pressed(false);
|
||||
|
||||
ERR_FAIL_COND(!node);
|
||||
const String conf_warning = node->get_configuration_warning();
|
||||
if (!conf_warning.empty()) {
|
||||
err_dialog->set_text(conf_warning);
|
||||
err_dialog->popup_centered_minsize();
|
||||
button_bake->set_pressed(false);
|
||||
return;
|
||||
}
|
||||
|
||||
NavigationMeshGenerator::clear(node->get_navigation_mesh());
|
||||
NavigationMeshGenerator::bake(node->get_navigation_mesh(), node);
|
||||
EditorNavigationMeshGenerator::get_singleton()->clear(node->get_navigation_mesh());
|
||||
EditorNavigationMeshGenerator::get_singleton()->bake(node->get_navigation_mesh(), node);
|
||||
|
||||
node->update_gizmo();
|
||||
if (node) {
|
||||
node->update_gizmo();
|
||||
}
|
||||
}
|
||||
|
||||
void NavigationMeshEditor::_clear_pressed() {
|
||||
|
||||
if (node)
|
||||
NavigationMeshGenerator::clear(node->get_navigation_mesh());
|
||||
EditorNavigationMeshGenerator::get_singleton()->clear(node->get_navigation_mesh());
|
||||
|
||||
button_bake->set_pressed(false);
|
||||
bake_info->set_text("");
|
||||
|
||||
Reference in New Issue
Block a user