Added in NavigationMeshGeneratorDummy and set up initialization.

This commit is contained in:
Relintai 2023-06-03 20:00:42 +02:00
parent 9a35d6c7d3
commit 0a3d1d6cf5
12 changed files with 220 additions and 31 deletions

View File

@ -63,6 +63,8 @@
#include "scene/register_scene_types.h" #include "scene/register_scene_types.h"
#include "scene/resources/packed_scene.h" #include "scene/resources/packed_scene.h"
#include "servers/audio_server.h" #include "servers/audio_server.h"
#include "servers/navigation/navigation_mesh_generator.h"
#include "servers/navigation/navigation_mesh_generator_dummy.h"
#include "servers/navigation_2d_server.h" #include "servers/navigation_2d_server.h"
#include "servers/navigation_server.h" #include "servers/navigation_server.h"
#include "servers/physics_2d_server.h" #include "servers/physics_2d_server.h"
@ -113,6 +115,8 @@ static AudioServer *audio_server = nullptr;
static PhysicsServer *physics_server = nullptr; static PhysicsServer *physics_server = nullptr;
static Physics2DServer *physics_2d_server = nullptr; static Physics2DServer *physics_2d_server = nullptr;
static RenderingServerCallbacks *rendering_server_callbacks = nullptr; static RenderingServerCallbacks *rendering_server_callbacks = nullptr;
static NavigationMeshGeneratorManager *navigation_mesh_generator_manager = nullptr;
static NavigationMeshGenerator *navigation_mesh_generator = nullptr;
static NavigationServer *navigation_server = nullptr; static NavigationServer *navigation_server = nullptr;
static Navigation2DServer *navigation_2d_server = nullptr; static Navigation2DServer *navigation_2d_server = nullptr;
@ -219,6 +223,36 @@ void finalize_physics() {
memdelete(physics_2d_server); memdelete(physics_2d_server);
} }
void initialize_navigation_mesh_generator() {
// Init chosen NavigationMeshGenerator
const String &server_name = GLOBAL_GET(NavigationMeshGeneratorManager::setting_property_name);
navigation_mesh_generator = NavigationMeshGeneratorManager::get_singleton()->new_server(server_name);
// Fall back to default if not found
if (!navigation_mesh_generator) {
// Navigation server not found, so use the default.
navigation_mesh_generator = NavigationMeshGeneratorManager::get_singleton()->new_default_server();
}
// Fall back to dummy if no default server has been registered.
if (!navigation_mesh_generator) {
ERR_PRINT("No NavigationMeshGenerator implementation has been registered! Falling back to a dummy implementation: navigation mesh baking features will be unavailable.");
navigation_mesh_generator = memnew(NavigationMeshGeneratorDummy);
}
if (navigation_mesh_generator) {
// need to register singleton earlier so modules / extensions / addons can use it on SCENE / SERVER init level
Engine::get_singleton()->add_singleton(Engine::Singleton("NavigationMeshGenerator", NavigationMeshGenerator::get_singleton()));
}
ERR_FAIL_NULL_MSG(navigation_mesh_generator, "Failed to initialize NavigationMeshGenerator.");
}
void finalize_navigation_mesh_generator() {
memdelete(navigation_mesh_generator);
navigation_mesh_generator = nullptr;
}
void initialize_navigation_server() { void initialize_navigation_server() {
ERR_FAIL_COND(navigation_server != nullptr); ERR_FAIL_COND(navigation_server != nullptr);
ERR_FAIL_COND(navigation_2d_server != nullptr); ERR_FAIL_COND(navigation_2d_server != nullptr);
@ -434,6 +468,9 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
register_core_settings(); //here globals is present register_core_settings(); //here globals is present
translation_server = memnew(TranslationServer); translation_server = memnew(TranslationServer);
navigation_mesh_generator_manager = memnew(NavigationMeshGeneratorManager);
performance = memnew(Performance); performance = memnew(Performance);
ClassDB::register_class<Performance>(); ClassDB::register_class<Performance>();
engine->add_singleton(Engine::Singleton("Performance", performance)); engine->add_singleton(Engine::Singleton("Performance", performance));
@ -1334,6 +1371,9 @@ error:
if (translation_server) { if (translation_server) {
memdelete(translation_server); memdelete(translation_server);
} }
if (navigation_mesh_generator_manager) {
memdelete(navigation_mesh_generator_manager);
}
if (globals) { if (globals) {
memdelete(globals); memdelete(globals);
} }
@ -1592,6 +1632,7 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
} }
initialize_physics(); initialize_physics();
initialize_navigation_mesh_generator();
initialize_navigation_server(); initialize_navigation_server();
register_server_singletons(); register_server_singletons();
@ -2346,6 +2387,8 @@ bool Main::iteration() {
rendering_server_callbacks->flush(); rendering_server_callbacks->flush();
message_queue->flush(); message_queue->flush();
NavigationMeshGenerator::get_singleton()->process();
RenderingServer::get_singleton()->sync(); //sync if still drawing from previous frames. RenderingServer::get_singleton()->sync(); //sync if still drawing from previous frames.
if (OS::get_singleton()->can_draw() && RenderingServer::get_singleton()->is_render_loop_enabled()) { if (OS::get_singleton()->can_draw() && RenderingServer::get_singleton()->is_render_loop_enabled()) {
@ -2526,6 +2569,7 @@ void Main::cleanup(bool p_force) {
} }
finalize_navigation_server(); finalize_navigation_server();
finalize_navigation_mesh_generator();
OS::get_singleton()->finalize(); OS::get_singleton()->finalize();
finalize_physics(); finalize_physics();
@ -2547,6 +2591,9 @@ void Main::cleanup(bool p_force) {
if (translation_server) { if (translation_server) {
memdelete(translation_server); memdelete(translation_server);
} }
if (navigation_mesh_generator_manager) {
memdelete(navigation_mesh_generator_manager);
}
if (globals) { if (globals) {
memdelete(globals); memdelete(globals);
} }

View File

@ -33,7 +33,7 @@
#include "core/io/marshalls.h" #include "core/io/marshalls.h"
#include "core/io/resource_saver.h" #include "core/io/resource_saver.h"
#include "navigation_mesh_generator.h" //#include "navigation_mesh_generator.h"
#include "scene/3d/mesh_instance.h" #include "scene/3d/mesh_instance.h"
#include "scene/gui/box_container.h" #include "scene/gui/box_container.h"
#include "scene/resources/mesh.h" #include "scene/resources/mesh.h"
@ -43,11 +43,13 @@
#include "scene/gui/dialogs.h" #include "scene/gui/dialogs.h"
void NavigationMeshEditor::_node_removed(Node *p_node) { void NavigationMeshEditor::_node_removed(Node *p_node) {
/*
if (p_node == node) { if (p_node == node) {
node = nullptr; node = nullptr;
hide(); hide();
} }
*/
} }
void NavigationMeshEditor::_notification(int p_option) { void NavigationMeshEditor::_notification(int p_option) {
@ -59,7 +61,7 @@ void NavigationMeshEditor::_notification(int p_option) {
void NavigationMeshEditor::_bake_pressed() { void NavigationMeshEditor::_bake_pressed() {
button_bake->set_pressed(false); button_bake->set_pressed(false);
/*
ERR_FAIL_COND(!node); ERR_FAIL_COND(!node);
if (!node->get_navigation_mesh().is_valid()) { if (!node->get_navigation_mesh().is_valid()) {
err_dialog->set_text(TTR("A NavigationMesh resource must be set or created for this node to work.")); err_dialog->set_text(TTR("A NavigationMesh resource must be set or created for this node to work."));
@ -71,9 +73,11 @@ void NavigationMeshEditor::_bake_pressed() {
NavigationMeshGenerator::get_singleton()->bake(node->get_navigation_mesh(), node); NavigationMeshGenerator::get_singleton()->bake(node->get_navigation_mesh(), node);
node->update_gizmos(); node->update_gizmos();
*/
} }
void NavigationMeshEditor::_clear_pressed() { void NavigationMeshEditor::_clear_pressed() {
/*
if (node) { if (node) {
NavigationMeshGenerator::get_singleton()->clear(node->get_navigation_mesh()); NavigationMeshGenerator::get_singleton()->clear(node->get_navigation_mesh());
} }
@ -84,8 +88,9 @@ void NavigationMeshEditor::_clear_pressed() {
if (node) { if (node) {
node->update_gizmos(); node->update_gizmos();
} }
*/
} }
/*
void NavigationMeshEditor::edit(NavigationMeshInstance *p_nav_mesh_instance) { void NavigationMeshEditor::edit(NavigationMeshInstance *p_nav_mesh_instance) {
if (p_nav_mesh_instance == nullptr || node == p_nav_mesh_instance) { if (p_nav_mesh_instance == nullptr || node == p_nav_mesh_instance) {
return; return;
@ -93,6 +98,7 @@ void NavigationMeshEditor::edit(NavigationMeshInstance *p_nav_mesh_instance) {
node = p_nav_mesh_instance; node = p_nav_mesh_instance;
} }
*/
void NavigationMeshEditor::_bind_methods() { void NavigationMeshEditor::_bind_methods() {
ClassDB::bind_method("_bake_pressed", &NavigationMeshEditor::_bake_pressed); ClassDB::bind_method("_bake_pressed", &NavigationMeshEditor::_bake_pressed);
@ -119,14 +125,14 @@ NavigationMeshEditor::NavigationMeshEditor() {
err_dialog = memnew(AcceptDialog); err_dialog = memnew(AcceptDialog);
add_child(err_dialog); add_child(err_dialog);
node = nullptr; //node = nullptr;
} }
NavigationMeshEditor::~NavigationMeshEditor() { NavigationMeshEditor::~NavigationMeshEditor() {
} }
void NavigationMeshEditorPlugin::edit(Object *p_object) { void NavigationMeshEditorPlugin::edit(Object *p_object) {
navigation_mesh_editor->edit(Object::cast_to<NavigationMeshInstance>(p_object)); //navigation_mesh_editor->edit(Object::cast_to<NavigationMeshInstance>(p_object));
} }
bool NavigationMeshEditorPlugin::handles(Object *p_object) const { bool NavigationMeshEditorPlugin::handles(Object *p_object) const {
@ -135,22 +141,22 @@ bool NavigationMeshEditorPlugin::handles(Object *p_object) const {
void NavigationMeshEditorPlugin::make_visible(bool p_visible) { void NavigationMeshEditorPlugin::make_visible(bool p_visible) {
if (p_visible) { if (p_visible) {
navigation_mesh_editor->show(); //navigation_mesh_editor->show();
navigation_mesh_editor->bake_hbox->show(); //navigation_mesh_editor->bake_hbox->show();
} else { } else {
navigation_mesh_editor->hide(); //navigation_mesh_editor->hide();
navigation_mesh_editor->bake_hbox->hide(); //navigation_mesh_editor->bake_hbox->hide();
navigation_mesh_editor->edit(nullptr); //navigation_mesh_editor->edit(nullptr);
} }
} }
NavigationMeshEditorPlugin::NavigationMeshEditorPlugin(EditorNode *p_node) { NavigationMeshEditorPlugin::NavigationMeshEditorPlugin(EditorNode *p_node) {
editor = p_node; editor = p_node;
navigation_mesh_editor = memnew(NavigationMeshEditor); //navigation_mesh_editor = memnew(NavigationMeshEditor);
editor->get_viewport()->add_child(navigation_mesh_editor); //editor->get_viewport()->add_child(navigation_mesh_editor);
add_control_to_container(CONTAINER_SPATIAL_EDITOR_MENU, navigation_mesh_editor->bake_hbox); //add_control_to_container(CONTAINER_SPATIAL_EDITOR_MENU, navigation_mesh_editor->bake_hbox);
navigation_mesh_editor->hide(); //navigation_mesh_editor->hide();
navigation_mesh_editor->bake_hbox->hide(); //navigation_mesh_editor->bake_hbox->hide();
} }
NavigationMeshEditorPlugin::~NavigationMeshEditorPlugin() { NavigationMeshEditorPlugin::~NavigationMeshEditorPlugin() {

View File

@ -35,7 +35,7 @@
#include "editor/editor_node.h" #include "editor/editor_node.h"
#include "editor/editor_plugin.h" #include "editor/editor_plugin.h"
class NavigationMeshInstance; ///class NavigationMeshInstance;
class NavigationMeshEditor : public Control { class NavigationMeshEditor : public Control {
friend class NavigationMeshEditorPlugin; friend class NavigationMeshEditorPlugin;
@ -49,7 +49,7 @@ class NavigationMeshEditor : public Control {
ToolButton *button_reset; ToolButton *button_reset;
Label *bake_info; Label *bake_info;
NavigationMeshInstance *node; //NavigationMeshInstance *node;
void _bake_pressed(); void _bake_pressed();
void _clear_pressed(); void _clear_pressed();
@ -60,7 +60,7 @@ protected:
void _notification(int p_option); void _notification(int p_option);
public: public:
void edit(NavigationMeshInstance *p_nav_mesh_instance); //void edit(NavigationMeshInstance *p_nav_mesh_instance);
NavigationMeshEditor(); NavigationMeshEditor();
~NavigationMeshEditor(); ~NavigationMeshEditor();
}; };

View File

@ -33,7 +33,7 @@
#include "core/os/mutex.h" #include "core/os/mutex.h"
#ifndef _3D_DISABLED #ifndef _3D_DISABLED
#include "navigation_mesh_generator.h" //#include "navigation_mesh_generator.h"
#include "scene/resources/mesh.h" #include "scene/resources/mesh.h"
#include "scene/resources/navigation_mesh.h" #include "scene/resources/navigation_mesh.h"
#endif #endif
@ -418,8 +418,8 @@ void PandemoniumNavigationServer::region_bake_navmesh(Ref<NavigationMesh> r_mesh
ERR_FAIL_COND(p_node == nullptr); ERR_FAIL_COND(p_node == nullptr);
#ifndef _3D_DISABLED #ifndef _3D_DISABLED
NavigationMeshGenerator::get_singleton()->clear(r_mesh); //NavigationMeshGenerator::get_singleton()->clear(r_mesh);
NavigationMeshGenerator::get_singleton()->bake(r_mesh, p_node); //NavigationMeshGenerator::get_singleton()->bake(r_mesh, p_node);
#endif #endif
} }

View File

@ -38,7 +38,7 @@
#include "servers/navigation_2d_server.h" #include "servers/navigation_2d_server.h"
#ifndef _3D_DISABLED #ifndef _3D_DISABLED
#include "navigation_mesh_generator.h" //#include "navigation_mesh_generator.h"
#endif #endif
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
@ -46,7 +46,7 @@
#endif #endif
#ifndef _3D_DISABLED #ifndef _3D_DISABLED
NavigationMeshGenerator *_nav_mesh_generator = nullptr; //NavigationMeshGenerator *_nav_mesh_generator = nullptr;
#endif #endif
NavigationServer *new_server() { NavigationServer *new_server() {
@ -66,15 +66,15 @@ void register_navigation_types(ModuleRegistrationLevel p_level) {
Navigation2DServerManager::set_default_server("PandemoniumNavigation", 10); Navigation2DServerManager::set_default_server("PandemoniumNavigation", 10);
#ifndef _3D_DISABLED #ifndef _3D_DISABLED
_nav_mesh_generator = memnew(NavigationMeshGenerator); //_nav_mesh_generator = memnew(NavigationMeshGenerator);
ClassDB::register_class<NavigationMeshGenerator>(); //ClassDB::register_class<NavigationMeshGenerator>();
Engine::get_singleton()->add_singleton(Engine::Singleton("NavigationMeshGenerator", NavigationMeshGenerator::get_singleton())); //Engine::get_singleton()->add_singleton(Engine::Singleton("NavigationMeshGenerator", NavigationMeshGenerator::get_singleton()));
#endif #endif
} }
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
if (p_level == MODULE_REGISTRATION_LEVEL_EDITOR) { if (p_level == MODULE_REGISTRATION_LEVEL_EDITOR) {
EditorPlugins::add_by_type<NavigationMeshEditorPlugin>(); //EditorPlugins::add_by_type<NavigationMeshEditorPlugin>();
} }
#endif #endif
} }
@ -82,9 +82,9 @@ void register_navigation_types(ModuleRegistrationLevel p_level) {
void unregister_navigation_types(ModuleRegistrationLevel p_level) { void unregister_navigation_types(ModuleRegistrationLevel p_level) {
#ifndef _3D_DISABLED #ifndef _3D_DISABLED
if (p_level == MODULE_REGISTRATION_LEVEL_SINGLETON) { if (p_level == MODULE_REGISTRATION_LEVEL_SINGLETON) {
if (_nav_mesh_generator) { //if (_nav_mesh_generator) {
memdelete(_nav_mesh_generator); // memdelete(_nav_mesh_generator);
} //}
} }
#endif #endif
} }

View File

@ -31,7 +31,6 @@
#include "navigation_mesh_generator.h" #include "navigation_mesh_generator.h"
#include "core/config/project_settings.h" #include "core/config/project_settings.h"
#include "core/object/func_ref.h"
#include "scene/2d/navigation_geometry_parser_2d.h" #include "scene/2d/navigation_geometry_parser_2d.h"
#ifndef _3D_DISABLED #ifndef _3D_DISABLED

View File

@ -34,6 +34,7 @@
#include "core/containers/rid.h" #include "core/containers/rid.h"
#include "core/object/class_db.h" #include "core/object/class_db.h"
#include "core/object/reference.h" #include "core/object/reference.h"
#include "core/object/func_ref.h"
class Node; class Node;
class NavigationGeometryParser2D; class NavigationGeometryParser2D;

View File

@ -0,0 +1,50 @@
#include "navigation_mesh_generator_dummy.h"
#include "core/config/project_settings.h"
#include "scene/2d/navigation_geometry_parser_2d.h"
#ifndef _3D_DISABLED
#include "scene/3d/navigation_geometry_parser_3d.h"
#endif // _3D_DISABLED
#include "scene/main/node.h"
#include "scene/resources/navigation_mesh.h"
#include "scene/resources/navigation_mesh_source_geometry_data_2d.h"
#ifndef _3D_DISABLED
#include "scene/resources/navigation_mesh_source_geometry_data_3d.h"
#endif // _3D_DISABLED
void NavigationMeshGeneratorDummy::cleanup() {}
void NavigationMeshGeneratorDummy::process() {}
// 2D //////////////////////////////
void NavigationMeshGeneratorDummy::register_geometry_parser_2d(Ref<NavigationGeometryParser2D> p_geometry_parser) {}
void NavigationMeshGeneratorDummy::unregister_geometry_parser_2d(Ref<NavigationGeometryParser2D> p_geometry_parser) {}
Ref<NavigationMeshSourceGeometryData2D> NavigationMeshGeneratorDummy::parse_2d_source_geometry_data(Ref<NavigationPolygon> p_navigation_polygon, Node *p_root_node, Ref<FuncRef> p_callback) {
return Ref<NavigationMeshSourceGeometryData2D>();
}
void NavigationMeshGeneratorDummy::bake_2d_from_source_geometry_data(Ref<NavigationPolygon> p_navigation_polygon, Ref<NavigationMeshSourceGeometryData2D> p_source_geometry_data, Ref<FuncRef> p_callback) {}
void NavigationMeshGeneratorDummy::parse_and_bake_2d(Ref<NavigationPolygon> p_navigation_polygon, Node *p_root_node, Ref<FuncRef> p_callback) {}
bool NavigationMeshGeneratorDummy::is_navigation_polygon_baking(Ref<NavigationPolygon> p_navigation_polygon) const {
return false;
}
// 3D //////////////////////////////
#ifndef _3D_DISABLED
void NavigationMeshGeneratorDummy::register_geometry_parser_3d(Ref<NavigationGeometryParser3D> p_geometry_parser) {}
void NavigationMeshGeneratorDummy::unregister_geometry_parser_3d(Ref<NavigationGeometryParser3D> p_geometry_parser) {}
Ref<NavigationMeshSourceGeometryData3D> NavigationMeshGeneratorDummy::parse_3d_source_geometry_data(Ref<NavigationMesh> p_navigation_mesh, Node *p_root_node, Ref<FuncRef> p_callback) {
return Ref<NavigationMeshSourceGeometryData3D>();
}
void NavigationMeshGeneratorDummy::bake_3d_from_source_geometry_data(Ref<NavigationMesh> p_navigation_mesh, Ref<NavigationMeshSourceGeometryData3D> p_source_geometry_data, Ref<FuncRef> p_callback) {}
void NavigationMeshGeneratorDummy::parse_and_bake_3d(Ref<NavigationMesh> p_navigation_mesh, Node *p_root_node, Ref<FuncRef> p_callback) {}
bool NavigationMeshGeneratorDummy::is_navigation_mesh_baking(Ref<NavigationMesh> p_navigation_mesh) const {
return false;
}
#endif // _3D_DISABLED

View File

@ -0,0 +1,79 @@
#ifndef NAVIGATION_MESH_GENERATOR_DUMMY_H
#define NAVIGATION_MESH_GENERATOR_DUMMY_H
/**************************************************************************/
/* navigation_mesh_generator_dummy.h */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#include "servers/navigation/navigation_mesh_generator.h"
#include "core/object/func_ref.h"
class Node;
class NavigationGeometryParser2D;
class NavigationGeometryParser3D;
class NavigationMeshSourceGeometryData2D;
class NavigationMeshSourceGeometryData3D;
class NavigationPolygon;
class NavigationMesh;
class FuncRef;
class NavigationMeshGeneratorDummy : public NavigationMeshGenerator {
GDCLASS(NavigationMeshGeneratorDummy, NavigationMeshGenerator);
public:
virtual void cleanup();
virtual void process();
// 2D //////////////////////////////
virtual void register_geometry_parser_2d(Ref<NavigationGeometryParser2D> p_geometry_parser);
virtual void unregister_geometry_parser_2d(Ref<NavigationGeometryParser2D> p_geometry_parser);
virtual Ref<NavigationMeshSourceGeometryData2D> parse_2d_source_geometry_data(Ref<NavigationPolygon> p_navigation_polygon, Node *p_root_node, Ref<FuncRef> p_callback = Ref<FuncRef>());
virtual void bake_2d_from_source_geometry_data(Ref<NavigationPolygon> p_navigation_polygon, Ref<NavigationMeshSourceGeometryData2D> p_source_geometry_data, Ref<FuncRef> p_callback = Ref<FuncRef>());
virtual void parse_and_bake_2d(Ref<NavigationPolygon> p_navigation_polygon, Node *p_root_node, Ref<FuncRef> p_callback = Ref<FuncRef>());
virtual bool is_navigation_polygon_baking(Ref<NavigationPolygon> p_navigation_polygon) const;
// 3D //////////////////////////////
#ifndef _3D_DISABLED
virtual void register_geometry_parser_3d(Ref<NavigationGeometryParser3D> p_geometry_parser);
virtual void unregister_geometry_parser_3d(Ref<NavigationGeometryParser3D> p_geometry_parser);
virtual Ref<NavigationMeshSourceGeometryData3D> parse_3d_source_geometry_data(Ref<NavigationMesh> p_navigation_mesh, Node *p_root_node, Ref<FuncRef> p_callback = Ref<FuncRef>());
virtual void bake_3d_from_source_geometry_data(Ref<NavigationMesh> p_navigation_mesh, Ref<NavigationMeshSourceGeometryData3D> p_source_geometry_data, Ref<FuncRef> p_callback = Ref<FuncRef>());
virtual void parse_and_bake_3d(Ref<NavigationMesh> p_navigation_mesh, Node *p_root_node, Ref<FuncRef> p_callback = Ref<FuncRef>());
virtual bool is_navigation_mesh_baking(Ref<NavigationMesh> p_navigation_mesh) const;
#endif // _3D_DISABLED
};
#endif // NAVIGATION_MESH_GENERATOR_DUMMY_H

View File

@ -52,6 +52,7 @@
#include "audio/effects/audio_effect_stereo_enhance.h" #include "audio/effects/audio_effect_stereo_enhance.h"
#include "audio/effects/audio_stream_generator.h" #include "audio/effects/audio_stream_generator.h"
#include "audio_server.h" #include "audio_server.h"
#include "navigation/navigation_mesh_generator.h"
#include "navigation_2d_server.h" #include "navigation_2d_server.h"
#include "navigation_server.h" #include "navigation_server.h"
#include "physics/physics_server_sw.h" #include "physics/physics_server_sw.h"
@ -111,6 +112,8 @@ void register_server_types() {
ClassDB::register_virtual_class<Physics2DServer>(); ClassDB::register_virtual_class<Physics2DServer>();
ClassDB::register_virtual_class<NavigationServer>(); ClassDB::register_virtual_class<NavigationServer>();
ClassDB::register_virtual_class<Navigation2DServer>(); ClassDB::register_virtual_class<Navigation2DServer>();
//ClassDB::register_class<NavigationMeshGeneratorManager>();
ClassDB::register_virtual_class<NavigationMeshGenerator>();
shader_types = memnew(ShaderTypes); shader_types = memnew(ShaderTypes);
@ -191,6 +194,10 @@ void register_server_types() {
PhysicsServerManager::register_server("PandemoniumPhysics", &_createPandemoniumPhysicsCallback); PhysicsServerManager::register_server("PandemoniumPhysics", &_createPandemoniumPhysicsCallback);
PhysicsServerManager::set_default_server("PandemoniumPhysics"); PhysicsServerManager::set_default_server("PandemoniumPhysics");
// Navigation
GLOBAL_DEF(NavigationMeshGeneratorManager::setting_property_name, "DEFAULT");
ProjectSettings::get_singleton()->set_custom_property_info(NavigationMeshGeneratorManager::setting_property_name, PropertyInfo(Variant::STRING, NavigationMeshGeneratorManager::setting_property_name, PROPERTY_HINT_ENUM, "DEFAULT"));
// Navigation 2D // Navigation 2D
GLOBAL_DEF(Navigation2DServerManager::setting_property_name, "DEFAULT"); GLOBAL_DEF(Navigation2DServerManager::setting_property_name, "DEFAULT");
ProjectSettings::get_singleton()->set_custom_property_info(Navigation2DServerManager::setting_property_name, PropertyInfo(Variant::STRING, Navigation2DServerManager::setting_property_name, PROPERTY_HINT_ENUM, "DEFAULT")); ProjectSettings::get_singleton()->set_custom_property_info(Navigation2DServerManager::setting_property_name, PropertyInfo(Variant::STRING, Navigation2DServerManager::setting_property_name, PROPERTY_HINT_ENUM, "DEFAULT"));