2017-02-28 13:10:29 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* register_types.cpp */
|
|
|
|
/*************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
|
|
|
/* https://godotengine.org */
|
|
|
|
/*************************************************************************/
|
2021-01-01 20:13:46 +01:00
|
|
|
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
|
2017-02-28 13:10:29 +01:00
|
|
|
/* */
|
|
|
|
/* 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 "register_types.h"
|
|
|
|
|
2020-11-07 23:33:38 +01:00
|
|
|
#include "core/config/engine.h"
|
2020-03-27 19:21:27 +01:00
|
|
|
#include "servers/navigation_server_3d.h"
|
2018-05-30 15:59:42 +02:00
|
|
|
|
2021-06-30 00:16:35 +02:00
|
|
|
#include "godot_navigation_server.h"
|
|
|
|
|
2020-01-10 12:22:34 +01:00
|
|
|
#ifndef _3D_DISABLED
|
|
|
|
#include "navigation_mesh_generator.h"
|
2019-05-23 08:37:58 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef TOOLS_ENABLED
|
2020-01-10 12:22:34 +01:00
|
|
|
#include "navigation_mesh_editor_plugin.h"
|
|
|
|
#endif
|
2019-07-09 23:33:29 +02:00
|
|
|
|
2020-01-10 12:22:34 +01:00
|
|
|
#ifndef _3D_DISABLED
|
2020-04-02 01:20:12 +02:00
|
|
|
NavigationMeshGenerator *_nav_mesh_generator = nullptr;
|
2020-01-10 12:22:34 +01:00
|
|
|
#endif
|
|
|
|
|
2020-03-27 19:21:27 +01:00
|
|
|
NavigationServer3D *new_server() {
|
2021-06-30 00:16:35 +02:00
|
|
|
return memnew(GodotNavigationServer);
|
2020-01-10 12:22:34 +01:00
|
|
|
}
|
2019-07-09 23:33:29 +02:00
|
|
|
|
2021-06-30 00:16:35 +02:00
|
|
|
void register_navigation_types() {
|
2020-03-27 19:21:27 +01:00
|
|
|
NavigationServer3DManager::set_default_server(new_server);
|
2020-01-10 12:22:34 +01:00
|
|
|
|
|
|
|
#ifndef _3D_DISABLED
|
|
|
|
_nav_mesh_generator = memnew(NavigationMeshGenerator);
|
2021-07-12 00:30:33 +02:00
|
|
|
GDREGISTER_CLASS(NavigationMeshGenerator);
|
2020-01-10 12:22:34 +01:00
|
|
|
Engine::get_singleton()->add_singleton(Engine::Singleton("NavigationMeshGenerator", NavigationMeshGenerator::get_singleton()));
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef TOOLS_ENABLED
|
|
|
|
EditorPlugins::add_by_type<NavigationMeshEditorPlugin>();
|
2019-05-23 08:37:58 +02:00
|
|
|
#endif
|
2018-05-30 15:59:42 +02:00
|
|
|
}
|
|
|
|
|
2021-06-30 00:16:35 +02:00
|
|
|
void unregister_navigation_types() {
|
2020-01-10 12:22:34 +01:00
|
|
|
#ifndef _3D_DISABLED
|
2019-05-23 08:37:58 +02:00
|
|
|
if (_nav_mesh_generator) {
|
|
|
|
memdelete(_nav_mesh_generator);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|