2014-02-10 02:10:30 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* register_core_types.cpp */
|
|
|
|
/*************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
2017-08-27 14:16:55 +02:00
|
|
|
/* https://godotengine.org */
|
2014-02-10 02:10:30 +01:00
|
|
|
/*************************************************************************/
|
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). */
|
2014-02-10 02:10:30 +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. */
|
|
|
|
/*************************************************************************/
|
2018-01-05 00:50:27 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
#include "register_core_types.h"
|
|
|
|
|
2020-11-07 23:33:38 +01:00
|
|
|
#include "core/config/engine.h"
|
|
|
|
#include "core/config/project_settings.h"
|
|
|
|
#include "core/core_bind.h"
|
2018-09-11 18:13:45 +02:00
|
|
|
#include "core/core_string_names.h"
|
2020-05-11 11:56:55 +02:00
|
|
|
#include "core/crypto/aes_context.h"
|
2019-07-11 15:26:44 +02:00
|
|
|
#include "core/crypto/crypto.h"
|
2019-07-19 15:06:43 +02:00
|
|
|
#include "core/crypto/hashing_context.h"
|
2021-06-19 17:58:49 +02:00
|
|
|
#include "core/extension/native_extension.h"
|
|
|
|
#include "core/extension/native_extension_manager.h"
|
2020-04-28 15:19:37 +02:00
|
|
|
#include "core/input/input.h"
|
2020-03-01 23:14:37 +01:00
|
|
|
#include "core/input/input_map.h"
|
2018-09-11 18:13:45 +02:00
|
|
|
#include "core/io/config_file.h"
|
2019-08-21 22:52:24 +02:00
|
|
|
#include "core/io/dtls_server.h"
|
2018-09-11 18:13:45 +02:00
|
|
|
#include "core/io/http_client.h"
|
|
|
|
#include "core/io/image_loader.h"
|
2020-11-10 22:31:33 +01:00
|
|
|
#include "core/io/json.h"
|
2018-09-11 18:13:45 +02:00
|
|
|
#include "core/io/marshalls.h"
|
|
|
|
#include "core/io/multiplayer_api.h"
|
2021-07-12 16:11:05 +02:00
|
|
|
#include "core/io/multiplayer_peer.h"
|
2020-11-07 23:33:38 +01:00
|
|
|
#include "core/io/packed_data_container.h"
|
2018-09-11 18:13:45 +02:00
|
|
|
#include "core/io/packet_peer.h"
|
2019-08-21 22:52:24 +02:00
|
|
|
#include "core/io/packet_peer_dtls.h"
|
2018-09-11 18:13:45 +02:00
|
|
|
#include "core/io/packet_peer_udp.h"
|
|
|
|
#include "core/io/pck_packer.h"
|
|
|
|
#include "core/io/resource_format_binary.h"
|
2019-02-12 13:30:56 +01:00
|
|
|
#include "core/io/resource_importer.h"
|
2021-07-23 21:01:18 +02:00
|
|
|
#include "core/io/resource_uid.h"
|
2018-09-11 18:13:45 +02:00
|
|
|
#include "core/io/stream_peer_ssl.h"
|
|
|
|
#include "core/io/tcp_server.h"
|
|
|
|
#include "core/io/translation_loader_po.h"
|
2019-08-22 19:03:35 +02:00
|
|
|
#include "core/io/udp_server.h"
|
2017-03-05 16:44:50 +01:00
|
|
|
#include "core/io/xml_parser.h"
|
2018-09-11 18:13:45 +02:00
|
|
|
#include "core/math/a_star.h"
|
|
|
|
#include "core/math/expression.h"
|
2020-05-25 19:20:45 +02:00
|
|
|
#include "core/math/geometry_2d.h"
|
|
|
|
#include "core/math/geometry_3d.h"
|
2018-09-21 13:32:17 +02:00
|
|
|
#include "core/math/random_number_generator.h"
|
2018-09-11 18:13:45 +02:00
|
|
|
#include "core/math/triangle_mesh.h"
|
2020-11-07 23:33:38 +01:00
|
|
|
#include "core/object/class_db.h"
|
|
|
|
#include "core/object/undo_redo.h"
|
2018-09-11 18:13:45 +02:00
|
|
|
#include "core/os/main_loop.h"
|
2021-05-24 13:54:05 +02:00
|
|
|
#include "core/os/time.h"
|
2021-01-16 16:28:54 +01:00
|
|
|
#include "core/string/optimized_translation.h"
|
2020-11-07 23:33:38 +01:00
|
|
|
#include "core/string/translation.h"
|
2018-09-11 18:13:45 +02:00
|
|
|
|
2018-06-11 02:59:53 +02:00
|
|
|
static Ref<ResourceFormatSaverBinary> resource_saver_binary;
|
|
|
|
static Ref<ResourceFormatLoaderBinary> resource_loader_binary;
|
|
|
|
static Ref<ResourceFormatImporter> resource_format_importer;
|
|
|
|
static Ref<ResourceFormatLoaderImage> resource_format_image;
|
2019-01-10 12:45:57 +01:00
|
|
|
static Ref<TranslationLoaderPO> resource_format_po;
|
2019-07-11 15:26:44 +02:00
|
|
|
static Ref<ResourceFormatSaverCrypto> resource_format_saver_crypto;
|
|
|
|
static Ref<ResourceFormatLoaderCrypto> resource_format_loader_crypto;
|
2018-07-29 21:45:23 +02:00
|
|
|
|
2020-04-02 01:20:12 +02:00
|
|
|
static _ResourceLoader *_resource_loader = nullptr;
|
|
|
|
static _ResourceSaver *_resource_saver = nullptr;
|
|
|
|
static _OS *_os = nullptr;
|
|
|
|
static _Engine *_engine = nullptr;
|
|
|
|
static _ClassDB *_classdb = nullptr;
|
|
|
|
static _Marshalls *_marshalls = nullptr;
|
2020-05-18 16:55:49 +02:00
|
|
|
static _EngineDebugger *_engine_debugger = nullptr;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2020-04-02 01:20:12 +02:00
|
|
|
static IP *ip = nullptr;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2020-05-25 19:20:45 +02:00
|
|
|
static _Geometry2D *_geometry_2d = nullptr;
|
|
|
|
static _Geometry3D *_geometry_3d = nullptr;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2020-02-26 11:28:13 +01:00
|
|
|
extern Mutex _global_mutex;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2021-06-19 17:58:49 +02:00
|
|
|
static NativeExtensionManager *native_extension_manager = nullptr;
|
|
|
|
|
2017-08-20 17:45:01 +02:00
|
|
|
extern void register_global_constants();
|
|
|
|
extern void unregister_global_constants();
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2021-07-23 21:01:18 +02:00
|
|
|
static ResourceUID *resource_uid = nullptr;
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
void register_core_types() {
|
2020-02-19 20:27:19 +01:00
|
|
|
//consistency check
|
2020-02-20 15:13:08 +01:00
|
|
|
static_assert(sizeof(Callable) <= 16);
|
2020-02-19 20:27:19 +01:00
|
|
|
|
2017-01-07 22:25:37 +01:00
|
|
|
ObjectDB::setup();
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
StringName::setup();
|
2019-01-27 23:24:55 +01:00
|
|
|
ResourceLoader::initialize();
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-08-20 17:45:01 +02:00
|
|
|
register_global_constants();
|
2020-11-09 04:19:09 +01:00
|
|
|
|
|
|
|
Variant::register_types();
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
CoreStringNames::create();
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2021-06-18 00:03:09 +02:00
|
|
|
resource_format_po.instantiate();
|
2017-03-05 16:44:50 +01:00
|
|
|
ResourceLoader::add_resource_format_loader(resource_format_po);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2021-06-18 00:03:09 +02:00
|
|
|
resource_saver_binary.instantiate();
|
2014-02-10 02:10:30 +01:00
|
|
|
ResourceSaver::add_resource_format_saver(resource_saver_binary);
|
2021-06-18 00:03:09 +02:00
|
|
|
resource_loader_binary.instantiate();
|
2014-02-10 02:10:30 +01:00
|
|
|
ResourceLoader::add_resource_format_loader(resource_loader_binary);
|
|
|
|
|
2021-06-18 00:03:09 +02:00
|
|
|
resource_format_importer.instantiate();
|
2017-02-01 13:45:45 +01:00
|
|
|
ResourceLoader::add_resource_format_loader(resource_format_importer);
|
|
|
|
|
2021-06-18 00:03:09 +02:00
|
|
|
resource_format_image.instantiate();
|
2018-07-29 21:45:23 +02:00
|
|
|
ResourceLoader::add_resource_format_loader(resource_format_image);
|
|
|
|
|
2021-07-12 00:30:33 +02:00
|
|
|
GDREGISTER_CLASS(Object);
|
|
|
|
|
|
|
|
GDREGISTER_VIRTUAL_CLASS(Script);
|
|
|
|
|
|
|
|
GDREGISTER_CLASS(RefCounted);
|
|
|
|
GDREGISTER_CLASS(WeakRef);
|
|
|
|
GDREGISTER_CLASS(Resource);
|
|
|
|
GDREGISTER_CLASS(Image);
|
|
|
|
|
|
|
|
GDREGISTER_VIRTUAL_CLASS(InputEvent);
|
|
|
|
GDREGISTER_VIRTUAL_CLASS(InputEventWithModifiers);
|
|
|
|
GDREGISTER_VIRTUAL_CLASS(InputEventFromWindow);
|
|
|
|
GDREGISTER_CLASS(InputEventKey);
|
|
|
|
GDREGISTER_VIRTUAL_CLASS(InputEventMouse);
|
|
|
|
GDREGISTER_CLASS(InputEventMouseButton);
|
|
|
|
GDREGISTER_CLASS(InputEventMouseMotion);
|
|
|
|
GDREGISTER_CLASS(InputEventJoypadButton);
|
|
|
|
GDREGISTER_CLASS(InputEventJoypadMotion);
|
|
|
|
GDREGISTER_CLASS(InputEventScreenDrag);
|
|
|
|
GDREGISTER_CLASS(InputEventScreenTouch);
|
|
|
|
GDREGISTER_CLASS(InputEventAction);
|
|
|
|
GDREGISTER_VIRTUAL_CLASS(InputEventGesture);
|
|
|
|
GDREGISTER_CLASS(InputEventMagnifyGesture);
|
|
|
|
GDREGISTER_CLASS(InputEventPanGesture);
|
|
|
|
GDREGISTER_CLASS(InputEventMIDI);
|
2017-05-20 17:38:03 +02:00
|
|
|
|
2021-03-23 17:03:29 +01:00
|
|
|
// Network
|
2021-07-12 00:30:33 +02:00
|
|
|
GDREGISTER_VIRTUAL_CLASS(IP);
|
2021-03-23 17:03:29 +01:00
|
|
|
|
2021-07-12 00:30:33 +02:00
|
|
|
GDREGISTER_VIRTUAL_CLASS(StreamPeer);
|
|
|
|
GDREGISTER_CLASS(StreamPeerBuffer);
|
|
|
|
GDREGISTER_CLASS(StreamPeerTCP);
|
|
|
|
GDREGISTER_CLASS(TCPServer);
|
2021-03-23 17:03:29 +01:00
|
|
|
|
2021-07-12 00:30:33 +02:00
|
|
|
GDREGISTER_VIRTUAL_CLASS(PacketPeer);
|
|
|
|
GDREGISTER_CLASS(PacketPeerStream);
|
|
|
|
GDREGISTER_CLASS(PacketPeerUDP);
|
|
|
|
GDREGISTER_CLASS(UDPServer);
|
2021-03-23 17:03:29 +01:00
|
|
|
|
|
|
|
ClassDB::register_custom_instance_class<HTTPClient>();
|
2019-07-11 15:26:44 +02:00
|
|
|
|
|
|
|
// Crypto
|
2021-07-12 00:30:33 +02:00
|
|
|
GDREGISTER_CLASS(HashingContext);
|
|
|
|
GDREGISTER_CLASS(AESContext);
|
2019-07-11 15:26:44 +02:00
|
|
|
ClassDB::register_custom_instance_class<X509Certificate>();
|
|
|
|
ClassDB::register_custom_instance_class<CryptoKey>();
|
2020-11-14 13:42:47 +01:00
|
|
|
ClassDB::register_custom_instance_class<HMACContext>();
|
2019-07-11 15:26:44 +02:00
|
|
|
ClassDB::register_custom_instance_class<Crypto>();
|
2017-01-03 03:03:46 +01:00
|
|
|
ClassDB::register_custom_instance_class<StreamPeerSSL>();
|
2021-03-23 17:03:29 +01:00
|
|
|
ClassDB::register_custom_instance_class<PacketPeerDTLS>();
|
|
|
|
ClassDB::register_custom_instance_class<DTLSServer>();
|
2019-07-11 15:26:44 +02:00
|
|
|
|
2021-06-18 00:03:09 +02:00
|
|
|
resource_format_saver_crypto.instantiate();
|
2019-07-11 15:26:44 +02:00
|
|
|
ResourceSaver::add_resource_format_saver(resource_format_saver_crypto);
|
2021-06-18 00:03:09 +02:00
|
|
|
resource_format_loader_crypto.instantiate();
|
2019-07-11 15:26:44 +02:00
|
|
|
ResourceLoader::add_resource_format_loader(resource_format_loader_crypto);
|
|
|
|
|
2021-07-12 00:30:33 +02:00
|
|
|
GDREGISTER_VIRTUAL_CLASS(MultiplayerPeer);
|
|
|
|
GDREGISTER_CLASS(MultiplayerAPI);
|
|
|
|
GDREGISTER_CLASS(MainLoop);
|
|
|
|
GDREGISTER_CLASS(Translation);
|
|
|
|
GDREGISTER_CLASS(OptimizedTranslation);
|
|
|
|
GDREGISTER_CLASS(UndoRedo);
|
|
|
|
GDREGISTER_CLASS(TriangleMesh);
|
2017-01-03 03:03:46 +01:00
|
|
|
|
2021-07-12 00:30:33 +02:00
|
|
|
GDREGISTER_CLASS(ResourceFormatLoader);
|
|
|
|
GDREGISTER_CLASS(ResourceFormatSaver);
|
2018-06-11 02:59:53 +02:00
|
|
|
|
2021-07-12 00:30:33 +02:00
|
|
|
GDREGISTER_CLASS(_File);
|
|
|
|
GDREGISTER_CLASS(_Directory);
|
|
|
|
GDREGISTER_CLASS(_Thread);
|
|
|
|
GDREGISTER_CLASS(_Mutex);
|
|
|
|
GDREGISTER_CLASS(_Semaphore);
|
2017-01-03 03:03:46 +01:00
|
|
|
|
2021-07-12 00:30:33 +02:00
|
|
|
GDREGISTER_CLASS(XMLParser);
|
|
|
|
GDREGISTER_CLASS(JSON);
|
2017-01-03 03:03:46 +01:00
|
|
|
|
2021-07-12 00:30:33 +02:00
|
|
|
GDREGISTER_CLASS(ConfigFile);
|
2017-01-03 03:03:46 +01:00
|
|
|
|
2021-07-12 00:30:33 +02:00
|
|
|
GDREGISTER_CLASS(PCKPacker);
|
2017-01-03 03:03:46 +01:00
|
|
|
|
2021-07-12 00:30:33 +02:00
|
|
|
GDREGISTER_CLASS(PackedDataContainer);
|
|
|
|
GDREGISTER_VIRTUAL_CLASS(PackedDataContainerRef);
|
|
|
|
GDREGISTER_CLASS(AStar);
|
|
|
|
GDREGISTER_CLASS(AStar2D);
|
|
|
|
GDREGISTER_CLASS(EncodedObjectAsID);
|
|
|
|
GDREGISTER_CLASS(RandomNumberGenerator);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2021-07-12 00:30:33 +02:00
|
|
|
GDREGISTER_VIRTUAL_CLASS(ResourceImporter);
|
2019-07-04 16:11:55 +02:00
|
|
|
|
2021-07-12 00:30:33 +02:00
|
|
|
GDREGISTER_CLASS(NativeExtension);
|
2021-06-19 17:58:49 +02:00
|
|
|
|
2021-07-12 00:30:33 +02:00
|
|
|
GDREGISTER_VIRTUAL_CLASS(NativeExtensionManager);
|
2021-06-19 17:58:49 +02:00
|
|
|
|
2021-07-23 21:01:18 +02:00
|
|
|
GDREGISTER_VIRTUAL_CLASS(ResourceUID);
|
|
|
|
|
|
|
|
resource_uid = memnew(ResourceUID);
|
|
|
|
|
2021-06-19 17:58:49 +02:00
|
|
|
native_extension_manager = memnew(NativeExtensionManager);
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
ip = IP::create();
|
|
|
|
|
2020-05-25 19:20:45 +02:00
|
|
|
_geometry_2d = memnew(_Geometry2D);
|
|
|
|
_geometry_3d = memnew(_Geometry3D);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
_resource_loader = memnew(_ResourceLoader);
|
|
|
|
_resource_saver = memnew(_ResourceSaver);
|
|
|
|
_os = memnew(_OS);
|
|
|
|
_engine = memnew(_Engine);
|
|
|
|
_classdb = memnew(_ClassDB);
|
2014-02-10 02:10:30 +01:00
|
|
|
_marshalls = memnew(_Marshalls);
|
2020-05-18 16:55:49 +02:00
|
|
|
_engine_debugger = memnew(_EngineDebugger);
|
2017-01-05 13:16:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void register_core_settings() {
|
2020-09-18 13:35:51 +02:00
|
|
|
// Since in register core types, globals may not be present.
|
2019-07-08 08:52:25 +02:00
|
|
|
GLOBAL_DEF("network/limits/tcp/connect_timeout_seconds", (30));
|
|
|
|
ProjectSettings::get_singleton()->set_custom_property_info("network/limits/tcp/connect_timeout_seconds", PropertyInfo(Variant::INT, "network/limits/tcp/connect_timeout_seconds", PROPERTY_HINT_RANGE, "1,1800,1"));
|
2018-07-19 23:58:15 +02:00
|
|
|
GLOBAL_DEF_RST("network/limits/packet_peer_stream/max_buffer_po2", (16));
|
2018-10-05 18:43:53 +02:00
|
|
|
ProjectSettings::get_singleton()->set_custom_property_info("network/limits/packet_peer_stream/max_buffer_po2", PropertyInfo(Variant::INT, "network/limits/packet_peer_stream/max_buffer_po2", PROPERTY_HINT_RANGE, "0,64,1,or_greater"));
|
2019-07-11 15:26:44 +02:00
|
|
|
|
2020-05-12 10:10:54 +02:00
|
|
|
GLOBAL_DEF("network/ssl/certificate_bundle_override", "");
|
|
|
|
ProjectSettings::get_singleton()->set_custom_property_info("network/ssl/certificate_bundle_override", PropertyInfo(Variant::STRING, "network/ssl/certificate_bundle_override", PROPERTY_HINT_FILE, "*.crt"));
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void register_core_singletons() {
|
2021-07-12 00:30:33 +02:00
|
|
|
GDREGISTER_CLASS(ProjectSettings);
|
|
|
|
GDREGISTER_VIRTUAL_CLASS(IP);
|
|
|
|
GDREGISTER_CLASS(_Geometry2D);
|
|
|
|
GDREGISTER_CLASS(_Geometry3D);
|
|
|
|
GDREGISTER_CLASS(_ResourceLoader);
|
|
|
|
GDREGISTER_CLASS(_ResourceSaver);
|
|
|
|
GDREGISTER_CLASS(_OS);
|
|
|
|
GDREGISTER_CLASS(_Engine);
|
|
|
|
GDREGISTER_CLASS(_ClassDB);
|
|
|
|
GDREGISTER_CLASS(_Marshalls);
|
|
|
|
GDREGISTER_CLASS(TranslationServer);
|
|
|
|
GDREGISTER_VIRTUAL_CLASS(Input);
|
|
|
|
GDREGISTER_CLASS(InputMap);
|
|
|
|
GDREGISTER_CLASS(Expression);
|
|
|
|
GDREGISTER_CLASS(_EngineDebugger);
|
|
|
|
GDREGISTER_CLASS(Time);
|
2017-10-09 23:49:17 +02:00
|
|
|
|
2017-11-13 21:46:57 +01:00
|
|
|
Engine::get_singleton()->add_singleton(Engine::Singleton("ProjectSettings", ProjectSettings::get_singleton()));
|
2021-06-19 17:58:49 +02:00
|
|
|
Engine::get_singleton()->add_singleton(Engine::Singleton("IP", IP::get_singleton(), "IP"));
|
2020-05-25 19:20:45 +02:00
|
|
|
Engine::get_singleton()->add_singleton(Engine::Singleton("Geometry2D", _Geometry2D::get_singleton()));
|
|
|
|
Engine::get_singleton()->add_singleton(Engine::Singleton("Geometry3D", _Geometry3D::get_singleton()));
|
2017-11-13 21:46:57 +01:00
|
|
|
Engine::get_singleton()->add_singleton(Engine::Singleton("ResourceLoader", _ResourceLoader::get_singleton()));
|
|
|
|
Engine::get_singleton()->add_singleton(Engine::Singleton("ResourceSaver", _ResourceSaver::get_singleton()));
|
|
|
|
Engine::get_singleton()->add_singleton(Engine::Singleton("OS", _OS::get_singleton()));
|
|
|
|
Engine::get_singleton()->add_singleton(Engine::Singleton("Engine", _Engine::get_singleton()));
|
|
|
|
Engine::get_singleton()->add_singleton(Engine::Singleton("ClassDB", _classdb));
|
|
|
|
Engine::get_singleton()->add_singleton(Engine::Singleton("Marshalls", _Marshalls::get_singleton()));
|
|
|
|
Engine::get_singleton()->add_singleton(Engine::Singleton("TranslationServer", TranslationServer::get_singleton()));
|
2020-04-28 15:19:37 +02:00
|
|
|
Engine::get_singleton()->add_singleton(Engine::Singleton("Input", Input::get_singleton()));
|
2017-11-13 21:46:57 +01:00
|
|
|
Engine::get_singleton()->add_singleton(Engine::Singleton("InputMap", InputMap::get_singleton()));
|
2020-05-18 16:55:49 +02:00
|
|
|
Engine::get_singleton()->add_singleton(Engine::Singleton("EngineDebugger", _EngineDebugger::get_singleton()));
|
2021-05-24 13:54:05 +02:00
|
|
|
Engine::get_singleton()->add_singleton(Engine::Singleton("Time", Time::get_singleton()));
|
2021-06-19 17:58:49 +02:00
|
|
|
Engine::get_singleton()->add_singleton(Engine::Singleton("NativeExtensionManager", NativeExtensionManager::get_singleton()));
|
2021-07-23 21:01:18 +02:00
|
|
|
Engine::get_singleton()->add_singleton(Engine::Singleton("ResourceUID", ResourceUID::get_singleton()));
|
2021-06-19 17:58:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void register_core_extensions() {
|
Fix various typos with codespell
Found via `codespell -q 3 -S ./thirdparty,*.po,./DONORS.md -L ackward,ang,ans,ba,beng,cas,childs,childrens,dof,doubleclick,fave,findn,hist,inout,leapyear,lod,nd,numer,ois,ony,paket,seeked,sinc,switchs,te,uint`
2021-07-07 17:17:32 +02:00
|
|
|
// Hardcoded for now.
|
2021-06-19 17:58:49 +02:00
|
|
|
if (ProjectSettings::get_singleton()->has_setting("native_extensions/paths")) {
|
|
|
|
Vector<String> paths = ProjectSettings::get_singleton()->get("native_extensions/paths");
|
|
|
|
for (int i = 0; i < paths.size(); i++) {
|
|
|
|
NativeExtensionManager::LoadStatus status = native_extension_manager->load_extension(paths[i]);
|
|
|
|
ERR_CONTINUE_MSG(status != NativeExtensionManager::LOAD_STATUS_OK, "Error loading extension: " + paths[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
native_extension_manager->initialize_extensions(NativeExtension::INITIALIZATION_LEVEL_CORE);
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void unregister_core_types() {
|
2021-06-19 17:58:49 +02:00
|
|
|
native_extension_manager->deinitialize_extensions(NativeExtension::INITIALIZATION_LEVEL_CORE);
|
|
|
|
|
|
|
|
memdelete(native_extension_manager);
|
2021-07-23 21:01:18 +02:00
|
|
|
|
|
|
|
memdelete(resource_uid);
|
2017-03-05 16:44:50 +01:00
|
|
|
memdelete(_resource_loader);
|
|
|
|
memdelete(_resource_saver);
|
|
|
|
memdelete(_os);
|
|
|
|
memdelete(_engine);
|
|
|
|
memdelete(_classdb);
|
|
|
|
memdelete(_marshalls);
|
2020-05-18 16:55:49 +02:00
|
|
|
memdelete(_engine_debugger);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2020-05-25 19:20:45 +02:00
|
|
|
memdelete(_geometry_2d);
|
|
|
|
memdelete(_geometry_3d);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2019-01-10 12:45:57 +01:00
|
|
|
ResourceLoader::remove_resource_format_loader(resource_format_image);
|
|
|
|
resource_format_image.unref();
|
|
|
|
|
|
|
|
ResourceSaver::remove_resource_format_saver(resource_saver_binary);
|
|
|
|
resource_saver_binary.unref();
|
|
|
|
|
|
|
|
ResourceLoader::remove_resource_format_loader(resource_loader_binary);
|
|
|
|
resource_loader_binary.unref();
|
|
|
|
|
|
|
|
ResourceLoader::remove_resource_format_loader(resource_format_importer);
|
|
|
|
resource_format_importer.unref();
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2018-06-11 02:59:53 +02:00
|
|
|
ResourceLoader::remove_resource_format_loader(resource_format_po);
|
|
|
|
resource_format_po.unref();
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2019-07-11 15:26:44 +02:00
|
|
|
ResourceSaver::remove_resource_format_saver(resource_format_saver_crypto);
|
|
|
|
resource_format_saver_crypto.unref();
|
|
|
|
ResourceLoader::remove_resource_format_loader(resource_format_loader_crypto);
|
|
|
|
resource_format_loader_crypto.unref();
|
|
|
|
|
2020-05-14 16:41:43 +02:00
|
|
|
if (ip) {
|
2014-02-10 02:10:30 +01:00
|
|
|
memdelete(ip);
|
2020-05-14 16:41:43 +02:00
|
|
|
}
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2019-01-27 23:24:55 +01:00
|
|
|
ResourceLoader::finalize();
|
|
|
|
|
2019-06-01 15:42:22 +02:00
|
|
|
ClassDB::cleanup_defaults();
|
2015-04-21 00:38:02 +02:00
|
|
|
ObjectDB::cleanup();
|
|
|
|
|
2020-11-09 04:19:09 +01:00
|
|
|
Variant::unregister_types();
|
|
|
|
|
2017-08-20 17:45:01 +02:00
|
|
|
unregister_global_constants();
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-01-03 03:03:46 +01:00
|
|
|
ClassDB::cleanup();
|
2014-02-10 02:10:30 +01:00
|
|
|
ResourceCache::clear();
|
2015-04-21 00:38:02 +02:00
|
|
|
CoreStringNames::free();
|
2014-02-10 02:10:30 +01:00
|
|
|
StringName::cleanup();
|
|
|
|
}
|