diff options
Diffstat (limited to 'core')
38 files changed, 365 insertions, 229 deletions
diff --git a/core/SCsub b/core/SCsub index 02abaa2bb6..4c541d7269 100644 --- a/core/SCsub +++ b/core/SCsub @@ -14,9 +14,9 @@ for x in env.global_defaults: gd_inc += '#include "platform/' + x + '/globals/global_defaults.h"\n' gd_call += "\tregister_" + x + "_global_defaults();\n" -gd_cpp = '#include "global_config.h"\n' +gd_cpp = '#include "project_settings.h"\n' gd_cpp += gd_inc -gd_cpp += "void GlobalConfig::register_global_defaults() {\n" + gd_call + "\n}\n" +gd_cpp += "void ProjectSettings::register_global_defaults() {\n" + gd_call + "\n}\n" f = open("global_defaults.gen.cpp", "wb") f.write(gd_cpp) @@ -48,7 +48,7 @@ if ("SCRIPT_AES256_ENCRYPTION_KEY" in os.environ): print("Invalid AES256 encryption key, not 64 bits hex: " + e) f = open("script_encryption_key.gen.cpp", "wb") -f.write("#include \"global_config.h\"\nuint8_t script_encryption_key[32]={" + txt + "};\n") +f.write("#include \"project_settings.h\"\nuint8_t script_encryption_key[32]={" + txt + "};\n") f.close() diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index a5ec9c1afc..ce08b3f754 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "core_bind.h" -#include "core/global_config.h" +#include "core/project_settings.h" #include "geometry.h" #include "io/file_access_compressed.h" #include "io/file_access_encrypted.h" @@ -106,7 +106,7 @@ PoolStringArray _ResourceLoader::get_dependencies(const String &p_path) { bool _ResourceLoader::has(const String &p_path) { - String local_path = GlobalConfig::get_singleton()->localize_path(p_path); + String local_path = ProjectSettings::get_singleton()->localize_path(p_path); return ResourceCache::has(local_path); }; @@ -149,7 +149,7 @@ _ResourceSaver *_ResourceSaver::singleton = NULL; void _ResourceSaver::_bind_methods() { ClassDB::bind_method(D_METHOD("save", "path", "resource:Resource", "flags"), &_ResourceSaver::save, DEFVAL(0)); - ClassDB::bind_method(D_METHOD("get_recognized_extensions", "type"), &_ResourceSaver::get_recognized_extensions); + ClassDB::bind_method(D_METHOD("get_recognized_extensions", "type:Resource"), &_ResourceSaver::get_recognized_extensions); BIND_CONSTANT(FLAG_RELATIVE_PATHS); BIND_CONSTANT(FLAG_BUNDLE_RESOURCES); @@ -998,7 +998,7 @@ void _OS::_bind_methods() { ClassDB::bind_method(D_METHOD("set_borderless_window", "borderless"), &_OS::set_borderless_window); ClassDB::bind_method(D_METHOD("get_borderless_window"), &_OS::get_borderless_window); - ClassDB::bind_method(D_METHOD("set_ime_position"), &_OS::set_ime_position); + ClassDB::bind_method(D_METHOD("set_ime_position", "position"), &_OS::set_ime_position); ClassDB::bind_method(D_METHOD("set_screen_orientation", "orientation"), &_OS::set_screen_orientation); ClassDB::bind_method(D_METHOD("get_screen_orientation"), &_OS::get_screen_orientation); @@ -1038,7 +1038,7 @@ void _OS::_bind_methods() { &_OS::get_unix_time_from_datetime); ClassDB::bind_method(D_METHOD("get_system_time_secs"), &_OS::get_system_time_secs); - ClassDB::bind_method(D_METHOD("set_icon", "icon"), &_OS::set_icon); + ClassDB::bind_method(D_METHOD("set_icon", "icon:Image"), &_OS::set_icon); ClassDB::bind_method(D_METHOD("get_exit_code"), &_OS::get_exit_code); ClassDB::bind_method(D_METHOD("set_exit_code", "code"), &_OS::set_exit_code); diff --git a/core/core_string_names.cpp b/core/core_string_names.cpp index 0ed44b0cb7..2adc15447a 100644 --- a/core/core_string_names.cpp +++ b/core/core_string_names.cpp @@ -44,6 +44,7 @@ CoreStringNames::CoreStringNames() { _iter_next = StaticCString::create("_iter_next"); _iter_get = StaticCString::create("_iter_get"); get_rid = StaticCString::create("get_rid"); + _custom_features = StaticCString::create("_custom_features"); #ifdef TOOLS_ENABLED _sections_unfolded = StaticCString::create("_sections_unfolded"); #endif diff --git a/core/core_string_names.h b/core/core_string_names.h index 4b4f87a8f0..501185f5b7 100644 --- a/core/core_string_names.h +++ b/core/core_string_names.h @@ -61,6 +61,7 @@ public: StringName _iter_next; StringName _iter_get; StringName get_rid; + StringName _custom_features; #ifdef TOOLS_ENABLED StringName _sections_unfolded; #endif diff --git a/core/dictionary.cpp b/core/dictionary.cpp index e6d549b83d..1fe45aff94 100644 --- a/core/dictionary.cpp +++ b/core/dictionary.cpp @@ -200,6 +200,7 @@ uint32_t Dictionary::hash() const { Array Dictionary::keys() const { +#if 0 Array karr; karr.resize(size()); const Variant *K = NULL; @@ -208,6 +209,26 @@ Array Dictionary::keys() const { karr[idx++] = (*K); } return karr; +#else + + Array varr; + varr.resize(size()); + if (_p->variant_map.empty()) + return varr; + + int count = _p->variant_map.size(); + const HashMap<Variant, DictionaryPrivate::Data, _DictionaryVariantHash>::Pair **pairs = (const HashMap<Variant, DictionaryPrivate::Data, _DictionaryVariantHash>::Pair **)alloca(count * sizeof(HashMap<Variant, DictionaryPrivate::Data, _DictionaryVariantHash>::Pair *)); + _p->variant_map.get_key_value_ptr_array(pairs); + + SortArray<const HashMap<Variant, DictionaryPrivate::Data, _DictionaryVariantHash>::Pair *, DictionaryPrivateSort> sort; + sort.sort(pairs, count); + + for (int i = 0; i < count; i++) { + varr[i] = pairs[i]->key; + } + + return varr; +#endif } Array Dictionary::values() const { diff --git a/core/image.cpp b/core/image.cpp index 6ab8bb6d46..50dc9c109d 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -2245,7 +2245,7 @@ void Image::_bind_methods() { ClassDB::bind_method(D_METHOD("detect_alpha"), &Image::detect_alpha); ClassDB::bind_method(D_METHOD("is_invisible"), &Image::is_invisible); - ClassDB::bind_method(D_METHOD("compress", "mode"), &Image::compress); + ClassDB::bind_method(D_METHOD("compress", "mode", "source", "lossy_quality"), &Image::compress); ClassDB::bind_method(D_METHOD("decompress"), &Image::decompress); ClassDB::bind_method(D_METHOD("is_compressed"), &Image::is_compressed); diff --git a/core/input_map.cpp b/core/input_map.cpp index 1307c467e6..1abe019167 100644 --- a/core/input_map.cpp +++ b/core/input_map.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "input_map.h" -#include "global_config.h" +#include "project_settings.h" #include "os/keyboard.h" InputMap *InputMap::singleton = NULL; @@ -41,11 +41,11 @@ void InputMap::_bind_methods() { ClassDB::bind_method(D_METHOD("add_action", "action"), &InputMap::add_action); ClassDB::bind_method(D_METHOD("erase_action", "action"), &InputMap::erase_action); - ClassDB::bind_method(D_METHOD("action_add_event", "action", "event"), &InputMap::action_add_event); - ClassDB::bind_method(D_METHOD("action_has_event", "action", "event"), &InputMap::action_has_event); - ClassDB::bind_method(D_METHOD("action_erase_event", "action", "event"), &InputMap::action_erase_event); + ClassDB::bind_method(D_METHOD("action_add_event", "action", "event:InputEvent"), &InputMap::action_add_event); + ClassDB::bind_method(D_METHOD("action_has_event", "action", "event:InputEvent"), &InputMap::action_has_event); + ClassDB::bind_method(D_METHOD("action_erase_event", "action", "event:InputEvent"), &InputMap::action_erase_event); ClassDB::bind_method(D_METHOD("get_action_list", "action"), &InputMap::_get_action_list); - ClassDB::bind_method(D_METHOD("event_is_action", "event", "action"), &InputMap::event_is_action); + ClassDB::bind_method(D_METHOD("event_is_action", "event:InputEvent", "action"), &InputMap::event_is_action); ClassDB::bind_method(D_METHOD("load_from_globals"), &InputMap::load_from_globals); } @@ -189,7 +189,7 @@ void InputMap::load_from_globals() { input_map.clear(); List<PropertyInfo> pinfo; - GlobalConfig::get_singleton()->get_property_list(&pinfo); + ProjectSettings::get_singleton()->get_property_list(&pinfo); for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) { const PropertyInfo &pi = E->get(); @@ -201,7 +201,7 @@ void InputMap::load_from_globals() { add_action(name); - Array va = GlobalConfig::get_singleton()->get(pi.name); + Array va = ProjectSettings::get_singleton()->get(pi.name); for (int i = 0; i < va.size(); i++) { @@ -281,7 +281,7 @@ void InputMap::load_default() { key->set_scancode(KEY_PAGEDOWN); action_add_event("ui_page_down", key); - //set("display/handheld/orientation", "landscape"); + //set("display/window/handheld/orientation", "landscape"); } InputMap::InputMap() { diff --git a/core/io/compression.cpp b/core/io/compression.cpp index b0f5448b6c..ca35ece8f5 100644 --- a/core/io/compression.cpp +++ b/core/io/compression.cpp @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "compression.h" -#include "global_config.h" +#include "project_settings.h" #include "os/copymem.h" #include "zip_io.h" diff --git a/core/io/file_access_memory.cpp b/core/io/file_access_memory.cpp index 32ea4ce096..2197b187eb 100644 --- a/core/io/file_access_memory.cpp +++ b/core/io/file_access_memory.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "file_access_memory.h" -#include "global_config.h" +#include "project_settings.h" #include "map.h" #include "os/copymem.h" #include "os/dir_access.h" @@ -43,8 +43,8 @@ void FileAccessMemory::register_file(String p_name, Vector<uint8_t> p_data) { } String name; - if (GlobalConfig::get_singleton()) - name = GlobalConfig::get_singleton()->globalize_path(p_name); + if (ProjectSettings::get_singleton()) + name = ProjectSettings::get_singleton()->globalize_path(p_name); else name = p_name; //name = DirAccess::normalize_path(name); diff --git a/core/io/file_access_network.cpp b/core/io/file_access_network.cpp index 50e78899fb..46457d1425 100644 --- a/core/io/file_access_network.cpp +++ b/core/io/file_access_network.cpp @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "file_access_network.h" -#include "global_config.h" +#include "project_settings.h" #include "io/ip.h" #include "marshalls.h" #include "os/os.h" diff --git a/core/io/ip.cpp b/core/io/ip.cpp index 6c463b983c..c869bdad9b 100644 --- a/core/io/ip.cpp +++ b/core/io/ip.cpp @@ -240,7 +240,7 @@ void IP::_bind_methods() { ClassDB::bind_method(D_METHOD("get_resolve_item_address", "id"), &IP::get_resolve_item_address); ClassDB::bind_method(D_METHOD("erase_resolve_item", "id"), &IP::erase_resolve_item); ClassDB::bind_method(D_METHOD("get_local_addresses"), &IP::_get_local_addresses); - ClassDB::bind_method(D_METHOD("clear_cache"), &IP::clear_cache, DEFVAL("")); + ClassDB::bind_method(D_METHOD("clear_cache", "hostname"), &IP::clear_cache, DEFVAL("")); BIND_CONSTANT(RESOLVER_STATUS_NONE); BIND_CONSTANT(RESOLVER_STATUS_WAITING); diff --git a/core/io/packet_peer.cpp b/core/io/packet_peer.cpp index 93682e6b8a..81446a3886 100644 --- a/core/io/packet_peer.cpp +++ b/core/io/packet_peer.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "packet_peer.h" -#include "global_config.h" +#include "project_settings.h" #include "io/marshalls.h" /* helpers / binders */ diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index 728cd5d4ff..602cbe6f30 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "resource_format_binary.h" -#include "global_config.h" +#include "project_settings.h" #include "image.h" #include "io/file_access_compressed.h" #include "io/marshalls.h" @@ -317,7 +317,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) { if (path.find("://") == -1 && path.is_rel_path()) { // path is relative to file being loaded, so convert to a resource path - path = GlobalConfig::get_singleton()->localize_path(res_path.get_base_dir().plus_file(path)); + path = ProjectSettings::get_singleton()->localize_path(res_path.get_base_dir().plus_file(path)); } if (remaps.find(path)) { @@ -346,7 +346,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) { if (path.find("://") == -1 && path.is_rel_path()) { // path is relative to file being loaded, so convert to a resource path - path = GlobalConfig::get_singleton()->localize_path(res_path.get_base_dir().plus_file(path)); + path = ProjectSettings::get_singleton()->localize_path(res_path.get_base_dir().plus_file(path)); } RES res = ResourceLoader::load(path, type); @@ -1017,7 +1017,7 @@ Ref<ResourceInteractiveLoader> ResourceFormatLoaderBinary::load_interactive(cons } Ref<ResourceInteractiveLoaderBinary> ria = memnew(ResourceInteractiveLoaderBinary); - ria->local_path = GlobalConfig::get_singleton()->localize_path(p_path); + ria->local_path = ProjectSettings::get_singleton()->localize_path(p_path); ria->res_path = ria->local_path; //ria->set_local_path( Globals::get_singleton()->localize_path(p_path) ); ria->open(f); @@ -1065,7 +1065,7 @@ void ResourceFormatLoaderBinary::get_dependencies(const String &p_path, List<Str ERR_FAIL_COND(!f); Ref<ResourceInteractiveLoaderBinary> ria = memnew(ResourceInteractiveLoaderBinary); - ria->local_path = GlobalConfig::get_singleton()->localize_path(p_path); + ria->local_path = ProjectSettings::get_singleton()->localize_path(p_path); ria->res_path = ria->local_path; //ria->set_local_path( Globals::get_singleton()->localize_path(p_path) ); ria->get_dependencies(f, p_dependencies, p_add_types); @@ -1152,7 +1152,7 @@ Error ResourceFormatLoaderBinary::rename_dependencies(const String &p_path, cons } Ref<ResourceInteractiveLoaderBinary> ria = memnew(ResourceInteractiveLoaderBinary); - ria->local_path = GlobalConfig::get_singleton()->localize_path(p_path); + ria->local_path = ProjectSettings::get_singleton()->localize_path(p_path); ria->res_path = ria->local_path; ria->remaps = p_map; //ria->set_local_path( Globals::get_singleton()->localize_path(p_path) ); @@ -1281,7 +1281,7 @@ String ResourceFormatLoaderBinary::get_resource_type(const String &p_path) const } Ref<ResourceInteractiveLoaderBinary> ria = memnew(ResourceInteractiveLoaderBinary); - ria->local_path = GlobalConfig::get_singleton()->localize_path(p_path); + ria->local_path = ProjectSettings::get_singleton()->localize_path(p_path); ria->res_path = ria->local_path; //ria->set_local_path( Globals::get_singleton()->localize_path(p_path) ); String r = ria->recognize(f); @@ -1984,7 +1984,7 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path, const RES &p Error ResourceFormatSaverBinary::save(const String &p_path, const RES &p_resource, uint32_t p_flags) { - String local_path = GlobalConfig::get_singleton()->localize_path(p_path); + String local_path = ProjectSettings::get_singleton()->localize_path(p_path); ResourceFormatSaverBinaryInstance saver; return saver.save(local_path, p_resource, p_flags); } diff --git a/core/io/resource_import.cpp b/core/io/resource_import.cpp index ffb27bc26a..61da4f3350 100644 --- a/core/io/resource_import.cpp +++ b/core/io/resource_import.cpp @@ -49,6 +49,7 @@ Error ResourceFormatImporter::_get_path_and_type(const String &p_path, PathAndTy int lines = 0; String error_text; + bool path_found = false; //first match must have priority while (true) { assign = Variant(); @@ -66,14 +67,16 @@ Error ResourceFormatImporter::_get_path_and_type(const String &p_path, PathAndTy } if (assign != String()) { - if (assign.begins_with("path.") && r_path_and_type.path == String()) { + if (!path_found && assign.begins_with("path.") && r_path_and_type.path == String()) { String feature = assign.get_slicec('.', 1); if (OS::get_singleton()->check_feature_support(feature)) { r_path_and_type.path = value; + path_found = true; //first match must have priority } - } else if (assign == "path") { + } else if (!path_found && assign == "path") { r_path_and_type.path = value; + path_found = true; //first match must have priority } else if (assign == "type") { r_path_and_type.type = value; } diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp index bb7be38413..285cc6e3c2 100644 --- a/core/io/resource_loader.cpp +++ b/core/io/resource_loader.cpp @@ -28,12 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "resource_loader.h" -#include "global_config.h" #include "io/resource_import.h" #include "os/file_access.h" #include "os/os.h" #include "path_remap.h" #include "print_string.h" +#include "project_settings.h" #include "translation.h" ResourceFormatLoader *ResourceLoader::loader[MAX_LOADERS]; @@ -84,7 +84,7 @@ void ResourceLoader::get_recognized_extensions_for_type(const String &p_type, Li void ResourceInteractiveLoader::_bind_methods() { - ClassDB::bind_method(D_METHOD("get_resource"), &ResourceInteractiveLoader::get_resource); + ClassDB::bind_method(D_METHOD("get_resource:Resource"), &ResourceInteractiveLoader::get_resource); ClassDB::bind_method(D_METHOD("poll"), &ResourceInteractiveLoader::poll); ClassDB::bind_method(D_METHOD("wait"), &ResourceInteractiveLoader::wait); ClassDB::bind_method(D_METHOD("get_stage"), &ResourceInteractiveLoader::get_stage); @@ -166,7 +166,7 @@ RES ResourceLoader::load(const String &p_path, const String &p_type_hint, bool p if (p_path.is_rel_path()) local_path = "res://" + p_path; else - local_path = GlobalConfig::get_singleton()->localize_path(p_path); + local_path = ProjectSettings::get_singleton()->localize_path(p_path); bool xl_remapped = false; String path = _path_remap(local_path, &xl_remapped); @@ -233,7 +233,7 @@ Ref<ResourceInteractiveLoader> ResourceLoader::load_interactive(const String &p_ if (p_path.is_rel_path()) local_path = "res://" + p_path; else - local_path = GlobalConfig::get_singleton()->localize_path(p_path); + local_path = ProjectSettings::get_singleton()->localize_path(p_path); bool xl_remapped = false; String path = _path_remap(local_path, &xl_remapped); @@ -304,7 +304,7 @@ void ResourceLoader::get_dependencies(const String &p_path, List<String> *p_depe if (path.is_rel_path()) local_path = "res://" + path; else - local_path = GlobalConfig::get_singleton()->localize_path(path); + local_path = ProjectSettings::get_singleton()->localize_path(path); for (int i = 0; i < loader_count; i++) { @@ -327,7 +327,7 @@ Error ResourceLoader::rename_dependencies(const String &p_path, const Map<String if (path.is_rel_path()) local_path = "res://" + path; else - local_path = GlobalConfig::get_singleton()->localize_path(path); + local_path = ProjectSettings::get_singleton()->localize_path(path); for (int i = 0; i < loader_count; i++) { @@ -350,7 +350,7 @@ String ResourceLoader::get_resource_type(const String &p_path) { if (p_path.is_rel_path()) local_path = "res://" + p_path; else - local_path = GlobalConfig::get_singleton()->localize_path(p_path); + local_path = ProjectSettings::get_singleton()->localize_path(p_path); for (int i = 0; i < loader_count; i++) { @@ -430,7 +430,7 @@ void ResourceLoader::reload_translation_remaps() { void ResourceLoader::load_translation_remaps() { - Dictionary remaps = GlobalConfig::get_singleton()->get("locale/translation_remaps"); + Dictionary remaps = ProjectSettings::get_singleton()->get("locale/translation_remaps"); List<Variant> keys; remaps.get_key_list(&keys); for (List<Variant>::Element *E = keys.front(); E; E = E->next()) { diff --git a/core/io/resource_saver.cpp b/core/io/resource_saver.cpp index 8592346a72..58913b80cc 100644 --- a/core/io/resource_saver.cpp +++ b/core/io/resource_saver.cpp @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "resource_saver.h" -#include "global_config.h" +#include "project_settings.h" #include "os/file_access.h" #include "resource_loader.h" #include "script_language.h" @@ -64,7 +64,7 @@ Error ResourceSaver::save(const String &p_path, const RES &p_resource, uint32_t String old_path = p_resource->get_path(); - String local_path = GlobalConfig::get_singleton()->localize_path(p_path); + String local_path = ProjectSettings::get_singleton()->localize_path(p_path); RES rwcopy = p_resource; if (p_flags & FLAG_CHANGE_PATH) diff --git a/core/io/tcp_server.cpp b/core/io/tcp_server.cpp index 29a80ecc19..4c891188ee 100644 --- a/core/io/tcp_server.cpp +++ b/core/io/tcp_server.cpp @@ -49,7 +49,7 @@ void TCP_Server::_bind_methods() { ClassDB::bind_method(D_METHOD("listen", "port", "bind_address"), &TCP_Server::listen, DEFVAL("*")); ClassDB::bind_method(D_METHOD("is_connection_available"), &TCP_Server::is_connection_available); - ClassDB::bind_method(D_METHOD("take_connection"), &TCP_Server::take_connection); + ClassDB::bind_method(D_METHOD("take_connection:StreamPeerTCP"), &TCP_Server::take_connection); ClassDB::bind_method(D_METHOD("stop"), &TCP_Server::stop); } diff --git a/core/message_queue.cpp b/core/message_queue.cpp index 1c980a56e3..93d0b0730a 100644 --- a/core/message_queue.cpp +++ b/core/message_queue.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "message_queue.h" -#include "global_config.h" +#include "project_settings.h" #include "script_language.h" MessageQueue *MessageQueue::singleton = NULL; diff --git a/core/method_ptrcall.h b/core/method_ptrcall.h index c6dbfc2a7a..ead58c23c8 100644 --- a/core/method_ptrcall.h +++ b/core/method_ptrcall.h @@ -60,37 +60,37 @@ struct PtrToArg { } \ } -#define MAKE_PTRARGR(m_type, m_ret) \ - template <> \ - struct PtrToArg<m_type> { \ - _FORCE_INLINE_ static m_type convert(const void *p_ptr) { \ - return *reinterpret_cast<const m_type *>(p_ptr); \ - } \ - _FORCE_INLINE_ static void encode(m_type p_val, void *p_ptr) { \ - *((m_ret *)p_ptr) = p_val; \ - } \ - }; \ - template <> \ - struct PtrToArg<const m_type &> { \ - _FORCE_INLINE_ static m_type convert(const void *p_ptr) { \ - return *reinterpret_cast<const m_type *>(p_ptr); \ - } \ - _FORCE_INLINE_ static void encode(m_type p_val, void *p_ptr) { \ - *((m_ret *)p_ptr) = p_val; \ - } \ +#define MAKE_PTRARGCONV(m_type, m_conv) \ + template <> \ + struct PtrToArg<m_type> { \ + _FORCE_INLINE_ static m_type convert(const void *p_ptr) { \ + return static_cast<m_type>(*reinterpret_cast<const m_conv *>(p_ptr)); \ + } \ + _FORCE_INLINE_ static void encode(m_type p_val, void *p_ptr) { \ + *((m_conv *)p_ptr) = static_cast<m_conv>(p_val); \ + } \ + }; \ + template <> \ + struct PtrToArg<const m_type &> { \ + _FORCE_INLINE_ static m_type convert(const void *p_ptr) { \ + return static_cast<m_type>(*reinterpret_cast<const m_conv *>(p_ptr)); \ + } \ + _FORCE_INLINE_ static void encode(m_type p_val, void *p_ptr) { \ + *((m_conv *)p_ptr) = static_cast<m_conv>(p_val); \ + } \ } MAKE_PTRARG(bool); -MAKE_PTRARGR(uint8_t, int); -MAKE_PTRARGR(int8_t, int); -MAKE_PTRARGR(uint16_t, int); -MAKE_PTRARGR(int16_t, int); -MAKE_PTRARGR(uint32_t, int); -MAKE_PTRARGR(int32_t, int); -MAKE_PTRARGR(int64_t, int); -MAKE_PTRARGR(uint64_t, int); -MAKE_PTRARG(float); -MAKE_PTRARGR(double, float); +MAKE_PTRARGCONV(uint8_t, int64_t); +MAKE_PTRARGCONV(int8_t, int64_t); +MAKE_PTRARGCONV(uint16_t, int64_t); +MAKE_PTRARGCONV(int16_t, int64_t); +MAKE_PTRARGCONV(uint32_t, int64_t); +MAKE_PTRARGCONV(int32_t, int64_t); +MAKE_PTRARG(int64_t); +MAKE_PTRARG(uint64_t); +MAKE_PTRARGCONV(float, double); +MAKE_PTRARG(double); MAKE_PTRARG(String); MAKE_PTRARG(Vector2); diff --git a/core/object.cpp b/core/object.cpp index 9184fb9cd0..316c624268 100644 --- a/core/object.cpp +++ b/core/object.cpp @@ -993,6 +993,17 @@ void Object::cancel_delete() { _predelete_ok = true; } +void Object::set_script_and_instance(const RefPtr &p_script, ScriptInstance *p_instance) { + + //this function is not meant to be used in any of these ways + ERR_FAIL_COND(p_script.is_null()); + ERR_FAIL_COND(!p_instance); + ERR_FAIL_COND(script_instance != NULL || !script.is_null()); + + script = p_script; + script_instance = p_instance; +} + void Object::set_script(const RefPtr &p_script) { if (script == p_script) @@ -1723,7 +1734,7 @@ void Object::_bind_methods() { BIND_VMETHOD(MethodInfo("_set", PropertyInfo(Variant::STRING, "property"), PropertyInfo(Variant::NIL, "value"))); #ifdef TOOLS_ENABLED MethodInfo miget("_get", PropertyInfo(Variant::STRING, "property")); - miget.return_val.name = "var"; + miget.return_val.name = "Variant"; BIND_VMETHOD(miget); MethodInfo plget("_get_property_list"); diff --git a/core/object.h b/core/object.h index 556f3f1586..148a73fbc4 100644 --- a/core/object.h +++ b/core/object.h @@ -651,6 +651,8 @@ public: void set_script_instance(ScriptInstance *p_instance); _FORCE_INLINE_ ScriptInstance *get_script_instance() const { return script_instance; } + void set_script_and_instance(const RefPtr &p_script, ScriptInstance *p_instance); //some script languages can't control instance creation, so this function eases the process + void add_user_signal(const MethodInfo &p_signal); void emit_signal(const StringName &p_name, VARIANT_ARG_LIST); void emit_signal(const StringName &p_name, const Variant **p_args, int p_argcount); diff --git a/core/os/dir_access.cpp b/core/os/dir_access.cpp index aa03b764ef..484942bad5 100644 --- a/core/os/dir_access.cpp +++ b/core/os/dir_access.cpp @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "dir_access.h" -#include "global_config.h" +#include "project_settings.h" #include "os/file_access.h" #include "os/memory.h" #include "os/os.h" @@ -37,7 +37,7 @@ String DirAccess::_get_root_path() const { switch (_access_type) { - case ACCESS_RESOURCES: return GlobalConfig::get_singleton()->get_resource_path(); + case ACCESS_RESOURCES: return ProjectSettings::get_singleton()->get_resource_path(); case ACCESS_USERDATA: return OS::get_singleton()->get_data_dir(); default: return ""; } @@ -200,10 +200,10 @@ String DirAccess::fix_path(String p_path) const { case ACCESS_RESOURCES: { - if (GlobalConfig::get_singleton()) { + if (ProjectSettings::get_singleton()) { if (p_path.begins_with("res://")) { - String resource_path = GlobalConfig::get_singleton()->get_resource_path(); + String resource_path = ProjectSettings::get_singleton()->get_resource_path(); if (resource_path != "") { return p_path.replace_first("res:/", resource_path); diff --git a/core/os/file_access.cpp b/core/os/file_access.cpp index 805b66b983..2bb676381f 100644 --- a/core/os/file_access.cpp +++ b/core/os/file_access.cpp @@ -31,7 +31,7 @@ #include "core/io/file_access_pack.h" #include "core/io/marshalls.h" -#include "global_config.h" +#include "project_settings.h" #include "os/os.h" #include "thirdparty/misc/md5.h" @@ -135,10 +135,10 @@ String FileAccess::fix_path(const String &p_path) const { case ACCESS_RESOURCES: { - if (GlobalConfig::get_singleton()) { + if (ProjectSettings::get_singleton()) { if (r_path.begins_with("res://")) { - String resource_path = GlobalConfig::get_singleton()->get_resource_path(); + String resource_path = ProjectSettings::get_singleton()->get_resource_path(); if (resource_path != "") { return r_path.replace("res:/", resource_path); diff --git a/core/os/input.cpp b/core/os/input.cpp index bc388d0bca..18d644668c 100644 --- a/core/os/input.cpp +++ b/core/os/input.cpp @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "input.h" -#include "global_config.h" +#include "project_settings.h" #include "input_map.h" #include "os/os.h" Input *Input::singleton = NULL; @@ -84,7 +84,7 @@ void Input::_bind_methods() { ClassDB::bind_method(D_METHOD("action_press", "action"), &Input::action_press); ClassDB::bind_method(D_METHOD("action_release", "action"), &Input::action_release); ClassDB::bind_method(D_METHOD("set_custom_mouse_cursor", "image:Texture", "hotspot"), &Input::set_custom_mouse_cursor, DEFVAL(Vector2())); - ClassDB::bind_method(D_METHOD("parse_input_event", "event"), &Input::parse_input_event); + ClassDB::bind_method(D_METHOD("parse_input_event", "event:InputEvent"), &Input::parse_input_event); BIND_CONSTANT(MOUSE_MODE_VISIBLE); BIND_CONSTANT(MOUSE_MODE_HIDDEN); @@ -101,7 +101,7 @@ void Input::get_argument_options(const StringName &p_function, int p_idx, List<S if (p_idx == 0 && (pf == "is_action_pressed" || pf == "action_press" || pf == "action_release" || pf == "is_action_just_pressed" || pf == "is_action_just_released")) { List<PropertyInfo> pinfo; - GlobalConfig::get_singleton()->get_property_list(&pinfo); + ProjectSettings::get_singleton()->get_property_list(&pinfo); for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) { const PropertyInfo &pi = E->get(); diff --git a/core/os/input_event.cpp b/core/os/input_event.cpp index 1c575aa970..0a07b6b2b7 100644 --- a/core/os/input_event.cpp +++ b/core/os/input_event.cpp @@ -103,7 +103,7 @@ bool InputEvent::is_action_type() const { if (String(p_method) == "is_action" && p_argidx == 0) { List<PropertyInfo> pinfo; - GlobalConfig::get_singleton()->get_property_list(&pinfo); + ProjectSettings::get_singleton()->get_property_list(&pinfo); for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) { const PropertyInfo &pi = E->get(); diff --git a/core/os/main_loop.cpp b/core/os/main_loop.cpp index 248f5537c6..93658c07c2 100644 --- a/core/os/main_loop.cpp +++ b/core/os/main_loop.cpp @@ -32,7 +32,7 @@ void MainLoop::_bind_methods() { - ClassDB::bind_method(D_METHOD("input_event", "ev"), &MainLoop::input_event); + ClassDB::bind_method(D_METHOD("input_event", "ev:InputEvent"), &MainLoop::input_event); ClassDB::bind_method(D_METHOD("input_text", "text"), &MainLoop::input_text); ClassDB::bind_method(D_METHOD("init"), &MainLoop::init); ClassDB::bind_method(D_METHOD("iteration", "delta"), &MainLoop::iteration); diff --git a/core/os/os.cpp b/core/os/os.cpp index 48463722cf..5a9766891d 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -30,9 +30,9 @@ #include "os.h" #include "dir_access.h" -#include "global_config.h" #include "input.h" #include "os/file_access.h" +#include "project_settings.h" #include <stdarg.h> @@ -260,7 +260,7 @@ String OS::get_locale() const { String OS::get_resource_dir() const { - return GlobalConfig::get_singleton()->get_resource_path(); + return ProjectSettings::get_singleton()->get_resource_path(); } String OS::get_system_dir(SystemDir p_dir) const { @@ -269,7 +269,7 @@ String OS::get_system_dir(SystemDir p_dir) const { } String OS::get_safe_application_name() const { - String an = GlobalConfig::get_singleton()->get("application/config/name"); + String an = ProjectSettings::get_singleton()->get("application/config/name"); Vector<String> invalid_char = String("\\ / : * ? \" < > |").split(" "); for (int i = 0; i < invalid_char.size(); i++) { an = an.replace(invalid_char[i], "-"); @@ -494,6 +494,24 @@ int OS::get_power_percent_left() { return -1; } +bool OS::check_feature_support(const String &p_feature) { + + if (p_feature == get_name()) + return true; +#ifdef DEBUG_ENABLED + if (p_feature == "debug") + return true; +#else + if (p_feature == "release") + return true; +#endif + + if (_check_internal_feature_support(p_feature)) + return true; + + return false; +} + OS::OS() { last_error = NULL; singleton = this; diff --git a/core/os/os.h b/core/os/os.h index cafd1f4e14..362fec8a9e 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -109,6 +109,7 @@ protected: virtual void set_cmdline(const char *p_execpath, const List<String> &p_args); void _ensure_data_dir(); + virtual bool _check_internal_feature_support(const String &p_feature) = 0; public: typedef int64_t ProcessID; @@ -408,7 +409,7 @@ public: virtual int get_power_seconds_left(); virtual int get_power_percent_left(); - virtual bool check_feature_support(const String &p_feature) = 0; + bool check_feature_support(const String &p_feature); bool is_hidpi_allowed() const { return _allow_hidpi; } OS(); diff --git a/core/global_config.cpp b/core/project_settings.cpp index 95f4ec5e22..0426af3fa0 100644 --- a/core/global_config.cpp +++ b/core/project_settings.cpp @@ -27,9 +27,10 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "global_config.h" +#include "project_settings.h" #include "bind/core_bind.h" +#include "core_string_names.h" #include "io/file_access_network.h" #include "io/file_access_pack.h" #include "io/marshalls.h" @@ -38,24 +39,23 @@ #include "os/keyboard.h" #include "os/os.h" #include "variant_parser.h" - #include <zlib.h> #define FORMAT_VERSION 3 -GlobalConfig *GlobalConfig::singleton = NULL; +ProjectSettings *ProjectSettings::singleton = NULL; -GlobalConfig *GlobalConfig::get_singleton() { +ProjectSettings *ProjectSettings::get_singleton() { return singleton; } -String GlobalConfig::get_resource_path() const { +String ProjectSettings::get_resource_path() const { return resource_path; }; -String GlobalConfig::localize_path(const String &p_path) const { +String ProjectSettings::localize_path(const String &p_path) const { if (resource_path == "") return p_path; //not initialied yet @@ -99,13 +99,13 @@ String GlobalConfig::localize_path(const String &p_path) const { }; } -void GlobalConfig::set_initial_value(const String &p_name, const Variant &p_value) { +void ProjectSettings::set_initial_value(const String &p_name, const Variant &p_value) { ERR_FAIL_COND(!props.has(p_name)); props[p_name].initial = p_value; } -String GlobalConfig::globalize_path(const String &p_path) const { +String ProjectSettings::globalize_path(const String &p_path) const { if (p_path.begins_with("res://")) { @@ -119,13 +119,44 @@ String GlobalConfig::globalize_path(const String &p_path) const { return p_path; } -bool GlobalConfig::_set(const StringName &p_name, const Variant &p_value) { +bool ProjectSettings::_set(const StringName &p_name, const Variant &p_value) { _THREAD_SAFE_METHOD_ if (p_value.get_type() == Variant::NIL) props.erase(p_name); else { + + if (p_name == CoreStringNames::get_singleton()->_custom_features) { + Vector<String> custom_feature_array = p_value; + for (int i = 0; i < custom_feature_array.size(); i++) { + + custom_features.insert(custom_feature_array[i]); + } + return true; + } + + if (!disable_feature_overrides) { + int dot = p_name.operator String().find("."); + if (dot != -1) { + Vector<String> s = p_name.operator String().split("."); + + bool override_valid = false; + for (int i = 1; i < s.size(); i++) { + String feature = s[i].strip_edges(); + if (OS::get_singleton()->check_feature_support(feature) || custom_features.has(feature)) { + override_valid = true; + break; + } + } + + if (override_valid) { + + feature_overrides[s[0]] = p_name; + } + } + } + if (props.has(p_name)) { if (!props[p_name].overrided) props[p_name].variant = p_value; @@ -137,15 +168,19 @@ bool GlobalConfig::_set(const StringName &p_name, const Variant &p_value) { return true; } -bool GlobalConfig::_get(const StringName &p_name, Variant &r_ret) const { +bool ProjectSettings::_get(const StringName &p_name, Variant &r_ret) const { _THREAD_SAFE_METHOD_ - if (!props.has(p_name)) { - print_line("WARNING: not found: " + String(p_name)); + StringName name = p_name; + if (!disable_feature_overrides && feature_overrides.has(name)) { + name = feature_overrides[name]; + } + if (!props.has(name)) { + print_line("WARNING: not found: " + String(name)); return false; } - r_ret = props[p_name].variant; + r_ret = props[name].variant; return true; } @@ -159,7 +194,7 @@ struct _VCSort { bool operator<(const _VCSort &p_vcs) const { return order == p_vcs.order ? name < p_vcs.name : order < p_vcs.order; } }; -void GlobalConfig::_get_property_list(List<PropertyInfo> *p_list) const { +void ProjectSettings::_get_property_list(List<PropertyInfo> *p_list) const { _THREAD_SAFE_METHOD_ @@ -186,8 +221,13 @@ void GlobalConfig::_get_property_list(List<PropertyInfo> *p_list) const { for (Set<_VCSort>::Element *E = vclist.front(); E; E = E->next()) { - if (custom_prop_info.has(E->get().name)) { - PropertyInfo pi = custom_prop_info[E->get().name]; + String prop_info_name = E->get().name; + int dot = prop_info_name.find("."); + if (dot != -1) + prop_info_name = prop_info_name.substr(0, dot); + + if (custom_prop_info.has(prop_info_name)) { + PropertyInfo pi = custom_prop_info[prop_info_name]; pi.name = E->get().name; pi.usage = E->get().flags; p_list->push_back(pi); @@ -196,7 +236,7 @@ void GlobalConfig::_get_property_list(List<PropertyInfo> *p_list) const { } } -bool GlobalConfig::_load_resource_pack(const String &p_pack) { +bool ProjectSettings::_load_resource_pack(const String &p_pack) { if (PackedData::get_singleton()->is_disabled()) return false; @@ -213,13 +253,13 @@ bool GlobalConfig::_load_resource_pack(const String &p_pack) { return true; } -Error GlobalConfig::setup(const String &p_path, const String &p_main_pack) { +Error ProjectSettings::setup(const String &p_path, const String &p_main_pack) { //If looking for files in network, just use network! if (FileAccessNetworkClient::get_singleton()) { - if (_load_settings("res://project.godot") == OK || _load_settings_binary("res://godot.cfb") == OK) { + if (_load_settings("res://project.godot") == OK || _load_settings_binary("res://project.binary") == OK) { _load_settings("res://override.cfg"); } @@ -236,7 +276,7 @@ Error GlobalConfig::setup(const String &p_path, const String &p_main_pack) { bool ok = _load_resource_pack(p_main_pack); ERR_FAIL_COND_V(!ok, ERR_CANT_OPEN); - if (_load_settings("res://project.godot") == OK || _load_settings_binary("res://godot.cfb") == OK) { + 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")); } @@ -249,7 +289,7 @@ Error GlobalConfig::setup(const String &p_path, const String &p_main_pack) { if (_load_resource_pack(exec_path.get_basename() + ".pck")) { - if (_load_settings("res://project.godot") == OK || _load_settings_binary("res://godot.cfb") == OK) { + 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")); } @@ -270,7 +310,7 @@ Error GlobalConfig::setup(const String &p_path, const String &p_main_pack) { // data.pck and data.zip are deprecated and no longer supported, apologies. // make sure this is loaded from the resource path - if (_load_settings("res://project.godot") == OK || _load_settings_binary("res://godot.cfb") == OK) { + if (_load_settings("res://project.godot") == OK || _load_settings_binary("res://project.binary") == OK) { _load_settings("res://override.cfg"); } @@ -291,7 +331,7 @@ Error GlobalConfig::setup(const String &p_path, const String &p_main_pack) { while (true) { //try to load settings in ascending through dirs shape! - if (_load_settings(current_dir + "/project.godot") == OK || _load_settings_binary(current_dir + "/godot.cfb") == OK) { + if (_load_settings(current_dir + "/project.godot") == OK || _load_settings_binary(current_dir + "/project.binary") == OK) { _load_settings(current_dir + "/override.cfg"); candidate = current_dir; @@ -318,19 +358,19 @@ Error GlobalConfig::setup(const String &p_path, const String &p_main_pack) { return OK; } -bool GlobalConfig::has(String p_var) const { +bool ProjectSettings::has(String p_var) const { _THREAD_SAFE_METHOD_ return props.has(p_var); } -void GlobalConfig::set_registering_order(bool p_enable) { +void ProjectSettings::set_registering_order(bool p_enable) { registering_order = p_enable; } -Error GlobalConfig::_load_settings_binary(const String p_path) { +Error ProjectSettings::_load_settings_binary(const String p_path) { Error err; FileAccess *f = FileAccess::open(p_path, FileAccess::READ, &err); @@ -343,7 +383,7 @@ Error GlobalConfig::_load_settings_binary(const String p_path) { if (hdr[0] != 'E' || hdr[1] != 'C' || hdr[2] != 'F' || hdr[3] != 'G') { memdelete(f); - ERR_EXPLAIN("Corrupted header in binary godot.cfb (not ECFG)"); + ERR_EXPLAIN("Corrupted header in binary project.binary (not ECFG)"); ERR_FAIL_V(ERR_FILE_CORRUPT;) } @@ -372,7 +412,7 @@ Error GlobalConfig::_load_settings_binary(const String p_path) { return OK; } -Error GlobalConfig::_load_settings(const String p_path) { +Error ProjectSettings::_load_settings(const String p_path) { Error err; FileAccess *f = FileAccess::open(p_path, FileAccess::READ, &err); @@ -403,7 +443,7 @@ Error GlobalConfig::_load_settings(const String p_path) { memdelete(f); return OK; } else if (err != OK) { - ERR_PRINTS("GlobalConfig::load - " + p_path + ":" + itos(lines) + " error: " + error_text); + ERR_PRINTS("ProjectSettings::load - " + p_path + ":" + itos(lines) + " error: " + error_text); memdelete(f); return err; } @@ -427,19 +467,19 @@ Error GlobalConfig::_load_settings(const String p_path) { return OK; } -int GlobalConfig::get_order(const String &p_name) const { +int ProjectSettings::get_order(const String &p_name) const { ERR_FAIL_COND_V(!props.has(p_name), -1); return props[p_name].order; } -void GlobalConfig::set_order(const String &p_name, int p_order) { +void ProjectSettings::set_order(const String &p_name, int p_order) { ERR_FAIL_COND(!props.has(p_name)); props[p_name].order = p_order; } -void GlobalConfig::set_builtin_order(const String &p_name) { +void ProjectSettings::set_builtin_order(const String &p_name) { ERR_FAIL_COND(!props.has(p_name)); if (props[p_name].order >= NO_BUILTIN_ORDER_BASE) { @@ -447,24 +487,24 @@ void GlobalConfig::set_builtin_order(const String &p_name) { } } -void GlobalConfig::clear(const String &p_name) { +void ProjectSettings::clear(const String &p_name) { ERR_FAIL_COND(!props.has(p_name)); props.erase(p_name); } -Error GlobalConfig::save() { +Error ProjectSettings::save() { return save_custom(get_resource_path() + "/project.godot"); } -Error GlobalConfig::_save_settings_binary(const String &p_file, const Map<String, List<String> > &props, const CustomMap &p_custom) { +Error ProjectSettings::_save_settings_binary(const String &p_file, const Map<String, List<String> > &props, const CustomMap &p_custom, const String &p_custom_features) { Error err; FileAccess *file = FileAccess::open(p_file, FileAccess::WRITE, &err); if (err != OK) { - ERR_EXPLAIN("Couldn't save godot.cfb at " + p_file); + ERR_EXPLAIN("Couldn't save project.binary at " + p_file); ERR_FAIL_COND_V(err, err) } @@ -481,7 +521,34 @@ Error GlobalConfig::_save_settings_binary(const String &p_file, const Map<String } } - file->store_32(count); //store how many properties are saved + if (p_custom_features != String()) { + file->store_32(count + 1); + //store how many properties are saved, add one for custom featuers, which must always go first + String key = CoreStringNames::get_singleton()->_custom_features; + file->store_32(key.length()); + file->store_string(key); + + int len; + Error err = encode_variant(p_custom_features, NULL, len); + if (err != OK) { + memdelete(file); + ERR_FAIL_V(err); + } + + Vector<uint8_t> buff; + buff.resize(len); + + err = encode_variant(p_custom_features, &buff[0], len); + if (err != OK) { + memdelete(file); + ERR_FAIL_V(err); + } + file->store_32(len); + file->store_buffer(buff.ptr(), buff.size()); + + } else { + file->store_32(count); //store how many properties are saved + } for (Map<String, List<String> >::Element *E = props.front(); E; E = E->next()) { @@ -523,7 +590,7 @@ Error GlobalConfig::_save_settings_binary(const String &p_file, const Map<String return OK; } -Error GlobalConfig::_save_settings_text(const String &p_file, const Map<String, List<String> > &props, const CustomMap &p_custom) { +Error ProjectSettings::_save_settings_text(const String &p_file, const Map<String, List<String> > &props, const CustomMap &p_custom, const String &p_custom_features) { Error err; FileAccess *file = FileAccess::open(p_file, FileAccess::WRITE, &err); @@ -534,6 +601,9 @@ Error GlobalConfig::_save_settings_text(const String &p_file, const Map<String, } file->store_string("config_version=" + itos(FORMAT_VERSION) + "\n"); + if (p_custom_features != String()) + file->store_string("custom_features=\"" + p_custom_features + "\"\n"); + file->store_string("\n"); for (Map<String, List<String> >::Element *E = props.front(); E; E = E->next()) { @@ -565,12 +635,12 @@ Error GlobalConfig::_save_settings_text(const String &p_file, const Map<String, return OK; } -Error GlobalConfig::_save_custom_bnd(const String &p_file) { // add other params as dictionary and array? +Error ProjectSettings::_save_custom_bnd(const String &p_file) { // add other params as dictionary and array? return save_custom(p_file); }; -Error GlobalConfig::save_custom(const String &p_path, const CustomMap &p_custom, const Set<String> &p_ignore_masks) { +Error ProjectSettings::save_custom(const String &p_path, const CustomMap &p_custom, const Vector<String> &p_custom_features) { ERR_FAIL_COND_V(p_path == "", ERR_INVALID_PARAMETER); @@ -586,19 +656,6 @@ Error GlobalConfig::save_custom(const String &p_path, const CustomMap &p_custom, if (p_custom.has(G->key())) continue; - bool discard = false; - - for (const Set<String>::Element *E = p_ignore_masks.front(); E; E = E->next()) { - - if (String(G->key()).match(E->get())) { - discard = true; - break; - } - } - - if (discard) - continue; - _VCSort vc; vc.name = G->key(); //*k; vc.order = v->order; @@ -639,10 +696,20 @@ Error GlobalConfig::save_custom(const String &p_path, const CustomMap &p_custom, props[category].push_back(name); } + String custom_features; + + for (int i = 0; i < p_custom_features.size(); i++) { + if (i > 0) + custom_features += ","; + + String f = p_custom_features[i].strip_edges().replace("\"", ""); + custom_features += f; + } + if (p_path.ends_with(".godot")) - return _save_settings_text(p_path, props, p_custom); - else if (p_path.ends_with(".cfb")) - return _save_settings_binary(p_path, props, p_custom); + return _save_settings_text(p_path, props, p_custom, custom_features); + else if (p_path.ends_with(".binary")) + return _save_settings_binary(p_path, props, p_custom, custom_features); else { ERR_EXPLAIN("Unknown config file format: " + p_path); @@ -695,24 +762,24 @@ Error GlobalConfig::save_custom(const String &p_path, const CustomMap &p_custom, Variant _GLOBAL_DEF(const String &p_var, const Variant &p_default) { Variant ret; - if (GlobalConfig::get_singleton()->has(p_var)) { - ret = GlobalConfig::get_singleton()->get(p_var); + if (ProjectSettings::get_singleton()->has(p_var)) { + ret = ProjectSettings::get_singleton()->get(p_var); } else { - GlobalConfig::get_singleton()->set(p_var, p_default); + ProjectSettings::get_singleton()->set(p_var, p_default); ret = p_default; } - GlobalConfig::get_singleton()->set_initial_value(p_var, p_default); - GlobalConfig::get_singleton()->set_builtin_order(p_var); + ProjectSettings::get_singleton()->set_initial_value(p_var, p_default); + ProjectSettings::get_singleton()->set_builtin_order(p_var); return ret; } -void GlobalConfig::add_singleton(const Singleton &p_singleton) { +void ProjectSettings::add_singleton(const Singleton &p_singleton) { singletons.push_back(p_singleton); singleton_ptrs[p_singleton.name] = p_singleton.ptr; } -Object *GlobalConfig::get_singleton_object(const String &p_name) const { +Object *ProjectSettings::get_singleton_object(const String &p_name) const { const Map<StringName, Object *>::Element *E = singleton_ptrs.find(p_name); if (!E) @@ -721,21 +788,21 @@ Object *GlobalConfig::get_singleton_object(const String &p_name) const { return E->get(); }; -bool GlobalConfig::has_singleton(const String &p_name) const { +bool ProjectSettings::has_singleton(const String &p_name) const { return get_singleton_object(p_name) != NULL; }; -void GlobalConfig::get_singletons(List<Singleton> *p_singletons) { +void ProjectSettings::get_singletons(List<Singleton> *p_singletons) { for (List<Singleton>::Element *E = singletons.front(); E; E = E->next()) p_singletons->push_back(E->get()); } -Vector<String> GlobalConfig::get_optimizer_presets() const { +Vector<String> ProjectSettings::get_optimizer_presets() const { List<PropertyInfo> pi; - GlobalConfig::get_singleton()->get_property_list(&pi); + ProjectSettings::get_singleton()->get_property_list(&pi); Vector<String> names; for (List<PropertyInfo>::Element *E = pi.front(); E; E = E->next()) { @@ -750,7 +817,7 @@ Vector<String> GlobalConfig::get_optimizer_presets() const { return names; } -void GlobalConfig::_add_property_info_bind(const Dictionary &p_info) { +void ProjectSettings::_add_property_info_bind(const Dictionary &p_info) { ERR_FAIL_COND(!p_info.has("name")); ERR_FAIL_COND(!p_info.has("type")); @@ -769,24 +836,24 @@ void GlobalConfig::_add_property_info_bind(const Dictionary &p_info) { set_custom_property_info(pinfo.name, pinfo); } -void GlobalConfig::set_custom_property_info(const String &p_prop, const PropertyInfo &p_info) { +void ProjectSettings::set_custom_property_info(const String &p_prop, const PropertyInfo &p_info) { ERR_FAIL_COND(!props.has(p_prop)); custom_prop_info[p_prop] = p_info; custom_prop_info[p_prop].name = p_prop; } -void GlobalConfig::set_disable_platform_override(bool p_disable) { +void ProjectSettings::set_disable_feature_overrides(bool p_disable) { - disable_platform_override = p_disable; + disable_feature_overrides = p_disable; } -bool GlobalConfig::is_using_datapack() const { +bool ProjectSettings::is_using_datapack() const { return using_datapack; } -bool GlobalConfig::property_can_revert(const String &p_name) { +bool ProjectSettings::property_can_revert(const String &p_name) { if (!props.has(p_name)) return false; @@ -794,7 +861,7 @@ bool GlobalConfig::property_can_revert(const String &p_name) { return props[p_name].initial != props[p_name].variant; } -Variant GlobalConfig::property_get_revert(const String &p_name) { +Variant ProjectSettings::property_get_revert(const String &p_name) { if (!props.has(p_name)) return Variant(); @@ -802,32 +869,32 @@ Variant GlobalConfig::property_get_revert(const String &p_name) { return props[p_name].initial; } -void GlobalConfig::_bind_methods() { - - ClassDB::bind_method(D_METHOD("has", "name"), &GlobalConfig::has); - ClassDB::bind_method(D_METHOD("set_order", "name", "pos"), &GlobalConfig::set_order); - ClassDB::bind_method(D_METHOD("get_order", "name"), &GlobalConfig::get_order); - ClassDB::bind_method(D_METHOD("set_initial_value", "name", "value"), &GlobalConfig::set_initial_value); - ClassDB::bind_method(D_METHOD("add_property_info", "hint"), &GlobalConfig::_add_property_info_bind); - ClassDB::bind_method(D_METHOD("clear", "name"), &GlobalConfig::clear); - ClassDB::bind_method(D_METHOD("localize_path", "path"), &GlobalConfig::localize_path); - ClassDB::bind_method(D_METHOD("globalize_path", "path"), &GlobalConfig::globalize_path); - ClassDB::bind_method(D_METHOD("save"), &GlobalConfig::save); - ClassDB::bind_method(D_METHOD("has_singleton", "name"), &GlobalConfig::has_singleton); - ClassDB::bind_method(D_METHOD("get_singleton", "name"), &GlobalConfig::get_singleton_object); - ClassDB::bind_method(D_METHOD("load_resource_pack", "pack"), &GlobalConfig::_load_resource_pack); - ClassDB::bind_method(D_METHOD("property_can_revert", "name"), &GlobalConfig::property_can_revert); - ClassDB::bind_method(D_METHOD("property_get_revert:Variant", "name"), &GlobalConfig::property_get_revert); - - ClassDB::bind_method(D_METHOD("save_custom", "file"), &GlobalConfig::_save_custom_bnd); +void ProjectSettings::_bind_methods() { + + ClassDB::bind_method(D_METHOD("has", "name"), &ProjectSettings::has); + ClassDB::bind_method(D_METHOD("set_order", "name", "pos"), &ProjectSettings::set_order); + ClassDB::bind_method(D_METHOD("get_order", "name"), &ProjectSettings::get_order); + ClassDB::bind_method(D_METHOD("set_initial_value", "name", "value"), &ProjectSettings::set_initial_value); + ClassDB::bind_method(D_METHOD("add_property_info", "hint"), &ProjectSettings::_add_property_info_bind); + ClassDB::bind_method(D_METHOD("clear", "name"), &ProjectSettings::clear); + ClassDB::bind_method(D_METHOD("localize_path", "path"), &ProjectSettings::localize_path); + ClassDB::bind_method(D_METHOD("globalize_path", "path"), &ProjectSettings::globalize_path); + ClassDB::bind_method(D_METHOD("save"), &ProjectSettings::save); + ClassDB::bind_method(D_METHOD("has_singleton", "name"), &ProjectSettings::has_singleton); + ClassDB::bind_method(D_METHOD("get_singleton", "name"), &ProjectSettings::get_singleton_object); + ClassDB::bind_method(D_METHOD("load_resource_pack", "pack"), &ProjectSettings::_load_resource_pack); + ClassDB::bind_method(D_METHOD("property_can_revert", "name"), &ProjectSettings::property_can_revert); + ClassDB::bind_method(D_METHOD("property_get_revert:Variant", "name"), &ProjectSettings::property_get_revert); + + ClassDB::bind_method(D_METHOD("save_custom", "file"), &ProjectSettings::_save_custom_bnd); } -GlobalConfig::GlobalConfig() { +ProjectSettings::ProjectSettings() { singleton = this; last_order = NO_BUILTIN_ORDER_BASE; last_builtin_order = 0; - disable_platform_override = false; + disable_feature_overrides = false; registering_order = true; Array va; @@ -945,11 +1012,13 @@ GlobalConfig::GlobalConfig() { GLOBAL_DEF("input/ui_page_down", va); input_presets.push_back("input/ui_page_down"); - //GLOBAL_DEF("display/handheld/orientation", "landscape"); + //GLOBAL_DEF("display/window/handheld/orientation", "landscape"); custom_prop_info["display/window/handheld/orientation"] = PropertyInfo(Variant::STRING, "display/window/handheld/orientation", PROPERTY_HINT_ENUM, "landscape,portrait,reverse_landscape,reverse_portrait,sensor_landscape,sensor_portrait,sensor"); custom_prop_info["rendering/threads/thread_model"] = PropertyInfo(Variant::INT, "rendering/threads/thread_model", PROPERTY_HINT_ENUM, "Single-Unsafe,Single-Safe,Multi-Threaded"); custom_prop_info["physics/2d/thread_model"] = PropertyInfo(Variant::INT, "physics/2d/thread_model", PROPERTY_HINT_ENUM, "Single-Unsafe,Single-Safe,Multi-Threaded"); + custom_prop_info["rendering/quality/intended_usage/framebuffer_allocation"] = PropertyInfo(Variant::INT, "rendering/quality/intended_usage/framebuffer_allocation", PROPERTY_HINT_ENUM, "2D,2D Without Sampling,3D,3D Without Effects"); + GLOBAL_DEF("rendering/quality/intended_usage/framebuffer_mode", 2); GLOBAL_DEF("debug/settings/profiler/max_functions", 16384); @@ -964,7 +1033,7 @@ GlobalConfig::GlobalConfig() { using_datapack = false; } -GlobalConfig::~GlobalConfig() { +ProjectSettings::~ProjectSettings() { singleton = NULL; } diff --git a/core/global_config.h b/core/project_settings.h index 30c77bbc27..278d4b8132 100644 --- a/core/global_config.h +++ b/core/project_settings.h @@ -37,9 +37,9 @@ @author Juan Linietsky <reduzio@gmail.com> */ -class GlobalConfig : public Object { +class ProjectSettings : public Object { - GDCLASS(GlobalConfig, Object); + GDCLASS(ProjectSettings, Object); _THREAD_SAFE_CLASS_ public: @@ -53,13 +53,12 @@ public: ptr = p_ptr; } }; - -protected: enum { //properties that are not for built in values begin from this value, so builtin ones are displayed first NO_BUILTIN_ORDER_BASE = 1 << 16 }; +protected: struct VariantContainer { int order; bool persist; @@ -88,21 +87,24 @@ protected: Map<StringName, VariantContainer> props; String resource_path; Map<StringName, PropertyInfo> custom_prop_info; - bool disable_platform_override; + bool disable_feature_overrides; bool using_datapack; List<String> input_presets; + Set<String> custom_features; + Map<StringName, StringName> feature_overrides; + bool _set(const StringName &p_name, const Variant &p_value); bool _get(const StringName &p_name, Variant &r_ret) const; void _get_property_list(List<PropertyInfo> *p_list) const; - static GlobalConfig *singleton; + static ProjectSettings *singleton; Error _load_settings(const String p_path); Error _load_settings_binary(const String p_path); - Error _save_settings_text(const String &p_file, const Map<String, List<String> > &props, const CustomMap &p_custom = CustomMap()); - Error _save_settings_binary(const String &p_file, const Map<String, List<String> > &props, const CustomMap &p_custom = CustomMap()); + Error _save_settings_text(const String &p_file, const Map<String, List<String> > &props, const CustomMap &p_custom = CustomMap(), const String &p_custom_features = String()); + Error _save_settings_binary(const String &p_file, const Map<String, List<String> > &props, const CustomMap &p_custom = CustomMap(), const String &p_custom_features = String()); List<Singleton> singletons; Map<StringName, Object *> singleton_ptrs; @@ -127,7 +129,7 @@ public: String get_resource_path() const; - static GlobalConfig *get_singleton(); + static ProjectSettings *get_singleton(); void clear(const String &p_name); int get_order(const String &p_name) const; @@ -136,7 +138,7 @@ public: Error setup(const String &p_path, const String &p_main_pack); - Error save_custom(const String &p_path = "", const CustomMap &p_custom = CustomMap(), const Set<String> &p_ignore_masks = Set<String>()); + Error save_custom(const String &p_path = "", const CustomMap &p_custom = CustomMap(), const Vector<String> &p_custom_features = Vector<String>()); Error save(); void set_custom_property_info(const String &p_prop, const PropertyInfo &p_info); @@ -149,7 +151,7 @@ public: List<String> get_input_presets() const { return input_presets; } - void set_disable_platform_override(bool p_disable); + void set_disable_feature_overrides(bool p_disable); Object *get_singleton_object(const String &p_name) const; void register_global_defaults(); @@ -158,13 +160,13 @@ public: void set_registering_order(bool p_registering); - GlobalConfig(); - ~GlobalConfig(); + ProjectSettings(); + ~ProjectSettings(); }; //not a macro any longer Variant _GLOBAL_DEF(const String &p_var, const Variant &p_default); #define GLOBAL_DEF(m_var, m_value) _GLOBAL_DEF(m_var, m_value) -#define GLOBAL_GET(m_var) GlobalConfig::get_singleton()->get(m_var) +#define GLOBAL_GET(m_var) ProjectSettings::get_singleton()->get(m_var) #endif diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp index d6a521a86f..07715f9718 100644 --- a/core/register_core_types.cpp +++ b/core/register_core_types.cpp @@ -36,7 +36,7 @@ #include "core_string_names.h" #include "func_ref.h" #include "geometry.h" -#include "global_config.h" +#include "project_settings.h" #include "input_map.h" #include "io/config_file.h" #include "io/http_client.h" @@ -177,18 +177,18 @@ void register_core_settings() { void register_core_singletons() { - GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("GlobalConfig", GlobalConfig::get_singleton())); - GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("IP", IP::get_singleton())); - GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("Geometry", _Geometry::get_singleton())); - GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("ResourceLoader", _ResourceLoader::get_singleton())); - GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("ResourceSaver", _ResourceSaver::get_singleton())); - GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("OS", _OS::get_singleton())); - GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("Engine", _Engine::get_singleton())); - GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("ClassDB", _classdb)); - GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("Marshalls", _Marshalls::get_singleton())); - GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("TranslationServer", TranslationServer::get_singleton())); - GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("Input", Input::get_singleton())); - GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("InputMap", InputMap::get_singleton())); + 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())); + ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("ResourceLoader", _ResourceLoader::get_singleton())); + ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("ResourceSaver", _ResourceSaver::get_singleton())); + ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("OS", _OS::get_singleton())); + ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("Engine", _Engine::get_singleton())); + ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("ClassDB", _classdb)); + ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("Marshalls", _Marshalls::get_singleton())); + ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("TranslationServer", TranslationServer::get_singleton())); + ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("Input", Input::get_singleton())); + ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("InputMap", InputMap::get_singleton())); } void unregister_core_types() { diff --git a/core/resource.cpp b/core/resource.cpp index a7a5498ef6..5625784396 100644 --- a/core/resource.cpp +++ b/core/resource.cpp @@ -31,7 +31,6 @@ #include "core_string_names.h" #include "io/resource_loader.h" -#include "io/resource_loader.h" #include "os/file_access.h" #include "script_language.h" #include <stdio.h> @@ -340,7 +339,7 @@ void Resource::_bind_methods() { ClassDB::bind_method(D_METHOD("get_local_scene:Node"), &Resource::get_local_scene); ClassDB::bind_method(D_METHOD("setup_local_to_scene"), &Resource::setup_local_to_scene); - ClassDB::bind_method(D_METHOD("duplicate", "subresources"), &Resource::duplicate, DEFVAL(false)); + ClassDB::bind_method(D_METHOD("duplicate:Resource", "subresources"), &Resource::duplicate, DEFVAL(false)); ADD_SIGNAL(MethodInfo("changed")); ADD_GROUP("Resource", "resource_"); ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "resource_local_to_scene"), "set_local_to_scene", "is_local_to_scene"); diff --git a/core/safe_refcount.cpp b/core/safe_refcount.cpp index 1bd16f9e4f..d7e5297321 100644 --- a/core/safe_refcount.cpp +++ b/core/safe_refcount.cpp @@ -55,7 +55,7 @@ static _ALWAYS_INLINE_ T _atomic_decrement_impl(register T *pw) { } template <class T> -static _ALWAYS_INLINE_T _atomic_increment_impl(register T *pw) { +static _ALWAYS_INLINE_ T _atomic_increment_impl(register T *pw) { (*pw)++; @@ -71,7 +71,7 @@ static _ALWAYS_INLINE_ T _atomic_sub_impl(register T *pw, register T val) { } template <class T> -static _ALWAYS_INLINE_T _atomic_add_impl(register T *pw, register T val) { +static _ALWAYS_INLINE_ T _atomic_add_impl(register T *pw, register T val) { (*pw) += val; @@ -185,7 +185,7 @@ static _ALWAYS_INLINE_ uint64_t _atomic_increment_impl(register uint64_t *pw) { static _ALWAYS_INLINE_ uint64_t _atomic_sub_impl(register uint64_t *pw, register uint64_t val) { -#if _WIN32_WINNT >= 0x0601 // Windows 7+ +#if _WIN32_WINNT >= 0x0601 && !defined(UWP_ENABLED) // Windows 7+ except UWP return InterlockedExchangeSubtract64(pw, val) - val; #else return InterlockedExchangeAdd64((LONGLONG volatile *)pw, -(int64_t)val) - val; diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp index 7fc151d83f..a7b6f25590 100644 --- a/core/script_debugger_remote.cpp +++ b/core/script_debugger_remote.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "script_debugger_remote.h" -#include "global_config.h" +#include "project_settings.h" #include "io/ip.h" #include "os/input.h" #include "os/os.h" @@ -130,7 +130,7 @@ void ScriptDebuggerRemote::debug(ScriptLanguage *p_script, bool p_can_continue) ERR_FAIL(); } - OS::get_singleton()->enable_for_stealing_focus(GlobalConfig::get_singleton()->get("editor_pid")); + OS::get_singleton()->enable_for_stealing_focus(ProjectSettings::get_singleton()->get("editor_pid")); packet_peer_stream->put_var("debug_enter"); packet_peer_stream->put_var(2); @@ -952,7 +952,7 @@ ScriptDebuggerRemote::ScriptDebuggerRemote() { phl.userdata = this; add_print_handler(&phl); requested_quit = false; - performance = GlobalConfig::get_singleton()->get_singleton_object("Performance"); + performance = ProjectSettings::get_singleton()->get_singleton_object("Performance"); last_perf_time = 0; poll_every = 0; request_scene_tree = NULL; @@ -967,7 +967,7 @@ ScriptDebuggerRemote::ScriptDebuggerRemote() { eh.userdata = this; add_error_handler(&eh); - profile_info.resize(CLAMP(int(GlobalConfig::get_singleton()->get("debug/settings/profiler/max_functions")), 128, 65535)); + profile_info.resize(CLAMP(int(ProjectSettings::get_singleton()->get("debug/settings/profiler/max_functions")), 128, 65535)); profile_info_ptrs.resize(profile_info.size()); profiling = false; max_frame_functions = 16; diff --git a/core/script_language.cpp b/core/script_language.cpp index 4a7fdc9d64..aeb1573840 100644 --- a/core/script_language.cpp +++ b/core/script_language.cpp @@ -99,6 +99,13 @@ void ScriptServer::init_languages() { } } +void ScriptServer::finish_languages() { + + for (int i = 0; i < _language_count; i++) { + _languages[i]->finish(); + } +} + void ScriptServer::set_reload_scripts_on_save(bool p_enable) { reload_scripts_on_save = p_enable; diff --git a/core/script_language.h b/core/script_language.h index a81300233f..7aba3ec0f1 100644 --- a/core/script_language.h +++ b/core/script_language.h @@ -69,6 +69,7 @@ public: static void thread_exit(); static void init_languages(); + static void finish_languages(); }; class ScriptInstance; diff --git a/core/translation.cpp b/core/translation.cpp index 72231ef295..d782006ddc 100644 --- a/core/translation.cpp +++ b/core/translation.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "translation.h" -#include "global_config.h" +#include "project_settings.h" #include "io/resource_loader.h" #include "os/os.h" @@ -1053,8 +1053,8 @@ TranslationServer *TranslationServer::singleton = NULL; bool TranslationServer::_load_translations(const String &p_from) { - if (GlobalConfig::get_singleton()->has(p_from)) { - PoolVector<String> translations = GlobalConfig::get_singleton()->get(p_from); + if (ProjectSettings::get_singleton()->has(p_from)) { + PoolVector<String> translations = ProjectSettings::get_singleton()->get(p_from); int tcount = translations.size(); @@ -1095,7 +1095,7 @@ void TranslationServer::setup() { options += locale_list[idx]; idx++; } - GlobalConfig::get_singleton()->set_custom_property_info("locale/fallback", PropertyInfo(Variant::STRING, "locale/fallback", PROPERTY_HINT_ENUM, options)); + ProjectSettings::get_singleton()->set_custom_property_info("locale/fallback", PropertyInfo(Variant::STRING, "locale/fallback", PROPERTY_HINT_ENUM, options)); } #endif //load translations diff --git a/core/variant_parser.cpp b/core/variant_parser.cpp index 26a6a05a30..398f20caf3 100644 --- a/core/variant_parser.cpp +++ b/core/variant_parser.cpp @@ -1099,7 +1099,7 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream, return OK; - } else if (id == "PoolFloatArray" || id == "FloatArray") { + } else if (id == "PoolRealArray" || id == "FloatArray") { Vector<float> args; Error err = _parse_construct<float>(p_stream, args, line, r_err_str); @@ -1855,7 +1855,7 @@ Error VariantWriter::write(const Variant &p_variant, StoreStringFunc p_store_str } break; case Variant::POOL_REAL_ARRAY: { - p_store_string_func(p_store_string_ud, "PoolFloatArray( "); + p_store_string_func(p_store_string_ud, "PoolRealArray( "); PoolVector<real_t> data = p_variant; int len = data.size(); PoolVector<real_t>::Read r = data.read(); |