diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/class_db.cpp | 10 | ||||
-rw-r--r-- | core/class_db.h | 8 | ||||
-rw-r--r-- | core/os/input.cpp | 1 | ||||
-rw-r--r-- | core/project_settings.cpp | 53 | ||||
-rw-r--r-- | core/project_settings.h | 2 | ||||
-rw-r--r-- | core/register_core_types.cpp | 18 |
6 files changed, 47 insertions, 45 deletions
diff --git a/core/class_db.cpp b/core/class_db.cpp index f5ddd9c761..12310f6151 100644 --- a/core/class_db.cpp +++ b/core/class_db.cpp @@ -205,6 +205,7 @@ ClassDB::ClassInfo::ClassInfo() { creation_func = NULL; inherits_ptr = NULL; disabled = false; + exposed = false; } ClassDB::ClassInfo::~ClassInfo() { } @@ -1284,6 +1285,15 @@ bool ClassDB::is_class_enabled(StringName p_class) { return !ti->disabled; } +bool ClassDB::is_class_exposed(StringName p_class) { + + OBJTYPE_RLOCK; + + ClassInfo *ti = classes.getptr(p_class); + ERR_FAIL_COND_V(!ti, false); + return ti->exposed; +} + StringName ClassDB::get_category(const StringName &p_node) { ERR_FAIL_COND_V(!classes.has(p_node), StringName()); diff --git a/core/class_db.h b/core/class_db.h index f6b97748b0..5910a2ce01 100644 --- a/core/class_db.h +++ b/core/class_db.h @@ -127,6 +127,7 @@ public: StringName inherits; StringName name; bool disabled; + bool exposed; Object *(*creation_func)(); ClassInfo(); ~ClassInfo(); @@ -168,6 +169,7 @@ public: ClassInfo *t = classes.getptr(T::get_class_static()); ERR_FAIL_COND(!t); t->creation_func = &creator<T>; + t->exposed = true; T::register_custom_data_to_otdb(); } @@ -176,6 +178,9 @@ public: GLOBAL_LOCK_FUNCTION; T::initialize_class(); + ClassInfo *t = classes.getptr(T::get_class_static()); + ERR_FAIL_COND(!t); + t->exposed = true; //nothing } @@ -193,6 +198,7 @@ public: ClassInfo *t = classes.getptr(T::get_class_static()); ERR_FAIL_COND(!t); t->creation_func = &_create_ptr_func<T>; + t->exposed = true; T::register_custom_data_to_otdb(); } @@ -347,6 +353,8 @@ public: static void set_class_enabled(StringName p_class, bool p_enable); static bool is_class_enabled(StringName p_class); + static bool is_class_exposed(StringName p_class); + static void add_resource_base_extension(const StringName &p_extension, const StringName &p_class); static void get_resource_base_extensions(List<String> *p_extensions); static void get_extensions_for_type(const StringName &p_class, List<String> *p_extensions); diff --git a/core/os/input.cpp b/core/os/input.cpp index a4b82299a7..848b003d5e 100644 --- a/core/os/input.cpp +++ b/core/os/input.cpp @@ -58,6 +58,7 @@ void Input::_bind_methods() { ClassDB::bind_method(D_METHOD("is_action_just_released", "action"), &Input::is_action_just_released); ClassDB::bind_method(D_METHOD("add_joy_mapping", "mapping", "update_existing"), &Input::add_joy_mapping, DEFVAL(false)); ClassDB::bind_method(D_METHOD("remove_joy_mapping", "guid"), &Input::remove_joy_mapping); + ClassDB::bind_method(D_METHOD("joy_connection_changed", "device", "connected", "name", "guid"), &Input::joy_connection_changed); ClassDB::bind_method(D_METHOD("is_joy_known", "device"), &Input::is_joy_known); ClassDB::bind_method(D_METHOD("get_joy_axis", "device", "axis"), &Input::get_joy_axis); ClassDB::bind_method(D_METHOD("get_joy_name", "device"), &Input::get_joy_name); diff --git a/core/project_settings.cpp b/core/project_settings.cpp index 3994011c06..c4d1b199a0 100644 --- a/core/project_settings.cpp +++ b/core/project_settings.cpp @@ -261,7 +261,7 @@ bool ProjectSettings::_load_resource_pack(const String &p_pack) { return true; } -Error ProjectSettings::setup(const String &p_path, const String &p_main_pack) { +Error ProjectSettings::setup(const String &p_path, const String &p_main_pack, bool p_upwards) { //If looking for files in network, just use network! @@ -270,11 +270,6 @@ Error ProjectSettings::setup(const String &p_path, const String &p_main_pack) { if (_load_settings("res://project.godot") == OK || _load_settings_binary("res://project.binary") == OK) { _load_settings("res://override.cfg"); -#ifdef DEBUG_ENABLED - } else { - // when debug version of godot is used, provide some feedback to the developer - print_line("Couldn't open project over network"); -#endif } return OK; @@ -292,12 +287,6 @@ Error ProjectSettings::setup(const String &p_path, const String &p_main_pack) { if (_load_settings("res://project.godot") == OK || _load_settings_binary("res://project.binary") == OK) { //load override from location of the main pack _load_settings(p_main_pack.get_base_dir().plus_file("override.cfg")); -#ifdef DEBUG_ENABLED - // when debug version of godot is used, provide some feedback to the developer - print_line("Successfully loaded " + p_main_pack + "/project.godot or project.binary"); - } else { - print_line("Couldn't load/find " + p_main_pack + "/project.godot or project.binary"); -#endif } return OK; @@ -315,18 +304,9 @@ Error ProjectSettings::setup(const String &p_path, const String &p_main_pack) { if (_load_resource_pack(datapack_name)) { found = true; } else { -#ifdef DEBUG_ENABLED - // when debug version of godot is used, provide some feedback to the developer - print_line("Couldn't open " + datapack_name); -#endif datapack_name = filebase_name + ".pck"; if (_load_resource_pack(datapack_name)) { found = true; -#ifdef DEBUG_ENABLED - } else { - // when debug version of godot is used, provide some feedback to the developer - print_line("Couldn't open " + datapack_name); -#endif } } @@ -335,13 +315,6 @@ Error ProjectSettings::setup(const String &p_path, const String &p_main_pack) { if (_load_settings("res://project.godot") == OK || _load_settings_binary("res://project.binary") == OK) { // load override from location of executable _load_settings(exec_path.get_base_dir().plus_file("override.cfg")); - -#ifdef DEBUG_ENABLED - // when debug version of godot is used, provide some feedback to the developer - print_line("Successfully loaded " + datapack_name + "/project.godot or project.binary"); - } else { - print_line("Couldn't load/find " + datapack_name + "/project.godot or project.binary"); -#endif } return OK; @@ -362,12 +335,6 @@ Error ProjectSettings::setup(const String &p_path, const String &p_main_pack) { if (_load_settings("res://project.godot") == OK || _load_settings_binary("res://project.binary") == OK) { _load_settings("res://override.cfg"); -#ifdef DEBUG_ENABLED - // when debug version of godot is used, provide some feedback to the developer - print_line("Successfully loaded " + resource_path + "/project.godot or project.binary"); - } else { - print_line("Couldn't load/find " + resource_path + "/project.godot or project.binary"); -#endif } return OK; @@ -393,18 +360,16 @@ Error ProjectSettings::setup(const String &p_path, const String &p_main_pack) { candidate = current_dir; found = true; break; -#ifdef DEBUG_ENABLED - // when debug version of godot is used, provide some feedback to the developer - print_line("Successfully loaded " + current_dir + "/project.godot or project.binary"); - } else { - print_line("Couldn't load/find " + current_dir + "/project.godot or project.binary"); -#endif } - d->change_dir(".."); - if (d->get_current_dir() == current_dir) - break; //not doing anything useful - current_dir = d->get_current_dir(); + if (p_upwards) { + d->change_dir(".."); + if (d->get_current_dir() == current_dir) + break; //not doing anything useful + current_dir = d->get_current_dir(); + } else { + break; + } } resource_path = candidate; diff --git a/core/project_settings.h b/core/project_settings.h index ea6034dc84..f75cad815f 100644 --- a/core/project_settings.h +++ b/core/project_settings.h @@ -139,7 +139,7 @@ public: void set_order(const String &p_name, int p_order); void set_builtin_order(const String &p_name); - Error setup(const String &p_path, const String &p_main_pack); + Error setup(const String &p_path, const String &p_main_pack, bool p_upwards = false); Error save_custom(const String &p_path = "", const CustomMap &p_custom = CustomMap(), const Vector<String> &p_custom_features = Vector<String>(), bool p_merge_with_current = true); Error save(); diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp index 0e34a3eea5..c6d7cd44e8 100644 --- a/core/register_core_types.cpp +++ b/core/register_core_types.cpp @@ -40,6 +40,7 @@ #include "io/config_file.h" #include "io/http_client.h" #include "io/marshalls.h" +#include "io/networked_multiplayer_peer.h" #include "io/packet_peer.h" #include "io/packet_peer_udp.h" #include "io/pck_packer.h" @@ -109,6 +110,8 @@ void register_core_types() { ClassDB::register_class<Object>(); + ClassDB::register_virtual_class<Script>(); + ClassDB::register_class<Reference>(); ClassDB::register_class<WeakRef>(); ClassDB::register_class<Resource>(); @@ -136,6 +139,7 @@ void register_core_types() { ClassDB::register_virtual_class<IP>(); ClassDB::register_virtual_class<PacketPeer>(); ClassDB::register_class<PacketPeerStream>(); + ClassDB::register_virtual_class<NetworkedMultiplayerPeer>(); ClassDB::register_class<MainLoop>(); //ClassDB::register_type<OptimizedSaver>(); ClassDB::register_class<Translation>(); @@ -185,6 +189,20 @@ void register_core_settings() { void register_core_singletons() { + ClassDB::register_class<ProjectSettings>(); + ClassDB::register_virtual_class<IP>(); + ClassDB::register_class<_Geometry>(); + ClassDB::register_class<_ResourceLoader>(); + ClassDB::register_class<_ResourceSaver>(); + ClassDB::register_class<_OS>(); + ClassDB::register_class<_Engine>(); + ClassDB::register_class<_ClassDB>(); + ClassDB::register_class<_Marshalls>(); + ClassDB::register_class<TranslationServer>(); + ClassDB::register_virtual_class<Input>(); + ClassDB::register_class<InputMap>(); + ClassDB::register_class<_JSON>(); + ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("ProjectSettings", ProjectSettings::get_singleton())); ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("IP", IP::get_singleton())); ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("Geometry", _Geometry::get_singleton())); |