mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-22 11:56:49 +01:00
Added init and finish methods to the NavigationMeshGenerator. Also small tweaks in initialization.
This commit is contained in:
parent
9ae3aa65b7
commit
e81f25ac7b
@ -226,6 +226,8 @@ void finalize_physics() {
|
||||
}
|
||||
|
||||
void initialize_navigation_mesh_generator() {
|
||||
ERR_FAIL_COND(navigation_mesh_generator != NULL);
|
||||
|
||||
// Init chosen NavigationMeshGenerator
|
||||
const String &server_name = GLOBAL_GET(NavigationMeshGeneratorManager::setting_property_name);
|
||||
navigation_mesh_generator = NavigationMeshGeneratorManager::get_singleton()->new_server(server_name);
|
||||
@ -243,6 +245,8 @@ void initialize_navigation_mesh_generator() {
|
||||
}
|
||||
|
||||
if (navigation_mesh_generator) {
|
||||
navigation_mesh_generator->init();
|
||||
|
||||
// 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()));
|
||||
}
|
||||
@ -251,6 +255,10 @@ void initialize_navigation_mesh_generator() {
|
||||
}
|
||||
|
||||
void finalize_navigation_mesh_generator() {
|
||||
ERR_FAIL_COND(!navigation_mesh_generator);
|
||||
|
||||
navigation_mesh_generator->finish();
|
||||
|
||||
memdelete(navigation_mesh_generator);
|
||||
navigation_mesh_generator = nullptr;
|
||||
}
|
||||
|
@ -71,6 +71,12 @@ NavigationMeshGenerator *NavigationMeshGenerator::get_singleton() {
|
||||
return singleton;
|
||||
}
|
||||
|
||||
void NavigationMeshGenerator::init() {
|
||||
}
|
||||
|
||||
void NavigationMeshGenerator::finish() {
|
||||
}
|
||||
|
||||
NavigationMeshGenerator::NavigationMeshGenerator() {
|
||||
ERR_FAIL_COND(singleton != nullptr);
|
||||
singleton = this;
|
||||
|
@ -85,6 +85,9 @@ public:
|
||||
virtual bool is_navigation_mesh_baking(Ref<NavigationMesh> p_navigation_mesh) const = 0;
|
||||
#endif // _3D_DISABLED
|
||||
|
||||
virtual void init();
|
||||
virtual void finish();
|
||||
|
||||
NavigationMeshGenerator();
|
||||
~NavigationMeshGenerator();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user