Add init() virtual methods to the navigation servers.

This commit is contained in:
Relintai 2023-04-16 18:23:56 +02:00
parent aabd293f3b
commit 45ffb33025
5 changed files with 12 additions and 2 deletions

View File

@ -230,7 +230,7 @@ void initialize_navigation_server() {
navigation_server = NavigationServerManager::new_default_server();
}
ERR_FAIL_COND(!navigation_server);
//physics_server->init();
navigation_server->init();
/// 2D Navigation server
navigation_2d_server = Navigation2DServerManager::new_server(ProjectSettings::get_singleton()->get(Navigation2DServerManager::setting_property_name));
@ -239,7 +239,7 @@ void initialize_navigation_server() {
navigation_2d_server = Navigation2DServerManager::new_default_server();
}
ERR_FAIL_COND(!navigation_2d_server);
//navigation_2d_server->init();
navigation_2d_server->init();
}
void finalize_navigation_server() {

View File

@ -90,6 +90,9 @@ void Navigation2DServer::_bind_methods() {
ADD_SIGNAL(MethodInfo("map_changed", PropertyInfo(Variant::RID, "map")));
}
void Navigation2DServer::init() {
}
Navigation2DServer::Navigation2DServer() {
singleton = this;
}

View File

@ -184,6 +184,8 @@ public:
/// Destroy the `RID`
virtual void free(RID p_object) const = 0;
virtual void init();
Navigation2DServer();
virtual ~Navigation2DServer();
};

View File

@ -36,6 +36,9 @@
NavigationServer *NavigationServer::singleton = nullptr;
void NavigationServer::init() {
}
void NavigationServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_maps"), &NavigationServer::get_maps);

View File

@ -213,6 +213,8 @@ public:
/// Note: This function is not thread safe.
virtual void process(real_t delta_time) = 0;
virtual void init();
NavigationServer();
virtual ~NavigationServer();
};