diff options
200 files changed, 1692 insertions, 959 deletions
diff --git a/.travis.yml b/.travis.yml index 8aa21a4de4..371c965db4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -88,8 +88,8 @@ script: sh ./misc/travis/clang-format.sh; else if [ "$TRAVIS_OS_NAME" = "windows" ]; then - scons platform=$GODOT_TARGET progress=no verbose=yes CXX=$CXX openssl=builtin; + scons -j 2 platform=$GODOT_TARGET progress=no verbose=yes CXX=$CXX openssl=builtin; else - scons platform=$GODOT_TARGET progress=no verbose=yes bits=64 CXX=$CXX openssl=builtin; + scons -j 2 platform=$GODOT_TARGET progress=no verbose=yes bits=64 CXX=$CXX openssl=builtin; fi fi 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..69d0ba7851 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); }; @@ -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/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..57acb6c754 100644 --- a/core/io/resource_loader.cpp +++ b/core/io/resource_loader.cpp @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "resource_loader.h" -#include "global_config.h" +#include "project_settings.h" #include "io/resource_import.h" #include "os/file_access.h" #include "os/os.h" @@ -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/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/object.cpp b/core/object.cpp index 9184fb9cd0..000cefcac7 100644 --- a/core/object.cpp +++ b/core/object.cpp @@ -1723,7 +1723,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/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..1a0a50a10f 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,8 @@ 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_featores=\"" + p_custom_features + "\"\n"); for (Map<String, List<String> >::Element *E = props.front(); E; E = E->next()) { @@ -565,12 +634,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 +655,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 +695,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 +761,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 +787,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 +816,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 +835,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 +860,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 +868,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 +1011,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 +1032,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/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/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/doc/base/classes.xml b/doc/base/classes.xml index a137f9be7d..fa93d7ece7 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -741,7 +741,7 @@ <member name="Geometry" type="Geometry" setter="" getter="" brief=""> [Geometry] singleton </member> - <member name="GlobalConfig" type="GlobalConfig" setter="" getter="" brief=""> + <member name="ProjectSettings" type="ProjectSettings" setter="" getter="" brief=""> </member> <member name="IP" type="IP" setter="" getter="" brief=""> [IP] singleton @@ -17682,7 +17682,7 @@ </constant> </constants> </class> -<class name="GlobalConfig" inherits="Object" category="Core"> +<class name="ProjectSettings" inherits="Object" category="Core"> <brief_description> Contains global variables accessible from everywhere. </brief_description> diff --git a/drivers/alsa/audio_driver_alsa.cpp b/drivers/alsa/audio_driver_alsa.cpp index b32d540380..4e6739e8c0 100644 --- a/drivers/alsa/audio_driver_alsa.cpp +++ b/drivers/alsa/audio_driver_alsa.cpp @@ -31,7 +31,7 @@ #ifdef ALSA_ENABLED -#include "global_config.h" +#include "project_settings.h" #include <errno.h> diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp index e854abb6a1..0cb7aa8745 100644 --- a/drivers/gles2/rasterizer_gles2.cpp +++ b/drivers/gles2/rasterizer_gles2.cpp @@ -31,7 +31,7 @@ #include "rasterizer_gles2.h" #include "gl_context/context_gl.h" -#include "global_config.h" +#include "project_settings.h" #include "os/os.h" #include "servers/visual/particle_system_sw.h" #include "servers/visual/shader_language.h" @@ -3942,7 +3942,7 @@ void RasterizerGLES2::begin_frame() { //fragment_lighting=Globals::get_singleton()->get("rasterizer/use_fragment_lighting"); #ifdef TOOLS_ENABLED canvas_shader.set_conditional(CanvasShaderGLES2::USE_PIXEL_SNAP, GLOBAL_DEF("rendering/use_2d_pixel_snap", false)); - shadow_filter = ShadowFilterTechnique(int(GlobalConfig::get_singleton()->get("rasterizer/shadow_filter"))); + shadow_filter = ShadowFilterTechnique(int(ProjectSettings::get_singleton()->get("rasterizer/shadow_filter"))); #endif canvas_shader.set_conditional(CanvasShaderGLES2::SHADOW_PCF5, shadow_filter == SHADOW_FILTER_PCF5); @@ -6819,7 +6819,7 @@ void RasterizerGLES2::end_scene() { if (current_env->bg_mode == VS::ENV_BG_COLOR) bgcolor = current_env->bg_param[VS::ENV_BG_PARAM_COLOR]; else - bgcolor = GlobalConfig::get_singleton()->get("render/default_clear_color"); + bgcolor = ProjectSettings::get_singleton()->get("render/default_clear_color"); bgcolor = _convert_color(bgcolor); float a = use_fb ? float(current_env->bg_param[VS::ENV_BG_PARAM_GLOW]) : 1.0; glClearColor(bgcolor.r, bgcolor.g, bgcolor.b, a); @@ -10718,7 +10718,7 @@ RasterizerGLES2::RasterizerGLES2(bool p_compress_arrays, bool p_keep_ram_copy, b fragment_lighting = GLOBAL_DEF("rasterizer/use_fragment_lighting", true); read_depth_supported = true; //todo check for extension shadow_filter = ShadowFilterTechnique((int)(GLOBAL_DEF("rasterizer/shadow_filter", SHADOW_FILTER_PCF5))); - GlobalConfig::get_singleton()->set_custom_property_info("rasterizer/shadow_filter", PropertyInfo(Variant::INT, "rasterizer/shadow_filter", PROPERTY_HINT_ENUM, "None,PCF5,PCF13,ESM")); + ProjectSettings::get_singleton()->set_custom_property_info("rasterizer/shadow_filter", PropertyInfo(Variant::INT, "rasterizer/shadow_filter", PROPERTY_HINT_ENUM, "None,PCF5,PCF13,ESM")); use_fp16_fb = bool(GLOBAL_DEF("rasterizer/fp16_framebuffer", true)); use_shadow_mapping = true; use_fast_texture_filter = !bool(GLOBAL_DEF("rasterizer/trilinear_mipmap_filter", true)); diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index 98e55c5a53..42d4572b7f 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "rasterizer_canvas_gles3.h" -#include "global_config.h" +#include "project_settings.h" #include "os/os.h" #include "rasterizer_scene_gles3.h" #include "servers/visual/visual_server_raster.h" diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp index 233095dec2..4f0d9a03c4 100644 --- a/drivers/gles3/rasterizer_gles3.cpp +++ b/drivers/gles3/rasterizer_gles3.cpp @@ -30,7 +30,7 @@ #include "rasterizer_gles3.h" #include "gl_context/context_gl.h" -#include "global_config.h" +#include "project_settings.h" #include "os/os.h" #include <string.h> RasterizerStorage *RasterizerGLES3::get_storage() { diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index b7547f53a8..5d884fff11 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -29,8 +29,8 @@ /*************************************************************************/ #include "rasterizer_scene_gles3.h" -#include "global_config.h" #include "os/os.h" +#include "project_settings.h" #include "rasterizer_canvas_gles3.h" #ifndef GLES_OVER_GL @@ -4779,8 +4779,6 @@ void RasterizerSceneGLES3::initialize() { state.scene_shader.add_custom_define("#define MAX_SKELETON_BONES " + itos(state.max_skeleton_bones) + "\n"); } - GLOBAL_DEF("rendering/quality/shadows/filter_mode", 1); - GlobalConfig::get_singleton()->set_custom_property_info("rendering/quality/shadows/filter_mode", PropertyInfo(Variant::INT, "rendering/quality/shadows/filter_mode", PROPERTY_HINT_ENUM, "Disabled,PCF5,PCF13")); shadow_filter_mode = SHADOW_FILTER_NEAREST; { //reflection cubemaps @@ -4872,9 +4870,9 @@ void RasterizerSceneGLES3::initialize() { { GLOBAL_DEF("rendering/quality/subsurface_scattering/quality", 1); - GlobalConfig::get_singleton()->set_custom_property_info("rendering/quality/subsurface_scattering/quality", PropertyInfo(Variant::INT, "rendering/quality/subsurface_scattering/quality", PROPERTY_HINT_ENUM, "Low,Medium,High")); + ProjectSettings::get_singleton()->set_custom_property_info("rendering/quality/subsurface_scattering/quality", PropertyInfo(Variant::INT, "rendering/quality/subsurface_scattering/quality", PROPERTY_HINT_ENUM, "Low,Medium,High")); GLOBAL_DEF("rendering/quality/subsurface_scattering/scale", 1.0); - GlobalConfig::get_singleton()->set_custom_property_info("rendering/quality/subsurface_scattering/scale", PropertyInfo(Variant::INT, "rendering/quality/subsurface_scattering/scale", PROPERTY_HINT_RANGE, "0.01,8,0.01")); + ProjectSettings::get_singleton()->set_custom_property_info("rendering/quality/subsurface_scattering/scale", PropertyInfo(Variant::INT, "rendering/quality/subsurface_scattering/scale", PROPERTY_HINT_RANGE, "0.01,8,0.01")); GLOBAL_DEF("rendering/quality/subsurface_scattering/follow_surface", false); GLOBAL_DEF("rendering/quality/voxel_cone_tracing/high_quality", true); @@ -4916,12 +4914,12 @@ void RasterizerSceneGLES3::initialize() { void RasterizerSceneGLES3::iteration() { - shadow_filter_mode = ShadowFilterMode(int(GlobalConfig::get_singleton()->get("rendering/quality/shadows/filter_mode"))); - subsurface_scatter_follow_surface = GlobalConfig::get_singleton()->get("rendering/quality/subsurface_scattering/follow_surface"); - subsurface_scatter_quality = SubSurfaceScatterQuality(int(GlobalConfig::get_singleton()->get("rendering/quality/subsurface_scattering/quality"))); - subsurface_scatter_size = GlobalConfig::get_singleton()->get("rendering/quality/subsurface_scattering/scale"); + shadow_filter_mode = ShadowFilterMode(int(ProjectSettings::get_singleton()->get("rendering/quality/shadows/filter_mode"))); + subsurface_scatter_follow_surface = ProjectSettings::get_singleton()->get("rendering/quality/subsurface_scattering/follow_surface"); + subsurface_scatter_quality = SubSurfaceScatterQuality(int(ProjectSettings::get_singleton()->get("rendering/quality/subsurface_scattering/quality"))); + subsurface_scatter_size = ProjectSettings::get_singleton()->get("rendering/quality/subsurface_scattering/scale"); - state.scene_shader.set_conditional(SceneShaderGLES3::VCT_QUALITY_HIGH, GlobalConfig::get_singleton()->get("rendering/quality/voxel_cone_tracing/high_quality")); + state.scene_shader.set_conditional(SceneShaderGLES3::VCT_QUALITY_HIGH, ProjectSettings::get_singleton()->get("rendering/quality/voxel_cone_tracing/high_quality")); } void RasterizerSceneGLES3::finalize() { diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index 981426f4dc..17e77aed89 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "rasterizer_storage_gles3.h" -#include "global_config.h" +#include "project_settings.h" #include "rasterizer_canvas_gles3.h" #include "rasterizer_scene_gles3.h" @@ -6848,7 +6848,7 @@ void RasterizerStorageGLES3::initialize() { } config.shrink_textures_x2 = false; - config.use_fast_texture_filter = int(GlobalConfig::get_singleton()->get("rendering/quality/filters/use_nearest_mipmap_filter")); + config.use_fast_texture_filter = int(ProjectSettings::get_singleton()->get("rendering/quality/filters/use_nearest_mipmap_filter")); config.use_anisotropic_filter = config.extensions.has("rendering/quality/filters/anisotropic_filter_level"); config.s3tc_supported = config.extensions.has("GL_EXT_texture_compression_dxt1") || config.extensions.has("GL_EXT_texture_compression_s3tc") || config.extensions.has("WEBGL_compressed_texture_s3tc"); @@ -6872,7 +6872,7 @@ void RasterizerStorageGLES3::initialize() { config.use_anisotropic_filter = config.extensions.has("GL_EXT_texture_filter_anisotropic"); if (config.use_anisotropic_filter) { glGetFloatv(_GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &config.anisotropic_level); - config.anisotropic_level = MIN(int(GlobalConfig::get_singleton()->get("rendering/quality/anisotropic_filter_level")), config.anisotropic_level); + config.anisotropic_level = MIN(int(ProjectSettings::get_singleton()->get("rendering/quality/anisotropic_filter_level")), config.anisotropic_level); } frame.clear_request = false; @@ -7009,7 +7009,7 @@ void RasterizerStorageGLES3::initialize() { frame.current_rt = NULL; config.keep_original_textures = false; config.generate_wireframes = false; - config.use_texture_array_environment = GLOBAL_DEF("rendering/quality/reflections/texture_array_reflections", true); + config.use_texture_array_environment = GLOBAL_GET("rendering/quality/reflections/texture_array_reflections"); } void RasterizerStorageGLES3::finalize() { diff --git a/drivers/png/resource_saver_png.cpp b/drivers/png/resource_saver_png.cpp index 0d7e1d9d72..ff3128d476 100644 --- a/drivers/png/resource_saver_png.cpp +++ b/drivers/png/resource_saver_png.cpp @@ -30,7 +30,7 @@ #include "resource_saver_png.h" #include "core/image.h" -#include "global_config.h" +#include "project_settings.h" #include "os/file_access.h" #include "scene/resources/texture.h" diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.cpp b/drivers/pulseaudio/audio_driver_pulseaudio.cpp index 45827ee4f7..fb04ef0088 100644 --- a/drivers/pulseaudio/audio_driver_pulseaudio.cpp +++ b/drivers/pulseaudio/audio_driver_pulseaudio.cpp @@ -33,7 +33,7 @@ #include <pulse/error.h> -#include "global_config.h" +#include "project_settings.h" Error AudioDriverPulseAudio::init() { diff --git a/drivers/rtaudio/audio_driver_rtaudio.cpp b/drivers/rtaudio/audio_driver_rtaudio.cpp index 0cbe145b41..4dee796060 100644 --- a/drivers/rtaudio/audio_driver_rtaudio.cpp +++ b/drivers/rtaudio/audio_driver_rtaudio.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "audio_driver_rtaudio.h" -#include "global_config.h" +#include "project_settings.h" #include "os/os.h" #ifdef RTAUDIO_ENABLED diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index 2f88296ea4..d05529ef9a 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -53,7 +53,7 @@ #if defined(__FreeBSD__) || defined(__OpenBSD__) #include <sys/param.h> #endif -#include "global_config.h" +#include "project_settings.h" #include <assert.h> #include <dlfcn.h> #include <errno.h> @@ -494,7 +494,7 @@ String OS_Unix::get_data_dir() const { if (has_environment("HOME")) { - bool use_godot = GlobalConfig::get_singleton()->get("application/config/use_shared_user_dir"); + bool use_godot = ProjectSettings::get_singleton()->get("application/config/use_shared_user_dir"); if (use_godot) return get_environment("HOME") + "/.godot/app_userdata/" + an; else @@ -502,12 +502,7 @@ String OS_Unix::get_data_dir() const { } } - return GlobalConfig::get_singleton()->get_resource_path(); -} - -bool OS_Unix::check_feature_support(const String &p_feature) { - - return VisualServer::get_singleton()->has_os_feature(p_feature); + return ProjectSettings::get_singleton()->get_resource_path(); } String OS_Unix::get_installed_templates_path() const { diff --git a/drivers/unix/os_unix.h b/drivers/unix/os_unix.h index 67eb5cefdf..953b0f0431 100644 --- a/drivers/unix/os_unix.h +++ b/drivers/unix/os_unix.h @@ -117,8 +117,6 @@ public: virtual String get_executable_path() const; virtual String get_data_dir() const; - virtual bool check_feature_support(const String &p_feature); - //virtual void run( MainLoop * p_main_loop ); }; diff --git a/drivers/xaudio2/audio_driver_xaudio2.cpp b/drivers/xaudio2/audio_driver_xaudio2.cpp index 23ba177824..da6de79592 100644 --- a/drivers/xaudio2/audio_driver_xaudio2.cpp +++ b/drivers/xaudio2/audio_driver_xaudio2.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "audio_driver_xaudio2.h" -#include "global_config.h" +#include "project_settings.h" #include "os/os.h" const char *AudioDriverXAudio2::get_name() const { diff --git a/editor/asset_library_editor_plugin.cpp b/editor/asset_library_editor_plugin.cpp index 27d468bc25..74e21b31ea 100644 --- a/editor/asset_library_editor_plugin.cpp +++ b/editor/asset_library_editor_plugin.cpp @@ -1228,8 +1228,8 @@ void EditorAssetLibrary::_asset_open() { void EditorAssetLibrary::_manage_plugins() { - ProjectSettings::get_singleton()->popup_project_settings(); - ProjectSettings::get_singleton()->set_plugins_page(); + ProjectSettingsEditor::get_singleton()->popup_project_settings(); + ProjectSettingsEditor::get_singleton()->set_plugins_page(); } void EditorAssetLibrary::_install_external_asset(String p_zip_path, String p_title) { diff --git a/editor/collada/collada.cpp b/editor/collada/collada.cpp index 2f234c441a..ab1e397ccc 100644 --- a/editor/collada/collada.cpp +++ b/editor/collada/collada.cpp @@ -306,7 +306,7 @@ void Collada::_parse_image(XMLParser &parser) { String path = parser.get_attribute_value("source").strip_edges(); if (path.find("://") == -1 && path.is_rel_path()) { // path is relative to file being loaded, so convert to a resource path - image.path = GlobalConfig::get_singleton()->localize_path(state.local_path.get_base_dir() + "/" + path.percent_decode()); + image.path = ProjectSettings::get_singleton()->localize_path(state.local_path.get_base_dir() + "/" + path.percent_decode()); } } else { @@ -323,11 +323,11 @@ void Collada::_parse_image(XMLParser &parser) { 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(state.local_path.get_base_dir() + "/" + path); + path = ProjectSettings::get_singleton()->localize_path(state.local_path.get_base_dir() + "/" + path); } else if (path.find("file:///") == 0) { path = path.replace_first("file:///", ""); - path = GlobalConfig::get_singleton()->localize_path(path); + path = ProjectSettings::get_singleton()->localize_path(path); } image.path = path; @@ -2556,7 +2556,7 @@ Error Collada::load(const String &p_path, int p_flags) { Error err = parser.open(p_path); ERR_FAIL_COND_V(err, err); - state.local_path = GlobalConfig::get_singleton()->localize_path(p_path); + state.local_path = ProjectSettings::get_singleton()->localize_path(p_path); state.import_flags = p_flags; /* Skip headers */ err = OK; diff --git a/editor/collada/collada.h b/editor/collada/collada.h index ca60c392dd..38e66a7e45 100644 --- a/editor/collada/collada.h +++ b/editor/collada/collada.h @@ -32,7 +32,7 @@ #ifndef COLLADA_H #define COLLADA_H -#include "global_config.h" +#include "project_settings.h" #include "io/xml_parser.h" #include "map.h" #include "scene/resources/material.h" diff --git a/editor/doc/doc_data.cpp b/editor/doc/doc_data.cpp index 6a79f99354..fa90cd36b3 100644 --- a/editor/doc/doc_data.cpp +++ b/editor/doc/doc_data.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "doc_data.h" -#include "global_config.h" +#include "project_settings.h" #include "global_constants.h" #include "io/compression.h" #include "io/marshalls.h" @@ -568,14 +568,14 @@ void DocData::generate(bool p_basic_types) { c.constants.push_back(cd); } - List<GlobalConfig::Singleton> singletons; - GlobalConfig::get_singleton()->get_singletons(&singletons); + List<ProjectSettings::Singleton> singletons; + ProjectSettings::get_singleton()->get_singletons(&singletons); //servers (this is kind of hackish) - for (List<GlobalConfig::Singleton>::Element *E = singletons.front(); E; E = E->next()) { + for (List<ProjectSettings::Singleton>::Element *E = singletons.front(); E; E = E->next()) { PropertyDoc pd; - GlobalConfig::Singleton &s = E->get(); + ProjectSettings::Singleton &s = E->get(); pd.name = s.name; pd.type = s.ptr->get_class(); while (String(ClassDB::get_parent_class(pd.type)) != "Object") diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp index b83ac69141..399c22bf2c 100644 --- a/editor/editor_autoload_settings.cpp +++ b/editor/editor_autoload_settings.cpp @@ -30,7 +30,7 @@ #include "editor_autoload_settings.h" #include "editor_node.h" -#include "global_config.h" +#include "project_settings.h" #include "global_constants.h" #define PREVIEW_LIST_MAX_SIZE 10 @@ -115,12 +115,12 @@ void EditorAutoloadSettings::_autoload_add() { UndoRedo *undo_redo = EditorNode::get_singleton()->get_undo_redo(); undo_redo->create_action(TTR("Add AutoLoad")); - undo_redo->add_do_property(GlobalConfig::get_singleton(), name, "*" + path); + undo_redo->add_do_property(ProjectSettings::get_singleton(), name, "*" + path); - if (GlobalConfig::get_singleton()->has(name)) { - undo_redo->add_undo_property(GlobalConfig::get_singleton(), name, GlobalConfig::get_singleton()->get(name)); + if (ProjectSettings::get_singleton()->has(name)) { + undo_redo->add_undo_property(ProjectSettings::get_singleton(), name, ProjectSettings::get_singleton()->get(name)); } else { - undo_redo->add_undo_property(GlobalConfig::get_singleton(), name, Variant()); + undo_redo->add_undo_property(ProjectSettings::get_singleton(), name, Variant()); } undo_redo->add_do_method(this, "update_autoload"); @@ -169,7 +169,7 @@ void EditorAutoloadSettings::_autoload_edited() { return; } - if (GlobalConfig::get_singleton()->has("autoload/" + name)) { + if (ProjectSettings::get_singleton()->has("autoload/" + name)) { ti->set_text(0, old_name); EditorNode::get_singleton()->show_warning(vformat(TTR("Autoload '%s' already exists!"), name)); return; @@ -179,18 +179,18 @@ void EditorAutoloadSettings::_autoload_edited() { name = "autoload/" + name; - int order = GlobalConfig::get_singleton()->get_order(selected_autoload); - String path = GlobalConfig::get_singleton()->get(selected_autoload); + int order = ProjectSettings::get_singleton()->get_order(selected_autoload); + String path = ProjectSettings::get_singleton()->get(selected_autoload); undo_redo->create_action(TTR("Rename Autoload")); - undo_redo->add_do_property(GlobalConfig::get_singleton(), name, path); - undo_redo->add_do_method(GlobalConfig::get_singleton(), "set_order", name, order); - undo_redo->add_do_method(GlobalConfig::get_singleton(), "clear", selected_autoload); + undo_redo->add_do_property(ProjectSettings::get_singleton(), name, path); + undo_redo->add_do_method(ProjectSettings::get_singleton(), "set_order", name, order); + undo_redo->add_do_method(ProjectSettings::get_singleton(), "clear", selected_autoload); - undo_redo->add_undo_property(GlobalConfig::get_singleton(), selected_autoload, path); - undo_redo->add_undo_method(GlobalConfig::get_singleton(), "set_order", selected_autoload, order); - undo_redo->add_undo_method(GlobalConfig::get_singleton(), "clear", name); + undo_redo->add_undo_property(ProjectSettings::get_singleton(), selected_autoload, path); + undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set_order", selected_autoload, order); + undo_redo->add_undo_method(ProjectSettings::get_singleton(), "clear", name); undo_redo->add_do_method(this, "update_autoload"); undo_redo->add_undo_method(this, "update_autoload"); @@ -207,8 +207,8 @@ void EditorAutoloadSettings::_autoload_edited() { bool checked = ti->is_checked(2); String base = "autoload/" + ti->get_text(0); - int order = GlobalConfig::get_singleton()->get_order(base); - String path = GlobalConfig::get_singleton()->get(base); + int order = ProjectSettings::get_singleton()->get_order(base); + String path = ProjectSettings::get_singleton()->get(base); if (path.begins_with("*")) path = path.substr(1, path.length()); @@ -218,11 +218,11 @@ void EditorAutoloadSettings::_autoload_edited() { undo_redo->create_action(TTR("Toggle AutoLoad Globals")); - undo_redo->add_do_property(GlobalConfig::get_singleton(), base, path); - undo_redo->add_undo_property(GlobalConfig::get_singleton(), base, GlobalConfig::get_singleton()->get(base)); + undo_redo->add_do_property(ProjectSettings::get_singleton(), base, path); + undo_redo->add_undo_property(ProjectSettings::get_singleton(), base, ProjectSettings::get_singleton()->get(base)); - undo_redo->add_do_method(GlobalConfig::get_singleton(), "set_order", base, order); - undo_redo->add_undo_method(GlobalConfig::get_singleton(), "set_order", base, order); + undo_redo->add_do_method(ProjectSettings::get_singleton(), "set_order", base, order); + undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set_order", base, order); undo_redo->add_do_method(this, "update_autoload"); undo_redo->add_undo_method(this, "update_autoload"); @@ -262,16 +262,16 @@ void EditorAutoloadSettings::_autoload_button_pressed(Object *p_item, int p_colu String swap_name = "autoload/" + swap->get_text(0); - int order = GlobalConfig::get_singleton()->get_order(name); - int swap_order = GlobalConfig::get_singleton()->get_order(swap_name); + int order = ProjectSettings::get_singleton()->get_order(name); + int swap_order = ProjectSettings::get_singleton()->get_order(swap_name); undo_redo->create_action(TTR("Move Autoload")); - undo_redo->add_do_method(GlobalConfig::get_singleton(), "set_order", name, swap_order); - undo_redo->add_undo_method(GlobalConfig::get_singleton(), "set_order", name, order); + undo_redo->add_do_method(ProjectSettings::get_singleton(), "set_order", name, swap_order); + undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set_order", name, order); - undo_redo->add_do_method(GlobalConfig::get_singleton(), "set_order", swap_name, order); - undo_redo->add_undo_method(GlobalConfig::get_singleton(), "set_order", swap_name, swap_order); + undo_redo->add_do_method(ProjectSettings::get_singleton(), "set_order", swap_name, order); + undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set_order", swap_name, swap_order); undo_redo->add_do_method(this, "update_autoload"); undo_redo->add_undo_method(this, "update_autoload"); @@ -283,15 +283,15 @@ void EditorAutoloadSettings::_autoload_button_pressed(Object *p_item, int p_colu } break; case BUTTON_DELETE: { - int order = GlobalConfig::get_singleton()->get_order(name); + int order = ProjectSettings::get_singleton()->get_order(name); undo_redo->create_action(TTR("Remove Autoload")); - undo_redo->add_do_property(GlobalConfig::get_singleton(), name, Variant()); + undo_redo->add_do_property(ProjectSettings::get_singleton(), name, Variant()); - undo_redo->add_undo_property(GlobalConfig::get_singleton(), name, GlobalConfig::get_singleton()->get(name)); - undo_redo->add_undo_method(GlobalConfig::get_singleton(), "set_persisting", name, true); - undo_redo->add_undo_method(GlobalConfig::get_singleton(), "set_order", order); + undo_redo->add_undo_property(ProjectSettings::get_singleton(), name, ProjectSettings::get_singleton()->get(name)); + undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set_persisting", name, true); + undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set_order", order); undo_redo->add_do_method(this, "update_autoload"); undo_redo->add_undo_method(this, "update_autoload"); @@ -322,7 +322,7 @@ void EditorAutoloadSettings::update_autoload() { TreeItem *root = tree->create_item(); List<PropertyInfo> props; - GlobalConfig::get_singleton()->get_property_list(&props); + ProjectSettings::get_singleton()->get_property_list(&props); for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) { @@ -332,14 +332,14 @@ void EditorAutoloadSettings::update_autoload() { continue; String name = pi.name.get_slice("/", 1); - String path = GlobalConfig::get_singleton()->get(pi.name); + String path = ProjectSettings::get_singleton()->get(pi.name); if (name.empty()) continue; AutoLoadInfo info; info.name = pi.name; - info.order = GlobalConfig::get_singleton()->get_order(pi.name); + info.order = ProjectSettings::get_singleton()->get_order(pi.name); autoload_cache.push_back(info); @@ -459,7 +459,7 @@ void EditorAutoloadSettings::drop_data_fw(const Point2 &p_point, const Variant & move_to_back = true; } - int order = GlobalConfig::get_singleton()->get_order("autoload/" + name); + int order = ProjectSettings::get_singleton()->get_order("autoload/" + name); AutoLoadInfo aux; List<AutoLoadInfo>::Element *E = NULL; @@ -476,7 +476,7 @@ void EditorAutoloadSettings::drop_data_fw(const Point2 &p_point, const Variant & orders.resize(autoload_cache.size()); for (int i = 0; i < autoloads.size(); i++) { - aux.order = GlobalConfig::get_singleton()->get_order("autoload/" + autoloads[i]); + aux.order = ProjectSettings::get_singleton()->get_order("autoload/" + autoloads[i]); List<AutoLoadInfo>::Element *I = autoload_cache.find(aux); @@ -506,8 +506,8 @@ void EditorAutoloadSettings::drop_data_fw(const Point2 &p_point, const Variant & i = 0; for (List<AutoLoadInfo>::Element *E = autoload_cache.front(); E; E = E->next()) { - undo_redo->add_do_method(GlobalConfig::get_singleton(), "set_order", E->get().name, orders[i++]); - undo_redo->add_undo_method(GlobalConfig::get_singleton(), "set_order", E->get().name, E->get().order); + undo_redo->add_do_method(ProjectSettings::get_singleton(), "set_order", E->get().name, orders[i++]); + undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set_order", E->get().name, E->get().order); } orders.clear(); diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp index 58ffa223fb..f8dbd9abe5 100644 --- a/editor/editor_data.cpp +++ b/editor/editor_data.cpp @@ -31,7 +31,7 @@ #include "editor_node.h" #include "editor_settings.h" -#include "global_config.h" +#include "project_settings.h" #include "io/resource_loader.h" #include "os/dir_access.h" #include "os/file_access.h" @@ -353,6 +353,7 @@ void EditorData::notify_edited_scene_changed() { for (int i = 0; i < editor_plugins.size(); i++) { editor_plugins[i]->edited_scene_changed(); + editor_plugins[i]->notify_scene_changed(get_edited_scene_root()); } } @@ -488,8 +489,14 @@ void EditorData::move_edited_scene_index(int p_idx, int p_to_idx) { } void EditorData::remove_scene(int p_idx) { ERR_FAIL_INDEX(p_idx, edited_scene.size()); - if (edited_scene[p_idx].root) + if (edited_scene[p_idx].root) { + + for (int i = 0; i < editor_plugins.size(); i++) { + editor_plugins[i]->notify_scene_closed(edited_scene[p_idx].root->get_filename()); + } + memdelete(edited_scene[p_idx].root); + } if (current_edited_scene > p_idx) current_edited_scene--; @@ -615,6 +622,17 @@ int EditorData::get_edited_scene_count() const { return edited_scene.size(); } +Vector<EditorData::EditedScene> EditorData::get_edited_scenes() const { + + Vector<EditedScene> out_edited_scenes_list = Vector<EditedScene>(); + + for (int i = 0; i < edited_scene.size(); i++) { + out_edited_scenes_list.push_back(edited_scene[i]); + } + + return out_edited_scenes_list; +} + void EditorData::set_edited_scene_version(uint64_t version, int scene_idx) { ERR_FAIL_INDEX(current_edited_scene, edited_scene.size()); if (scene_idx < 0) { diff --git a/editor/editor_data.h b/editor/editor_data.h index 50f0d5fd41..a601b5019d 100644 --- a/editor/editor_data.h +++ b/editor/editor_data.h @@ -31,6 +31,7 @@ #define EDITOR_DATA_H #include "editor/editor_plugin.h" +#include "editor/plugins/script_editor_plugin.h" #include "list.h" #include "pair.h" #include "scene/resources/texture.h" @@ -109,6 +110,17 @@ public: Ref<Texture> icon; }; + struct EditedScene { + Node *root; + Dictionary editor_states; + List<Node *> selection; + Vector<EditorHistory::History> history_stored; + int history_current; + Dictionary custom_state; + uint64_t version; + NodePath live_edit_root; + }; + private: Vector<EditorPlugin *> editor_plugins; @@ -124,17 +136,6 @@ private: void _cleanup_history(); - struct EditedScene { - Node *root; - Dictionary editor_states; - List<Node *> selection; - Vector<EditorHistory::History> history_stored; - int history_current; - Dictionary custom_state; - uint64_t version; - NodePath live_edit_root; - }; - Vector<EditedScene> edited_scene; int current_edited_scene; @@ -180,6 +181,7 @@ public: int get_edited_scene() const; Node *get_edited_scene_root(int p_idx = -1); int get_edited_scene_count() const; + Vector<EditedScene> get_edited_scenes() const; String get_scene_title(int p_idx) const; String get_scene_path(int p_idx) const; String get_scene_type(int p_idx) const; diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index 5cd00738a2..6bf92ddd2d 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -33,13 +33,13 @@ #include "editor/plugins/script_editor_plugin.h" #include "editor_node.h" #include "editor_settings.h" -#include "global_config.h" #include "io/config_file.h" #include "io/resource_loader.h" #include "io/resource_saver.h" #include "io/zip_io.h" #include "os/dir_access.h" #include "os/file_access.h" +#include "project_settings.h" #include "script_language.h" #include "version.h" @@ -200,6 +200,17 @@ Vector<String> EditorExportPreset::get_patches() const { return patches; } +void EditorExportPreset::set_custom_features(const String &p_custom_features) { + + custom_features = p_custom_features; + EditorExport::singleton->save_presets(); +} + +String EditorExportPreset::get_custom_features() const { + + return custom_features; +} + EditorExportPreset::EditorExportPreset() { export_filter = EXPORT_ALL_RESOURCES; @@ -491,9 +502,23 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> & //save config! - String config_file = "godot.cfb"; + Vector<String> custom_list; + + if (p_preset->get_custom_features() != String()) { + + Vector<String> tmp_custom_list = p_preset->get_custom_features().split(","); + + for (int i = 0; i < tmp_custom_list.size(); i++) { + String f = tmp_custom_list[i].strip_edges(); + if (f != String()) { + custom_list.push_back(f); + } + } + } + + String config_file = "project.binary"; String engine_cfb = EditorSettings::get_singleton()->get_settings_path() + "/tmp/tmp" + config_file; - GlobalConfig::get_singleton()->save_custom(engine_cfb); + ProjectSettings::get_singleton()->save_custom(engine_cfb, ProjectSettings::CustomMap(), custom_list); Vector<uint8_t> data = FileAccess::get_file_as_array(engine_cfb); p_func(p_udata, "res://" + config_file, data, idx, total); @@ -691,6 +716,7 @@ void EditorExport::_save() { config->set_value(section, "name", preset->get_name()); config->set_value(section, "platform", preset->get_platform()->get_name()); config->set_value(section, "runnable", preset->is_runnable()); + config->set_value(section, "custom_features", preset->get_custom_features()); bool save_files = false; switch (preset->get_export_filter()) { case EditorExportPreset::EXPORT_ALL_RESOURCES: { @@ -823,6 +849,10 @@ void EditorExport::load_config() { preset->set_name(config->get_value(section, "name")); preset->set_runnable(config->get_value(section, "runnable")); + if (config->has_section_key(section, "custom_features")) { + preset->set_custom_features(config->get_value(section, "custom_features")); + } + String export_filter = config->get_value(section, "export_filter"); bool get_files = false; @@ -931,6 +961,11 @@ String EditorExportPlatformPC::get_name() const { return name; } + +String EditorExportPlatformPC::get_os_name() const { + + return os_name; +} Ref<Texture> EditorExportPlatformPC::get_logo() const { return logo; @@ -1033,6 +1068,10 @@ void EditorExportPlatformPC::set_name(const String &p_name) { name = p_name; } +void EditorExportPlatformPC::set_os_name(const String &p_name) { + os_name = p_name; +} + void EditorExportPlatformPC::set_logo(const Ref<Texture> &p_logo) { logo = p_logo; } @@ -1055,6 +1094,20 @@ void EditorExportPlatformPC::set_debug_32(const String &p_file) { debug_file_32 = p_file; } +void EditorExportPlatformPC::add_platform_feature(const String &p_feature) { + + extra_features.insert(p_feature); +} + +void EditorExportPlatformPC::get_platform_features(List<String> *r_features) { + r_features->push_back("pc"); //all pcs support "pc" + r_features->push_back("s3tc"); //all pcs support "s3tc" compression + r_features->push_back(get_os_name()); //OS name is a feature + for (Set<String>::Element *E = extra_features.front(); E; E = E->next()) { + r_features->push_back(E->get()); + } +} + EditorExportPlatformPC::EditorExportPlatformPC() { } @@ -1065,7 +1118,6 @@ EditorExportPlatformPC::EditorExportPlatformPC() { #include "editor/plugins/script_editor_plugin.h" #include "editor_node.h" #include "editor_settings.h" -#include "global_config.h" #include "io/config_file.h" #include "io/md5.h" #include "io/resource_loader.h" @@ -1074,14 +1126,15 @@ EditorExportPlatformPC::EditorExportPlatformPC() { #include "io_plugins/editor_texture_import_plugin.h" #include "os/dir_access.h" #include "os/file_access.h" +#include "project_settings.h" #include "script_language.h" #include "version.h" String EditorImportPlugin::validate_source_path(const String& p_path) { - String gp = GlobalConfig::get_singleton()->globalize_path(p_path); - String rp = GlobalConfig::get_singleton()->get_resource_path(); + String gp = ProjectSettings::get_singleton()->globalize_path(p_path); + String rp = ProjectSettings::get_singleton()->get_resource_path(); if (!rp.ends_with("/")) rp+="/"; @@ -1091,7 +1144,7 @@ String EditorImportPlugin::validate_source_path(const String& p_path) { String EditorImportPlugin::expand_source_path(const String& p_path) { if (p_path.is_rel_path()) { - return GlobalConfig::get_singleton()->get_resource_path().plus_file(p_path).simplify_path(); + return ProjectSettings::get_singleton()->get_resource_path().plus_file(p_path).simplify_path(); } else { return p_path; } @@ -1766,7 +1819,7 @@ Error EditorExportPlatform::export_project_files(EditorExportSaveFunction p_func { MD5_CTX ctx; MD5Init(&ctx); - String path = GlobalConfig::get_singleton()->get_resource_path()+"::"+String(E->get())+"::"+get_name(); + String path = ProjectSettings::get_singleton()->get_resource_path()+"::"+String(E->get())+"::"+get_name(); MD5Update(&ctx,(unsigned char*)path.utf8().get_data(),path.utf8().length()); MD5Final(&ctx); md5 = String::md5(ctx.digest); @@ -1875,11 +1928,11 @@ Error EditorExportPlatform::export_project_files(EditorExportSaveFunction p_func int flags=0; - if (GlobalConfig::get_singleton()->get("image_loader/filter")) + if (ProjectSettings::get_singleton()->get("image_loader/filter")) flags|=EditorTextureImportPlugin::IMAGE_FLAG_FILTER; - if (!GlobalConfig::get_singleton()->get("image_loader/gen_mipmaps")) + if (!ProjectSettings::get_singleton()->get("image_loader/gen_mipmaps")) flags|=EditorTextureImportPlugin::IMAGE_FLAG_NO_MIPMAPS; - if (!GlobalConfig::get_singleton()->get("image_loader/repeat")) + if (!ProjectSettings::get_singleton()->get("image_loader/repeat")) flags|=EditorTextureImportPlugin::IMAGE_FLAG_REPEAT; flags|=EditorTextureImportPlugin::IMAGE_FLAG_FIX_BORDER_ALPHA; @@ -1988,7 +2041,7 @@ Error EditorExportPlatform::export_project_files(EditorExportSaveFunction p_func StringName engine_cfg="res://project.godot"; StringName boot_splash; { - String splash=GlobalConfig::get_singleton()->get("application/boot_splash"); //avoid splash from being converted + String splash=ProjectSettings::get_singleton()->get("application/boot_splash"); //avoid splash from being converted splash=splash.strip_edges(); if (splash!=String()) { if (!splash.begins_with("res://")) @@ -1999,7 +2052,7 @@ Error EditorExportPlatform::export_project_files(EditorExportSaveFunction p_func } StringName custom_cursor; { - String splash=GlobalConfig::get_singleton()->get("display/custom_mouse_cursor"); //avoid splash from being converted + String splash=ProjectSettings::get_singleton()->get("display/custom_mouse_cursor"); //avoid splash from being converted splash=splash.strip_edges(); if (splash!=String()) { if (!splash.begins_with("res://")) @@ -2083,9 +2136,9 @@ Error EditorExportPlatform::export_project_files(EditorExportSaveFunction p_func } - String remap_file="godot.cfb"; + String remap_file="project.binary"; String engine_cfb =EditorSettings::get_singleton()->get_settings_path()+"/tmp/tmp"+remap_file; - GlobalConfig::get_singleton()->save_custom(engine_cfb,custom); + ProjectSettings::get_singleton()->save_custom(engine_cfb,custom); Vector<uint8_t> data = FileAccess::get_file_as_array(engine_cfb); Error err = p_func(p_udata,"res://"+remap_file,data,counter,files.size()); diff --git a/editor/editor_export.h b/editor/editor_export.h index 64381fbb35..dc4b198575 100644 --- a/editor/editor_export.h +++ b/editor/editor_export.h @@ -70,6 +70,8 @@ private: String name; + String custom_features; + protected: bool _set(const StringName &p_name, const Variant &p_value); bool _get(const StringName &p_name, Variant &r_ret) const; @@ -107,6 +109,9 @@ public: void remove_patch(int p_idx); Vector<String> get_patches() const; + void set_custom_features(const String &p_custom_features); + String get_custom_features() const; + const List<PropertyInfo> &get_properties() const { return properties; } EditorExportPreset(); @@ -153,12 +158,13 @@ private: static Error _save_zip_file(void *p_userdata, const String &p_path, const Vector<uint8_t> &p_data, int p_file, int p_total); protected: - virtual void get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) = 0; bool exists_export_template(String template_file_name, String *err) const; String find_export_template(String template_file_name, String *err = NULL) const; void gen_export_flags(Vector<String> &r_flags, int p_flags); public: + virtual void get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) = 0; + struct ExportOption { PropertyInfo option; Variant default_value; @@ -175,6 +181,7 @@ public: virtual void get_export_options(List<ExportOption> *r_options) = 0; virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const { return true; } + virtual String get_os_name() const = 0; virtual String get_name() const = 0; virtual Ref<Texture> get_logo() const = 0; @@ -203,6 +210,7 @@ public: virtual String get_binary_extension() const = 0; virtual Error export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags = 0) = 0; + virtual void get_platform_features(List<String> *r_features) = 0; EditorExportPlatform(); }; @@ -253,6 +261,7 @@ class EditorExportPlatformPC : public EditorExportPlatform { Ref<ImageTexture> logo; String name; + String os_name; String extension; String release_file_32; @@ -260,6 +269,8 @@ class EditorExportPlatformPC : public EditorExportPlatform { String debug_file_32; String debug_file_64; + Set<String> extra_features; + bool use64; public: @@ -268,6 +279,7 @@ public: virtual void get_export_options(List<ExportOption> *r_options); virtual String get_name() const; + virtual String get_os_name() const; virtual Ref<Texture> get_logo() const; virtual bool can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const; @@ -276,6 +288,7 @@ public: void set_extension(const String &p_extension); void set_name(const String &p_name); + void set_os_name(const String &p_name); void set_logo(const Ref<Texture> &p_loco); @@ -284,6 +297,9 @@ public: void set_debug_64(const String &p_file); void set_debug_32(const String &p_file); + void add_platform_feature(const String &p_feature); + virtual void get_platform_features(List<String> *r_features); + EditorExportPlatformPC(); }; diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index f314f772d1..f0f84416bf 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -32,12 +32,12 @@ #include "editor_node.h" #include "editor_resource_preview.h" #include "editor_settings.h" -#include "global_config.h" #include "io/resource_import.h" #include "io/resource_loader.h" #include "io/resource_saver.h" #include "os/file_access.h" #include "os/os.h" +#include "project_settings.h" #include "variant_parser.h" EditorFileSystem *EditorFileSystem::singleton = NULL; @@ -137,7 +137,7 @@ EditorFileSystemDirectory *EditorFileSystemDirectory::get_parent() { void EditorFileSystemDirectory::_bind_methods() { ClassDB::bind_method(D_METHOD("get_subdir_count"), &EditorFileSystemDirectory::get_subdir_count); - ClassDB::bind_method(D_METHOD("get_subdir", "idx"), &EditorFileSystemDirectory::get_subdir); + ClassDB::bind_method(D_METHOD("get_subdir:EditorFileSystemDirectory", "idx"), &EditorFileSystemDirectory::get_subdir); ClassDB::bind_method(D_METHOD("get_file_count"), &EditorFileSystemDirectory::get_file_count); ClassDB::bind_method(D_METHOD("get_file", "idx"), &EditorFileSystemDirectory::get_file); ClassDB::bind_method(D_METHOD("get_file_path", "idx"), &EditorFileSystemDirectory::get_file_path); @@ -179,7 +179,7 @@ void EditorFileSystem::_scan_filesystem() { sources_changed.clear(); file_cache.clear(); - String project = GlobalConfig::get_singleton()->get_resource_path(); + String project = ProjectSettings::get_singleton()->get_resource_path(); String fscache = EditorSettings::get_singleton()->get_project_settings_path().plus_file("filesystem_cache2"); FileAccess *f = FileAccess::open(fscache, FileAccess::READ); @@ -1008,7 +1008,7 @@ bool EditorFileSystem::_find_file(const String &p_file, EditorFileSystemDirector if (!filesystem || scanning) return false; - String f = GlobalConfig::get_singleton()->localize_path(p_file); + String f = ProjectSettings::get_singleton()->localize_path(p_file); if (!f.begins_with("res://")) return false; @@ -1121,7 +1121,7 @@ EditorFileSystemDirectory *EditorFileSystem::get_filesystem_path(const String &p if (!filesystem || scanning) return NULL; - String f = GlobalConfig::get_singleton()->localize_path(p_path); + String f = ProjectSettings::get_singleton()->localize_path(p_path); if (!f.begins_with("res://")) return NULL; @@ -1335,7 +1335,7 @@ void EditorFileSystem::_reimport_file(const String &p_file) { f->store_line("[params]"); f->store_line(""); - //store options in provided order, to avoid file changing + //store options in provided order, to avoid file changing. Order is also important because first match is accepted first. for (List<ResourceImporter::ImportOption>::Element *E = opts.front(); E; E = E->next()) { diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index f6a7aeff06..990628d6af 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -39,7 +39,6 @@ #include "editor_help.h" #include "editor_settings.h" #include "editor_themes.h" -#include "global_config.h" #include "io/config_file.h" #include "io/stream_peer_ssl.h" #include "io/zip_io.h" @@ -52,12 +51,14 @@ #include "os/os.h" #include "path_remap.h" #include "print_string.h" +#include "project_settings.h" #include "pvrtc_compress.h" #include "register_exporters.h" #include "scene/resources/packed_scene.h" #include "servers/physics_2d_server.h" #include "translation.h" #include "version.h" +#include "version_hash.gen.h" #include <stdio.h> // plugins #include "asset_library_editor_plugin.h" @@ -163,7 +164,7 @@ void EditorNode::_update_scene_tabs() { void EditorNode::_update_title() { - String appname = GlobalConfig::get_singleton()->get("application/config/name"); + String appname = ProjectSettings::get_singleton()->get("application/config/name"); String title = appname.empty() ? String(VERSION_FULL_NAME) : String(_MKSTR(VERSION_NAME) + String(" - ") + appname); String edited = editor_data.get_edited_scene_root() ? editor_data.get_edited_scene_root()->get_filename() : String(); if (!edited.empty()) @@ -272,7 +273,7 @@ void EditorNode::_notification(int p_what) { } editor_selection->update(); - scene_root->set_size_override(true, Size2(GlobalConfig::get_singleton()->get("display/window/size/width"), GlobalConfig::get_singleton()->get("display/window/size/height"))); + scene_root->set_size_override(true, Size2(ProjectSettings::get_singleton()->get("display/window/size/width"), ProjectSettings::get_singleton()->get("display/window/size/height"))); ResourceImporterTexture::get_singleton()->update_imports(); } @@ -519,7 +520,7 @@ void EditorNode::save_resource_in_path(const Ref<Resource> &p_resource, const St flg|=ResourceSaver::FLAG_RELATIVE_PATHS; */ - String path = GlobalConfig::get_singleton()->localize_path(p_path); + String path = ProjectSettings::get_singleton()->localize_path(p_path); Error err = ResourceSaver::save(path, p_resource, flg | ResourceSaver::FLAG_REPLACE_SUBRESOURCE_PATHS); if (err != OK) { @@ -870,7 +871,7 @@ void EditorNode::_save_scene_with_preview(String p_file) { //save thumbnail directly, as thumbnailer may not update due to actual scene not changing md5 String temp_path = EditorSettings::get_singleton()->get_settings_path().plus_file("tmp"); - String cache_base = GlobalConfig::get_singleton()->globalize_path(p_file).md5_text(); + String cache_base = ProjectSettings::get_singleton()->globalize_path(p_file).md5_text(); cache_base = temp_path.plus_file("resthumb-" + cache_base); //does not have it, try to load a cached thumbnail @@ -950,7 +951,7 @@ void EditorNode::_save_scene(String p_file, int idx) { _save_edited_subresources(scene, processed, flg); editor_data.save_editor_external_data(); if (err == OK) { - scene->set_filename(GlobalConfig::get_singleton()->localize_path(p_file)); + scene->set_filename(ProjectSettings::get_singleton()->localize_path(p_file)); //EditorFileSystem::get_singleton()->update_file(p_file,sdata->get_type()); if (idx < 0 || idx == editor_data.get_edited_scene()) set_current_version(editor_data.get_undo_redo().get_version()); @@ -1029,7 +1030,7 @@ void EditorNode::_import_action(const String &p_action) { EditorImport::generate_version_hashes(src); - Node *dst = SceneLoader::load(editor_data.get_imported_scene(GlobalConfig::get_singleton()->localize_path(_tmp_import_path))); + Node *dst = SceneLoader::load(editor_data.get_imported_scene(ProjectSettings::get_singleton()->localize_path(_tmp_import_path))); if (!dst) { @@ -1132,8 +1133,8 @@ void EditorNode::_dialog_action(String p_file) { } break; case SETTINGS_PICK_MAIN_SCENE: { - GlobalConfig::get_singleton()->set("application/run/main_scene", p_file); - GlobalConfig::get_singleton()->save(); + ProjectSettings::get_singleton()->set("application/run/main_scene", p_file); + ProjectSettings::get_singleton()->save(); //would be nice to show the project manager opened with the highlighted field.. _run(false, ""); // automatically run the project } break; @@ -1575,6 +1576,11 @@ void EditorNode::_edit_current() { editor_plugin_screen->make_visible(true); + int plugin_count = editor_data.get_editor_plugin_count(); + for (int i = 0; i < plugin_count; i++) { + editor_data.get_editor_plugin(i)->notify_main_screen_changed(editor_plugin_screen->get_name()); + } + for (int i = 0; i < editor_table.size(); i++) { main_editor_buttons[i]->set_pressed(editor_table[i] == main_plugin); @@ -1797,7 +1803,7 @@ void EditorNode::_run(bool p_current, const String &p_custom) { List<String> breakpoints; editor_data.get_editor_breakpoints(&breakpoints); - args = GlobalConfig::get_singleton()->get("editor/main_run_args"); + args = ProjectSettings::get_singleton()->get("editor/main_run_args"); Error error = editor_run.run(run_filename, args, breakpoints); @@ -2264,7 +2270,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { } instanced_scene->generate_instance_state(); - instanced_scene->set_filename( GlobalConfig::get_singleton()->localize_path(external_file) ); + instanced_scene->set_filename( ProjectSettings::get_singleton()->localize_path(external_file) ); editor_data.get_undo_redo().create_action("Instance Scene"); editor_data.get_undo_redo().add_do_method(parent,"add_child",instanced_scene); @@ -2865,6 +2871,11 @@ void EditorNode::_editor_select(int p_which) { editor_plugin_screen->make_visible(true); editor_plugin_screen->selected_notify(); + int plugin_count = editor_data.get_editor_plugin_count(); + for (int i = 0; i < plugin_count; i++) { + editor_data.get_editor_plugin(i)->notify_main_screen_changed(editor_plugin_screen->get_name()); + } + if (EditorSettings::get_singleton()->get("interface/separate_distraction_mode")) { if (p_which == EDITOR_SCRIPT) { set_distraction_free_mode(script_distraction); @@ -2934,9 +2945,9 @@ void EditorNode::_update_addon_config() { } if (enabled_addons.size() == 0) { - GlobalConfig::get_singleton()->set("editor_plugins/enabled", Variant()); + ProjectSettings::get_singleton()->set("editor_plugins/enabled", Variant()); } else { - GlobalConfig::get_singleton()->set("editor_plugins/enabled", enabled_addons); + ProjectSettings::get_singleton()->set("editor_plugins/enabled", enabled_addons); } project_settings->queue_save(); @@ -3277,7 +3288,7 @@ Error EditorNode::load_scene(const String &p_scene, bool p_ignore_broken_deps, b if (p_clear_errors) load_errors->clear(); - String lpath = GlobalConfig::get_singleton()->localize_path(p_scene); + String lpath = ProjectSettings::get_singleton()->localize_path(p_scene); if (!lpath.begins_with("res://")) { @@ -3565,7 +3576,7 @@ void EditorNode::animation_editor_make_visible(bool p_visible) { #endif void EditorNode::_add_to_recent_scenes(const String &p_scene) { - String base = "_" + GlobalConfig::get_singleton()->get_resource_path().replace("\\", "::").replace("/", "::"); + String base = "_" + ProjectSettings::get_singleton()->get_resource_path().replace("\\", "::").replace("/", "::"); Vector<String> rc = EDITOR_DEF(base + "/_recent_scenes", Array()); String name = p_scene; name = name.replace("res://", ""); @@ -3582,7 +3593,7 @@ void EditorNode::_add_to_recent_scenes(const String &p_scene) { void EditorNode::_open_recent_scene(int p_idx) { - String base = "_" + GlobalConfig::get_singleton()->get_resource_path().replace("\\", "::").replace("/", "::"); + String base = "_" + ProjectSettings::get_singleton()->get_resource_path().replace("\\", "::").replace("/", "::"); Vector<String> rc = EDITOR_DEF(base + "/_recent_scenes", Array()); ERR_FAIL_INDEX(p_idx, rc.size()); @@ -3625,13 +3636,13 @@ void EditorNode::_save_optimized() { } - project_settings->add_remapped_path(GlobalConfig::get_singleton()->localize_path(get_edited_scene()->get_filename()),GlobalConfig::get_singleton()->localize_path(path),platform); + project_settings->add_remapped_path(ProjectSettings::get_singleton()->localize_path(get_edited_scene()->get_filename()),ProjectSettings::get_singleton()->localize_path(path),platform); #endif } void EditorNode::_update_recent_scenes() { - String base = "_" + GlobalConfig::get_singleton()->get_resource_path().replace("\\", "::").replace("/", "::"); + String base = "_" + ProjectSettings::get_singleton()->get_resource_path().replace("\\", "::").replace("/", "::"); Vector<String> rc = EDITOR_DEF(base + "/_recent_scenes", Array()); recent_scenes->clear(); for (int i = 0; i < rc.size(); i++) { @@ -3746,6 +3757,7 @@ void EditorNode::register_editor_types() { ClassDB::register_class<EditorResourcePreviewGenerator>(); ClassDB::register_class<EditorFileSystem>(); ClassDB::register_class<EditorFileSystemDirectory>(); + ClassDB::register_virtual_class<ScriptEditor>(); //ClassDB::register_type<EditorImporter>(); //ClassDB::register_type<EditorPostImport>(); @@ -5408,7 +5420,7 @@ EditorNode::EditorNode() { VisualServer::get_singleton()->viewport_set_hide_scenario(scene_root->get_viewport_rid(), true); scene_root->set_disable_input(true); scene_root->set_as_audio_listener_2d(true); - //scene_root->set_size_override(true,Size2(GlobalConfig::get_singleton()->get("display/width"),GlobalConfig::get_singleton()->get("display/height"))); + //scene_root->set_size_override(true,Size2(ProjectSettings::get_singleton()->get("display/width"),ProjectSettings::get_singleton()->get("display/height"))); //scene_root->set_world_2d( Ref<World2D>( memnew( World2D )) ); @@ -5937,7 +5949,7 @@ EditorNode::EditorNode() { settings_config_dialog = memnew(EditorSettingsDialog); gui_base->add_child(settings_config_dialog); - project_settings = memnew(ProjectSettings(&editor_data)); + project_settings = memnew(ProjectSettingsEditor(&editor_data)); gui_base->add_child(project_settings); import_confirmation = memnew(ConfirmationDialog); @@ -5975,14 +5987,18 @@ EditorNode::EditorNode() { logo->set_texture(gui_base->get_icon("Logo", "EditorIcons")); hbc->add_child(logo); + String hash = String(VERSION_HASH); + if (hash.length() != 0) + hash = "." + hash.left(7); + Label *about_text = memnew(Label); about_text->set_v_size_flags(Control::SIZE_SHRINK_CENTER); - about_text->set_text(VERSION_FULL_NAME + String::utf8("\n\u00A9 2007-2017 Juan Linietsky, Ariel Manzur.\n\u00A9 2014-2017 ") + + about_text->set_text(VERSION_FULL_NAME + hash + String::utf8("\n\u00A9 2007-2017 Juan Linietsky, Ariel Manzur.\n\u00A9 2014-2017 ") + TTR("Godot Engine contributors") + "\n"); hbc->add_child(about_text); TabContainer *tc = memnew(TabContainer); - tc->set_custom_minimum_size(Size2(600, 240) * EDSCALE); + tc->set_custom_minimum_size(Size2(630, 240) * EDSCALE); tc->set_v_size_flags(Control::SIZE_EXPAND_FILL); vbc->add_child(tc); @@ -6010,14 +6026,14 @@ EditorNode::EditorNode() { dev_vbc->add_child(lbl); ItemList *il = memnew(ItemList); - il->set_max_columns(32); + il->set_max_columns(16); il->set_h_size_flags(Control::SIZE_EXPAND_FILL); - il->set_custom_minimum_size(Size2(0, i == 3 ? DEV_NAMES_COUNT * 7.6 : 30) * EDSCALE); + il->set_fixed_column_width(230 * EDSCALE); + il->set_auto_height(true); const char **dev_names_ptr = dev_src[i]; while (*dev_names_ptr) il->add_item(String::utf8(*dev_names_ptr++), NULL, false); dev_vbc->add_child(il); - il->set_fixed_column_width(240 * EDSCALE); HSeparator *hs = memnew(HSeparator); hs->set_modulate(Color(0, 0, 0, 0)); @@ -6264,7 +6280,7 @@ EditorNode::EditorNode() { Physics2DServer::get_singleton()->set_active(false); // no physics by default if editor ScriptServer::set_scripting_enabled(false); // no scripting by default if editor - //GlobalConfig::get_singleton()->set("render/room_cull_enabled",false); + //ProjectSettings::get_singleton()->set("render/room_cull_enabled",false); reference_resource_mem = true; save_external_resources_mem = true; @@ -6277,7 +6293,7 @@ EditorNode::EditorNode() { //store project name in ssettings String project_name; //figure it out from path - project_name = GlobalConfig::get_singleton()->get_resource_path().replace("\\", "/"); + project_name = ProjectSettings::get_singleton()->get_resource_path().replace("\\", "/"); print_line("path: " + project_name); if (project_name.length() && project_name[project_name.length() - 1] == '/') project_name = project_name.substr(0, project_name.length() - 1); @@ -6285,7 +6301,7 @@ EditorNode::EditorNode() { project_name = project_name.replace("/", "::"); if (project_name != "") { - EditorSettings::get_singleton()->set("projects/" + project_name, GlobalConfig::get_singleton()->get_resource_path()); + EditorSettings::get_singleton()->set("projects/" + project_name, ProjectSettings::get_singleton()->get_resource_path()); EditorSettings::get_singleton()->raise_order("projects/" + project_name); EditorSettings::get_singleton()->save(); } @@ -6366,8 +6382,8 @@ EditorNode::EditorNode() { _initializing_addons = true; Vector<String> addons; - if (GlobalConfig::get_singleton()->has("editor_plugins/enabled")) { - addons = GlobalConfig::get_singleton()->get("editor_plugins/enabled"); + if (ProjectSettings::get_singleton()->has("editor_plugins/enabled")) { + addons = ProjectSettings::get_singleton()->get("editor_plugins/enabled"); } for (int i = 0; i < addons.size(); i++) { diff --git a/editor/editor_node.h b/editor/editor_node.h index 228fbe7196..e5a4cf654a 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -64,7 +64,7 @@ #include "editor/editor_log.h" #include "editor/editor_run_script.h" #include "editor/project_export.h" -#include "editor/project_settings.h" +#include "editor/project_settings_editor.h" #include "editor/resources_dock.h" #include "editor/run_settings_dialog.h" #include "editor/scene_tree_dock.h" @@ -310,7 +310,7 @@ private: //OptimizedPresetsDialog *optimized_presets; EditorSettingsDialog *settings_config_dialog; RunSettingsDialog *run_settings_dialog; - ProjectSettings *project_settings; + ProjectSettingsEditor *project_settings; EditorFileDialog *file; ExportTemplateManager *export_template_manager; FileDialog *file_templates; diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp index 606fd8ee5e..c65065db43 100644 --- a/editor/editor_plugin.cpp +++ b/editor/editor_plugin.cpp @@ -171,6 +171,46 @@ void EditorPlugin::set_input_event_forwarding_always_enabled() { always_input_forwarding_list->add_plugin(this); } +Node *EditorPlugin::get_edited_scene_root() { + return EditorNode::get_singleton()->get_edited_scene(); +} + +Array EditorPlugin::get_open_scenes() const { + + Array ret; + Vector<EditorData::EditedScene> scenes = EditorNode::get_singleton()->get_editor_data().get_edited_scenes(); + + int scns_amount = scenes.size(); + for (int idx_scn = 0; idx_scn < scns_amount; idx_scn++) { + if (scenes[idx_scn].root == NULL) + continue; + ret.push_back(scenes[idx_scn].root->get_filename()); + } + return ret; +} + +ScriptEditor *EditorPlugin::get_script_editor() { + return ScriptEditor::get_singleton(); +} + +void EditorPlugin::notify_scene_changed(const Node *scn_root) { + if (scn_root == NULL) return; + emit_signal("scene_changed", scn_root); +} + +void EditorPlugin::notify_main_screen_changed(const String &screen_name) { + + if (screen_name == last_main_screen_name) + return; + + emit_signal("main_screen_changed", screen_name); + last_main_screen_name = screen_name; +} + +void EditorPlugin::notify_scene_closed(const String &scene_filepath) { + emit_signal("scene_closed", scene_filepath); +} + Ref<SpatialEditorGizmo> EditorPlugin::create_spatial_gizmo(Spatial *p_spatial) { //?? if (get_script_instance() && get_script_instance()->has_method("create_spatial_gizmo")) { @@ -392,13 +432,17 @@ void EditorPlugin::_bind_methods() { ClassDB::bind_method(D_METHOD("get_undo_redo:UndoRedo"), &EditorPlugin::_get_undo_redo); ClassDB::bind_method(D_METHOD("get_selection:EditorSelection"), &EditorPlugin::get_selection); ClassDB::bind_method(D_METHOD("get_editor_settings:EditorSettings"), &EditorPlugin::get_editor_settings); + ClassDB::bind_method(D_METHOD("get_script_editor:ScriptEditor"), &EditorPlugin::get_script_editor); ClassDB::bind_method(D_METHOD("queue_save_layout"), &EditorPlugin::queue_save_layout); - ClassDB::bind_method(D_METHOD("edit_resource"), &EditorPlugin::edit_resource); + ClassDB::bind_method(D_METHOD("edit_resource", "resource:Resource"), &EditorPlugin::edit_resource); ClassDB::bind_method(D_METHOD("open_scene_from_path", "scene_filepath"), &EditorPlugin::open_scene_from_path); ClassDB::bind_method(D_METHOD("reload_scene_from_path", "scene_filepath"), &EditorPlugin::reload_scene_from_path); - ClassDB::bind_method(D_METHOD("add_import_plugin"), &EditorPlugin::add_import_plugin); - ClassDB::bind_method(D_METHOD("remove_import_plugin"), &EditorPlugin::remove_import_plugin); + ClassDB::bind_method(D_METHOD("add_import_plugin", "importer:EditorImportPlugin"), &EditorPlugin::add_import_plugin); + ClassDB::bind_method(D_METHOD("remove_import_plugin", "importer:EditorImportPlugin"), &EditorPlugin::remove_import_plugin); ClassDB::bind_method(D_METHOD("set_input_event_forwarding_always_enabled"), &EditorPlugin::set_input_event_forwarding_always_enabled); + ClassDB::bind_method(D_METHOD("get_open_scenes"), &EditorPlugin::get_open_scenes); + ClassDB::bind_method(D_METHOD("get_edited_scene_root:Node"), &EditorPlugin::get_edited_scene_root); + ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "forward_canvas_gui_input", PropertyInfo(Variant::TRANSFORM2D, "canvas_xform"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"))); ClassDB::add_virtual_method(get_class_static(), MethodInfo("forward_draw_over_canvas", PropertyInfo(Variant::TRANSFORM2D, "canvas_xform"), PropertyInfo(Variant::OBJECT, "canvas:Control"))); ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "forward_spatial_gui_input", PropertyInfo(Variant::OBJECT, "camera", PROPERTY_HINT_RESOURCE_TYPE, "Camera"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"))); @@ -420,6 +464,10 @@ void EditorPlugin::_bind_methods() { ClassDB::add_virtual_method(get_class_static(), MethodInfo("set_window_layout", PropertyInfo(Variant::OBJECT, "layout", PROPERTY_HINT_RESOURCE_TYPE, "ConfigFile"))); ClassDB::add_virtual_method(get_class_static(), MethodInfo("get_window_layout", PropertyInfo(Variant::OBJECT, "layout", PROPERTY_HINT_RESOURCE_TYPE, "ConfigFile"))); + ADD_SIGNAL(MethodInfo("scene_changed", PropertyInfo(Variant::OBJECT, "scene_root:Node"))); + ADD_SIGNAL(MethodInfo("scene_closed", PropertyInfo(Variant::STRING, "filepath:String"))); + ADD_SIGNAL(MethodInfo("main_screen_changed", PropertyInfo(Variant::STRING, "screen_name:String"))); + BIND_CONSTANT(CONTAINER_TOOLBAR); BIND_CONSTANT(CONTAINER_SPATIAL_EDITOR_MENU); BIND_CONSTANT(CONTAINER_SPATIAL_EDITOR_SIDE); @@ -442,6 +490,7 @@ void EditorPlugin::_bind_methods() { EditorPlugin::EditorPlugin() { undo_redo = NULL; input_event_forwarding_always_enabled = false; + last_main_screen_name = ""; } EditorPlugin::~EditorPlugin() { diff --git a/editor/editor_plugin.h b/editor/editor_plugin.h index 3653851d5a..a0f64fb1ea 100644 --- a/editor/editor_plugin.h +++ b/editor/editor_plugin.h @@ -52,6 +52,8 @@ class EditorImportPlugin; class EditorExportPlugin; class EditorResourcePreview; class EditorFileSystem; +class EditorToolAddons; +class ScriptEditor; class EditorPlugin : public Node { @@ -63,6 +65,8 @@ class EditorPlugin : public Node { bool input_event_forwarding_always_enabled; + String last_main_screen_name; + protected: static void _bind_methods(); UndoRedo &get_undo_redo() { return *undo_redo; } @@ -113,6 +117,14 @@ public: void set_input_event_forwarding_always_enabled(); bool is_input_event_forwarding_always_enabled() { return input_event_forwarding_always_enabled; } + Node *get_edited_scene_root(); + Array get_open_scenes() const; + ScriptEditor *get_script_editor(); + + void notify_main_screen_changed(const String &screen_name); + void notify_scene_changed(const Node *scn_root); + void notify_scene_closed(const String &scene_filepath); + virtual Ref<SpatialEditorGizmo> create_spatial_gizmo(Spatial *p_spatial); virtual bool forward_canvas_gui_input(const Transform2D &p_canvas_xform, const Ref<InputEvent> &p_event); virtual void forward_draw_over_canvas(const Transform2D &p_canvas_xform, Control *p_canvas); diff --git a/editor/editor_plugin_settings.cpp b/editor/editor_plugin_settings.cpp index c6b9d4bb41..6ab1468b1d 100644 --- a/editor/editor_plugin_settings.cpp +++ b/editor/editor_plugin_settings.cpp @@ -30,7 +30,7 @@ #include "editor_plugin_settings.h" #include "editor_node.h" -#include "global_config.h" +#include "project_settings.h" #include "io/config_file.h" #include "os/file_access.h" #include "os/main_loop.h" @@ -82,7 +82,7 @@ void EditorPluginSettings::update_plugins() { plugins.sort(); - Vector<String> active_plugins = GlobalConfig::get_singleton()->get("editor_plugins/enabled"); + Vector<String> active_plugins = ProjectSettings::get_singleton()->get("editor_plugins/enabled"); for (int i = 0; i < plugins.size(); i++) { diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp index 5d68de3bb6..3a6b34b7b4 100644 --- a/editor/editor_resource_preview.cpp +++ b/editor/editor_resource_preview.cpp @@ -31,7 +31,7 @@ #include "editor_scale.h" #include "editor_settings.h" -#include "global_config.h" +#include "project_settings.h" #include "io/resource_loader.h" #include "io/resource_saver.h" #include "message_queue.h" @@ -206,7 +206,7 @@ void EditorResourcePreview::_thread() { } else { String temp_path = EditorSettings::get_singleton()->get_settings_path().plus_file("tmp"); - String cache_base = GlobalConfig::get_singleton()->globalize_path(item.path).md5_text(); + String cache_base = ProjectSettings::get_singleton()->globalize_path(item.path).md5_text(); cache_base = temp_path.plus_file("resthumb-" + cache_base); //does not have it, try to load a cached thumbnail diff --git a/editor/editor_run.cpp b/editor/editor_run.cpp index 8d01484b34..aa97dd237b 100644 --- a/editor/editor_run.cpp +++ b/editor/editor_run.cpp @@ -30,7 +30,7 @@ #include "editor_run.h" #include "editor_settings.h" -#include "global_config.h" +#include "project_settings.h" EditorRun::Status EditorRun::get_status() const { @@ -40,7 +40,7 @@ Error EditorRun::run(const String &p_scene, const String p_custom_args, const Li List<String> args; - String resource_path = GlobalConfig::get_singleton()->get_resource_path(); + String resource_path = ProjectSettings::get_singleton()->get_resource_path(); String remote_host = EditorSettings::get_singleton()->get("network/debug/remote_host"); int remote_port = (int)EditorSettings::get_singleton()->get("network/debug/remote_port"); @@ -79,12 +79,12 @@ Error EditorRun::run(const String &p_scene, const String p_custom_args, const Li Size2 desired_size; - desired_size.x = GlobalConfig::get_singleton()->get("display/window/size/width"); - desired_size.y = GlobalConfig::get_singleton()->get("display/window/size/height"); + desired_size.x = ProjectSettings::get_singleton()->get("display/window/size/width"); + desired_size.y = ProjectSettings::get_singleton()->get("display/window/size/height"); Size2 test_size; - test_size.x = GlobalConfig::get_singleton()->get("display/window/size/test_width"); - test_size.y = GlobalConfig::get_singleton()->get("display/window/size/test_height"); + test_size.x = ProjectSettings::get_singleton()->get("display/window/size/test_width"); + test_size.y = ProjectSettings::get_singleton()->get("display/window/size/test_height"); if (test_size.x > 0 && test_size.y > 0) { desired_size = test_size; diff --git a/editor/editor_run_script.cpp b/editor/editor_run_script.cpp index 8bd1b8f4fd..0e980b040e 100644 --- a/editor/editor_run_script.cpp +++ b/editor/editor_run_script.cpp @@ -81,8 +81,8 @@ void EditorScript::set_editor(EditorNode *p_editor) { void EditorScript::_bind_methods() { - ClassDB::bind_method(D_METHOD("add_root_node", "node"), &EditorScript::add_root_node); - ClassDB::bind_method(D_METHOD("get_scene"), &EditorScript::get_scene); + ClassDB::bind_method(D_METHOD("add_root_node", "node:Node"), &EditorScript::add_root_node); + ClassDB::bind_method(D_METHOD("get_scene:Node"), &EditorScript::get_scene); BIND_VMETHOD(MethodInfo("_run")); } diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 4ab1a435f8..e653502c0e 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -30,7 +30,7 @@ #include "editor_settings.h" #include "editor_node.h" -#include "global_config.h" +#include "project_settings.h" #include "io/compression.h" #include "io/config_file.h" #include "io/file_access_memory.h" @@ -329,7 +329,7 @@ void EditorSettings::create() { dir->change_dir("config"); - String pcp = GlobalConfig::get_singleton()->get_resource_path(); + String pcp = ProjectSettings::get_singleton()->get_resource_path(); if (pcp.ends_with("/")) pcp = config_path.substr(0, pcp.size() - 1); pcp = pcp.get_file() + "-" + pcp.md5_text(); diff --git a/editor/file_type_cache.cpp b/editor/file_type_cache.cpp index de6ee171ae..100ebe21cd 100644 --- a/editor/file_type_cache.cpp +++ b/editor/file_type_cache.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "file_type_cache.h" -#include "global_config.h" +#include "project_settings.h" #include "os/file_access.h" FileTypeCache *FileTypeCache::singleton = NULL; @@ -55,7 +55,7 @@ void FileTypeCache::set_file_type(const String &p_path, const String &p_type) { void FileTypeCache::load() { GLOBAL_LOCK_FUNCTION - String project = GlobalConfig::get_singleton()->get_resource_path(); + String project = ProjectSettings::get_singleton()->get_resource_path(); FileAccess *f = FileAccess::open(project + "/file_type_cache.cch", FileAccess::READ); if (!f) { @@ -80,7 +80,7 @@ void FileTypeCache::load() { void FileTypeCache::save() { GLOBAL_LOCK_FUNCTION - String project = GlobalConfig::get_singleton()->get_resource_path(); + String project = ProjectSettings::get_singleton()->get_resource_path(); FileAccess *f = FileAccess::open(project + "/file_type_cache.cch", FileAccess::WRITE); if (!f) { diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index fe66cd7009..ae3fdede73 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -31,7 +31,7 @@ #include "editor_node.h" #include "editor_settings.h" -#include "global_config.h" +#include "project_settings.h" #include "io/resource_loader.h" #include "os/dir_access.h" #include "os/file_access.h" @@ -879,7 +879,7 @@ void FileSystemDock::_file_option(int p_option) { String path = files->get_item_metadata(idx); if (p_option == FILE_SHOW_IN_EXPLORER) { - String dir = GlobalConfig::get_singleton()->globalize_path(path); + String dir = ProjectSettings::get_singleton()->globalize_path(path); dir = dir.substr(0, dir.find_last("/")); OS::get_singleton()->shell_open(String("file://") + dir); return; @@ -1067,7 +1067,7 @@ void FileSystemDock::_folder_option(int p_option) { break; case FOLDER_SHOW_IN_EXPLORER: String path = item->get_metadata(tree->get_selected_column()); - String dir = GlobalConfig::get_singleton()->globalize_path(path); + String dir = ProjectSettings::get_singleton()->globalize_path(path); OS::get_singleton()->shell_open(String("file://") + dir); return; } diff --git a/editor/import/resource_importer_texture.cpp b/editor/import/resource_importer_texture.cpp index 7e23a422f7..98020ed9b8 100644 --- a/editor/import/resource_importer_texture.cpp +++ b/editor/import/resource_importer_texture.cpp @@ -416,26 +416,26 @@ Error ResourceImporterTexture::import(const String &p_source_file, const String bool force_normal = normal == 1; if (compress_mode == COMPRESS_VIDEO_RAM) { - //must import in all formats + //must import in all formats, in order of priority (so platform choses the best supported one. IE, etc2 over etc). //Android, GLES 2.x - if (GlobalConfig::get_singleton()->get("rendering/vram_compression/import_s3tc")) { + if (ProjectSettings::get_singleton()->get("rendering/vram_compression/import_s3tc")) { _save_stex(image, p_save_path + ".s3tc.stex", compress_mode, lossy, Image::COMPRESS_S3TC, mipmaps, tex_flags, stream, detect_3d, detect_srgb, force_rgbe, detect_normal, force_normal); r_platform_variants->push_back("s3tc"); } - if (GlobalConfig::get_singleton()->get("rendering/vram_compression/import_etc")) { - _save_stex(image, p_save_path + ".etc.stex", compress_mode, lossy, Image::COMPRESS_ETC, mipmaps, tex_flags, stream, detect_3d, detect_srgb, force_rgbe, detect_normal, force_normal); - r_platform_variants->push_back("etc"); - } - - if (GlobalConfig::get_singleton()->get("rendering/vram_compression/import_etc2")) { + if (ProjectSettings::get_singleton()->get("rendering/vram_compression/import_etc2")) { _save_stex(image, p_save_path + ".etc2.stex", compress_mode, lossy, Image::COMPRESS_ETC2, mipmaps, tex_flags, stream, detect_3d, detect_srgb, force_rgbe, detect_normal, force_normal); r_platform_variants->push_back("etc2"); } - if (GlobalConfig::get_singleton()->get("rendering/vram_compression/import_pvrtc")) { + if (ProjectSettings::get_singleton()->get("rendering/vram_compression/import_etc")) { + _save_stex(image, p_save_path + ".etc.stex", compress_mode, lossy, Image::COMPRESS_ETC, mipmaps, tex_flags, stream, detect_3d, detect_srgb, force_rgbe, detect_normal, force_normal); + r_platform_variants->push_back("etc"); + } + + if (ProjectSettings::get_singleton()->get("rendering/vram_compression/import_pvrtc")) { _save_stex(image, p_save_path + ".pvrtc.stex", compress_mode, lossy, Image::COMPRESS_PVRTC4, mipmaps, tex_flags, stream, detect_3d, detect_srgb, force_rgbe, detect_normal, force_normal); r_platform_variants->push_back("pvrtc"); diff --git a/editor/io_plugins/editor_export_scene.cpp b/editor/io_plugins/editor_export_scene.cpp index bdf9dc6844..390217053a 100644 --- a/editor/io_plugins/editor_export_scene.cpp +++ b/editor/io_plugins/editor_export_scene.cpp @@ -30,7 +30,7 @@ #include "editor_export_scene.h" #if 0 #include "editor/editor_settings.h" -#include "global_config.h" +#include "project_settings.h" #include "io/resource_loader.h" #include "io/resource_saver.h" #include "os/dir_access.h" @@ -63,7 +63,7 @@ Vector<uint8_t> EditorSceneExportPlugin::custom_export(String& p_path,const Ref< uint64_t sd=0; String smd5; - String gp = GlobalConfig::get_singleton()->globalize_path(p_path); + String gp = ProjectSettings::get_singleton()->globalize_path(p_path); String md5=gp.md5_text(); String tmp_path = EditorSettings::get_singleton()->get_settings_path().plus_file("tmp/"); diff --git a/editor/io_plugins/editor_scene_import_plugin.cpp b/editor/io_plugins/editor_scene_import_plugin.cpp index fed02b0e72..5f0e928844 100644 --- a/editor/io_plugins/editor_scene_import_plugin.cpp +++ b/editor/io_plugins/editor_scene_import_plugin.cpp @@ -31,7 +31,7 @@ #if 0 #include "editor/create_dialog.h" #include "editor/editor_node.h" -#include "global_config.h" +#include "project_settings.h" #include "io/resource_saver.h" #include "os/file_access.h" #include "os/os.h" @@ -672,9 +672,9 @@ void EditorSceneImportDialog::_choose_save_file(const String& p_path) { void EditorSceneImportDialog::_choose_script(const String& p_path) { - String p = GlobalConfig::get_singleton()->localize_path(p_path); + String p = ProjectSettings::get_singleton()->localize_path(p_path); if (!p.is_resource_file()) - p=GlobalConfig::get_singleton()->get_resource_path().path_to(p_path.get_base_dir())+p_path.get_file(); + p=ProjectSettings::get_singleton()->get_resource_path().path_to(p_path.get_base_dir())+p_path.get_file(); script_path->set_text(p); } @@ -727,7 +727,7 @@ void EditorSceneImportDialog::_import(bool p_and_open) { if (texture_action->get_selected()==0) dst_path=save_path->get_text();//.get_base_dir(); else - dst_path=GlobalConfig::get_singleton()->get("import/shared_textures"); + dst_path=ProjectSettings::get_singleton()->get("import/shared_textures"); uint32_t flags=0; @@ -1277,7 +1277,7 @@ EditorSceneImportDialog::EditorSceneImportDialog(EditorNode *p_editor, EditorSce set_hide_on_ok(false); GLOBAL_DEF("import/shared_textures","res://"); - GlobalConfig::get_singleton()->set_custom_property_info("import/shared_textures",PropertyInfo(Variant::STRING,"import/shared_textures",PROPERTY_HINT_DIR)); + ProjectSettings::get_singleton()->set_custom_property_info("import/shared_textures",PropertyInfo(Variant::STRING,"import/shared_textures",PROPERTY_HINT_DIR)); import_hb->add_constant_override("separation",30); @@ -2812,7 +2812,7 @@ Error EditorSceneImportPlugin::import2(Node *scene, const String& p_dest_path, c String path = texture->get_path(); String fname= path.get_file(); - String target_path = GlobalConfig::get_singleton()->localize_path(target_res_path.plus_file(fname)); + String target_path = ProjectSettings::get_singleton()->localize_path(target_res_path.plus_file(fname)); progress.step(TTR("Import Image:")+" "+fname,3+(idx)*100/imagemap.size()); idx++; diff --git a/editor/io_plugins/editor_texture_import_plugin.cpp b/editor/io_plugins/editor_texture_import_plugin.cpp index d48675fa30..842c43f4de 100644 --- a/editor/io_plugins/editor_texture_import_plugin.cpp +++ b/editor/io_plugins/editor_texture_import_plugin.cpp @@ -33,7 +33,7 @@ #include "editor/editor_node.h" #include "editor/editor_settings.h" #include "editor_atlas.h" -#include "global_config.h" +#include "project_settings.h" #include "io/image_loader.h" #include "io/marshalls.h" #include "io/resource_saver.h" @@ -1653,7 +1653,7 @@ Vector<uint8_t> EditorTextureImportPlugin::custom_export(const String& p_path, c uint8_t f4[4]; encode_uint32(flags,&f4[0]); MD5Init(&ctx); - String gp = GlobalConfig::get_singleton()->globalize_path(p_path); + String gp = ProjectSettings::get_singleton()->globalize_path(p_path); CharString cs = gp.utf8(); MD5Update(&ctx,(unsigned char*)cs.get_data(),cs.length()); MD5Update(&ctx,f4,4); diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index c3e1f60ccc..82b03d3a19 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -31,7 +31,7 @@ #include "editor/animation_editor.h" #include "editor/editor_settings.h" -#include "global_config.h" +#include "project_settings.h" #include "io/resource_loader.h" #include "io/resource_saver.h" #include "os/keyboard.h" @@ -372,7 +372,7 @@ void AnimationPlayerEditor::_animation_save_in_path(const Ref<Resource> &p_resou flg |= ResourceSaver::FLAG_RELATIVE_PATHS; */ - String path = GlobalConfig::get_singleton()->localize_path(p_path); + String path = ProjectSettings::get_singleton()->localize_path(p_path); Error err = ResourceSaver::save(path, p_resource, flg | ResourceSaver::FLAG_REPLACE_SUBRESOURCE_PATHS); if (err != OK) { diff --git a/editor/plugins/animation_tree_editor_plugin.cpp b/editor/plugins/animation_tree_editor_plugin.cpp index d67832e10b..156a74144c 100644 --- a/editor/plugins/animation_tree_editor_plugin.cpp +++ b/editor/plugins/animation_tree_editor_plugin.cpp @@ -29,8 +29,8 @@ /*************************************************************************/ #include "animation_tree_editor_plugin.h" -#include "core/global_config.h" #include "core/io/resource_loader.h" +#include "core/project_settings.h" #include "os/input.h" #include "os/keyboard.h" #include "scene/gui/menu_button.h" @@ -371,6 +371,7 @@ void AnimationTreeEditor::_popup_edit_dialog() { edit_label[0]->show(); edit_scroll[0]->set_min(0); edit_scroll[0]->set_max(1); + edit_scroll[0]->set_step(0.01); edit_scroll[0]->set_value(anim_tree->mix_node_get_amount(edited_node)); edit_scroll[0]->set_begin(Point2(15, 25)); edit_scroll[0]->show(); @@ -383,6 +384,7 @@ void AnimationTreeEditor::_popup_edit_dialog() { edit_label[0]->show(); edit_scroll[0]->set_min(0); edit_scroll[0]->set_max(1); + edit_scroll[0]->set_step(0.01); edit_scroll[0]->set_value(anim_tree->blend2_node_get_amount(edited_node)); edit_scroll[0]->set_begin(Point2(15, 25)); edit_scroll[0]->show(); @@ -398,6 +400,7 @@ void AnimationTreeEditor::_popup_edit_dialog() { edit_label[0]->show(); edit_scroll[0]->set_min(-1); edit_scroll[0]->set_max(1); + edit_scroll[0]->set_step(0.01); edit_scroll[0]->set_value(anim_tree->blend3_node_get_amount(edited_node)); edit_scroll[0]->set_begin(Point2(15, 25)); edit_scroll[0]->show(); @@ -411,6 +414,7 @@ void AnimationTreeEditor::_popup_edit_dialog() { edit_label[0]->show(); edit_scroll[0]->set_min(0); edit_scroll[0]->set_max(1); + edit_scroll[0]->set_step(0.01); edit_scroll[0]->set_value(anim_tree->blend4_node_get_amount(edited_node).x); edit_scroll[0]->set_begin(Point2(15, 25)); edit_scroll[0]->show(); @@ -419,6 +423,7 @@ void AnimationTreeEditor::_popup_edit_dialog() { edit_label[1]->show(); edit_scroll[1]->set_min(0); edit_scroll[1]->set_max(1); + edit_scroll[1]->set_step(0.01); edit_scroll[1]->set_value(anim_tree->blend4_node_get_amount(edited_node).y); edit_scroll[1]->set_begin(Point2(15, 75)); edit_scroll[1]->show(); @@ -1408,7 +1413,7 @@ AnimationTreeEditor::AnimationTreeEditor() { file_dialog = memnew(EditorFileDialog); file_dialog->set_enable_multiple_selection(true); - file_dialog->set_current_dir(GlobalConfig::get_singleton()->get_resource_path()); + file_dialog->set_current_dir(ProjectSettings::get_singleton()->get_resource_path()); add_child(file_dialog); file_dialog->connect("file_selected", this, "_file_dialog_selected"); diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index c8936c8c35..4f07fdba2b 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -35,7 +35,7 @@ #include "editor/plugins/animation_player_editor_plugin.h" #include "editor/plugins/script_editor_plugin.h" #include "editor/script_editor_debugger.h" -#include "global_config.h" +#include "project_settings.h" #include "os/input.h" #include "os/keyboard.h" #include "print_string.h" @@ -2007,7 +2007,7 @@ void CanvasItemEditor::_viewport_draw() { VisualServer::get_singleton()->canvas_item_add_line(ci, transform.xform(display_rotate_from), transform.xform(display_rotate_to), rotate_color); } - Size2 screen_size = Size2(GlobalConfig::get_singleton()->get("display/window/size/width"), GlobalConfig::get_singleton()->get("display/window/size/height")); + Size2 screen_size = Size2(ProjectSettings::get_singleton()->get("display/window/size/width"), ProjectSettings::get_singleton()->get("display/window/size/height")); Vector2 screen_endpoints[4] = { transform.xform(Vector2(0, 0)), @@ -2323,7 +2323,7 @@ void CanvasItemEditor::_update_scrollbars() { h_scroll->set_begin(Point2(0, size.height - hmin.height)); h_scroll->set_end(Point2(size.width - vmin.width, size.height)); - Size2 screen_rect = Size2(GlobalConfig::get_singleton()->get("display/window/size/width"), GlobalConfig::get_singleton()->get("display/window/size/height")); + Size2 screen_rect = Size2(ProjectSettings::get_singleton()->get("display/window/size/width"), ProjectSettings::get_singleton()->get("display/window/size/height")); Rect2 local_rect = Rect2(Point2(), viewport->get_size() - Size2(vmin.width, hmin.height)); @@ -3697,7 +3697,7 @@ bool CanvasItemEditorViewport::_create_instance(Node *parent, String &path, cons } } - instanced_scene->set_filename(GlobalConfig::get_singleton()->localize_path(path)); + instanced_scene->set_filename(ProjectSettings::get_singleton()->localize_path(path)); editor_data->get_undo_redo().add_do_method(parent, "add_child", instanced_scene); editor_data->get_undo_redo().add_do_method(instanced_scene, "set_owner", editor->get_edited_scene()); diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp index 7f8581535c..ce6eefd694 100644 --- a/editor/plugins/editor_preview_plugins.cpp +++ b/editor/plugins/editor_preview_plugins.cpp @@ -186,7 +186,7 @@ Ref<Texture> EditorPackedScenePreviewPlugin::generate(const RES &p_from) { Ref<Texture> EditorPackedScenePreviewPlugin::generate_from_path(const String &p_path) { String temp_path = EditorSettings::get_singleton()->get_settings_path().plus_file("tmp"); - String cache_base = GlobalConfig::get_singleton()->globalize_path(p_path).md5_text(); + String cache_base = ProjectSettings::get_singleton()->globalize_path(p_path).md5_text(); cache_base = temp_path.plus_file("resthumb-" + cache_base); //does not have it, try to load a cached thumbnail diff --git a/editor/plugins/path_editor_plugin.cpp b/editor/plugins/path_editor_plugin.cpp index 3524c34d62..c32ed1064f 100644 --- a/editor/plugins/path_editor_plugin.cpp +++ b/editor/plugins/path_editor_plugin.cpp @@ -204,7 +204,7 @@ void PathSpatialGizmo::redraw() { if (c.is_null()) return; - PoolVector<Vector3> v3a = c->tesselate(); + PoolVector<Vector3> v3a = c->tessellate(); //PoolVector<Vector3> v3a=c->get_baked_points(); int v3s = v3a.size(); @@ -289,7 +289,7 @@ bool PathEditorPlugin::forward_spatial_gui_input(Camera *p_camera, const Ref<Inp if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && (curve_create->is_pressed() || (curve_edit->is_pressed() && mb->get_control()))) { //click into curve, break it down - PoolVector<Vector3> v3a = c->tesselate(); + PoolVector<Vector3> v3a = c->tessellate(); int idx = 0; int rc = v3a.size(); int closest_seg = -1; diff --git a/editor/plugins/resource_preloader_editor_plugin.cpp b/editor/plugins/resource_preloader_editor_plugin.cpp index ea7a84d2f4..463b6360ad 100644 --- a/editor/plugins/resource_preloader_editor_plugin.cpp +++ b/editor/plugins/resource_preloader_editor_plugin.cpp @@ -30,7 +30,7 @@ #include "resource_preloader_editor_plugin.h" #include "editor/editor_settings.h" -#include "global_config.h" +#include "project_settings.h" #include "io/resource_loader.h" void ResourcePreloaderEditor::_gui_input(Ref<InputEvent> p_event) { diff --git a/editor/plugins/sample_editor_plugin.cpp b/editor/plugins/sample_editor_plugin.cpp index a9af5823e3..0b99ab5460 100644 --- a/editor/plugins/sample_editor_plugin.cpp +++ b/editor/plugins/sample_editor_plugin.cpp @@ -31,7 +31,7 @@ #if 0 #include "editor/editor_settings.h" -#include "global_config.h" +#include "project_settings.h" #include "io/resource_loader.h" diff --git a/editor/plugins/sample_library_editor_plugin.cpp b/editor/plugins/sample_library_editor_plugin.cpp index 9eb1af70d1..04c805165f 100644 --- a/editor/plugins/sample_library_editor_plugin.cpp +++ b/editor/plugins/sample_library_editor_plugin.cpp @@ -32,7 +32,7 @@ #include "sample_library_editor_plugin.h" #include "editor/editor_settings.h" -#include "global_config.h" +#include "project_settings.h" #include "io/resource_loader.h" #include "sample_editor_plugin.h" #include "scene/main/viewport.h" diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index d10831eea1..c90d66f914 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -32,7 +32,7 @@ #include "editor/editor_node.h" #include "editor/editor_settings.h" #include "editor/script_editor_debugger.h" -#include "global_config.h" +#include "project_settings.h" #include "io/resource_loader.h" #include "io/resource_saver.h" #include "os/file_access.h" @@ -405,6 +405,8 @@ void ScriptEditor::_go_to_tab(int p_idx) { script_icon->set_texture(c->cast_to<ScriptEditorBase>()->get_icon()); if (is_visible_in_tree()) c->cast_to<ScriptEditorBase>()->ensure_focus(); + + notify_script_changed(c->cast_to<ScriptEditorBase>()->get_edited_script()); } if (c->cast_to<EditorHelp>()) { @@ -510,7 +512,7 @@ void ScriptEditor::_close_tab(int p_idx, bool p_save) { apply_scripts(); } current->clear_edit_menu(); - + notify_script_close(current->get_edited_script()); } else { EditorHelp *help = tab_container->get_child(selected)->cast_to<EditorHelp>(); _add_recent_script(help->get_class()); @@ -777,6 +779,31 @@ void ScriptEditor::_file_dialog_action(String p_file) { file_dialog_option = -1; } +Ref<Script> ScriptEditor::_get_current_script() { + + int selected = tab_container->get_current_tab(); + if (selected < 0 || selected >= tab_container->get_child_count()) + return NULL; + + ScriptEditorBase *current = tab_container->get_child(selected)->cast_to<ScriptEditorBase>(); + if (current) { + return current->get_edited_script(); + } else { + return NULL; + } +} + +Array ScriptEditor::_get_open_scripts() const { + + Array ret; + Vector<Ref<Script> > scripts = get_open_scripts(); + int scrits_amount = scripts.size(); + for (int idx_script = 0; idx_script < scrits_amount; idx_script++) { + ret.push_back(scripts[idx_script]); + } + return ret; +} + void ScriptEditor::_menu_option(int p_option) { switch (p_option) { @@ -1127,6 +1154,14 @@ void ScriptEditor::edited_scene_changed() { _update_modified_scripts_for_external_editor(); } +void ScriptEditor::notify_script_close(const Ref<Script> &p_script) { + emit_signal("script_close", p_script); +} + +void ScriptEditor::notify_script_changed(const Ref<Script> &p_script) { + emit_signal("editor_script_changed", p_script); +} + static const Node *_find_node_with_script(const Node *p_node, const RefPtr &p_script) { if (p_node->get_script() == p_script) @@ -1568,8 +1603,8 @@ bool ScriptEditor::edit(const Ref<Script> &p_script, int p_line, int p_col, bool String flags = EditorSettings::get_singleton()->get("text_editor/external/exec_flags"); Dictionary keys; - keys["project"] = GlobalConfig::get_singleton()->get_resource_path(); - keys["file"] = GlobalConfig::get_singleton()->globalize_path(p_script->get_path()); + keys["project"] = ProjectSettings::get_singleton()->get_resource_path(); + keys["file"] = ProjectSettings::get_singleton()->globalize_path(p_script->get_path()); keys["line"] = p_line >= 0 ? p_line : 0; keys["col"] = p_col; @@ -1662,6 +1697,7 @@ bool ScriptEditor::edit(const Ref<Script> &p_script, int p_line, int p_col, bool if (p_line >= 0) se->goto_line(p_line - 1); + notify_script_changed(p_script); return true; } @@ -2038,6 +2074,8 @@ void ScriptEditor::_update_history_pos(int p_new_pos) { n->cast_to<ScriptEditorBase>()->set_edit_state(history[history_pos].state); n->cast_to<ScriptEditorBase>()->ensure_focus(); + + notify_script_changed(n->cast_to<ScriptEditorBase>()->get_edited_script()); } if (n->cast_to<EditorHelp>()) { @@ -2065,6 +2103,21 @@ void ScriptEditor::_history_back() { _update_history_pos(history_pos - 1); } } + +Vector<Ref<Script> > ScriptEditor::get_open_scripts() const { + + Vector<Ref<Script> > out_scripts = Vector<Ref<Script> >(); + + for (int i = 0; i < tab_container->get_child_count(); i++) { + ScriptEditorBase *se = tab_container->get_child(i)->cast_to<ScriptEditorBase>(); + if (!se) + continue; + out_scripts.push_back(se->get_edited_script()); + } + + return out_scripts; +} + void ScriptEditor::set_scene_root_script(Ref<Script> p_script) { bool open_dominant = EditorSettings::get_singleton()->get("text_editor/files/open_dominant_script_on_scene_change"); @@ -2158,6 +2211,12 @@ void ScriptEditor::_bind_methods() { ClassDB::bind_method("_history_back", &ScriptEditor::_history_back); ClassDB::bind_method("_live_auto_reload_running_scripts", &ScriptEditor::_live_auto_reload_running_scripts); ClassDB::bind_method("_unhandled_input", &ScriptEditor::_unhandled_input); + + ClassDB::bind_method(D_METHOD("get_current_script"), &ScriptEditor::_get_current_script); + ClassDB::bind_method(D_METHOD("get_open_scripts"), &ScriptEditor::_get_open_scripts); + + ADD_SIGNAL(MethodInfo("editor_script_changed", PropertyInfo(Variant::OBJECT, "script:Script"))); + ADD_SIGNAL(MethodInfo("script_close", PropertyInfo(Variant::STRING, "script:String"))); } ScriptEditor::ScriptEditor(EditorNode *p_editor) { diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h index 010a5604ec..d8a9415df1 100644 --- a/editor/plugins/script_editor_plugin.h +++ b/editor/plugins/script_editor_plugin.h @@ -321,6 +321,9 @@ class ScriptEditor : public PanelContainer { int file_dialog_option; void _file_dialog_action(String p_file); + Ref<Script> _get_current_script(); + Array _get_open_scripts() const; + static void _open_script_request(const String &p_path); static ScriptEditor *script_editor; @@ -354,11 +357,15 @@ public: void get_window_layout(Ref<ConfigFile> p_layout); void set_scene_root_script(Ref<Script> p_script); + Vector<Ref<Script> > get_open_scripts() const; bool script_goto_method(Ref<Script> p_script, const String &p_method); virtual void edited_scene_changed(); + void notify_script_close(const Ref<Script> &p_script); + void notify_script_changed(const Ref<Script> &p_script); + void close_builtin_scripts_from_scene(const String &p_scene); void goto_help(const String &p_desc) { _help_class_goto(p_desc); } diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index 58fc32309f..8e6e92d48b 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -36,7 +36,7 @@ #include "editor/editor_settings.h" #include "editor/plugins/animation_player_editor_plugin.h" #include "editor/spatial_editor_gizmos.h" -#include "global_config.h" +#include "project_settings.h" #include "os/keyboard.h" #include "print_string.h" #include "scene/3d/camera.h" @@ -1717,11 +1717,11 @@ void SpatialEditorViewport::_notification(int p_what) { //update shadow atlas if changed - int shadowmap_size = GlobalConfig::get_singleton()->get("rendering/quality/shadow_atlas/size"); - int atlas_q0 = GlobalConfig::get_singleton()->get("rendering/quality/shadow_atlas/quadrant_0_subdiv"); - int atlas_q1 = GlobalConfig::get_singleton()->get("rendering/quality/shadow_atlas/quadrant_1_subdiv"); - int atlas_q2 = GlobalConfig::get_singleton()->get("rendering/quality/shadow_atlas/quadrant_2_subdiv"); - int atlas_q3 = GlobalConfig::get_singleton()->get("rendering/quality/shadow_atlas/quadrant_3_subdiv"); + int shadowmap_size = ProjectSettings::get_singleton()->get("rendering/quality/shadow_atlas/size"); + int atlas_q0 = ProjectSettings::get_singleton()->get("rendering/quality/shadow_atlas/quadrant_0_subdiv"); + int atlas_q1 = ProjectSettings::get_singleton()->get("rendering/quality/shadow_atlas/quadrant_1_subdiv"); + int atlas_q2 = ProjectSettings::get_singleton()->get("rendering/quality/shadow_atlas/quadrant_2_subdiv"); + int atlas_q3 = ProjectSettings::get_singleton()->get("rendering/quality/shadow_atlas/quadrant_3_subdiv"); viewport->set_shadow_atlas_size(shadowmap_size); viewport->set_shadow_atlas_quadrant_subdiv(0, Viewport::ShadowAtlasQuadrantSubdiv(atlas_q0)); @@ -1731,10 +1731,10 @@ void SpatialEditorViewport::_notification(int p_what) { //update msaa if changed - int msaa_mode = GlobalConfig::get_singleton()->get("rendering/quality/filters/msaa"); + int msaa_mode = ProjectSettings::get_singleton()->get("rendering/quality/filters/msaa"); viewport->set_msaa(Viewport::MSAA(msaa_mode)); - bool hdr = GlobalConfig::get_singleton()->get("rendering/quality/depth/hdr"); + bool hdr = ProjectSettings::get_singleton()->get("rendering/quality/depth/hdr"); viewport->set_hdr(hdr); bool show_info = view_menu->get_popup()->is_item_checked(view_menu->get_popup()->get_item_index(VIEW_INFORMATION)); @@ -1834,7 +1834,7 @@ void SpatialEditorViewport::_draw() { if (previewing) { - Size2 ss = Size2(GlobalConfig::get_singleton()->get("display/window/size/width"), GlobalConfig::get_singleton()->get("display/window/size/height")); + Size2 ss = Size2(ProjectSettings::get_singleton()->get("display/window/size/width"), ProjectSettings::get_singleton()->get("display/window/size/height")); float aspect = ss.aspect(); Size2 s = get_size(); diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index d06c065f4f..fa80894f7b 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -30,7 +30,7 @@ #include "sprite_frames_editor_plugin.h" #include "editor/editor_settings.h" -#include "global_config.h" +#include "project_settings.h" #include "io/resource_loader.h" #include "scene/3d/sprite_3d.h" diff --git a/editor/plugins/texture_editor_plugin.cpp b/editor/plugins/texture_editor_plugin.cpp index c4fe15e61c..70a1227c52 100644 --- a/editor/plugins/texture_editor_plugin.cpp +++ b/editor/plugins/texture_editor_plugin.cpp @@ -30,7 +30,7 @@ #include "texture_editor_plugin.h" #include "editor/editor_settings.h" -#include "global_config.h" +#include "project_settings.h" #include "io/resource_loader.h" void TextureEditor::_gui_input(Ref<InputEvent> p_event) { diff --git a/editor/project_export.cpp b/editor/project_export.cpp index ce22ed4731..b498044a65 100644 --- a/editor/project_export.cpp +++ b/editor/project_export.cpp @@ -32,7 +32,7 @@ #include "editor_data.h" #include "editor_node.h" #include "editor_settings.h" -#include "global_config.h" +#include "project_settings.h" #include "io/image_loader.h" #include "io/resource_loader.h" #include "io/resource_saver.h" @@ -51,6 +51,7 @@ void ProjectExportDialog::_notification(int p_what) { case NOTIFICATION_READY: { delete_preset->set_icon(get_icon("Del", "EditorIcons")); connect("confirmed", this, "_export_pck_zip"); + custom_feature_display->get_parent_control()->add_style_override("panel", get_stylebox("bg", "Tree")); } break; case NOTIFICATION_POPUP_HIDE: { EditorSettings::get_singleton()->set("interface/dialogs/export_bounds", get_rect()); @@ -240,9 +241,62 @@ void ProjectExportDialog::_edit_preset(int p_index) { export_button->set_disabled(false); } + custom_features->set_text(current->get_custom_features()); + _update_feature_list(); + updating = false; } +void ProjectExportDialog::_update_feature_list() { + + Ref<EditorExportPreset> current = EditorExport::get_singleton()->get_export_preset(presets->get_current()); + ERR_FAIL_COND(current.is_null()); + + Set<String> fset; + List<String> features; + + current->get_platform()->get_platform_features(&features); + current->get_platform()->get_preset_features(current, &features); + + String custom = current->get_custom_features(); + Vector<String> custom_list = custom.split(","); + for (int i = 0; i < custom_list.size(); i++) { + String f = custom_list[i].strip_edges(); + if (f != String()) { + features.push_back(f); + } + } + + for (List<String>::Element *E = features.front(); E; E = E->next()) { + fset.insert(E->get()); + } + + custom_feature_display->clear(); + for (Set<String>::Element *E = fset.front(); E; E = E->next()) { + String f = E->get(); + if (E->next()) { + f += ", "; + } + custom_feature_display->add_text(f); + } +} + +void ProjectExportDialog::_custom_features_changed(const String &p_text) { + + if (updating) + return; + + Ref<EditorExportPreset> current = EditorExport::get_singleton()->get_export_preset(presets->get_current()); + ERR_FAIL_COND(current.is_null()); + + current->set_custom_features(p_text); + _update_feature_list(); +} + +void ProjectExportDialog::_tab_changed(int) { + _update_feature_list(); +} + void ProjectExportDialog::_patch_button_pressed(Object *p_item, int p_column, int p_id) { TreeItem *ti = (TreeItem *)p_item; @@ -294,10 +348,10 @@ void ProjectExportDialog::_patch_selected(const String &p_path) { if (patch_index >= patches.size()) { - current->add_patch(GlobalConfig::get_singleton()->get_resource_path().path_to(p_path) + "*"); + current->add_patch(ProjectSettings::get_singleton()->get_resource_path().path_to(p_path) + "*"); } else { String enabled = patches[patch_index].ends_with("*") ? String("*") : String(); - current->set_patch(patch_index, GlobalConfig::get_singleton()->get_resource_path().path_to(p_path) + enabled); + current->set_patch(patch_index, ProjectSettings::get_singleton()->get_resource_path().path_to(p_path) + enabled); } _edit_preset(presets->get_current()); @@ -705,6 +759,8 @@ void ProjectExportDialog::_bind_methods() { ClassDB::bind_method("_open_export_template_manager", &ProjectExportDialog::_open_export_template_manager); ClassDB::bind_method("_export_project", &ProjectExportDialog::_export_project); ClassDB::bind_method("_export_project_to_path", &ProjectExportDialog::_export_project_to_path); + ClassDB::bind_method("_custom_features_changed", &ProjectExportDialog::_custom_features_changed); + ClassDB::bind_method("_tab_changed", &ProjectExportDialog::_tab_changed); } ProjectExportDialog::ProjectExportDialog() { @@ -828,6 +884,21 @@ ProjectExportDialog::ProjectExportDialog() { patch_erase->connect("confirmed", this, "_patch_deleted"); add_child(patch_erase); + VBoxContainer *feature_vb = memnew(VBoxContainer); + feature_vb->set_name(TTR("Features")); + custom_features = memnew(LineEdit); + custom_features->connect("text_changed", this, "_custom_features_changed"); + feature_vb->add_margin_child(TTR("Custom (comma-separated):"), custom_features); + Panel *features_panel = memnew(Panel); + custom_feature_display = memnew(RichTextLabel); + features_panel->add_child(custom_feature_display); + custom_feature_display->set_area_as_parent_rect(10 * EDSCALE); + custom_feature_display->set_v_size_flags(SIZE_EXPAND_FILL); + feature_vb->add_margin_child(TTR("Feature List:"), features_panel, true); + sections->add_child(feature_vb); + + sections->connect("tab_changed", this, "_tab_changed"); + //disable by default name->set_editable(false); runnable->set_disabled(true); diff --git a/editor/project_export.h b/editor/project_export.h index a3bbfc52ff..29c24005e0 100644 --- a/editor/project_export.h +++ b/editor/project_export.h @@ -40,6 +40,7 @@ #include "scene/gui/label.h" #include "scene/gui/link_button.h" #include "scene/gui/option_button.h" +#include "scene/gui/rich_text_label.h" #include "scene/gui/tab_container.h" #include "scene/gui/tree.h" #include "scene/main/timer.h" @@ -91,6 +92,9 @@ private: Button *export_button; + LineEdit *custom_features; + RichTextLabel *custom_feature_display; + Label *export_error; HBoxContainer *export_templates_error; @@ -132,6 +136,11 @@ private: void _export_project(); void _export_project_to_path(const String &p_path); + void _update_feature_list(); + void _custom_features_changed(const String &p_text); + + void _tab_changed(int); + protected: void _notification(int p_what); static void _bind_methods(); diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index e3f22c833e..acf5fe02cc 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -202,10 +202,10 @@ private: f->store_line("\n"); f->store_line("[application]"); f->store_line("\n"); - f->store_line("name=\"" + project_name->get_text() + "\""); - f->store_line("icon=\"res://icon.png\""); + f->store_line("config/name=\"" + project_name->get_text() + "\""); + f->store_line("config/icon=\"res://icon.png\""); f->store_line("[rendering]"); - f->store_line("viewport/default_environment=\"res://default_env.tres\""); + f->store_line("environment/default_environment=\"res://default_env.tres\""); memdelete(f); ResourceSaver::save(dir.plus_file("/icon.png"), get_icon("DefaultProjectIcon", "EditorIcons")); @@ -811,16 +811,16 @@ void ProjectManager::_load_recent_projects() { String project_name = TTR("Unnamed Project"); - if (cf->has_section_key("application", "name")) { - project_name = static_cast<String>(cf->get_value("application", "name")).xml_unescape(); + if (cf->has_section_key("application", "config/name")) { + project_name = static_cast<String>(cf->get_value("application", "config/name")).xml_unescape(); } if (filter_option == ProjectListFilter::FILTER_NAME && search_term != "" && project_name.findn(search_term) == -1) continue; Ref<Texture> icon; - if (cf->has_section_key("application", "icon")) { - String appicon = cf->get_value("application", "icon"); + if (cf->has_section_key("application", "config/icon")) { + String appicon = cf->get_value("application", "config/icon"); if (appicon != "") { Ref<Image> img; img.instance(); @@ -840,8 +840,8 @@ void ProjectManager::_load_recent_projects() { } String main_scene; - if (cf->has_section_key("application", "main_scene")) { - main_scene = cf->get_value("application", "main_scene"); + if (cf->has_section_key("application", "run/main_scene")) { + main_scene = cf->get_value("application", "run/main_scene"); } selected_list_copy.erase(project); diff --git a/editor/project_settings.cpp b/editor/project_settings_editor.cpp index f72c655561..6d23e874df 100644 --- a/editor/project_settings.cpp +++ b/editor/project_settings_editor.cpp @@ -27,17 +27,17 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "project_settings.h" +#include "project_settings_editor.h" #include "editor_node.h" -#include "global_config.h" #include "global_constants.h" #include "os/keyboard.h" +#include "project_settings.h" #include "scene/gui/margin_container.h" #include "scene/gui/tab_container.h" #include "translation.h" -ProjectSettings *ProjectSettings::singleton = NULL; +ProjectSettingsEditor *ProjectSettingsEditor::singleton = NULL; static const char *_button_names[JOY_BUTTON_MAX] = { "PS Cross, XBox A, Nintendo B", @@ -72,11 +72,11 @@ static const char *_axis_names[JOY_AXIS_MAX * 2] = { "", " (R2)" }; -void ProjectSettings::_notification(int p_what) { +void ProjectSettingsEditor::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { - globals_editor->edit(GlobalConfig::get_singleton()); + globals_editor->edit(ProjectSettings::get_singleton()); search_button->set_icon(get_icon("Search", "EditorIcons")); clear_button->set_icon(get_icon("Close", "EditorIcons")); @@ -112,7 +112,7 @@ void ProjectSettings::_notification(int p_what) { } } -void ProjectSettings::_action_selected() { +void ProjectSettingsEditor::_action_selected() { TreeItem *ti = input_editor->get_selected(); if (!ti || !ti->is_editable(0)) @@ -122,7 +122,7 @@ void ProjectSettings::_action_selected() { edit_idx = -1; } -void ProjectSettings::_action_edited() { +void ProjectSettingsEditor::_action_edited() { TreeItem *ti = input_editor->get_selected(); if (!ti) @@ -146,7 +146,7 @@ void ProjectSettings::_action_edited() { String action_prop = "input/" + new_name; - if (GlobalConfig::get_singleton()->has(action_prop)) { + if (ProjectSettings::get_singleton()->has(action_prop)) { ti->set_text(0, old_name); add_at = "input/" + old_name; @@ -156,17 +156,17 @@ void ProjectSettings::_action_edited() { return; } - int order = GlobalConfig::get_singleton()->get_order(add_at); - Array va = GlobalConfig::get_singleton()->get(add_at); + int order = ProjectSettings::get_singleton()->get_order(add_at); + Array va = ProjectSettings::get_singleton()->get(add_at); setting = true; undo_redo->create_action(TTR("Rename Input Action Event")); - undo_redo->add_do_method(GlobalConfig::get_singleton(), "clear", add_at); - undo_redo->add_do_method(GlobalConfig::get_singleton(), "set", action_prop, va); - undo_redo->add_do_method(GlobalConfig::get_singleton(), "set_order", action_prop, order); - undo_redo->add_undo_method(GlobalConfig::get_singleton(), "clear", action_prop); - undo_redo->add_undo_method(GlobalConfig::get_singleton(), "set", add_at, va); - undo_redo->add_undo_method(GlobalConfig::get_singleton(), "set_order", add_at, order); + undo_redo->add_do_method(ProjectSettings::get_singleton(), "clear", add_at); + undo_redo->add_do_method(ProjectSettings::get_singleton(), "set", action_prop, va); + undo_redo->add_do_method(ProjectSettings::get_singleton(), "set_order", action_prop, order); + undo_redo->add_undo_method(ProjectSettings::get_singleton(), "clear", action_prop); + undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set", add_at, va); + undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set_order", add_at, order); undo_redo->add_do_method(this, "_update_actions"); undo_redo->add_undo_method(this, "_update_actions"); undo_redo->add_do_method(this, "_settings_changed"); @@ -177,12 +177,12 @@ void ProjectSettings::_action_edited() { add_at = action_prop; } -void ProjectSettings::_device_input_add() { +void ProjectSettingsEditor::_device_input_add() { Ref<InputEvent> ie; String name = add_at; int idx = edit_idx; - Variant old_val = GlobalConfig::get_singleton()->get(name); + Variant old_val = ProjectSettings::get_singleton()->get(name); Array arr = old_val; // ie.device = device_id->get_value(); // ie.type = add_type; @@ -260,8 +260,8 @@ void ProjectSettings::_device_input_add() { } undo_redo->create_action(TTR("Add Input Action Event")); - undo_redo->add_do_method(GlobalConfig::get_singleton(), "set", name, arr); - undo_redo->add_undo_method(GlobalConfig::get_singleton(), "set", name, old_val); + undo_redo->add_do_method(ProjectSettings::get_singleton(), "set", name, arr); + undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set", name, old_val); undo_redo->add_do_method(this, "_update_actions"); undo_redo->add_undo_method(this, "_update_actions"); undo_redo->add_do_method(this, "_settings_changed"); @@ -271,7 +271,7 @@ void ProjectSettings::_device_input_add() { _show_last_added(ie, name); } -void ProjectSettings::_press_a_key_confirm() { +void ProjectSettingsEditor::_press_a_key_confirm() { if (last_wait_for_key.is_null()) return; @@ -287,7 +287,7 @@ void ProjectSettings::_press_a_key_confirm() { String name = add_at; int idx = edit_idx; - Variant old_val = GlobalConfig::get_singleton()->get(name); + Variant old_val = ProjectSettings::get_singleton()->get(name); Array arr = old_val; for (int i = 0; i < arr.size(); i++) { @@ -307,8 +307,8 @@ void ProjectSettings::_press_a_key_confirm() { } undo_redo->create_action(TTR("Add Input Action Event")); - undo_redo->add_do_method(GlobalConfig::get_singleton(), "set", name, arr); - undo_redo->add_undo_method(GlobalConfig::get_singleton(), "set", name, old_val); + undo_redo->add_do_method(ProjectSettings::get_singleton(), "set", name, arr); + undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set", name, old_val); undo_redo->add_do_method(this, "_update_actions"); undo_redo->add_undo_method(this, "_update_actions"); undo_redo->add_do_method(this, "_settings_changed"); @@ -318,7 +318,7 @@ void ProjectSettings::_press_a_key_confirm() { _show_last_added(ie, name); } -void ProjectSettings::_show_last_added(const Ref<InputEvent> &p_event, const String &p_name) { +void ProjectSettingsEditor::_show_last_added(const Ref<InputEvent> &p_event, const String &p_name) { TreeItem *r = input_editor->get_root(); String name = p_name; @@ -351,7 +351,7 @@ void ProjectSettings::_show_last_added(const Ref<InputEvent> &p_event, const Str if (found) input_editor->ensure_cursor_is_visible(); } -void ProjectSettings::_wait_for_key(const Ref<InputEvent> &p_event) { +void ProjectSettingsEditor::_wait_for_key(const Ref<InputEvent> &p_event) { Ref<InputEventKey> k = p_event; @@ -373,7 +373,7 @@ void ProjectSettings::_wait_for_key(const Ref<InputEvent> &p_event) { } } -void ProjectSettings::_add_item(int p_item, Ref<InputEvent> p_exiting_event) { +void ProjectSettingsEditor::_add_item(int p_item, Ref<InputEvent> p_exiting_event) { add_type = InputType(p_item); @@ -458,7 +458,7 @@ void ProjectSettings::_add_item(int p_item, Ref<InputEvent> p_exiting_event) { } } -void ProjectSettings::_edit_item(Ref<InputEvent> p_exiting_event) { +void ProjectSettingsEditor::_edit_item(Ref<InputEvent> p_exiting_event) { InputType ie_type; @@ -480,7 +480,7 @@ void ProjectSettings::_edit_item(Ref<InputEvent> p_exiting_event) { _add_item(ie_type, p_exiting_event); } -void ProjectSettings::_action_activated() { +void ProjectSettingsEditor::_action_activated() { TreeItem *ti = input_editor->get_selected(); @@ -489,7 +489,7 @@ void ProjectSettings::_action_activated() { String name = "input/" + ti->get_parent()->get_text(0); int idx = ti->get_metadata(0); - Array va = GlobalConfig::get_singleton()->get(name); + Array va = ProjectSettings::get_singleton()->get(name); ERR_FAIL_INDEX(idx, va.size()); @@ -503,7 +503,7 @@ void ProjectSettings::_action_activated() { _edit_item(ie); } -void ProjectSettings::_action_button_pressed(Object *p_obj, int p_column, int p_id) { +void ProjectSettingsEditor::_action_button_pressed(Object *p_obj, int p_column, int p_id) { TreeItem *ti = p_obj->cast_to<TreeItem>(); @@ -528,13 +528,13 @@ void ProjectSettings::_action_button_pressed(Object *p_obj, int p_column, int p_ //remove main thing String name = "input/" + ti->get_text(0); - Variant old_val = GlobalConfig::get_singleton()->get(name); - int order = GlobalConfig::get_singleton()->get_order(name); + Variant old_val = ProjectSettings::get_singleton()->get(name); + int order = ProjectSettings::get_singleton()->get_order(name); undo_redo->create_action(TTR("Add Input Action")); - undo_redo->add_do_method(GlobalConfig::get_singleton(), "clear", name); - undo_redo->add_undo_method(GlobalConfig::get_singleton(), "set", name, old_val); - undo_redo->add_undo_method(GlobalConfig::get_singleton(), "set_order", name, order); + undo_redo->add_do_method(ProjectSettings::get_singleton(), "clear", name); + undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set", name, old_val); + undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set_order", name, order); undo_redo->add_do_method(this, "_update_actions"); undo_redo->add_undo_method(this, "_update_actions"); undo_redo->add_do_method(this, "_settings_changed"); @@ -544,7 +544,7 @@ void ProjectSettings::_action_button_pressed(Object *p_obj, int p_column, int p_ } else { //remove action String name = "input/" + ti->get_parent()->get_text(0); - Variant old_val = GlobalConfig::get_singleton()->get(name); + Variant old_val = ProjectSettings::get_singleton()->get(name); int idx = ti->get_metadata(0); Array va = old_val; @@ -559,8 +559,8 @@ void ProjectSettings::_action_button_pressed(Object *p_obj, int p_column, int p_ va.resize(va.size() - 1); undo_redo->create_action(TTR("Erase Input Action Event")); - undo_redo->add_do_method(GlobalConfig::get_singleton(), "set", name, va); - undo_redo->add_undo_method(GlobalConfig::get_singleton(), "set", name, old_val); + undo_redo->add_do_method(ProjectSettings::get_singleton(), "set", name, va); + undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set", name, old_val); undo_redo->add_do_method(this, "_update_actions"); undo_redo->add_undo_method(this, "_update_actions"); undo_redo->add_do_method(this, "_settings_changed"); @@ -579,7 +579,7 @@ void ProjectSettings::_action_button_pressed(Object *p_obj, int p_column, int p_ //edit action String name = "input/" + ti->get_parent()->get_text(0); int idx = ti->get_metadata(0); - Array va = GlobalConfig::get_singleton()->get(name); + Array va = ProjectSettings::get_singleton()->get(name); ERR_FAIL_INDEX(idx, va.size()); @@ -596,7 +596,7 @@ void ProjectSettings::_action_button_pressed(Object *p_obj, int p_column, int p_ } } -void ProjectSettings::_update_actions() { +void ProjectSettingsEditor::_update_actions() { if (setting) return; @@ -606,7 +606,7 @@ void ProjectSettings::_update_actions() { input_editor->set_hide_root(true); List<PropertyInfo> props; - GlobalConfig::get_singleton()->get_property_list(&props); + ProjectSettings::get_singleton()->get_property_list(&props); for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) { @@ -622,14 +622,14 @@ void ProjectSettings::_update_actions() { //item->set_cell_mode(0,TreeItem::CELL_MODE_CHECK); item->set_text(0, name); item->add_button(0, get_icon("Add", "EditorIcons"), 1, false, TTR("Add Event")); - if (!GlobalConfig::get_singleton()->get_input_presets().find(pi.name)) { + if (!ProjectSettings::get_singleton()->get_input_presets().find(pi.name)) { item->add_button(0, get_icon("Remove", "EditorIcons"), 2, false, TTR("Remove")); item->set_editable(0, true); } item->set_custom_bg_color(0, get_color("prop_subsection", "Editor")); //item->set_checked(0,pi.usage&PROPERTY_USAGE_CHECKED); - Array actions = GlobalConfig::get_singleton()->get(pi.name); + Array actions = ProjectSettings::get_singleton()->get(pi.name); for (int i = 0; i < actions.size(); i++) { @@ -706,7 +706,7 @@ void ProjectSettings::_update_actions() { } } -void ProjectSettings::popup_project_settings() { +void ProjectSettingsEditor::popup_project_settings() { // Restore valid window bounds or pop up at default size. if (EditorSettings::get_singleton()->has("interface/dialogs/project_settings_bounds")) { @@ -720,7 +720,7 @@ void ProjectSettings::popup_project_settings() { plugin_settings->update_plugins(); } -void ProjectSettings::_item_selected() { +void ProjectSettingsEditor::_item_selected() { TreeItem *ti = globals_editor->get_property_editor()->get_scene_tree()->get_selected(); if (!ti) @@ -729,15 +729,15 @@ void ProjectSettings::_item_selected() { return; category->set_text(globals_editor->get_current_section()); property->set_text(ti->get_text(0)); - popup_platform->set_disabled(false); + popup_copy_to_feature->set_disabled(false); } -void ProjectSettings::_item_adds(String) { +void ProjectSettingsEditor::_item_adds(String) { _item_add(); } -void ProjectSettings::_item_add() { +void ProjectSettingsEditor::_item_add() { Variant value; switch (type->get_selected()) { @@ -765,12 +765,12 @@ void ProjectSettings::_item_add() { undo_redo->create_action("Add Global Property"); - undo_redo->add_do_property(GlobalConfig::get_singleton(), name, value); + undo_redo->add_do_property(ProjectSettings::get_singleton(), name, value); - if (GlobalConfig::get_singleton()->has(name)) { - undo_redo->add_undo_property(GlobalConfig::get_singleton(), name, GlobalConfig::get_singleton()->get(name)); + if (ProjectSettings::get_singleton()->has(name)) { + undo_redo->add_undo_property(ProjectSettings::get_singleton(), name, ProjectSettings::get_singleton()->get(name)); } else { - undo_redo->add_undo_property(GlobalConfig::get_singleton(), name, Variant()); + undo_redo->add_undo_property(ProjectSettings::get_singleton(), name, Variant()); } undo_redo->add_do_method(globals_editor, "update_category_list"); @@ -786,20 +786,35 @@ void ProjectSettings::_item_add() { _settings_changed(); } -void ProjectSettings::_item_del() { +void ProjectSettingsEditor::_item_del() { - String catname = category->get_text().strip_edges(); - //ERR_FAIL_COND(!catname.is_valid_identifier()); - String propname = property->get_text().strip_edges(); - //ERR_FAIL_COND(!propname.is_valid_identifier()); + String path = globals_editor->get_property_editor()->get_selected_path(); + if (path == String()) { + EditorNode::get_singleton()->show_warning(TTR("Select an setting item first!")); + return; + } - String name = catname != "" ? catname + "/" + propname : propname; + String property = globals_editor->get_current_section().plus_file(path); - undo_redo->create_action("Delete Global Property"); + if (!ProjectSettings::get_singleton()->has(property)) { + EditorNode::get_singleton()->show_warning(TTR("No property '" + property + "' exists.")); + return; + } - undo_redo->add_do_property(GlobalConfig::get_singleton(), name, Variant()); + if (ProjectSettings::get_singleton()->get_order(property) < ProjectSettings::NO_BUILTIN_ORDER_BASE) { + EditorNode::get_singleton()->show_warning(TTR("Setting '" + property + "' is internal, and it can't be deleted.")); + return; + } - undo_redo->add_undo_property(GlobalConfig::get_singleton(), name, GlobalConfig::get_singleton()->get(name)); + print_line("to delete.. " + property); + undo_redo->create_action(TTR("Delete Item")); + + Variant value = ProjectSettings::get_singleton()->get(property); + int order = ProjectSettings::get_singleton()->get_order(property); + + undo_redo->add_do_method(ProjectSettings::get_singleton(), "clear", property); + undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set", property, value); + undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set_order", property, order); undo_redo->add_do_method(globals_editor, "update_category_list"); undo_redo->add_undo_method(globals_editor, "update_category_list"); @@ -808,16 +823,14 @@ void ProjectSettings::_item_del() { undo_redo->add_undo_method(this, "_settings_changed"); undo_redo->commit_action(); - - _settings_changed(); } -void ProjectSettings::_action_adds(String) { +void ProjectSettingsEditor::_action_adds(String) { _action_add(); } -void ProjectSettings::_action_add() { +void ProjectSettingsEditor::_action_add() { String action = action_name->get_text(); if (action.find("/") != -1 || action.find(":") != -1 || action == "") { @@ -826,7 +839,7 @@ void ProjectSettings::_action_add() { return; } - if (GlobalConfig::get_singleton()->has("input/" + action)) { + if (ProjectSettings::get_singleton()->has("input/" + action)) { message->set_text(vformat(TTR("Action '%s' already exists!"), action)); message->popup_centered(Size2(300, 100)); return; @@ -835,8 +848,8 @@ void ProjectSettings::_action_add() { Array va; String name = "input/" + action; undo_redo->create_action(TTR("Add Input Action Event")); - undo_redo->add_do_method(GlobalConfig::get_singleton(), "set", name, va); - undo_redo->add_undo_method(GlobalConfig::get_singleton(), "clear", name); + undo_redo->add_do_method(ProjectSettings::get_singleton(), "set", name, va); + undo_redo->add_undo_method(ProjectSettings::get_singleton(), "clear", name); undo_redo->add_do_method(this, "_update_actions"); undo_redo->add_undo_method(this, "_update_actions"); undo_redo->add_do_method(this, "_settings_changed"); @@ -859,66 +872,119 @@ void ProjectSettings::_action_add() { input_editor->ensure_cursor_is_visible(); } -void ProjectSettings::_item_checked(const String &p_item, bool p_check) { +void ProjectSettingsEditor::_item_checked(const String &p_item, bool p_check) { } -void ProjectSettings::_save() { +void ProjectSettingsEditor::_save() { - Error err = GlobalConfig::get_singleton()->save(); + Error err = ProjectSettings::get_singleton()->save(); message->set_text(err != OK ? TTR("Error saving settings.") : TTR("Settings saved OK.")); message->popup_centered(Size2(300, 100)); } -void ProjectSettings::_settings_prop_edited(const String &p_name) { +void ProjectSettingsEditor::_settings_prop_edited(const String &p_name) { String full_item = globals_editor->get_full_item_path(p_name); _settings_changed(); } -void ProjectSettings::_settings_changed() { +void ProjectSettingsEditor::_settings_changed() { timer->start(); } -void ProjectSettings::queue_save() { +void ProjectSettingsEditor::queue_save() { _settings_changed(); } -void ProjectSettings::_copy_to_platform(int p_which) { +void ProjectSettingsEditor::_copy_to_platform_about_to_show() { - String catname = category->get_text(); - if (!catname.is_valid_identifier()) { - message->set_text("Invalid Category.\nValid characters: a-z,A-Z,0-9 or _"); - message->popup_centered(Size2(300, 100)); - return; + Set<String> presets; + + presets.insert("s3tc"); + presets.insert("etc"); + presets.insert("etc2"); + presets.insert("pvrtc"); + presets.insert("debug"); + presets.insert("release"); + + for (int i = 0; i < EditorExport::get_singleton()->get_export_platform_count(); i++) { + List<String> p; + EditorExport::get_singleton()->get_export_platform(i)->get_platform_features(&p); + for (List<String>::Element *E = p.front(); E; E = E->next()) { + presets.insert(E->get()); + } } - String propname = property->get_text(); - if (!propname.is_valid_identifier()) { - message->set_text("Invalid Property.\nValid characters: a-z,A-Z,0-9 or _"); - message->popup_centered(Size2(300, 100)); + for (int i = 0; i < EditorExport::get_singleton()->get_export_preset_count(); i++) { + + List<String> p; + EditorExport::get_singleton()->get_export_preset(i)->get_platform()->get_preset_features(EditorExport::get_singleton()->get_export_preset(i), &p); + for (List<String>::Element *E = p.front(); E; E = E->next()) { + presets.insert(E->get()); + } + + String custom = EditorExport::get_singleton()->get_export_preset(i)->get_custom_features(); + Vector<String> custom_list = custom.split(","); + for (int i = 0; i < custom_list.size(); i++) { + String f = custom_list[i].strip_edges(); + if (f != String()) { + presets.insert(f); + } + } + } + + popup_copy_to_feature->get_popup()->clear(); + int id = 0; + for (Set<String>::Element *E = presets.front(); E; E = E->next()) { + popup_copy_to_feature->get_popup()->add_item(E->get(), id++); + } +} + +void ProjectSettingsEditor::_copy_to_platform(int p_which) { + + String path = globals_editor->get_property_editor()->get_selected_path(); + if (path == String()) { + EditorNode::get_singleton()->show_warning(TTR("Select an setting item first!")); return; } - String name = catname + "/" + propname; - Variant value = GlobalConfig::get_singleton()->get(name); + String property = globals_editor->get_current_section().plus_file(path); - catname += "." + popup_platform->get_popup()->get_item_text(p_which); - name = catname + "/" + propname; + undo_redo->create_action(TTR("Override for Feature")); - GlobalConfig::get_singleton()->set(name, value); - globals_editor->get_property_editor()->update_tree(); + Variant value = ProjectSettings::get_singleton()->get(property); + if (property.find(".") != -1) { //overwriting overwrite, keep overwrite + undo_redo->add_do_method(ProjectSettings::get_singleton(), "clear", property); + undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set", property, value); + } + + String feature = popup_copy_to_feature->get_popup()->get_item_text(p_which); + String new_path = property + "." + feature; + + undo_redo->add_do_method(ProjectSettings::get_singleton(), "set", new_path, value); + if (ProjectSettings::get_singleton()->has(new_path)) { + undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set", new_path, ProjectSettings::get_singleton()->get(new_path)); + } + + undo_redo->add_do_method(globals_editor, "update_category_list"); + undo_redo->add_undo_method(globals_editor, "update_category_list"); + + undo_redo->add_do_method(this, "_settings_changed"); + undo_redo->add_undo_method(this, "_settings_changed"); + + undo_redo->commit_action(); } -void ProjectSettings::add_translation(const String &p_translation) { +void ProjectSettingsEditor::add_translation(const String &p_translation) { _translation_add(p_translation); } -void ProjectSettings::_translation_add(const String &p_path) { +void ProjectSettingsEditor::_translation_add(const String &p_path) { - PoolStringArray translations = GlobalConfig::get_singleton()->get("locale/translations"); + PoolStringArray translations = ProjectSettings::get_singleton()->get("locale/translations"); for (int i = 0; i < translations.size(); i++) { @@ -928,8 +994,8 @@ void ProjectSettings::_translation_add(const String &p_path) { translations.push_back(p_path); undo_redo->create_action(TTR("Add Translation")); - undo_redo->add_do_property(GlobalConfig::get_singleton(), "locale/translations", translations); - undo_redo->add_undo_property(GlobalConfig::get_singleton(), "locale/translations", GlobalConfig::get_singleton()->get("locale/translations")); + undo_redo->add_do_property(ProjectSettings::get_singleton(), "locale/translations", translations); + undo_redo->add_undo_property(ProjectSettings::get_singleton(), "locale/translations", ProjectSettings::get_singleton()->get("locale/translations")); undo_redo->add_do_method(this, "_update_translations"); undo_redo->add_undo_method(this, "_update_translations"); undo_redo->add_do_method(this, "_settings_changed"); @@ -937,27 +1003,27 @@ void ProjectSettings::_translation_add(const String &p_path) { undo_redo->commit_action(); } -void ProjectSettings::_translation_file_open() { +void ProjectSettingsEditor::_translation_file_open() { translation_file_open->popup_centered_ratio(); } -void ProjectSettings::_translation_delete(Object *p_item, int p_column, int p_button) { +void ProjectSettingsEditor::_translation_delete(Object *p_item, int p_column, int p_button) { TreeItem *ti = p_item->cast_to<TreeItem>(); ERR_FAIL_COND(!ti); int idx = ti->get_metadata(0); - PoolStringArray translations = GlobalConfig::get_singleton()->get("locale/translations"); + PoolStringArray translations = ProjectSettings::get_singleton()->get("locale/translations"); ERR_FAIL_INDEX(idx, translations.size()); translations.remove(idx); undo_redo->create_action(TTR("Remove Translation")); - undo_redo->add_do_property(GlobalConfig::get_singleton(), "locale/translations", translations); - undo_redo->add_undo_property(GlobalConfig::get_singleton(), "locale/translations", GlobalConfig::get_singleton()->get("locale/translations")); + undo_redo->add_do_property(ProjectSettings::get_singleton(), "locale/translations", translations); + undo_redo->add_undo_property(ProjectSettings::get_singleton(), "locale/translations", ProjectSettings::get_singleton()->get("locale/translations")); undo_redo->add_do_method(this, "_update_translations"); undo_redo->add_undo_method(this, "_update_translations"); undo_redo->add_do_method(this, "_settings_changed"); @@ -965,18 +1031,18 @@ void ProjectSettings::_translation_delete(Object *p_item, int p_column, int p_bu undo_redo->commit_action(); } -void ProjectSettings::_translation_res_file_open() { +void ProjectSettingsEditor::_translation_res_file_open() { translation_res_file_open->popup_centered_ratio(); } -void ProjectSettings::_translation_res_add(const String &p_path) { +void ProjectSettingsEditor::_translation_res_add(const String &p_path) { Variant prev; Dictionary remaps; - if (GlobalConfig::get_singleton()->has("locale/translation_remaps")) { - remaps = GlobalConfig::get_singleton()->get("locale/translation_remaps"); + if (ProjectSettings::get_singleton()->has("locale/translation_remaps")) { + remaps = ProjectSettings::get_singleton()->get("locale/translation_remaps"); prev = remaps; } @@ -986,8 +1052,8 @@ void ProjectSettings::_translation_res_add(const String &p_path) { remaps[p_path] = PoolStringArray(); undo_redo->create_action(TTR("Add Remapped Path")); - undo_redo->add_do_property(GlobalConfig::get_singleton(), "locale/translation_remaps", remaps); - undo_redo->add_undo_property(GlobalConfig::get_singleton(), "locale/translation_remaps", prev); + undo_redo->add_do_property(ProjectSettings::get_singleton(), "locale/translation_remaps", remaps); + undo_redo->add_undo_property(ProjectSettings::get_singleton(), "locale/translation_remaps", prev); undo_redo->add_do_method(this, "_update_translations"); undo_redo->add_undo_method(this, "_update_translations"); undo_redo->add_do_method(this, "_settings_changed"); @@ -995,15 +1061,15 @@ void ProjectSettings::_translation_res_add(const String &p_path) { undo_redo->commit_action(); } -void ProjectSettings::_translation_res_option_file_open() { +void ProjectSettingsEditor::_translation_res_option_file_open() { translation_res_option_file_open->popup_centered_ratio(); } -void ProjectSettings::_translation_res_option_add(const String &p_path) { +void ProjectSettingsEditor::_translation_res_option_add(const String &p_path) { - ERR_FAIL_COND(!GlobalConfig::get_singleton()->has("locale/translation_remaps")); + ERR_FAIL_COND(!ProjectSettings::get_singleton()->has("locale/translation_remaps")); - Dictionary remaps = GlobalConfig::get_singleton()->get("locale/translation_remaps"); + Dictionary remaps = ProjectSettings::get_singleton()->get("locale/translation_remaps"); TreeItem *k = translation_remap->get_selected(); ERR_FAIL_COND(!k); @@ -1016,8 +1082,8 @@ void ProjectSettings::_translation_res_option_add(const String &p_path) { remaps[key] = r; undo_redo->create_action(TTR("Resource Remap Add Remap")); - undo_redo->add_do_property(GlobalConfig::get_singleton(), "locale/translation_remaps", remaps); - undo_redo->add_undo_property(GlobalConfig::get_singleton(), "locale/translation_remaps", GlobalConfig::get_singleton()->get("locale/translation_remaps")); + undo_redo->add_do_property(ProjectSettings::get_singleton(), "locale/translation_remaps", remaps); + undo_redo->add_undo_property(ProjectSettings::get_singleton(), "locale/translation_remaps", ProjectSettings::get_singleton()->get("locale/translation_remaps")); undo_redo->add_do_method(this, "_update_translations"); undo_redo->add_undo_method(this, "_update_translations"); undo_redo->add_do_method(this, "_settings_changed"); @@ -1025,7 +1091,7 @@ void ProjectSettings::_translation_res_option_add(const String &p_path) { undo_redo->commit_action(); } -void ProjectSettings::_translation_res_select() { +void ProjectSettingsEditor::_translation_res_select() { if (updating_translations) return; @@ -1033,15 +1099,15 @@ void ProjectSettings::_translation_res_select() { call_deferred("_update_translations"); } -void ProjectSettings::_translation_res_option_changed() { +void ProjectSettingsEditor::_translation_res_option_changed() { if (updating_translations) return; - if (!GlobalConfig::get_singleton()->has("locale/translation_remaps")) + if (!ProjectSettings::get_singleton()->has("locale/translation_remaps")) return; - Dictionary remaps = GlobalConfig::get_singleton()->get("locale/translation_remaps"); + Dictionary remaps = ProjectSettings::get_singleton()->get("locale/translation_remaps"); TreeItem *k = translation_remap->get_selected(); ERR_FAIL_COND(!k); @@ -1065,8 +1131,8 @@ void ProjectSettings::_translation_res_option_changed() { updating_translations = true; undo_redo->create_action(TTR("Change Resource Remap Language")); - undo_redo->add_do_property(GlobalConfig::get_singleton(), "locale/translation_remaps", remaps); - undo_redo->add_undo_property(GlobalConfig::get_singleton(), "locale/translation_remaps", GlobalConfig::get_singleton()->get("locale/translation_remaps")); + undo_redo->add_do_property(ProjectSettings::get_singleton(), "locale/translation_remaps", remaps); + undo_redo->add_undo_property(ProjectSettings::get_singleton(), "locale/translation_remaps", ProjectSettings::get_singleton()->get("locale/translation_remaps")); undo_redo->add_do_method(this, "_update_translations"); undo_redo->add_undo_method(this, "_update_translations"); undo_redo->add_do_method(this, "_settings_changed"); @@ -1075,15 +1141,15 @@ void ProjectSettings::_translation_res_option_changed() { updating_translations = false; } -void ProjectSettings::_translation_res_delete(Object *p_item, int p_column, int p_button) { +void ProjectSettingsEditor::_translation_res_delete(Object *p_item, int p_column, int p_button) { if (updating_translations) return; - if (!GlobalConfig::get_singleton()->has("locale/translation_remaps")) + if (!ProjectSettings::get_singleton()->has("locale/translation_remaps")) return; - Dictionary remaps = GlobalConfig::get_singleton()->get("locale/translation_remaps"); + Dictionary remaps = ProjectSettings::get_singleton()->get("locale/translation_remaps"); TreeItem *k = p_item->cast_to<TreeItem>(); @@ -1093,8 +1159,8 @@ void ProjectSettings::_translation_res_delete(Object *p_item, int p_column, int remaps.erase(key); undo_redo->create_action(TTR("Remove Resource Remap")); - undo_redo->add_do_property(GlobalConfig::get_singleton(), "locale/translation_remaps", remaps); - undo_redo->add_undo_property(GlobalConfig::get_singleton(), "locale/translation_remaps", GlobalConfig::get_singleton()->get("locale/translation_remaps")); + undo_redo->add_do_property(ProjectSettings::get_singleton(), "locale/translation_remaps", remaps); + undo_redo->add_undo_property(ProjectSettings::get_singleton(), "locale/translation_remaps", ProjectSettings::get_singleton()->get("locale/translation_remaps")); undo_redo->add_do_method(this, "_update_translations"); undo_redo->add_undo_method(this, "_update_translations"); undo_redo->add_do_method(this, "_settings_changed"); @@ -1102,15 +1168,15 @@ void ProjectSettings::_translation_res_delete(Object *p_item, int p_column, int undo_redo->commit_action(); } -void ProjectSettings::_translation_res_option_delete(Object *p_item, int p_column, int p_button) { +void ProjectSettingsEditor::_translation_res_option_delete(Object *p_item, int p_column, int p_button) { if (updating_translations) return; - if (!GlobalConfig::get_singleton()->has("locale/translation_remaps")) + if (!ProjectSettings::get_singleton()->has("locale/translation_remaps")) return; - Dictionary remaps = GlobalConfig::get_singleton()->get("locale/translation_remaps"); + Dictionary remaps = ProjectSettings::get_singleton()->get("locale/translation_remaps"); TreeItem *k = translation_remap->get_selected(); ERR_FAIL_COND(!k); @@ -1127,8 +1193,8 @@ void ProjectSettings::_translation_res_option_delete(Object *p_item, int p_colum remaps[key] = r; undo_redo->create_action(TTR("Remove Resource Remap Option")); - undo_redo->add_do_property(GlobalConfig::get_singleton(), "locale/translation_remaps", remaps); - undo_redo->add_undo_property(GlobalConfig::get_singleton(), "locale/translation_remaps", GlobalConfig::get_singleton()->get("locale/translation_remaps")); + undo_redo->add_do_property(ProjectSettings::get_singleton(), "locale/translation_remaps", remaps); + undo_redo->add_undo_property(ProjectSettings::get_singleton(), "locale/translation_remaps", ProjectSettings::get_singleton()->get("locale/translation_remaps")); undo_redo->add_do_method(this, "_update_translations"); undo_redo->add_undo_method(this, "_update_translations"); undo_redo->add_do_method(this, "_settings_changed"); @@ -1136,7 +1202,7 @@ void ProjectSettings::_translation_res_option_delete(Object *p_item, int p_colum undo_redo->commit_action(); } -void ProjectSettings::_update_translations() { +void ProjectSettingsEditor::_update_translations() { //update translations @@ -1148,9 +1214,9 @@ void ProjectSettings::_update_translations() { translation_list->clear(); TreeItem *root = translation_list->create_item(NULL); translation_list->set_hide_root(true); - if (GlobalConfig::get_singleton()->has("locale/translations")) { + if (ProjectSettings::get_singleton()->has("locale/translations")) { - PoolStringArray translations = GlobalConfig::get_singleton()->get("locale/translations"); + PoolStringArray translations = ProjectSettings::get_singleton()->get("locale/translations"); for (int i = 0; i < translations.size(); i++) { TreeItem *t = translation_list->create_item(root); @@ -1186,9 +1252,9 @@ void ProjectSettings::_update_translations() { langnames += names[i]; } - if (GlobalConfig::get_singleton()->has("locale/translation_remaps")) { + if (ProjectSettings::get_singleton()->has("locale/translation_remaps")) { - Dictionary remaps = GlobalConfig::get_singleton()->get("locale/translation_remaps"); + Dictionary remaps = ProjectSettings::get_singleton()->get("locale/translation_remaps"); List<Variant> rk; remaps.get_key_list(&rk); Vector<String> keys; @@ -1241,7 +1307,7 @@ void ProjectSettings::_update_translations() { updating_translations = false; } -void ProjectSettings::_toggle_search_bar(bool p_pressed) { +void ProjectSettingsEditor::_toggle_search_bar(bool p_pressed) { globals_editor->get_property_editor()->set_use_filter(p_pressed); @@ -1258,7 +1324,7 @@ void ProjectSettings::_toggle_search_bar(bool p_pressed) { } } -void ProjectSettings::_clear_search_box() { +void ProjectSettingsEditor::_clear_search_box() { if (search_box->get_text() == "") return; @@ -1267,52 +1333,54 @@ void ProjectSettings::_clear_search_box() { globals_editor->get_property_editor()->update_tree(); } -void ProjectSettings::set_plugins_page() { +void ProjectSettingsEditor::set_plugins_page() { tab_container->set_current_tab(plugin_settings->get_index()); } -void ProjectSettings::_bind_methods() { - - ClassDB::bind_method(D_METHOD("_item_selected"), &ProjectSettings::_item_selected); - ClassDB::bind_method(D_METHOD("_item_add"), &ProjectSettings::_item_add); - ClassDB::bind_method(D_METHOD("_item_adds"), &ProjectSettings::_item_adds); - ClassDB::bind_method(D_METHOD("_item_del"), &ProjectSettings::_item_del); - ClassDB::bind_method(D_METHOD("_item_checked"), &ProjectSettings::_item_checked); - ClassDB::bind_method(D_METHOD("_save"), &ProjectSettings::_save); - ClassDB::bind_method(D_METHOD("_action_add"), &ProjectSettings::_action_add); - ClassDB::bind_method(D_METHOD("_action_adds"), &ProjectSettings::_action_adds); - ClassDB::bind_method(D_METHOD("_action_selected"), &ProjectSettings::_action_selected); - ClassDB::bind_method(D_METHOD("_action_edited"), &ProjectSettings::_action_edited); - ClassDB::bind_method(D_METHOD("_action_activated"), &ProjectSettings::_action_activated); - ClassDB::bind_method(D_METHOD("_action_button_pressed"), &ProjectSettings::_action_button_pressed); - ClassDB::bind_method(D_METHOD("_update_actions"), &ProjectSettings::_update_actions); - ClassDB::bind_method(D_METHOD("_wait_for_key"), &ProjectSettings::_wait_for_key); - ClassDB::bind_method(D_METHOD("_add_item"), &ProjectSettings::_add_item, DEFVAL(Variant())); - ClassDB::bind_method(D_METHOD("_device_input_add"), &ProjectSettings::_device_input_add); - ClassDB::bind_method(D_METHOD("_press_a_key_confirm"), &ProjectSettings::_press_a_key_confirm); - ClassDB::bind_method(D_METHOD("_settings_prop_edited"), &ProjectSettings::_settings_prop_edited); - ClassDB::bind_method(D_METHOD("_copy_to_platform"), &ProjectSettings::_copy_to_platform); - ClassDB::bind_method(D_METHOD("_update_translations"), &ProjectSettings::_update_translations); - ClassDB::bind_method(D_METHOD("_translation_delete"), &ProjectSettings::_translation_delete); - ClassDB::bind_method(D_METHOD("_settings_changed"), &ProjectSettings::_settings_changed); - ClassDB::bind_method(D_METHOD("_translation_add"), &ProjectSettings::_translation_add); - ClassDB::bind_method(D_METHOD("_translation_file_open"), &ProjectSettings::_translation_file_open); - - ClassDB::bind_method(D_METHOD("_translation_res_add"), &ProjectSettings::_translation_res_add); - ClassDB::bind_method(D_METHOD("_translation_res_file_open"), &ProjectSettings::_translation_res_file_open); - ClassDB::bind_method(D_METHOD("_translation_res_option_add"), &ProjectSettings::_translation_res_option_add); - ClassDB::bind_method(D_METHOD("_translation_res_option_file_open"), &ProjectSettings::_translation_res_option_file_open); - ClassDB::bind_method(D_METHOD("_translation_res_select"), &ProjectSettings::_translation_res_select); - ClassDB::bind_method(D_METHOD("_translation_res_option_changed"), &ProjectSettings::_translation_res_option_changed); - ClassDB::bind_method(D_METHOD("_translation_res_delete"), &ProjectSettings::_translation_res_delete); - ClassDB::bind_method(D_METHOD("_translation_res_option_delete"), &ProjectSettings::_translation_res_option_delete); - - ClassDB::bind_method(D_METHOD("_clear_search_box"), &ProjectSettings::_clear_search_box); - ClassDB::bind_method(D_METHOD("_toggle_search_bar"), &ProjectSettings::_toggle_search_bar); +void ProjectSettingsEditor::_bind_methods() { + + ClassDB::bind_method(D_METHOD("_item_selected"), &ProjectSettingsEditor::_item_selected); + ClassDB::bind_method(D_METHOD("_item_add"), &ProjectSettingsEditor::_item_add); + ClassDB::bind_method(D_METHOD("_item_adds"), &ProjectSettingsEditor::_item_adds); + ClassDB::bind_method(D_METHOD("_item_del"), &ProjectSettingsEditor::_item_del); + ClassDB::bind_method(D_METHOD("_item_checked"), &ProjectSettingsEditor::_item_checked); + ClassDB::bind_method(D_METHOD("_save"), &ProjectSettingsEditor::_save); + ClassDB::bind_method(D_METHOD("_action_add"), &ProjectSettingsEditor::_action_add); + ClassDB::bind_method(D_METHOD("_action_adds"), &ProjectSettingsEditor::_action_adds); + ClassDB::bind_method(D_METHOD("_action_selected"), &ProjectSettingsEditor::_action_selected); + ClassDB::bind_method(D_METHOD("_action_edited"), &ProjectSettingsEditor::_action_edited); + ClassDB::bind_method(D_METHOD("_action_activated"), &ProjectSettingsEditor::_action_activated); + ClassDB::bind_method(D_METHOD("_action_button_pressed"), &ProjectSettingsEditor::_action_button_pressed); + ClassDB::bind_method(D_METHOD("_update_actions"), &ProjectSettingsEditor::_update_actions); + ClassDB::bind_method(D_METHOD("_wait_for_key"), &ProjectSettingsEditor::_wait_for_key); + ClassDB::bind_method(D_METHOD("_add_item"), &ProjectSettingsEditor::_add_item, DEFVAL(Variant())); + ClassDB::bind_method(D_METHOD("_device_input_add"), &ProjectSettingsEditor::_device_input_add); + ClassDB::bind_method(D_METHOD("_press_a_key_confirm"), &ProjectSettingsEditor::_press_a_key_confirm); + ClassDB::bind_method(D_METHOD("_settings_prop_edited"), &ProjectSettingsEditor::_settings_prop_edited); + ClassDB::bind_method(D_METHOD("_copy_to_platform"), &ProjectSettingsEditor::_copy_to_platform); + ClassDB::bind_method(D_METHOD("_update_translations"), &ProjectSettingsEditor::_update_translations); + ClassDB::bind_method(D_METHOD("_translation_delete"), &ProjectSettingsEditor::_translation_delete); + ClassDB::bind_method(D_METHOD("_settings_changed"), &ProjectSettingsEditor::_settings_changed); + ClassDB::bind_method(D_METHOD("_translation_add"), &ProjectSettingsEditor::_translation_add); + ClassDB::bind_method(D_METHOD("_translation_file_open"), &ProjectSettingsEditor::_translation_file_open); + + ClassDB::bind_method(D_METHOD("_translation_res_add"), &ProjectSettingsEditor::_translation_res_add); + ClassDB::bind_method(D_METHOD("_translation_res_file_open"), &ProjectSettingsEditor::_translation_res_file_open); + ClassDB::bind_method(D_METHOD("_translation_res_option_add"), &ProjectSettingsEditor::_translation_res_option_add); + ClassDB::bind_method(D_METHOD("_translation_res_option_file_open"), &ProjectSettingsEditor::_translation_res_option_file_open); + ClassDB::bind_method(D_METHOD("_translation_res_select"), &ProjectSettingsEditor::_translation_res_select); + ClassDB::bind_method(D_METHOD("_translation_res_option_changed"), &ProjectSettingsEditor::_translation_res_option_changed); + ClassDB::bind_method(D_METHOD("_translation_res_delete"), &ProjectSettingsEditor::_translation_res_delete); + ClassDB::bind_method(D_METHOD("_translation_res_option_delete"), &ProjectSettingsEditor::_translation_res_option_delete); + + ClassDB::bind_method(D_METHOD("_clear_search_box"), &ProjectSettingsEditor::_clear_search_box); + ClassDB::bind_method(D_METHOD("_toggle_search_bar"), &ProjectSettingsEditor::_toggle_search_bar); + + ClassDB::bind_method(D_METHOD("_copy_to_platform_about_to_show"), &ProjectSettingsEditor::_copy_to_platform_about_to_show); } -ProjectSettings::ProjectSettings(EditorData *p_data) { +ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { singleton = this; set_title(TTR("Project Settings (project.godot)")); @@ -1388,11 +1456,6 @@ ProjectSettings::ProjectSettings(EditorData *p_data) { add->set_text(TTR("Add")); add->connect("pressed", this, "_item_add"); - Button *del = memnew(Button); - add_prop_bar->add_child(del); - del->set_text(TTR("Del")); - del->connect("pressed", this, "_item_del"); - search_bar = memnew(HBoxContainer); search_bar->set_h_size_flags(Control::SIZE_EXPAND_FILL); hbc->add_child(search_bar); @@ -1409,6 +1472,7 @@ ProjectSettings::ProjectSettings(EditorData *p_data) { globals_editor = memnew(SectionedPropertyEditor); props_base->add_child(globals_editor); globals_editor->get_property_editor()->set_undo_redo(EditorNode::get_singleton()->get_undo_redo()); + globals_editor->get_property_editor()->set_property_selectable(true); //globals_editor->hide_top_label(); globals_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL); globals_editor->register_search_box(search_box); @@ -1430,15 +1494,17 @@ ProjectSettings::ProjectSettings(EditorData *p_data) { save->connect("pressed",this,"_save"); */ - hbc = memnew(HBoxContainer); - props_base->add_child(hbc); + Button *del = memnew(Button); + hbc->add_child(del); + del->set_text(TTR("Delete")); + del->connect("pressed", this, "_item_del"); - popup_platform = memnew(MenuButton); - popup_platform->set_text(TTR("Copy To Platform..")); - popup_platform->set_disabled(true); - hbc->add_child(popup_platform); + add_prop_bar->add_child(memnew(VSeparator)); - hbc->add_spacer(); + popup_copy_to_feature = memnew(MenuButton); + popup_copy_to_feature->set_text(TTR("Override For..")); + popup_copy_to_feature->set_disabled(true); + add_prop_bar->add_child(popup_copy_to_feature); /*List<StringName> ep; EditorImportExport::get_singleton()->get_export_platforms(&ep); @@ -1446,11 +1512,13 @@ ProjectSettings::ProjectSettings(EditorData *p_data) { for(List<StringName>::Element *E=ep.front();E;E=E->next()) { - popup_platform->get_popup()->add_item( E->get() ); + popup_copy_to_feature->get_popup()->add_item( E->get() ); }*/ - popup_platform->get_popup()->connect("id_pressed", this, "_copy_to_platform"); + popup_copy_to_feature->get_popup()->connect("id_pressed", this, "_copy_to_platform"); + popup_copy_to_feature->get_popup()->connect("about_to_show", this, "_copy_to_platform_about_to_show"); + get_ok()->set_text(TTR("Close")); set_hide_on_ok(true); @@ -1665,7 +1733,7 @@ ProjectSettings::ProjectSettings(EditorData *p_data) { timer = memnew(Timer); timer->set_wait_time(1.5); - timer->connect("timeout", GlobalConfig::get_singleton(), "save"); + timer->connect("timeout", ProjectSettings::get_singleton(), "save"); timer->set_one_shot(true); add_child(timer); diff --git a/editor/project_settings.h b/editor/project_settings_editor.h index 03140a854b..4390a23d60 100644 --- a/editor/project_settings.h +++ b/editor/project_settings_editor.h @@ -40,8 +40,8 @@ //#include "project_export_settings.h" -class ProjectSettings : public AcceptDialog { - GDCLASS(ProjectSettings, AcceptDialog); +class ProjectSettingsEditor : public AcceptDialog { + GDCLASS(ProjectSettingsEditor, AcceptDialog); enum InputType { INPUT_KEY, @@ -78,7 +78,7 @@ class ProjectSettings : public AcceptDialog { SpinBox *device_id; OptionButton *device_index; Label *device_index_label; - MenuButton *popup_platform; + MenuButton *popup_copy_to_feature; LineEdit *action_name; Tree *input_editor; @@ -145,9 +145,11 @@ class ProjectSettings : public AcceptDialog { void _toggle_search_bar(bool p_pressed); void _clear_search_box(); - ProjectSettings(); + void _copy_to_platform_about_to_show(); - static ProjectSettings *singleton; + ProjectSettingsEditor(); + + static ProjectSettingsEditor *singleton; protected: void _notification(int p_what); @@ -155,13 +157,13 @@ protected: public: void add_translation(const String &p_translation); - static ProjectSettings *get_singleton() { return singleton; } + static ProjectSettingsEditor *get_singleton() { return singleton; } void popup_project_settings(); void set_plugins_page(); void queue_save(); - ProjectSettings(EditorData *p_data); + ProjectSettingsEditor(EditorData *p_data); }; #endif // PROJECT_SETTINGS_H diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp index 31be4e1818..c2af2445cc 100644 --- a/editor/property_editor.cpp +++ b/editor/property_editor.cpp @@ -37,8 +37,6 @@ #include "editor_help.h" #include "editor_node.h" #include "editor_settings.h" -#include "global_config.h" -#include "global_config.h" #include "io/image_loader.h" #include "io/resource_loader.h" #include "multi_node_edit.h" @@ -46,6 +44,8 @@ #include "os/keyboard.h" #include "pair.h" #include "print_string.h" +#include "project_settings.h" +#include "project_settings.h" #include "property_selector.h" #include "scene/gui/label.h" #include "scene/main/viewport.h" @@ -415,7 +415,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant:: int idx = i * 10 + j; CheckBox *c = checks20[idx]; - c->set_text(GlobalConfig::get_singleton()->get(basename + "/layer_" + itos(idx + 1))); + c->set_text(ProjectSettings::get_singleton()->get(basename + "/layer_" + itos(idx + 1))); c->set_pressed(flgs & (1 << (i * 10 + j))); c->show(); } @@ -1019,7 +1019,7 @@ void CustomPropertyEditor::_file_selected(String p_file) { if (hint == PROPERTY_HINT_FILE || hint == PROPERTY_HINT_DIR) { - v = GlobalConfig::get_singleton()->localize_path(p_file); + v = ProjectSettings::get_singleton()->localize_path(p_file); emit_signal("variant_changed"); hide(); } @@ -3002,8 +3002,18 @@ void PropertyEditor::update_tree() { String name = (basename.find("/") != -1) ? basename.right(basename.find_last("/") + 1) : basename; - if (capitalize_paths) - name = name.camelcase_to_underscore().capitalize(); + if (capitalize_paths) { + int dot = name.find("."); + if (dot != -1) { + String ov = name.right(dot); + name = name.substr(0, dot); + name = name.camelcase_to_underscore().capitalize(); + name += ov; + + } else { + name = name.camelcase_to_underscore().capitalize(); + } + } String path = basename.left(basename.find_last("/")); @@ -3046,7 +3056,7 @@ void PropertyEditor::update_tree() { //item->set_custom_bg_color(1,col); } item->set_editable(0, false); - item->set_selectable(0, false); + item->set_selectable(0, property_selectable); if (p.usage & PROPERTY_USAGE_CHECKABLE) { @@ -3059,6 +3069,18 @@ void PropertyEditor::update_tree() { item->set_text(0, name); item->set_tooltip(0, p.name); + if (name.find(".") != -1) { + Color textcol = get_color("font_color", "Tree"); + textcol.a *= 0.5; + //override :D + item->set_custom_color(0, textcol); + item->set_custom_color(1, textcol); + + Color iconcol(1, 1, 1, 0.6); + item->set_icon_color(0, iconcol); + item->set_icon_color(1, iconcol); + } + if (use_doc_hints) { StringName setter; StringName type; @@ -4308,6 +4330,11 @@ void PropertyEditor::register_text_enter(Node *p_line_edit) { search_box->connect("text_changed", this, "_filter_changed"); } +void PropertyEditor::set_property_selectable(bool p_selectable) { + property_selectable = p_selectable; + update_tree(); +} + void PropertyEditor::set_subsection_selectable(bool p_selectable) { if (p_selectable == subsection_selectable) @@ -4394,6 +4421,7 @@ PropertyEditor::PropertyEditor() { updating_folding = true; use_filter = false; subsection_selectable = false; + property_selectable = false; show_type_icons = EDITOR_DEF("interface/show_type_icons", false); } @@ -4647,6 +4675,8 @@ void SectionedPropertyEditor::update_category_list() { if (section_map.has(selected_category)) { section_map[selected_category]->select(0); } + + editor->update_tree(); } void SectionedPropertyEditor::register_search_box(LineEdit *p_box) { diff --git a/editor/property_editor.h b/editor/property_editor.h index 1ae44e473b..273eff371e 100644 --- a/editor/property_editor.h +++ b/editor/property_editor.h @@ -191,6 +191,7 @@ class PropertyEditor : public Control { bool subsection_selectable; bool hide_script; bool use_folding; + bool property_selectable; bool updating_folding; @@ -288,6 +289,7 @@ public: void register_text_enter(Node *p_line_edit); void set_subsection_selectable(bool p_selectable); + void set_property_selectable(bool p_selectable); void set_use_folding(bool p_enable); PropertyEditor(); diff --git a/editor/resources_dock.cpp b/editor/resources_dock.cpp index ddecfd108f..d3b68d92e4 100644 --- a/editor/resources_dock.cpp +++ b/editor/resources_dock.cpp @@ -32,10 +32,10 @@ #include "editor_file_system.h" #include "editor_node.h" #include "editor_settings.h" -#include "global_config.h" #include "io/resource_loader.h" #include "io/resource_saver.h" #include "project_settings.h" +#include "project_settings_editor.h" void ResourcesDock::_tool_selected(int p_tool) { @@ -124,7 +124,7 @@ void ResourcesDock::save_resource(const String &p_path, const Ref<Resource> &p_r flg|=ResourceSaver::FLAG_RELATIVE_PATHS; */ - String path = GlobalConfig::get_singleton()->localize_path(p_path); + String path = ProjectSettings::get_singleton()->localize_path(p_path); Error err = ResourceSaver::save(path, p_resource, flg | ResourceSaver::FLAG_REPLACE_SUBRESOURCE_PATHS); if (err != OK) { diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index cdae9baaf2..a9e998e76a 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -37,7 +37,7 @@ #include "editor/plugins/spatial_editor_plugin.h" #include "editor_node.h" #include "editor_settings.h" -#include "global_config.h" +#include "project_settings.h" #include "multi_node_edit.h" #include "os/keyboard.h" #include "scene/main/viewport.h" @@ -183,7 +183,7 @@ void SceneTreeDock::_perform_instance_scenes(const Vector<String> &p_files, Node } } - instanced_scene->set_filename(GlobalConfig::get_singleton()->localize_path(p_files[i])); + instanced_scene->set_filename(ProjectSettings::get_singleton()->localize_path(p_files[i])); instances.push_back(instanced_scene); } diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp index 4a9b64639b..c3a3410717 100644 --- a/editor/script_create_dialog.cpp +++ b/editor/script_create_dialog.cpp @@ -31,7 +31,7 @@ #include "editor/editor_scale.h" #include "editor_file_system.h" -#include "global_config.h" +#include "project_settings.h" #include "io/resource_saver.h" #include "os/file_access.h" #include "script_language.h" @@ -167,7 +167,7 @@ void ScriptCreateDialog::_create_new() { scr->set_name(cname); if (!is_built_in) { - String lpath = GlobalConfig::get_singleton()->localize_path(file_path->get_text()); + String lpath = ProjectSettings::get_singleton()->localize_path(file_path->get_text()); scr->set_path(lpath); Error err = ResourceSaver::save(lpath, scr, ResourceSaver::FLAG_CHANGE_PATH); if (err != OK) { @@ -305,7 +305,7 @@ void ScriptCreateDialog::_browse_path(bool browse_parent) { void ScriptCreateDialog::_file_selected(const String &p_file) { - String p = GlobalConfig::get_singleton()->localize_path(p_file); + String p = ProjectSettings::get_singleton()->localize_path(p_file); if (is_browsing_parent) { parent_name->set_text("\"" + p + "\""); _class_name_changed("\"" + p + "\""); @@ -327,7 +327,7 @@ void ScriptCreateDialog::_path_changed(const String &p_path) { return; } - p = GlobalConfig::get_singleton()->localize_path(p); + p = ProjectSettings::get_singleton()->localize_path(p); if (!p.begins_with("res://")) { _msg_path_valid(false, TTR("Path is not local")); _update_dialog(); diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp index c2e54ebd69..2af3bd5f31 100644 --- a/editor/script_editor_debugger.cpp +++ b/editor/script_editor_debugger.cpp @@ -32,7 +32,7 @@ #include "editor_node.h" #include "editor_profiler.h" #include "editor_settings.h" -#include "global_config.h" +#include "project_settings.h" #include "main/performance.h" #include "property_editor.h" #include "scene/gui/dialogs.h" diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp index 6c64f3af42..eec047cd9a 100644 --- a/editor/settings_config_dialog.cpp +++ b/editor/settings_config_dialog.cpp @@ -32,7 +32,7 @@ #include "editor_file_system.h" #include "editor_node.h" #include "editor_settings.h" -#include "global_config.h" +#include "project_settings.h" #include "os/keyboard.h" #include "scene/gui/margin_container.h" diff --git a/main/main.cpp b/main/main.cpp index ece54e7427..98c8b59ebc 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -31,10 +31,10 @@ #include "app_icon.gen.h" #include "core/register_core_types.h" #include "drivers/register_driver_types.h" -#include "global_config.h" #include "message_queue.h" #include "modules/register_module_types.h" #include "os/os.h" +#include "project_settings.h" #include "scene/register_scene_types.h" #include "script_debugger_local.h" #include "script_debugger_remote.h" @@ -74,7 +74,7 @@ #include "translation.h" #include "version.h" -static GlobalConfig *globals = NULL; +static ProjectSettings *globals = NULL; static Engine *engine = NULL; static InputMap *input_map = NULL; static bool _start_success = false; @@ -205,14 +205,14 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph Thread::_main_thread_id = Thread::get_caller_ID(); - globals = memnew(GlobalConfig); + globals = memnew(ProjectSettings); input_map = memnew(InputMap); register_core_settings(); //here globals is present translation_server = memnew(TranslationServer); performance = memnew(Performance); - globals->add_singleton(GlobalConfig::Singleton("Performance", performance)); + globals->add_singleton(ProjectSettings::Singleton("Performance", performance)); MAIN_PRINT("Main: Parse CMDLine"); @@ -529,7 +529,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph if (I->next()) { - GlobalConfig::get_singleton()->set("editor_scene", game_path = I->next()->get()); + ProjectSettings::get_singleton()->set("editor_scene", game_path = I->next()->get()); } else { goto error; } @@ -551,7 +551,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph if (I->next()) { int editor_pid = I->next()->get().to_int(); - GlobalConfig::get_singleton()->set("editor_pid", editor_pid); + ProjectSettings::get_singleton()->set("editor_pid", editor_pid); N = I->next()->next(); } else { goto error; @@ -642,7 +642,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph #ifdef TOOLS_ENABLED if (editor) { packed_data->set_disabled(true); - globals->set_disable_platform_override(true); + globals->set_disable_feature_overrides(true); StreamPeerSSL::initialize_certs = false; //will be initialized by editor } @@ -665,10 +665,10 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph use_custom_res = false; } - if (bool(GlobalConfig::get_singleton()->get("application/run/disable_stdout"))) { + if (bool(ProjectSettings::get_singleton()->get("application/run/disable_stdout"))) { quiet_stdout = true; } - if (bool(GlobalConfig::get_singleton()->get("application/run/disable_stderr"))) { + if (bool(ProjectSettings::get_singleton()->get("application/run/disable_stderr"))) { _print_error_enabled = false; }; @@ -679,7 +679,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph #ifdef TOOLS_ENABLED - if (main_args.size() == 0 && (!GlobalConfig::get_singleton()->has("application/run/main_loop_type")) && (!GlobalConfig::get_singleton()->has("application/main_scene") || String(GlobalConfig::get_singleton()->get("application/main_scene")) == "")) + if (main_args.size() == 0 && (!ProjectSettings::get_singleton()->has("application/run/main_loop_type")) && (!ProjectSettings::get_singleton()->has("application/run/main_scene") || String(ProjectSettings::get_singleton()->get("application/run/main_scene")) == "")) use_custom_res = false; //project manager (run without arguments) #endif @@ -724,6 +724,9 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph use_vsync = GLOBAL_DEF("display/window/vsync/use_vsync", use_vsync); GLOBAL_DEF("display/window/size/test_width", 0); GLOBAL_DEF("display/window/size/test_height", 0); + GLOBAL_DEF("rendering/quality/intended_usage/framebuffer_allocation", 2); + GLOBAL_DEF("rendering/quality/intended_usage/framebuffer_allocation.mobile", 3); + Engine::get_singleton()->_pixel_snap = GLOBAL_DEF("rendering/quality/2d/use_pixel_snap", false); OS::get_singleton()->_keep_screen_on = GLOBAL_DEF("display/window/energy_saving/keep_screen_on", true); if (rtm == -1) { @@ -812,7 +815,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph message_queue = memnew(MessageQueue); - GlobalConfig::get_singleton()->register_global_defaults(); + ProjectSettings::get_singleton()->register_global_defaults(); if (p_second_phase) return setup2(); @@ -913,7 +916,7 @@ Error Main::setup2() { if (show_logo) { //boot logo! String boot_logo_path = GLOBAL_DEF("application/boot_splash/image", String()); bool boot_logo_scale = GLOBAL_DEF("application/boot_splash/fullsize", true); - GlobalConfig::get_singleton()->set_custom_property_info("application/boot_splash/image", PropertyInfo(Variant::STRING, "application/boot_splash/image", PROPERTY_HINT_FILE, "*.png")); + ProjectSettings::get_singleton()->set_custom_property_info("application/boot_splash/image", PropertyInfo(Variant::STRING, "application/boot_splash/image", PROPERTY_HINT_FILE, "*.png")); Ref<Image> boot_logo; @@ -933,7 +936,7 @@ Error Main::setup2() { VisualServer::get_singleton()->set_boot_image(boot_logo, boot_bg, boot_logo_scale); #ifndef TOOLS_ENABLED //no tools, so free the boot logo (no longer needed) -//GlobalConfig::get_singleton()->set("application/boot_logo",Image()); +//ProjectSettings::get_singleton()->set("application/boot_logo",Image()); #endif } else { @@ -958,7 +961,7 @@ Error Main::setup2() { MAIN_PRINT("Main: END"); GLOBAL_DEF("application/config/icon", String()); - GlobalConfig::get_singleton()->set_custom_property_info("application/config/icon", PropertyInfo(Variant::STRING, "application/config/icon", PROPERTY_HINT_FILE, "*.png,*.webp")); + ProjectSettings::get_singleton()->set_custom_property_info("application/config/icon", PropertyInfo(Variant::STRING, "application/config/icon", PROPERTY_HINT_FILE, "*.png,*.webp")); if (bool(GLOBAL_DEF("display/window/handheld/emulate_touchscreen", false))) { if (!OS::get_singleton()->has_touchscreen_ui_hint() && Input::get_singleton() && !editor) { @@ -977,15 +980,15 @@ Error Main::setup2() { GLOBAL_DEF("display/mouse_cursor/custom_image", String()); GLOBAL_DEF("display/mouse_cursor/custom_image_hotspot", Vector2()); - GlobalConfig::get_singleton()->set_custom_property_info("display/mouse_cursor/custom_image", PropertyInfo(Variant::STRING, "display/mouse_cursor/custom_image", PROPERTY_HINT_FILE, "*.png,*.webp")); + ProjectSettings::get_singleton()->set_custom_property_info("display/mouse_cursor/custom_image", PropertyInfo(Variant::STRING, "display/mouse_cursor/custom_image", PROPERTY_HINT_FILE, "*.png,*.webp")); - if (String(GlobalConfig::get_singleton()->get("display/mouse_cursor/custom_image")) != String()) { + if (String(ProjectSettings::get_singleton()->get("display/mouse_cursor/custom_image")) != String()) { //print_line("use custom cursor"); - Ref<Texture> cursor = ResourceLoader::load(GlobalConfig::get_singleton()->get("display/mouse_cursor/custom_image")); + Ref<Texture> cursor = ResourceLoader::load(ProjectSettings::get_singleton()->get("display/mouse_cursor/custom_image")); if (cursor.is_valid()) { //print_line("loaded ok"); - Vector2 hotspot = GlobalConfig::get_singleton()->get("display/mouse_cursor/custom_image_hotspot"); + Vector2 hotspot = ProjectSettings::get_singleton()->get("display/mouse_cursor/custom_image_hotspot"); Input::get_singleton()->set_custom_mouse_cursor(cursor, hotspot); } } @@ -1276,7 +1279,7 @@ bool Main::start() { sml->set_auto_accept_quit(GLOBAL_DEF("application/config/auto_accept_quit", true)); sml->set_quit_on_go_back(GLOBAL_DEF("application/config/quit_on_go_back", true)); - String appname = GlobalConfig::get_singleton()->get("application/config/name"); + String appname = ProjectSettings::get_singleton()->get("application/config/name"); appname = TranslationServer::get_singleton()->translate(appname); OS::get_singleton()->set_window_title(appname); @@ -1291,12 +1294,14 @@ bool Main::start() { sml->get_root()->set_shadow_atlas_quadrant_subdiv(1, Viewport::ShadowAtlasQuadrantSubdiv(shadow_atlas_q1_subdiv)); sml->get_root()->set_shadow_atlas_quadrant_subdiv(2, Viewport::ShadowAtlasQuadrantSubdiv(shadow_atlas_q2_subdiv)); sml->get_root()->set_shadow_atlas_quadrant_subdiv(3, Viewport::ShadowAtlasQuadrantSubdiv(shadow_atlas_q3_subdiv)); + Viewport::Usage usage = Viewport::Usage(int(GLOBAL_GET("rendering/quality/intended_usage/framebuffer_allocation"))); + sml->get_root()->set_usage(usage); } else { GLOBAL_DEF("display/window/stretch/mode", "disabled"); - GlobalConfig::get_singleton()->set_custom_property_info("display/window/stretch/mode", PropertyInfo(Variant::STRING, "display/window/stretch/mode", PROPERTY_HINT_ENUM, "disabled,2d,viewport")); + ProjectSettings::get_singleton()->set_custom_property_info("display/window/stretch/mode", PropertyInfo(Variant::STRING, "display/window/stretch/mode", PROPERTY_HINT_ENUM, "disabled,2d,viewport")); GLOBAL_DEF("display/window/stretch/aspect", "ignore"); - GlobalConfig::get_singleton()->set_custom_property_info("display/window/stretch/aspect", PropertyInfo(Variant::STRING, "display/window/stretch/aspect", PROPERTY_HINT_ENUM, "ignore,keep,keep_width,keep_height")); + ProjectSettings::get_singleton()->set_custom_property_info("display/window/stretch/aspect", PropertyInfo(Variant::STRING, "display/window/stretch/aspect", PROPERTY_HINT_ENUM, "ignore,keep,keep_width,keep_height")); sml->set_auto_accept_quit(GLOBAL_DEF("application/config/auto_accept_quit", true)); sml->set_quit_on_go_back(GLOBAL_DEF("application/config/quit_on_go_back", true)); } @@ -1311,7 +1316,7 @@ bool Main::start() { if (!absolute) { - if (GlobalConfig::get_singleton()->is_using_datapack()) { + if (ProjectSettings::get_singleton()->is_using_datapack()) { local_game_path = "res://" + local_game_path; @@ -1334,7 +1339,7 @@ bool Main::start() { } } - local_game_path = GlobalConfig::get_singleton()->localize_path(local_game_path); + local_game_path = ProjectSettings::get_singleton()->localize_path(local_game_path); #ifdef TOOLS_ENABLED if (editor) { @@ -1360,7 +1365,7 @@ bool Main::start() { if (game_path != "" || script != "") { //autoload List<PropertyInfo> props; - GlobalConfig::get_singleton()->get_property_list(&props); + ProjectSettings::get_singleton()->get_property_list(&props); //first pass, add the constants so they exist before any script is loaded for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) { @@ -1369,7 +1374,7 @@ bool Main::start() { if (!s.begins_with("autoload/")) continue; String name = s.get_slicec('/', 1); - String path = GlobalConfig::get_singleton()->get(s); + String path = ProjectSettings::get_singleton()->get(s); bool global_var = false; if (path.begins_with("*")) { global_var = true; @@ -1390,7 +1395,7 @@ bool Main::start() { if (!s.begins_with("autoload/")) continue; String name = s.get_slicec('/', 1); - String path = GlobalConfig::get_singleton()->get(s); + String path = ProjectSettings::get_singleton()->get(s); bool global_var = false; if (path.begins_with("*")) { global_var = true; diff --git a/main/tests/test_io.cpp b/main/tests/test_io.cpp index 6986576081..f7c49c9249 100644 --- a/main/tests/test_io.cpp +++ b/main/tests/test_io.cpp @@ -31,7 +31,7 @@ #ifdef MINIZIP_ENABLED -#include "core/global_config.h" +#include "core/project_settings.h" #include "io/resource_loader.h" #include "io/resource_saver.h" #include "os/dir_access.h" @@ -91,10 +91,10 @@ MainLoop *test() { ResourceSaver::save("test_data/rock.xml", texture); print_line("localize paths"); - print_line(GlobalConfig::get_singleton()->localize_path("algo.xml")); - print_line(GlobalConfig::get_singleton()->localize_path("c:\\windows\\algo.xml")); - print_line(GlobalConfig::get_singleton()->localize_path(GlobalConfig::get_singleton()->get_resource_path() + "/something/something.xml")); - print_line(GlobalConfig::get_singleton()->localize_path("somedir/algo.xml")); + print_line(ProjectSettings::get_singleton()->localize_path("algo.xml")); + print_line(ProjectSettings::get_singleton()->localize_path("c:\\windows\\algo.xml")); + print_line(ProjectSettings::get_singleton()->localize_path(ProjectSettings::get_singleton()->get_resource_path() + "/something/something.xml")); + print_line(ProjectSettings::get_singleton()->localize_path("somedir/algo.xml")); { diff --git a/modules/gdnative/api_generator.cpp b/modules/gdnative/api_generator.cpp index d5f22ee7a3..47162bfc49 100644 --- a/modules/gdnative/api_generator.cpp +++ b/modules/gdnative/api_generator.cpp @@ -32,8 +32,8 @@ #ifdef TOOLS_ENABLED #include "class_db.h" -#include "core/global_config.h" #include "core/global_constants.h" +#include "core/project_settings.h" #include "os/file_access.h" // helper stuff @@ -150,7 +150,7 @@ List<ClassAPI> generate_c_api_classes() { if (name.begins_with("_")) { name.remove(0); } - class_api.is_singleton = GlobalConfig::get_singleton()->has_singleton(name); + class_api.is_singleton = ProjectSettings::get_singleton()->has_singleton(name); } class_api.is_instanciable = !class_api.is_singleton && ClassDB::can_instance(class_name); @@ -268,6 +268,8 @@ List<ClassAPI> generate_c_api_classes() { method_api.method_name = method_api.method_name.get_slice(":", 0); } else if (m->get().return_val.type != Variant::NIL) { method_api.return_type = m->get().return_val.hint == PROPERTY_HINT_RESOURCE_TYPE ? m->get().return_val.hint_string : Variant::get_type_name(m->get().return_val.type); + } else if (m->get().return_val.name != "") { + method_api.return_type = m->get().return_val.name; } else { method_api.return_type = "void"; } diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp index dad9a54df6..93e13850ac 100644 --- a/modules/gdnative/gdnative.cpp +++ b/modules/gdnative/gdnative.cpp @@ -29,11 +29,11 @@ /*************************************************************************/ #include "gdnative.h" -#include "global_config.h" #include "global_constants.h" #include "io/file_access_encrypted.h" #include "os/file_access.h" #include "os/os.h" +#include "project_settings.h" #include "scene/main/scene_tree.h" #include "scene/resources/scene_format_text.h" @@ -481,8 +481,8 @@ void GDNativeScript::set_script_name(StringName p_script_name) { } void GDNativeScript::_bind_methods() { - ClassDB::bind_method(D_METHOD("get_library"), &GDNativeScript::get_library); - ClassDB::bind_method(D_METHOD("set_library", "library"), &GDNativeScript::set_library); + ClassDB::bind_method(D_METHOD("get_library:GDNativeLibrary"), &GDNativeScript::get_library); + ClassDB::bind_method(D_METHOD("set_library", "library:GDNativeLibrary"), &GDNativeScript::set_library); ClassDB::bind_method(D_METHOD("get_script_name"), &GDNativeScript::get_script_name); ClassDB::bind_method(D_METHOD("set_script_name", "script_name"), &GDNativeScript::set_script_name); @@ -573,7 +573,7 @@ Error GDNativeLibrary::_initialize() { } ERR_FAIL_COND_V(platform_file == "", ERR_DOES_NOT_EXIST); - StringName path = GlobalConfig::get_singleton()->globalize_path(platform_file); + StringName path = ProjectSettings::get_singleton()->globalize_path(platform_file); GDNativeLibrary::currently_initialized_library = this; @@ -847,6 +847,16 @@ bool GDNativeInstance::set(const StringName &p_name, const Variant &p_value) { script->script_data->properties[p_name].setter.set_func((godot_object *)owner, script->script_data->properties[p_name].setter.method_data, userdata, *(godot_variant *)&p_value); return true; } + + Map<StringName, GDNativeScriptData::Method>::Element *E = script->script_data->methods.find("_set"); + if (E) { + Variant name = p_name; + const Variant *args[2] = { &name, &p_value }; + + E->get().method.method((godot_object *)owner, E->get().method.method_data, userdata, 2, (godot_variant **)args); + return true; + } + return false; } @@ -856,14 +866,66 @@ bool GDNativeInstance::get(const StringName &p_name, Variant &r_ret) const { if (script->script_data->properties.has(p_name)) { godot_variant value = script->script_data->properties[p_name].getter.get_func((godot_object *)owner, script->script_data->properties[p_name].getter.method_data, userdata); r_ret = *(Variant *)&value; + godot_variant_destroy(&value); + return true; + } + + Map<StringName, GDNativeScriptData::Method>::Element *E = script->script_data->methods.find("_get"); + if (E) { + Variant name = p_name; + const Variant *args[1] = { &name }; + + godot_variant result = E->get().method.method((godot_object *)owner, E->get().method.method_data, userdata, 1, (godot_variant **)args); + r_ret = *(Variant *)&result; + godot_variant_destroy(&result); return true; } + return false; } void GDNativeInstance::get_property_list(List<PropertyInfo> *p_properties) const { script->get_script_property_list(p_properties); // TODO: dynamic properties + + Map<StringName, GDNativeScriptData::Method>::Element *E = script->script_data->methods.find("_get_property_list"); + if (E) { + godot_variant result = E->get().method.method((godot_object *)owner, E->get().method.method_data, userdata, 0, NULL); + Variant ret = *(Variant *)&result; + godot_variant_destroy(&result); + + if (ret.get_type() != Variant::ARRAY) { + ERR_EXPLAIN("Wrong type for _get_property_list, must be an array of dictionaries."); + ERR_FAIL(); + } + + Array arr = ret; + for (int i = 0; i < arr.size(); i++) { + Dictionary d = arr[i]; + ERR_CONTINUE(!d.has("name")) + ERR_CONTINUE(!d.has("type")) + + PropertyInfo pinfo; + + pinfo.type = Variant::Type(d["type"].operator int()); + ERR_CONTINUE(pinfo.type < 0 || pinfo.type >= Variant::VARIANT_MAX); + + pinfo.name = d["name"]; + ERR_CONTINUE(pinfo.name == ""); + + if (d.has("hint")) { + pinfo.hint = PropertyHint(d["hint"].operator int()); + } + if (d.has("hint_string")) { + pinfo.hint_string = d["hint_string"]; + } + if (d.has("usage")) { + pinfo.usage = d["usage"]; + } + + p_properties->push_back(pinfo); + } + } } Variant::Type GDNativeInstance::get_property_type(const StringName &p_name, bool *r_is_valid) const { @@ -1021,7 +1083,7 @@ void GDNativeScriptLanguage::init() { // TODO: Expose globals GLOBAL_DEF("gdnative/default_gdnativelibrary", ""); PropertyInfo prop_info(Variant::STRING, "gdnative/default_gdnativelibrary", PROPERTY_HINT_FILE, "tres,res,dllib"); - GlobalConfig::get_singleton()->set_custom_property_info("gdnative/default_gdnativelibrary", prop_info); + ProjectSettings::get_singleton()->set_custom_property_info("gdnative/default_gdnativelibrary", prop_info); // generate bindings #if defined(TOOLS_ENABLED) && defined(DEBUG_METHODS_ENABLED) diff --git a/modules/gdnative/godot.cpp b/modules/gdnative/godot.cpp index 4dbb72bba1..764ce7c3ea 100644 --- a/modules/gdnative/godot.cpp +++ b/modules/gdnative/godot.cpp @@ -32,8 +32,8 @@ #include "class_db.h" #include "error_macros.h" #include "gdnative.h" -#include "global_config.h" #include "global_constants.h" +#include "project_settings.h" #include "variant.h" #ifdef __cplusplus @@ -93,7 +93,7 @@ void GDAPI godot_object_destroy(godot_object *p_o) { // Singleton API godot_object GDAPI *godot_global_get_singleton(char *p_name) { - return (godot_object *)GlobalConfig::get_singleton()->get_singleton_object(String(p_name)); + return (godot_object *)ProjectSettings::get_singleton()->get_singleton_object(String(p_name)); } // result shouldn't be freed // MethodBind API diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp index adf3c8edc4..f1b4828a3e 100644 --- a/modules/gdscript/gd_editor.cpp +++ b/modules/gdscript/gd_editor.cpp @@ -30,7 +30,7 @@ #include "editor/editor_settings.h" #include "gd_compiler.h" #include "gd_script.h" -#include "global_config.h" +#include "project_settings.h" #include "os/file_access.h" #ifdef TOOLS_ENABLED #include "editor/editor_file_system.h" @@ -638,7 +638,7 @@ static bool _guess_expression_type(GDCompletionContext &context, const GDParser: String which = arg1.get_slice("/", 2); if (which != "") { List<PropertyInfo> props; - GlobalConfig::get_singleton()->get_property_list(&props); + ProjectSettings::get_singleton()->get_property_list(&props); //print_line("find singleton"); for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) { @@ -650,7 +650,7 @@ static bool _guess_expression_type(GDCompletionContext &context, const GDParser: String name = s.get_slice("/", 1); //print_line("name: "+name+", which: "+which); if (name == which) { - String script = GlobalConfig::get_singleton()->get(s); + String script = ProjectSettings::get_singleton()->get(s); if (!script.begins_with("res://")) { script = "res://" + script; @@ -1105,7 +1105,7 @@ static bool _guess_identifier_type(GDCompletionContext &context, int p_line, con //autoloads as singletons List<PropertyInfo> props; - GlobalConfig::get_singleton()->get_property_list(&props); + ProjectSettings::get_singleton()->get_property_list(&props); for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) { @@ -1115,7 +1115,7 @@ static bool _guess_identifier_type(GDCompletionContext &context, int p_line, con String name = s.get_slice("/", 1); if (name == String(p_identifier)) { - String path = GlobalConfig::get_singleton()->get(s); + String path = ProjectSettings::get_singleton()->get(s); if (path.begins_with("*")) { String script = path.substr(1, path.length()); @@ -1344,7 +1344,7 @@ static void _find_identifiers(GDCompletionContext &context, int p_line, bool p_o //autoload singletons List<PropertyInfo> props; - GlobalConfig::get_singleton()->get_property_list(&props); + ProjectSettings::get_singleton()->get_property_list(&props); for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) { @@ -1352,7 +1352,7 @@ static void _find_identifiers(GDCompletionContext &context, int p_line, bool p_o if (!s.begins_with("autoload/")) continue; String name = s.get_slice("/", 1); - String path = GlobalConfig::get_singleton()->get(s); + String path = ProjectSettings::get_singleton()->get(s); if (path.begins_with("*")) { result.insert(name); } @@ -1685,7 +1685,7 @@ static void _find_type_arguments(GDCompletionContext &context, const GDParser::N if (p_argidx == 0 && (String(p_method) == "get_node" || String(p_method) == "has_node") && ClassDB::is_parent_class(id.obj_type, "Node")) { List<PropertyInfo> props; - GlobalConfig::get_singleton()->get_property_list(&props); + ProjectSettings::get_singleton()->get_property_list(&props); for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) { @@ -2660,7 +2660,7 @@ Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol //guess in autoloads as singletons List<PropertyInfo> props; - GlobalConfig::get_singleton()->get_property_list(&props); + ProjectSettings::get_singleton()->get_property_list(&props); for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) { @@ -2670,7 +2670,7 @@ Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol String name = s.get_slice("/", 1); if (name == String(p_symbol)) { - String path = GlobalConfig::get_singleton()->get(s); + String path = ProjectSettings::get_singleton()->get(s); if (path.begins_with("*")) { String script = path.substr(1, path.length()); diff --git a/modules/gdscript/gd_functions.cpp b/modules/gdscript/gd_functions.cpp index a361971ef4..8bc3b24a5e 100644 --- a/modules/gdscript/gd_functions.cpp +++ b/modules/gdscript/gd_functions.cpp @@ -1587,13 +1587,13 @@ MethodInfo GDFunctions::get_info(Function p_func) { } break; case TO_JSON: { - MethodInfo mi("to_json", PropertyInfo(Variant::NIL, "var:Variant")); + MethodInfo mi("to_json", PropertyInfo(Variant::NIL, "var")); mi.return_val.type = Variant::STRING; return mi; } break; case HASH: { - MethodInfo mi("hash", PropertyInfo(Variant::NIL, "var:Variant")); + MethodInfo mi("hash", PropertyInfo(Variant::NIL, "var")); mi.return_val.type = Variant::INT; return mi; } break; diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp index 0afb6ac179..ca62122342 100644 --- a/modules/gdscript/gd_script.cpp +++ b/modules/gdscript/gd_script.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "gd_script.h" #include "gd_compiler.h" -#include "global_config.h" +#include "project_settings.h" #include "global_constants.h" #include "io/file_access_encrypted.h" #include "os/file_access.h" @@ -1454,9 +1454,9 @@ void GDScriptLanguage::init() { //populate singletons - List<GlobalConfig::Singleton> singletons; - GlobalConfig::get_singleton()->get_singletons(&singletons); - for (List<GlobalConfig::Singleton>::Element *E = singletons.front(); E; E = E->next()) { + List<ProjectSettings::Singleton> singletons; + ProjectSettings::get_singleton()->get_singletons(&singletons); + for (List<ProjectSettings::Singleton>::Element *E = singletons.front(); E; E = E->next()) { _add_global(E->get().name, E->get().ptr); } diff --git a/modules/openssl/stream_peer_openssl.cpp b/modules/openssl/stream_peer_openssl.cpp index 8159296b3c..7a9d5195a9 100644 --- a/modules/openssl/stream_peer_openssl.cpp +++ b/modules/openssl/stream_peer_openssl.cpp @@ -560,7 +560,7 @@ void StreamPeerOpenSSL::initialize_ssl() { ERR_load_BIO_strings(); // Load BIO error strings OpenSSL_add_all_algorithms(); // Load all available encryption algorithms String certs_path = GLOBAL_DEF("network/ssl/certificates", ""); - GlobalConfig::get_singleton()->set_custom_property_info("network/ssl/certificates", PropertyInfo(Variant::STRING, "network/ssl/certificates", PROPERTY_HINT_FILE, "*.crt")); + ProjectSettings::get_singleton()->set_custom_property_info("network/ssl/certificates", PropertyInfo(Variant::STRING, "network/ssl/certificates", PROPERTY_HINT_FILE, "*.crt")); if (certs_path != "") { FileAccess *f = FileAccess::open(certs_path, FileAccess::READ); @@ -581,7 +581,7 @@ void StreamPeerOpenSSL::initialize_ssl() { } } String config_path = GLOBAL_DEF("network/ssl/config", ""); - GlobalConfig::get_singleton()->set_custom_property_info("network/ssl/config", PropertyInfo(Variant::STRING, "network/ssl/config", PROPERTY_HINT_FILE, "*.cnf")); + ProjectSettings::get_singleton()->set_custom_property_info("network/ssl/config", PropertyInfo(Variant::STRING, "network/ssl/config", PROPERTY_HINT_FILE, "*.cnf")); if (config_path != "") { Vector<uint8_t> data = FileAccess::get_file_as_array(config_path); diff --git a/modules/openssl/stream_peer_openssl.h b/modules/openssl/stream_peer_openssl.h index 5c830ebf37..10e02202aa 100644 --- a/modules/openssl/stream_peer_openssl.h +++ b/modules/openssl/stream_peer_openssl.h @@ -30,7 +30,7 @@ #ifndef STREAM_PEER_OPEN_SSL_H #define STREAM_PEER_OPEN_SSL_H -#include "global_config.h" +#include "project_settings.h" #include "io/stream_peer_ssl.h" #include "os/file_access.h" diff --git a/modules/theora/video_stream_theora.cpp b/modules/theora/video_stream_theora.cpp index d895f60280..f4af5026de 100644 --- a/modules/theora/video_stream_theora.cpp +++ b/modules/theora/video_stream_theora.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "video_stream_theora.h" -#include "global_config.h" +#include "project_settings.h" #include "os/os.h" #include "thirdparty/misc/yuv2rgb.h" @@ -728,7 +728,7 @@ void VideoStreamPlaybackTheora::play() { } playing = true; - delay_compensation = GlobalConfig::get_singleton()->get("audio/video_delay_compensation_ms"); + delay_compensation = ProjectSettings::get_singleton()->get("audio/video_delay_compensation_ms"); delay_compensation /= 1000.0; }; diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp index 84b4b0cab1..619ed8f6c0 100644 --- a/modules/visual_script/visual_script.cpp +++ b/modules/visual_script/visual_script.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "visual_script.h" -#include "global_config.h" +#include "project_settings.h" #include "os/os.h" #include "scene/main/node.h" #include "visual_script_nodes.h" diff --git a/modules/visual_script/visual_script_flow_control.cpp b/modules/visual_script/visual_script_flow_control.cpp index b53a21c53b..7074ac76c7 100644 --- a/modules/visual_script/visual_script_flow_control.cpp +++ b/modules/visual_script/visual_script_flow_control.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "visual_script_flow_control.h" -#include "global_config.h" +#include "project_settings.h" #include "io/resource_loader.h" #include "os/keyboard.h" @@ -875,7 +875,7 @@ String VisualScriptInputFilter::get_output_sequence_port_text(int p_port) const case Ref<InputEvent>::ACTION: { List<PropertyInfo> pinfo; - GlobalConfig::get_singleton()->get_property_list(&pinfo); + ProjectSettings::get_singleton()->get_property_list(&pinfo); int index = 1; text = "No Action"; @@ -1119,7 +1119,7 @@ bool VisualScriptInputFilter::_set(const StringName &p_name, const Variant &p_va if (what == "action_name") { List<PropertyInfo> pinfo; - GlobalConfig::get_singleton()->get_property_list(&pinfo); + ProjectSettings::get_singleton()->get_property_list(&pinfo); int index = 1; for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) { @@ -1325,7 +1325,7 @@ bool VisualScriptInputFilter::_get(const StringName &p_name, Variant &r_ret) con if (what == "action_name") { List<PropertyInfo> pinfo; - GlobalConfig::get_singleton()->get_property_list(&pinfo); + ProjectSettings::get_singleton()->get_property_list(&pinfo); int index = 1; for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) { @@ -1456,7 +1456,7 @@ void VisualScriptInputFilter::_get_property_list(List<PropertyInfo> *p_list) con actions = "None"; List<PropertyInfo> pinfo; - GlobalConfig::get_singleton()->get_property_list(&pinfo); + ProjectSettings::get_singleton()->get_property_list(&pinfo); Vector<String> al; for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) { diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp index 93b2aa2982..c42e784fbc 100644 --- a/modules/visual_script/visual_script_func_nodes.cpp +++ b/modules/visual_script/visual_script_func_nodes.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "visual_script_func_nodes.h" -#include "global_config.h" +#include "project_settings.h" #include "io/resource_loader.h" #include "os/os.h" #include "scene/main/node.h" @@ -347,7 +347,7 @@ void VisualScriptFunctionCall::set_singleton(const StringName &p_path) { return; singleton = p_path; - Object *obj = GlobalConfig::get_singleton()->get_singleton_object(singleton); + Object *obj = ProjectSettings::get_singleton()->get_singleton_object(singleton); if (obj) { base_type = obj->get_class(); } @@ -383,7 +383,7 @@ void VisualScriptFunctionCall::_update_method_cache() { } else if (call_mode == CALL_MODE_SINGLETON) { - Object *obj = GlobalConfig::get_singleton()->get_singleton_object(singleton); + Object *obj = ProjectSettings::get_singleton()->get_singleton_object(singleton); if (obj) { type = obj->get_class(); script = obj->get_script(); @@ -568,11 +568,11 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo &property) const if (call_mode != CALL_MODE_SINGLETON) { property.usage = 0; } else { - List<GlobalConfig::Singleton> names; - GlobalConfig::get_singleton()->get_singletons(&names); + List<ProjectSettings::Singleton> names; + ProjectSettings::get_singleton()->get_singletons(&names); property.hint = PROPERTY_HINT_ENUM; String sl; - for (List<GlobalConfig::Singleton>::Element *E = names.front(); E; E = E->next()) { + for (List<ProjectSettings::Singleton>::Element *E = names.front(); E; E = E->next()) { if (sl != String()) sl += ","; sl += E->get().name; @@ -606,7 +606,7 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo &property) const property.hint_string = itos(get_visual_script()->get_instance_ID()); } else if (call_mode == CALL_MODE_SINGLETON) { - Object *obj = GlobalConfig::get_singleton()->get_singleton_object(singleton); + Object *obj = ProjectSettings::get_singleton()->get_singleton_object(singleton); if (obj) { property.hint = PROPERTY_HINT_METHOD_OF_INSTANCE; property.hint_string = itos(obj->get_instance_ID()); @@ -867,7 +867,7 @@ public: } break; case VisualScriptFunctionCall::CALL_MODE_SINGLETON: { - Object *object = GlobalConfig::get_singleton()->get_singleton_object(singleton); + Object *object = ProjectSettings::get_singleton()->get_singleton_object(singleton); if (!object) { r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD; r_error_str = "Invalid singleton name: '" + String(singleton) + "'"; diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp index 5f24bcc2c3..9cbadde521 100644 --- a/modules/visual_script/visual_script_nodes.cpp +++ b/modules/visual_script/visual_script_nodes.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "visual_script_nodes.h" -#include "global_config.h" +#include "project_settings.h" #include "global_constants.h" #include "os/input.h" #include "os/os.h" @@ -1939,13 +1939,13 @@ public: VisualScriptNodeInstance *VisualScriptEngineSingleton::instance(VisualScriptInstance *p_instance) { VisualScriptNodeInstanceEngineSingleton *instance = memnew(VisualScriptNodeInstanceEngineSingleton); - instance->singleton = GlobalConfig::get_singleton()->get_singleton_object(singleton); + instance->singleton = ProjectSettings::get_singleton()->get_singleton_object(singleton); return instance; } VisualScriptEngineSingleton::TypeGuess VisualScriptEngineSingleton::guess_output_type(TypeGuess *p_inputs, int p_output) const { - Object *obj = GlobalConfig::get_singleton()->get_singleton_object(singleton); + Object *obj = ProjectSettings::get_singleton()->get_singleton_object(singleton); TypeGuess tg; tg.type = Variant::OBJECT; if (obj) { @@ -1963,11 +1963,11 @@ void VisualScriptEngineSingleton::_bind_methods() { String cc; - List<GlobalConfig::Singleton> singletons; + List<ProjectSettings::Singleton> singletons; - GlobalConfig::get_singleton()->get_singletons(&singletons); + ProjectSettings::get_singleton()->get_singletons(&singletons); - for (List<GlobalConfig::Singleton>::Element *E = singletons.front(); E; E = E->next()) { + for (List<ProjectSettings::Singleton>::Element *E = singletons.front(); E; E = E->next()) { if (E->get().name == "VS" || E->get().name == "PS" || E->get().name == "PS2D" || E->get().name == "AS" || E->get().name == "TS" || E->get().name == "SS" || E->get().name == "SS2D") continue; //skip these, too simple named @@ -3466,7 +3466,7 @@ void VisualScriptInputAction::_validate_property(PropertyInfo &property) const { String actions; List<PropertyInfo> pinfo; - GlobalConfig::get_singleton()->get_property_list(&pinfo); + ProjectSettings::get_singleton()->get_property_list(&pinfo); Vector<String> al; for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) { diff --git a/modules/webm/video_stream_webm.cpp b/modules/webm/video_stream_webm.cpp index eaf4215302..ff0bca0fc5 100644 --- a/modules/webm/video_stream_webm.cpp +++ b/modules/webm/video_stream_webm.cpp @@ -34,7 +34,7 @@ #include "mkvparser/mkvparser.h" -#include "global_config.h" +#include "project_settings.h" #include "os/file_access.h" #include "thirdparty/misc/yuv2rgb.h" @@ -168,7 +168,7 @@ void VideoStreamPlaybackWebm::play() { stop(); - delay_compensation = GlobalConfig::get_singleton()->get("audio/video_delay_compensation_ms"); + delay_compensation = ProjectSettings::get_singleton()->get("audio/video_delay_compensation_ms"); delay_compensation /= 1000.0; playing = true; diff --git a/platform/android/audio_driver_jandroid.cpp b/platform/android/audio_driver_jandroid.cpp index 7b2127a211..cf1ea169b3 100644 --- a/platform/android/audio_driver_jandroid.cpp +++ b/platform/android/audio_driver_jandroid.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "audio_driver_jandroid.h" -#include "global_config.h" +#include "project_settings.h" #include "os/os.h" #include "thread_jandroid.h" diff --git a/platform/android/detect.py b/platform/android/detect.py index 7508c9ed0e..55b7052393 100644 --- a/platform/android/detect.py +++ b/platform/android/detect.py @@ -87,20 +87,6 @@ def configure(env): env['SPAWN'] = mySpawn - ## Build type - - if (env["target"].startswith("release")): - env.Append(LINKFLAGS=['-O2']) - env.Append(CPPFLAGS=['-O2', '-DNDEBUG', '-ffast-math', '-funsafe-math-optimizations', '-fomit-frame-pointer']) - if (can_vectorize): - env.Append(CPPFLAGS=['-ftree-vectorize']) - if (env["target"] == "release_debug"): - env.Append(CPPFLAGS=['-DDEBUG_ENABLED']) - elif (env["target"] == "debug"): - env.Append(LINKFLAGS=['-O0']) - env.Append(CPPFLAGS=['-O0', '-D_DEBUG', '-UNDEBUG', '-DDEBUG_ENABLED', - '-DDEBUG_MEMORY_ENABLED', '-g', '-fno-limit-debug-info']) - ## Architecture if env['android_arch'] not in ['armv7', 'armv6', 'x86']: @@ -133,6 +119,20 @@ def configure(env): else: env.extra_suffix = ".armv7" + env.extra_suffix + ## Build type + + if (env["target"].startswith("release")): + env.Append(LINKFLAGS=['-O2']) + env.Append(CPPFLAGS=['-O2', '-DNDEBUG', '-ffast-math', '-funsafe-math-optimizations', '-fomit-frame-pointer']) + if (can_vectorize): + env.Append(CPPFLAGS=['-ftree-vectorize']) + if (env["target"] == "release_debug"): + env.Append(CPPFLAGS=['-DDEBUG_ENABLED']) + elif (env["target"] == "debug"): + env.Append(LINKFLAGS=['-O0']) + env.Append(CPPFLAGS=['-O0', '-D_DEBUG', '-UNDEBUG', '-DDEBUG_ENABLED', + '-DDEBUG_MEMORY_ENABLED', '-g', '-fno-limit-debug-info']) + ## Compiler configuration env['SHLIBSUFFIX'] = '.so' diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index 95f48521f8..cb9d0c8b53 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -31,13 +31,13 @@ #include "editor/editor_export.h" #include "editor/editor_node.h" #include "editor/editor_settings.h" -#include "global_config.h" #include "io/marshalls.h" #include "io/zip_io.h" #include "os/file_access.h" #include "os/os.h" #include "platform/android/logo.gen.h" #include "platform/android/run_icon.gen.h" +#include "project_settings.h" #include "version.h" #include <string.h> #if 0 @@ -555,8 +555,8 @@ void EditorExportPlatformAndroid::_fix_resources(Vector<uint8_t>& p_manifest) { String lang = str.substr(str.find_last("-")+1,str.length()).replace("-","_"); String prop = "application/config/name_"+lang; - if (GlobalConfig::get_singleton()->has(prop)) { - str = GlobalConfig::get_singleton()->get(prop); + if (ProjectSettings::get_singleton()->has(prop)) { + str = ProjectSettings::get_singleton()->get(prop); } else { str = get_project_name(); } @@ -628,7 +628,7 @@ String EditorExportPlatformAndroid::get_project_name() const { if (this->name!="") { aname=this->name; } else { - aname = GlobalConfig::get_singleton()->get("application/config/name"); + aname = ProjectSettings::get_singleton()->get("application/config/name"); } @@ -1144,7 +1144,7 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d if (!found) { - String appicon = GlobalConfig::get_singleton()->get("application/config/icon"); + String appicon = ProjectSettings::get_singleton()->get("application/config/icon"); if (appicon!="" && appicon.ends_with(".png")) { FileAccess*f = FileAccess::open(appicon,FileAccess::READ); if (f) { @@ -1763,7 +1763,7 @@ Error EditorExportPlatformAndroid::run(int p_device, int p_flags) { String EditorExportPlatformAndroid::get_package_name() { String pname = package; - String basename = GlobalConfig::get_singleton()->get("application/config/name"); + String basename = ProjectSettings::get_singleton()->get("application/config/name"); basename=basename.to_lower(); String name; @@ -2208,7 +2208,7 @@ class EditorExportAndroid : public EditorExportPlatform { if (p_name != "") { aname = p_name; } else { - aname = GlobalConfig::get_singleton()->get("application/config/name"); + aname = ProjectSettings::get_singleton()->get("application/config/name"); } if (aname == "") { @@ -2221,7 +2221,7 @@ class EditorExportAndroid : public EditorExportPlatform { String get_package_name(const String &p_package) { String pname = p_package; - String basename = GlobalConfig::get_singleton()->get("application/config/name"); + String basename = ProjectSettings::get_singleton()->get("application/config/name"); basename = basename.to_lower(); String name; @@ -2537,6 +2537,10 @@ class EditorExportAndroid : public EditorExportPlatform { }*/ } + if (tname == "uses-feature" && /*nspace=="android" &&*/ attrname == "glEsVersion") { + print_line("version number: " + itos(decode_uint32(&p_manifest[iofs + 16]))); + } + if (tname == "uses-permission" && /*nspace=="android" &&*/ attrname == "name") { if (value.begins_with("godot.custom")) { @@ -2751,8 +2755,8 @@ class EditorExportAndroid : public EditorExportPlatform { String lang = str.substr(str.find_last("-") + 1, str.length()).replace("-", "_"); String prop = "application/config/name_" + lang; - if (GlobalConfig::get_singleton()->has(prop)) { - str = GlobalConfig::get_singleton()->get(prop); + if (ProjectSettings::get_singleton()->has(prop)) { + str = ProjectSettings::get_singleton()->get(prop); } else { str = get_project_name(package_name); } @@ -2831,6 +2835,8 @@ public: virtual void get_export_options(List<ExportOption> *r_options) { + r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "graphics/api", PROPERTY_HINT_ENUM, "OpenGL ES 2.0,OpenGL ES 3.0"), 1)); + r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "graphics/32_bits_framebuffer"), true)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "one_click_deploy/clear_previous_install"), true)); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_package/debug", PROPERTY_HINT_GLOBAL_FILE, "apk"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_package/release", PROPERTY_HINT_GLOBAL_FILE, "apk"), "")); @@ -2843,7 +2849,6 @@ public: r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "package/signed"), true)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "architecture/arm"), true)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "architecture/x86"), false)); - r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "screen/use_32_bits_view"), true)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "screen/immersive_mode"), true)); r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "screen/orientation", PROPERTY_HINT_ENUM, "Landscape,Portrait"), 0)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "screen/support_small"), true)); @@ -2875,6 +2880,11 @@ public: virtual String get_name() const { return "Android"; } + + virtual String get_os_name() const { + return "Android"; + } + virtual Ref<Texture> get_logo() const { return logo; } @@ -3219,7 +3229,7 @@ public: if (!found) { - String appicon = GlobalConfig::get_singleton()->get("application/config/icon"); + String appicon = ProjectSettings::get_singleton()->get("application/config/icon"); if (appicon != "" && appicon.ends_with(".png")) { FileAccess *f = FileAccess::open(appicon, FileAccess::READ); if (f) { @@ -3527,6 +3537,12 @@ public: return OK; } + virtual void get_platform_features(List<String> *r_features) { + + r_features->push_back("mobile"); + r_features->push_back("Android"); + } + EditorExportAndroid() { Ref<Image> img = memnew(Image(_android_logo)); diff --git a/platform/android/globals/global_defaults.cpp b/platform/android/globals/global_defaults.cpp index f708ad5dd7..6bdc6b337c 100644 --- a/platform/android/globals/global_defaults.cpp +++ b/platform/android/globals/global_defaults.cpp @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "global_defaults.h" -#include "global_config.h" +#include "project_settings.h" void register_android_global_defaults() { @@ -37,6 +37,6 @@ void register_android_global_defaults() { GLOBAL_DEF("display.Android/driver","GLES2"); //GLOBAL_DEF("rasterizer.Android/trilinear_mipmap_filter",false); - GlobalConfig::get_singleton()->set_custom_property_info("display.Android/driver",PropertyInfo(Variant::STRING,"display.Android/driver",PROPERTY_HINT_ENUM,"GLES2")); + ProjectSettings::get_singleton()->set_custom_property_info("display.Android/driver",PropertyInfo(Variant::STRING,"display.Android/driver",PROPERTY_HINT_ENUM,"GLES2")); */ } diff --git a/platform/android/godot_android.cpp b/platform/android/godot_android.cpp index 3a21f9212f..4e4fd8074c 100644 --- a/platform/android/godot_android.cpp +++ b/platform/android/godot_android.cpp @@ -36,7 +36,7 @@ #include <GLES2/gl2.h> #include "file_access_android.h" -#include "global_config.h" +#include "project_settings.h" #include "main/main.h" #include "os_android.h" #include <android/log.h> @@ -623,7 +623,7 @@ static void engine_handle_cmd(struct android_app *app, int32_t cmd) { #else Error err = Main::setup("apk", 0, NULL); - String modules = GlobalConfig::get_singleton()->get("android/modules"); + String modules = ProjectSettings::get_singleton()->get("android/modules"); Vector<String> mods = modules.split(",", false); mods.push_back("GodotOS"); __android_log_print(ANDROID_LOG_INFO, "godot", "mod count: %i", mods.size()); @@ -859,7 +859,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_Godot_registerSingleton(JNIEnv s->set_instance(env->NewGlobalRef(p_object)); jni_singletons[singname] = s; - GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton(singname, s)); + ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton(singname, s)); } static Variant::Type get_jni_type(const String &p_type) { @@ -926,7 +926,7 @@ JNIEXPORT jstring JNICALL Java_org_godotengine_godot_Godot_getGlobal(JNIEnv *env String js = env->GetStringUTFChars(path, NULL); - return env->NewStringUTF(GlobalConfig::get_singleton()->get(js).operator String().utf8().get_data()); + return env->NewStringUTF(ProjectSettings::get_singleton()->get(js).operator String().utf8().get_data()); } JNIEXPORT void JNICALL Java_org_godotengine_godot_Godot_registerMethod(JNIEnv *env, jobject obj, jstring sname, jstring name, jstring ret, jobjectArray args) { diff --git a/platform/android/java_glue.cpp b/platform/android/java_glue.cpp index d4bd443689..bd234fa4a2 100644 --- a/platform/android/java_glue.cpp +++ b/platform/android/java_glue.cpp @@ -36,7 +36,7 @@ #include "dir_access_jandroid.h" #include "file_access_android.h" #include "file_access_jandroid.h" -#include "global_config.h" +#include "project_settings.h" #include "java_class_wrapper.h" #include "main/input_default.h" #include "main/main.h" @@ -883,7 +883,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv *en __android_log_print(ANDROID_LOG_INFO, "godot", "*****SETUP OK"); //video driver is determined here, because once initialized, it can't be changed - String vd = GlobalConfig::get_singleton()->get("display/driver"); + String vd = ProjectSettings::get_singleton()->get("display/driver"); env->CallVoidMethod(_godot_instance, _on_video_init, (jboolean) true); @@ -930,12 +930,12 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_back(JNIEnv *env, job static void _initialize_java_modules() { - if (!GlobalConfig::get_singleton()->has("android/modules")) { + if (!ProjectSettings::get_singleton()->has("android/modules")) { print_line("ANDROID MODULES: Nothing to load, aborting"); return; } - String modules = GlobalConfig::get_singleton()->get("android/modules"); + String modules = ProjectSettings::get_singleton()->get("android/modules"); modules = modules.strip_edges(); if (modules == String()) { return; @@ -1005,7 +1005,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv *env, job // because of the way android forces you to do everything with threads java_class_wrapper = memnew(JavaClassWrapper(_godot_instance)); - GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("JavaClassWrapper", java_class_wrapper)); + ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("JavaClassWrapper", java_class_wrapper)); _initialize_java_modules(); Main::setup2(); @@ -1504,8 +1504,8 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_singleton(JNIEnv *env s->set_instance(env->NewGlobalRef(p_object)); jni_singletons[singname] = s; - GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton(singname, s)); - GlobalConfig::get_singleton()->set(singname, s); + ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton(singname, s)); + ProjectSettings::get_singleton()->set(singname, s); } static Variant::Type get_jni_type(const String &p_type) { @@ -1578,7 +1578,7 @@ JNIEXPORT jstring JNICALL Java_org_godotengine_godot_GodotLib_getGlobal(JNIEnv * String js = env->GetStringUTFChars(path, NULL); - return env->NewStringUTF(GlobalConfig::get_singleton()->get(js).operator String().utf8().get_data()); + return env->NewStringUTF(ProjectSettings::get_singleton()->get(js).operator String().utf8().get_data()); } JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_method(JNIEnv *env, jobject obj, jstring sname, jstring name, jstring ret, jobjectArray args) { diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp index 9010b9e7da..ad46ceb43f 100644 --- a/platform/android/os_android.cpp +++ b/platform/android/os_android.cpp @@ -29,8 +29,8 @@ /*************************************************************************/ #include "os_android.h" -#include "core/global_config.h" #include "core/io/file_access_buffered_fa.h" +#include "core/project_settings.h" #include "drivers/gles3/rasterizer_gles3.h" #include "drivers/unix/dir_access_unix.h" #include "drivers/unix/file_access_unix.h" @@ -677,7 +677,7 @@ String OS_Android::get_data_dir() const { } return "."; - //return GlobalConfig::get_singleton()->get_singleton_object("GodotOS")->call("get_data_dir"); + //return ProjectSettings::get_singleton()->get_singleton_object("GodotOS")->call("get_data_dir"); } void OS_Android::set_screen_orientation(ScreenOrientation p_orientation) { @@ -741,6 +741,10 @@ String OS_Android::get_joy_guid(int p_device) const { return input->get_joy_guid_remapped(p_device); } +bool OS_Android::_check_internal_feature_support(const String &p_feature) { + return p_feature == "mobile" || p_feature == "etc" || p_feature == "etc2"; //TODO support etc2 only if GLES3 driver is selected +} + OS_Android::OS_Android(GFXInitFunc p_gfx_init_func, void *p_gfx_init_ud, OpenURIFunc p_open_uri_func, GetDataDirFunc p_get_data_dir_func, GetLocaleFunc p_get_locale_func, GetModelFunc p_get_model_func, GetScreenDPIFunc p_get_screen_dpi_func, ShowVirtualKeyboardFunc p_show_vk, HideVirtualKeyboardFunc p_hide_vk, SetScreenOrientationFunc p_screen_orient, GetUniqueIDFunc p_get_unique_id, GetSystemDirFunc p_get_sdir_func, VideoPlayFunc p_video_play_func, VideoIsPlayingFunc p_video_is_playing_func, VideoPauseFunc p_video_pause_func, VideoStopFunc p_video_stop_func, SetKeepScreenOnFunc p_set_keep_screen_on_func, AlertFunc p_alert_func, bool p_use_apk_expansion) { use_apk_expansion = p_use_apk_expansion; diff --git a/platform/android/os_android.h b/platform/android/os_android.h index 897c71a7df..393bc68d8a 100644 --- a/platform/android/os_android.h +++ b/platform/android/os_android.h @@ -243,6 +243,7 @@ public: virtual String get_joy_guid(int p_device) const; void joy_connection_changed(int p_device, bool p_connected, String p_name); + virtual bool _check_internal_feature_support(const String &p_feature); OS_Android(GFXInitFunc p_gfx_init_func, void *p_gfx_init_ud, OpenURIFunc p_open_uri_func, GetDataDirFunc p_get_data_dir_func, GetLocaleFunc p_get_locale_func, GetModelFunc p_get_model_func, GetScreenDPIFunc p_get_screen_dpi_func, ShowVirtualKeyboardFunc p_show_vk, HideVirtualKeyboardFunc p_hide_vk, SetScreenOrientationFunc p_screen_orient, GetUniqueIDFunc p_get_unique_id, GetSystemDirFunc p_get_sdir_func, VideoPlayFunc p_video_play_func, VideoIsPlayingFunc p_video_is_playing_func, VideoPauseFunc p_video_pause_func, VideoStopFunc p_video_stop_func, SetKeepScreenOnFunc p_set_keep_screen_on_func, AlertFunc p_alert_func, bool p_use_apk_expansion); ~OS_Android(); }; diff --git a/platform/haiku/audio_driver_media_kit.cpp b/platform/haiku/audio_driver_media_kit.cpp index 9c4f6d3aba..93351e0799 100644 --- a/platform/haiku/audio_driver_media_kit.cpp +++ b/platform/haiku/audio_driver_media_kit.cpp @@ -31,7 +31,7 @@ #ifdef MEDIA_KIT_ENABLED -#include "global_config.h" +#include "project_settings.h" int32_t *AudioDriverMediaKit::samples_in = NULL; diff --git a/platform/haiku/os_haiku.cpp b/platform/haiku/os_haiku.cpp index 3131f2bf1e..e897d4c385 100644 --- a/platform/haiku/os_haiku.cpp +++ b/platform/haiku/os_haiku.cpp @@ -331,3 +331,8 @@ void OS_Haiku::get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen) c String OS_Haiku::get_executable_path() const { return OS::get_executable_path(); } + +bool OS_Haiku::_check_internal_feature_support(const String &p_feature) { + + return p_feature == "pc" || p_feature == "s3tc"; +} diff --git a/platform/haiku/os_haiku.h b/platform/haiku/os_haiku.h index 83e44734a6..256c9eecf7 100644 --- a/platform/haiku/os_haiku.h +++ b/platform/haiku/os_haiku.h @@ -120,6 +120,8 @@ public: virtual PowerState get_power_state(); virtual int get_power_seconds_left(); virtual int get_power_percent_left(); + + virtual bool _check_internal_feature_support(const String &p_feature); }; #endif diff --git a/platform/iphone/app_delegate.mm b/platform/iphone/app_delegate.mm index b6cd43b3a2..da6dfcf53f 100644 --- a/platform/iphone/app_delegate.mm +++ b/platform/iphone/app_delegate.mm @@ -30,7 +30,7 @@ #import "app_delegate.h" #include "audio_driver_iphone.h" -#include "core/global_config.h" +#include "core/project_settings.h" #import "gl_view.h" #include "main/main.h" #include "os_iphone.h" @@ -449,14 +449,14 @@ static int frame_count = 0; NSString *str = (NSString *)value; String uval = String::utf8([str UTF8String]); - GlobalConfig::get_singleton()->set("Info.plist/" + ukey, uval); + ProjectSettings::get_singleton()->set("Info.plist/" + ukey, uval); } else if ([value isKindOfClass:[NSNumber class]]) { NSNumber *n = (NSNumber *)value; double dval = [n doubleValue]; - GlobalConfig::get_singleton()->set("Info.plist/" + ukey, dval); + ProjectSettings::get_singleton()->set("Info.plist/" + ukey, dval); }; // do stuff } @@ -645,10 +645,10 @@ static int frame_count = 0; #ifdef MODULE_GAME_ANALYTICS_ENABLED printf("********************* didFinishLaunchingWithOptions\n"); - if (!GlobalConfig::get_singleton()->has("mobileapptracker/advertiser_id")) { + if (!ProjectSettings::get_singleton()->has("mobileapptracker/advertiser_id")) { return; } - if (!GlobalConfig::get_singleton()->has("mobileapptracker/conversion_key")) { + if (!ProjectSettings::get_singleton()->has("mobileapptracker/conversion_key")) { return; } diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp index 0960ec8791..a5efae8678 100644 --- a/platform/iphone/export/export.cpp +++ b/platform/iphone/export/export.cpp @@ -32,13 +32,13 @@ #include "editor/editor_export.h" #include "editor/editor_node.h" #include "editor/editor_settings.h" -#include "global_config.h" #include "io/marshalls.h" #include "io/resource_saver.h" #include "io/zip_io.h" #include "os/file_access.h" #include "os/os.h" #include "platform/osx/logo.gen.h" +#include "project_settings.h" #include "string.h" #include "version.h" @@ -60,6 +60,7 @@ protected: public: virtual String get_name() const { return "iOS"; } + virtual String get_os_name() const { return "iOS"; } virtual Ref<Texture> get_logo() const { return logo; } virtual String get_binary_extension() const { return "xcodeproj"; } @@ -67,6 +68,12 @@ public: virtual bool can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const; + virtual void get_platform_features(List<String> *r_features) { + + r_features->push_back("mobile"); + r_features->push_back("iOS"); + } + EditorExportPlatformIOS(); ~EditorExportPlatformIOS(); }; @@ -175,8 +182,8 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p String pkg_name; if (p_preset->get("application/name") != "") pkg_name = p_preset->get("application/name"); // app_name - else if (String(GlobalConfig::get_singleton()->get("application/name")) != "") - pkg_name = String(GlobalConfig::get_singleton()->get("application/name")); + else if (String(ProjectSettings::get_singleton()->get("application/config/name")) != "") + pkg_name = String(ProjectSettings::get_singleton()->get("application/config/name")); else pkg_name = "Unnamed"; diff --git a/platform/iphone/gl_view.mm b/platform/iphone/gl_view.mm index 6270fa85f2..4b137b7ffa 100644 --- a/platform/iphone/gl_view.mm +++ b/platform/iphone/gl_view.mm @@ -29,7 +29,7 @@ /*************************************************************************/ #import "gl_view.h" -#include "core/global_config.h" +#include "core/project_settings.h" #include "core/os/keyboard.h" #include "os_iphone.h" #include "servers/audio_server.h" @@ -77,7 +77,7 @@ void _hide_keyboard() { }; bool _play_video(String p_path, float p_volume, String p_audio_track, String p_subtitle_track) { - p_path = GlobalConfig::get_singleton()->globalize_path(p_path); + p_path = ProjectSettings::get_singleton()->globalize_path(p_path); NSString *file_path = [[[NSString alloc] initWithUTF8String:p_path.utf8().get_data()] autorelease]; diff --git a/platform/iphone/globals/global_defaults.cpp b/platform/iphone/globals/global_defaults.cpp index b320be2f85..aa4662302d 100644 --- a/platform/iphone/globals/global_defaults.cpp +++ b/platform/iphone/globals/global_defaults.cpp @@ -28,14 +28,14 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "global_defaults.h" -#include "global_config.h" +#include "project_settings.h" void register_iphone_global_defaults() { /*GLOBAL_DEF("rasterizer.iOS/use_fragment_lighting",false); GLOBAL_DEF("rasterizer.iOS/fp16_framebuffer",false); GLOBAL_DEF("display.iOS/driver","GLES2"); - GlobalConfig::get_singleton()->set_custom_property_info("display.iOS/driver",PropertyInfo(Variant::STRING,"display.iOS/driver",PROPERTY_HINT_ENUM,"GLES1,GLES2")); + ProjectSettings::get_singleton()->set_custom_property_info("display.iOS/driver",PropertyInfo(Variant::STRING,"display.iOS/driver",PROPERTY_HINT_ENUM,"GLES1,GLES2")); GLOBAL_DEF("display.iOS/use_cadisplaylink",true); */ } diff --git a/platform/iphone/os_iphone.cpp b/platform/iphone/os_iphone.cpp index b244edbff6..1329c94198 100644 --- a/platform/iphone/os_iphone.cpp +++ b/platform/iphone/os_iphone.cpp @@ -38,10 +38,10 @@ #include "audio_driver_iphone.h" #include "main/main.h" -#include "core/global_config.h" #include "core/io/file_access_pack.h" #include "core/os/dir_access.h" #include "core/os/file_access.h" +#include "core/project_settings.h" #include "sem_iphone.h" @@ -138,28 +138,28 @@ void OSIPhone::initialize(const VideoMode &p_desired, int p_video_driver, int p_ /* #ifdef IOS_SCORELOOP_ENABLED scoreloop = memnew(ScoreloopIOS); - GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("Scoreloop", scoreloop)); + ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("Scoreloop", scoreloop)); scoreloop->connect(); #endif */ #ifdef GAME_CENTER_ENABLED game_center = memnew(GameCenter); - GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("GameCenter", game_center)); + ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("GameCenter", game_center)); game_center->connect(); #endif #ifdef STOREKIT_ENABLED store_kit = memnew(InAppStore); - GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("InAppStore", store_kit)); + ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("InAppStore", store_kit)); #endif #ifdef ICLOUD_ENABLED icloud = memnew(ICloud); - GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("ICloud", icloud)); + ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("ICloud", icloud)); //icloud->connect(); #endif - GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("iOS", memnew(iOS))); + ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("iOS", memnew(iOS))); }; MainLoop *OSIPhone::get_main_loop() const { @@ -517,7 +517,7 @@ Error OSIPhone::native_video_play(String p_path, float p_volume, String p_audio_ print("Unable to play %S using the native player as it resides in a .pck file\n", p_path.c_str()); return ERR_INVALID_PARAMETER; } else { - p_path = p_path.replace("res:/", GlobalConfig::get_singleton()->get_resource_path()); + p_path = p_path.replace("res:/", ProjectSettings::get_singleton()->get_resource_path()); } } else if (p_path.begins_with("user://")) p_path = p_path.replace("user:/", get_data_dir()); @@ -552,6 +552,11 @@ void OSIPhone::native_video_stop() { _stop_video(); } +bool OSIPhone::_check_internal_feature_support(const String &p_feature) { + + return p_feature == "mobile" || p_feature == "etc" || p_feature == "pvrtc" || p_feature == "etc2"; +} + OSIPhone::OSIPhone(int width, int height) { main_loop = NULL; diff --git a/platform/iphone/os_iphone.h b/platform/iphone/os_iphone.h index 4031b7524c..b15e9fdffb 100644 --- a/platform/iphone/os_iphone.h +++ b/platform/iphone/os_iphone.h @@ -200,6 +200,7 @@ public: virtual void native_video_focus_out(); virtual void native_video_stop(); + virtual bool _check_internal_feature_support(const String &p_feature); OSIPhone(int width, int height); ~OSIPhone(); }; diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp index 4bdfdae39e..b436d52363 100644 --- a/platform/javascript/export/export.cpp +++ b/platform/javascript/export/export.cpp @@ -61,6 +61,7 @@ public: virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const; virtual String get_name() const; + virtual String get_os_name() const; virtual Ref<Texture> get_logo() const; virtual bool can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const; @@ -74,6 +75,12 @@ public: virtual Error run(const Ref<EditorExportPreset> &p_preset, int p_device, int p_debug_flags); virtual Ref<Texture> get_run_icon() const; + virtual void get_platform_features(List<String> *r_features) { + + r_features->push_back("web"); + r_features->push_back("JavaScript"); + } + EditorExportPlatformJavaScript(); }; @@ -167,6 +174,11 @@ String EditorExportPlatformJavaScript::get_name() const { return "HTML5"; } +String EditorExportPlatformJavaScript::get_os_name() const { + + return "JavaScript"; +} + Ref<Texture> EditorExportPlatformJavaScript::get_logo() const { return logo; diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp index 9df26f1471..7dbc178c60 100644 --- a/platform/javascript/os_javascript.cpp +++ b/platform/javascript/os_javascript.cpp @@ -29,8 +29,8 @@ /*************************************************************************/ #include "os_javascript.h" -#include "core/global_config.h" #include "core/io/file_access_buffered_fa.h" +#include "core/project_settings.h" #include "dom_keys.h" #include "drivers/gles3/rasterizer_gles3.h" #include "drivers/unix/dir_access_unix.h" @@ -487,7 +487,7 @@ void OS_JavaScript::initialize(const VideoMode &p_desired, int p_video_driver, i #ifdef JAVASCRIPT_EVAL_ENABLED javascript_eval = memnew(JavaScript); - GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("JavaScript", javascript_eval)); + ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("JavaScript", javascript_eval)); #endif visual_server->init(); @@ -828,7 +828,7 @@ String OS_JavaScript::get_data_dir() const { return get_data_dir_func(); */ return "/userfs"; - //return GlobalConfig::get_singleton()->get_singleton_object("GodotOS")->call("get_data_dir"); + //return ProjectSettings::get_singleton()->get_singleton_object("GodotOS")->call("get_data_dir"); }; String OS_JavaScript::get_executable_path() const { @@ -911,6 +911,11 @@ int OS_JavaScript::get_power_percent_left() { return power_manager->get_power_percent_left(); } +bool OS_JavaScript::_check_internal_feature_support(const String &p_feature) { + + return p_feature == "web" || p_feature == "s3tc"; // TODO check for these features really being available +} + OS_JavaScript::OS_JavaScript(const char *p_execpath, GetDataDirFunc p_get_data_dir_func) { set_cmdline(p_execpath, get_cmdline_args()); main_loop = NULL; diff --git a/platform/javascript/os_javascript.h b/platform/javascript/os_javascript.h index 65269148ec..24e96e20dd 100644 --- a/platform/javascript/os_javascript.h +++ b/platform/javascript/os_javascript.h @@ -164,6 +164,8 @@ public: virtual int get_power_seconds_left(); virtual int get_power_percent_left(); + virtual bool _check_internal_feature_support(const String &p_feature); + OS_JavaScript(const char *p_execpath, GetDataDirFunc p_get_data_dir_func); ~OS_JavaScript(); }; diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp index ca5535f771..03f424de8d 100644 --- a/platform/osx/export/export.cpp +++ b/platform/osx/export/export.cpp @@ -32,13 +32,13 @@ #include "editor/editor_export.h" #include "editor/editor_node.h" #include "editor/editor_settings.h" -#include "global_config.h" #include "io/marshalls.h" #include "io/resource_saver.h" #include "io/zip_io.h" #include "os/file_access.h" #include "os/os.h" #include "platform/osx/logo.gen.h" +#include "project_settings.h" #include "string.h" #include "version.h" #include <sys/stat.h> @@ -64,6 +64,7 @@ protected: public: virtual String get_name() const { return "Mac OSX"; } + virtual String get_os_name() const { return "OSX"; } virtual Ref<Texture> get_logo() const { return logo; } #ifdef OSX_ENABLED @@ -75,6 +76,13 @@ public: virtual bool can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const; + virtual void get_platform_features(List<String> *r_features) { + + r_features->push_back("pc"); + r_features->push_back("s3tc"); + r_features->push_back("OSX"); + } + EditorExportPlatformOSX(); ~EditorExportPlatformOSX(); }; @@ -275,8 +283,8 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p String pkg_name; if (p_preset->get("application/name") != "") pkg_name = p_preset->get("application/name"); // app_name - else if (String(GlobalConfig::get_singleton()->get("application/name")) != "") - pkg_name = String(GlobalConfig::get_singleton()->get("application/name")); + else if (String(ProjectSettings::get_singleton()->get("application/config/name")) != "") + pkg_name = String(ProjectSettings::get_singleton()->get("application/config/name")); else pkg_name = "Unnamed"; @@ -345,7 +353,7 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p if (p_preset->get("application/icon") != "") iconpath = p_preset->get("application/icon"); else - iconpath = GlobalConfig::get_singleton()->get("application/config/icon"); + iconpath = ProjectSettings::get_singleton()->get("application/config/icon"); print_line("icon? " + iconpath); if (iconpath != "") { Ref<Image> icon; @@ -438,7 +446,7 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p /** When exporting for OSX from any other platform we don't have access to code signing or creating DMGs so we'll wrap the bundle into a zip file. - Should probably find a nicer way to have just one export method instead of duplicating the method like this but I would the code got very + Should probably find a nicer way to have just one export method instead of duplicating the method like this but I would the code got very messy with switches inside of it. **/ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags) { @@ -484,8 +492,8 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p String pkg_name; if (p_preset->get("application/name") != "") pkg_name = p_preset->get("application/name"); // app_name - else if (String(GlobalConfig::get_singleton()->get("application/config/name")) != "") - pkg_name = String(GlobalConfig::get_singleton()->get("application/config/name")); + else if (String(ProjectSettings::get_singleton()->get("application/config/name")) != "") + pkg_name = String(ProjectSettings::get_singleton()->get("application/config/name")); else pkg_name = "Unnamed"; @@ -539,7 +547,7 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p if (p_preset->get("application/icon") != "") iconpath = p_preset->get("application/icon"); else - iconpath = GlobalConfig::get_singleton()->get("application/config/icon"); + iconpath = ProjectSettings::get_singleton()->get("application/config/icon"); print_line("icon? " + iconpath); if (iconpath != "") { Ref<Image> icon; diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h index a3036b1a8a..44f4334786 100644 --- a/platform/osx/os_osx.h +++ b/platform/osx/os_osx.h @@ -210,6 +210,8 @@ public: virtual int get_power_seconds_left(); virtual int get_power_percent_left(); + virtual bool _check_internal_feature_support(const String &p_feature); + void run(); void set_mouse_mode(MouseMode p_mode); diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index 87c25a5356..9f9c785a2a 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -1726,3 +1726,7 @@ OS_OSX::OS_OSX() { zoomed = false; display_scale = 1.0; } + +bool OS_OSX::_check_internal_feature_support(const String &p_feature) { + return p_feature == "pc" || p_feature == "s3tc"; +} diff --git a/platform/uwp/export/export.cpp b/platform/uwp/export/export.cpp index 92a7b2c112..a1aa58a5e7 100644 --- a/platform/uwp/export/export.cpp +++ b/platform/uwp/export/export.cpp @@ -32,12 +32,12 @@ #include "bind/core_bind.h" #include "editor/editor_export.h" #include "editor/editor_node.h" -#include "global_config.h" #include "io/marshalls.h" #include "io/zip_io.h" #include "object.h" #include "os/file_access.h" #include "platform/uwp/logo.gen.h" +#include "project_settings.h" #include "version.h" #include "thirdparty/minizip/unzip.h" @@ -774,7 +774,8 @@ class EditorExportUWP : public EditorExportPlatform { String architecture = arch == ARM ? "ARM" : arch == X86 ? "x86" : "x64"; result = result.replace("$architecture$", architecture); - result = result.replace("$display_name$", String(p_preset->get("package/display_name")).empty() ? (String)GlobalConfig::get_singleton()->get("application/name") : String(p_preset->get("package/display_name"))); + result = result.replace("$display_name$", String(p_preset->get("package/display_name")).empty() ? (String)ProjectSettings::get_singleton()->get("application/config/name") : String(p_preset->get("package/display_name"))); + result = result.replace("$publisher_display_name$", p_preset->get("package/publisher_display_name")); result = result.replace("$app_description$", p_preset->get("package/description")); result = result.replace("$bg_color$", p_preset->get("images/background_color")); @@ -1008,6 +1009,9 @@ public: virtual String get_name() const { return "Windows Universal"; } + virtual String get_os_name() const { + return "UWP"; + } virtual String get_binary_extension() const { return "appx"; @@ -1369,6 +1373,12 @@ public: return OK; } + virtual void get_platform_features(List<String> *r_features) { + + r_features->push_back("pc"); + r_features->push_back("UWP"); + } + EditorExportUWP() { Ref<Image> img = memnew(Image(_uwp_logo)); logo.instance(); diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp index b9ef778e01..fabb227bf5 100644 --- a/platform/uwp/os_uwp.cpp +++ b/platform/uwp/os_uwp.cpp @@ -35,12 +35,12 @@ #include "drivers/windows/mutex_windows.h" #include "drivers/windows/rw_lock_windows.h" #include "drivers/windows/semaphore_windows.h" -#include "global_config.h" #include "io/marshalls.h" #include "main/main.h" #include "platform/windows/packet_peer_udp_winsock.h" #include "platform/windows/stream_peer_winsock.h" #include "platform/windows/tcp_server_winsock.h" +#include "project_settings.h" #include "servers/audio_server.h" #include "servers/visual/visual_server_raster.h" #include "thread_uwp.h" @@ -851,9 +851,8 @@ String OSUWP::get_data_dir() const { return String(data_folder->Path->Data()).replace("\\", "/"); } -bool OSUWP::check_feature_support(const String &p_feature) { - - return VisualServer::get_singleton()->has_os_feature(p_feature); +bool OSUWP::_check_internal_feature_support(const String &p_feature) { + return p_feature == "pc" || p_feature == "s3tc"; } PowerState OSUWP::get_power_state() { diff --git a/platform/uwp/os_uwp.h b/platform/uwp/os_uwp.h index 45b8eefdee..dfa21a0934 100644 --- a/platform/uwp/os_uwp.h +++ b/platform/uwp/os_uwp.h @@ -236,7 +236,7 @@ public: virtual void move_window_to_foreground(); virtual String get_data_dir() const; - virtual bool check_feature_support(const String &p_feature); + virtual bool _check_internal_feature_support(const String &p_feature); void set_gl_context(ContextEGL *p_context); void screen_size_changed(); diff --git a/platform/windows/export/export.cpp b/platform/windows/export/export.cpp index c9271f6266..6cb33e2ff0 100644 --- a/platform/windows/export/export.cpp +++ b/platform/windows/export/export.cpp @@ -46,6 +46,7 @@ void register_windows_exporter() { platform->set_debug_32("windows_32_debug.exe"); platform->set_release_64("windows_64_release.exe"); platform->set_debug_64("windows_64_debug.exe"); + platform->set_os_name("Windows"); EditorExport::get_singleton()->add_export_platform(platform); } diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 36d6cd8565..3413050f4a 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -37,12 +37,12 @@ #include "drivers/windows/rw_lock_windows.h" #include "drivers/windows/semaphore_windows.h" #include "drivers/windows/thread_windows.h" -#include "global_config.h" #include "io/marshalls.h" #include "joypad.h" #include "lang_table.h" #include "main/main.h" #include "packet_peer_udp_winsock.h" +#include "project_settings.h" #include "servers/audio_server.h" #include "servers/visual/visual_server_raster.h" #include "servers/visual/visual_server_wrap_mt.h" @@ -2229,7 +2229,7 @@ String OS_Windows::get_data_dir() const { if (has_environment("APPDATA")) { - bool use_godot = GlobalConfig::get_singleton()->get("application/config/use_shared_user_dir"); + bool use_godot = ProjectSettings::get_singleton()->get("application/config/use_shared_user_dir"); if (!use_godot) return (OS::get_singleton()->get_environment("APPDATA") + "/" + an).replace("\\", "/"); else @@ -2237,7 +2237,7 @@ String OS_Windows::get_data_dir() const { } } - return GlobalConfig::get_singleton()->get_resource_path(); + return ProjectSettings::get_singleton()->get_resource_path(); } bool OS_Windows::is_joy_known(int p_device) { @@ -2274,9 +2274,9 @@ int OS_Windows::get_power_percent_left() { return power_manager->get_power_percent_left(); } -bool OS_Windows::check_feature_support(const String &p_feature) { +bool OS_Windows::_check_internal_feature_support(const String &p_feature) { - return VisualServer::get_singleton()->has_os_feature(p_feature); + return p_feature == "pc" || p_feature == "s3tc"; } OS_Windows::OS_Windows(HINSTANCE _hInstance) { diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h index 835141145f..e6589ddfad 100644 --- a/platform/windows/os_windows.h +++ b/platform/windows/os_windows.h @@ -288,7 +288,7 @@ public: virtual int get_power_seconds_left(); virtual int get_power_percent_left(); - virtual bool check_feature_support(const String &p_feature); + virtual bool _check_internal_feature_support(const String &p_feature); OS_Windows(HINSTANCE _hInstance); ~OS_Windows(); diff --git a/platform/x11/export/export.cpp b/platform/x11/export/export.cpp index 69784a473d..c8d6220aed 100644 --- a/platform/x11/export/export.cpp +++ b/platform/x11/export/export.cpp @@ -48,6 +48,7 @@ void register_x11_exporter() { platform->set_debug_32("linux_x11_32_debug"); platform->set_release_64("linux_x11_64_release"); platform->set_debug_64("linux_x11_64_debug"); + platform->set_os_name("X11"); EditorExport::get_singleton()->add_export_platform(platform); diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 04f41b2e89..3143f30f77 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -1947,6 +1947,11 @@ Error OS_X11::shell_open(String p_uri) { return ok; } +bool OS_X11::_check_internal_feature_support(const String &p_feature) { + + return p_feature == "pc" || p_feature == "s3tc"; +} + String OS_X11::get_system_dir(SystemDir p_dir) const { String xdgparam; diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h index 12e4bbb086..db70f8f84a 100644 --- a/platform/x11/os_x11.h +++ b/platform/x11/os_x11.h @@ -269,6 +269,8 @@ public: virtual int get_power_seconds_left(); virtual int get_power_percent_left(); + virtual bool _check_internal_feature_support(const String &p_feature); + void run(); OS_X11(); diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp index 68a3166aa7..40c25c8bf6 100644 --- a/scene/2d/canvas_item.cpp +++ b/scene/2d/canvas_item.cpp @@ -949,7 +949,7 @@ void CanvasItem::_bind_methods() { ClassDB::bind_method(D_METHOD("get_canvas_item"), &CanvasItem::get_canvas_item); - ClassDB::bind_method(D_METHOD("set_visible"), &CanvasItem::set_visible); + ClassDB::bind_method(D_METHOD("set_visible", "visible"), &CanvasItem::set_visible); ClassDB::bind_method(D_METHOD("is_visible"), &CanvasItem::is_visible); ClassDB::bind_method(D_METHOD("is_visible_in_tree"), &CanvasItem::is_visible_in_tree); ClassDB::bind_method(D_METHOD("show"), &CanvasItem::show); @@ -1001,7 +1001,7 @@ void CanvasItem::_bind_methods() { ClassDB::bind_method(D_METHOD("get_local_mouse_pos"), &CanvasItem::get_local_mouse_pos); ClassDB::bind_method(D_METHOD("get_global_mouse_position"), &CanvasItem::get_global_mouse_position); ClassDB::bind_method(D_METHOD("get_canvas"), &CanvasItem::get_canvas); - ClassDB::bind_method(D_METHOD("get_world_2d"), &CanvasItem::get_world_2d); + ClassDB::bind_method(D_METHOD("get_world_2d:World2D"), &CanvasItem::get_world_2d); //ClassDB::bind_method(D_METHOD("get_viewport"),&CanvasItem::get_viewport); ClassDB::bind_method(D_METHOD("set_material", "material:Material"), &CanvasItem::set_material); @@ -1018,7 +1018,7 @@ void CanvasItem::_bind_methods() { ClassDB::bind_method(D_METHOD("make_canvas_pos_local", "screen_point"), &CanvasItem::make_canvas_pos_local); - ClassDB::bind_method(D_METHOD("make_input_local", "event"), &CanvasItem::make_input_local); + ClassDB::bind_method(D_METHOD("make_input_local:InputEvent", "event:InputEvent"), &CanvasItem::make_input_local); BIND_VMETHOD(MethodInfo("_draw")); diff --git a/scene/2d/collision_shape_2d.cpp b/scene/2d/collision_shape_2d.cpp index ff4aa245ec..890ac0c1f3 100644 --- a/scene/2d/collision_shape_2d.cpp +++ b/scene/2d/collision_shape_2d.cpp @@ -201,8 +201,8 @@ bool CollisionShape2D::is_one_way_collision_enabled() const { void CollisionShape2D::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_shape", "shape"), &CollisionShape2D::set_shape); - ClassDB::bind_method(D_METHOD("get_shape"), &CollisionShape2D::get_shape); + ClassDB::bind_method(D_METHOD("set_shape", "shape:Shape2D"), &CollisionShape2D::set_shape); + ClassDB::bind_method(D_METHOD("get_shape:Shape2D"), &CollisionShape2D::get_shape); ClassDB::bind_method(D_METHOD("set_disabled", "disabled"), &CollisionShape2D::set_disabled); ClassDB::bind_method(D_METHOD("is_disabled"), &CollisionShape2D::is_disabled); ClassDB::bind_method(D_METHOD("set_one_way_collision", "enabled"), &CollisionShape2D::set_one_way_collision); diff --git a/scene/2d/light_2d.cpp b/scene/2d/light_2d.cpp index e8c2122bd1..044cb06c02 100644 --- a/scene/2d/light_2d.cpp +++ b/scene/2d/light_2d.cpp @@ -355,8 +355,8 @@ void Light2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_editor_only", "editor_only"), &Light2D::set_editor_only); ClassDB::bind_method(D_METHOD("is_editor_only"), &Light2D::is_editor_only); - ClassDB::bind_method(D_METHOD("set_texture", "texture"), &Light2D::set_texture); - ClassDB::bind_method(D_METHOD("get_texture"), &Light2D::get_texture); + ClassDB::bind_method(D_METHOD("set_texture", "texture:Texture"), &Light2D::set_texture); + ClassDB::bind_method(D_METHOD("get_texture:Texture"), &Light2D::get_texture); ClassDB::bind_method(D_METHOD("set_texture_offset", "texture_offset"), &Light2D::set_texture_offset); ClassDB::bind_method(D_METHOD("get_texture_offset"), &Light2D::get_texture_offset); diff --git a/scene/2d/line_2d.cpp b/scene/2d/line_2d.cpp index 5438557d0b..22e54cfb54 100644 --- a/scene/2d/line_2d.cpp +++ b/scene/2d/line_2d.cpp @@ -283,11 +283,11 @@ void Line2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_default_color", "color"), &Line2D::set_default_color); ClassDB::bind_method(D_METHOD("get_default_color"), &Line2D::get_default_color); - ClassDB::bind_method(D_METHOD("set_gradient", "color"), &Line2D::set_gradient); - ClassDB::bind_method(D_METHOD("get_gradient"), &Line2D::get_gradient); + ClassDB::bind_method(D_METHOD("set_gradient", "color:Gradient"), &Line2D::set_gradient); + ClassDB::bind_method(D_METHOD("get_gradient:Gradient"), &Line2D::get_gradient); - ClassDB::bind_method(D_METHOD("set_texture", "texture"), &Line2D::set_texture); - ClassDB::bind_method(D_METHOD("get_texture"), &Line2D::get_texture); + ClassDB::bind_method(D_METHOD("set_texture", "texture:Texture"), &Line2D::set_texture); + ClassDB::bind_method(D_METHOD("get_texture:Texture"), &Line2D::get_texture); ClassDB::bind_method(D_METHOD("set_texture_mode", "mode"), &Line2D::set_texture_mode); ClassDB::bind_method(D_METHOD("get_texture_mode"), &Line2D::get_texture_mode); diff --git a/scene/2d/node_2d.cpp b/scene/2d/node_2d.cpp index bd6ab99801..9de46fd937 100644 --- a/scene/2d/node_2d.cpp +++ b/scene/2d/node_2d.cpp @@ -444,7 +444,7 @@ void Node2D::_bind_methods() { ClassDB::bind_method(D_METHOD("edit_set_pivot", "pivot"), &Node2D::edit_set_pivot); - ClassDB::bind_method(D_METHOD("get_relative_transform_to_parent", "parent"), &Node2D::get_relative_transform_to_parent); + ClassDB::bind_method(D_METHOD("get_relative_transform_to_parent", "parent:Node2D"), &Node2D::get_relative_transform_to_parent); ADD_GROUP("Transform", ""); ADD_PROPERTYNZ(PropertyInfo(Variant::VECTOR2, "position"), "set_position", "get_position"); diff --git a/scene/3d/collision_shape.cpp b/scene/3d/collision_shape.cpp index 4fd215bd1a..a7cfc6fef2 100644 --- a/scene/3d/collision_shape.cpp +++ b/scene/3d/collision_shape.cpp @@ -127,9 +127,9 @@ String CollisionShape::get_configuration_warning() const { void CollisionShape::_bind_methods() { //not sure if this should do anything - ClassDB::bind_method(D_METHOD("resource_changed", "resource"), &CollisionShape::resource_changed); - ClassDB::bind_method(D_METHOD("set_shape", "shape"), &CollisionShape::set_shape); - ClassDB::bind_method(D_METHOD("get_shape"), &CollisionShape::get_shape); + ClassDB::bind_method(D_METHOD("resource_changed", "resource:Resource"), &CollisionShape::resource_changed); + ClassDB::bind_method(D_METHOD("set_shape", "shape:Shape"), &CollisionShape::set_shape); + ClassDB::bind_method(D_METHOD("get_shape:Shape"), &CollisionShape::get_shape); ClassDB::bind_method(D_METHOD("set_disabled", "enable"), &CollisionShape::set_disabled); ClassDB::bind_method(D_METHOD("is_disabled"), &CollisionShape::is_disabled); ClassDB::bind_method(D_METHOD("make_convex_from_brothers"), &CollisionShape::make_convex_from_brothers); diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp index 581dfb32c8..0c31282a6c 100644 --- a/scene/3d/gi_probe.cpp +++ b/scene/3d/gi_probe.cpp @@ -1443,8 +1443,8 @@ PoolVector<Face3> GIProbe::get_faces(uint32_t p_usage_flags) const { void GIProbe::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_probe_data", "data"), &GIProbe::set_probe_data); - ClassDB::bind_method(D_METHOD("get_probe_data"), &GIProbe::get_probe_data); + ClassDB::bind_method(D_METHOD("set_probe_data", "data:GIProbeData"), &GIProbe::set_probe_data); + ClassDB::bind_method(D_METHOD("get_probe_data:GIProbeData"), &GIProbe::get_probe_data); ClassDB::bind_method(D_METHOD("set_subdiv", "subdiv"), &GIProbe::set_subdiv); ClassDB::bind_method(D_METHOD("get_subdiv"), &GIProbe::get_subdiv); @@ -1473,7 +1473,7 @@ void GIProbe::_bind_methods() { ClassDB::bind_method(D_METHOD("set_compress", "enable"), &GIProbe::set_compress); ClassDB::bind_method(D_METHOD("is_compressed"), &GIProbe::is_compressed); - ClassDB::bind_method(D_METHOD("bake", "from_node", "create_visual_debug"), &GIProbe::bake, DEFVAL(Variant()), DEFVAL(false)); + ClassDB::bind_method(D_METHOD("bake", "from_node:Node", "create_visual_debug"), &GIProbe::bake, DEFVAL(Variant()), DEFVAL(false)); ClassDB::bind_method(D_METHOD("debug_bake"), &GIProbe::_debug_bake); ClassDB::set_method_flags(get_class_static(), _scs_create("debug_bake"), METHOD_FLAGS_DEFAULT | METHOD_FLAG_EDITOR); diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp index 9c87acec6e..977f1f81a7 100644 --- a/scene/3d/light.cpp +++ b/scene/3d/light.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "light.h" -#include "global_config.h" +#include "project_settings.h" #include "scene/resources/surface_tool.h" bool Light::_can_gizmo_scale() const { diff --git a/scene/3d/multimesh_instance.cpp b/scene/3d/multimesh_instance.cpp index b51953f27c..b4558698cc 100644 --- a/scene/3d/multimesh_instance.cpp +++ b/scene/3d/multimesh_instance.cpp @@ -31,8 +31,8 @@ void MultiMeshInstance::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_multimesh", "multimesh"), &MultiMeshInstance::set_multimesh); - ClassDB::bind_method(D_METHOD("get_multimesh"), &MultiMeshInstance::get_multimesh); + ClassDB::bind_method(D_METHOD("set_multimesh", "multimesh:MultiMesh"), &MultiMeshInstance::set_multimesh); + ClassDB::bind_method(D_METHOD("get_multimesh:MultiMesh"), &MultiMeshInstance::get_multimesh); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "multimesh", PROPERTY_HINT_RESOURCE_TYPE, "MultiMesh"), "set_multimesh", "get_multimesh"); } diff --git a/scene/3d/navigation_mesh.cpp b/scene/3d/navigation_mesh.cpp index 4c93bcfb5e..7392998d57 100644 --- a/scene/3d/navigation_mesh.cpp +++ b/scene/3d/navigation_mesh.cpp @@ -374,8 +374,8 @@ String NavigationMeshInstance::get_configuration_warning() const { void NavigationMeshInstance::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_navigation_mesh", "navmesh"), &NavigationMeshInstance::set_navigation_mesh); - ClassDB::bind_method(D_METHOD("get_navigation_mesh"), &NavigationMeshInstance::get_navigation_mesh); + ClassDB::bind_method(D_METHOD("set_navigation_mesh", "navmesh:NavigationMesh"), &NavigationMeshInstance::set_navigation_mesh); + ClassDB::bind_method(D_METHOD("get_navigation_mesh:NavigationMesh"), &NavigationMeshInstance::get_navigation_mesh); ClassDB::bind_method(D_METHOD("set_enabled", "enabled"), &NavigationMeshInstance::set_enabled); ClassDB::bind_method(D_METHOD("is_enabled"), &NavigationMeshInstance::is_enabled); diff --git a/scene/3d/portal.cpp b/scene/3d/portal.cpp index 64a9dc14ab..d77dde1dd8 100644 --- a/scene/3d/portal.cpp +++ b/scene/3d/portal.cpp @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "portal.h" -#include "global_config.h" +#include "project_settings.h" #include "scene/resources/surface_tool.h" #include "servers/visual_server.h" diff --git a/scene/3d/room_instance.cpp b/scene/3d/room_instance.cpp index 85713cf43a..7827768c09 100644 --- a/scene/3d/room_instance.cpp +++ b/scene/3d/room_instance.cpp @@ -32,7 +32,7 @@ #include "servers/visual_server.h" #include "geometry.h" -#include "global_config.h" +#include "project_settings.h" #include "scene/resources/surface_tool.h" void Room::_notification(int p_what) { diff --git a/scene/3d/skeleton.cpp b/scene/3d/skeleton.cpp index d498947a41..71af77c027 100644 --- a/scene/3d/skeleton.cpp +++ b/scene/3d/skeleton.cpp @@ -31,7 +31,7 @@ #include "message_queue.h" -#include "core/global_config.h" +#include "core/project_settings.h" #include "scene/resources/surface_tool.h" bool Skeleton::_set(const StringName &p_path, const Variant &p_value) { diff --git a/scene/audio/audio_player.cpp b/scene/audio/audio_player.cpp index bcca834642..fdf61c40d8 100644 --- a/scene/audio/audio_player.cpp +++ b/scene/audio/audio_player.cpp @@ -263,7 +263,7 @@ void AudioStreamPlayer::_bus_layout_changed() { void AudioStreamPlayer::_bind_methods() { ClassDB::bind_method(D_METHOD("set_stream", "stream:AudioStream"), &AudioStreamPlayer::set_stream); - ClassDB::bind_method(D_METHOD("get_stream"), &AudioStreamPlayer::get_stream); + ClassDB::bind_method(D_METHOD("get_stream:AudioStream"), &AudioStreamPlayer::get_stream); ClassDB::bind_method(D_METHOD("set_volume_db", "volume_db"), &AudioStreamPlayer::set_volume_db); ClassDB::bind_method(D_METHOD("get_volume_db"), &AudioStreamPlayer::get_volume_db); diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index c1dbc82f3c..9a5f55698e 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -493,11 +493,11 @@ void BaseButton::_bind_methods() { ClassDB::bind_method(D_METHOD("set_enabled_focus_mode", "mode"), &BaseButton::set_enabled_focus_mode); ClassDB::bind_method(D_METHOD("get_enabled_focus_mode"), &BaseButton::get_enabled_focus_mode); - ClassDB::bind_method(D_METHOD("set_shortcut", "shortcut"), &BaseButton::set_shortcut); - ClassDB::bind_method(D_METHOD("get_shortcut"), &BaseButton::get_shortcut); + ClassDB::bind_method(D_METHOD("set_shortcut", "shortcut:ShortCut"), &BaseButton::set_shortcut); + ClassDB::bind_method(D_METHOD("get_shortcut:ShortCut"), &BaseButton::get_shortcut); - ClassDB::bind_method(D_METHOD("set_button_group", "button_group"), &BaseButton::set_button_group); - ClassDB::bind_method(D_METHOD("get_button_group"), &BaseButton::get_button_group); + ClassDB::bind_method(D_METHOD("set_button_group", "button_group:ButtonGroup"), &BaseButton::set_button_group); + ClassDB::bind_method(D_METHOD("get_button_group:ButtonGroup"), &BaseButton::get_button_group); BIND_VMETHOD(MethodInfo("_pressed")); BIND_VMETHOD(MethodInfo("_toggled", PropertyInfo(Variant::BOOL, "pressed"))); diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index faaf761598..48cac69956 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -478,7 +478,7 @@ void ColorPicker::_bind_methods() { ClassDB::bind_method(D_METHOD("is_raw_mode"), &ColorPicker::is_raw_mode); ClassDB::bind_method(D_METHOD("set_edit_alpha", "show"), &ColorPicker::set_edit_alpha); ClassDB::bind_method(D_METHOD("is_editing_alpha"), &ColorPicker::is_editing_alpha); - ClassDB::bind_method(D_METHOD("add_preset"), &ColorPicker::add_preset); + ClassDB::bind_method(D_METHOD("add_preset", "color"), &ColorPicker::add_preset); ClassDB::bind_method(D_METHOD("_value_changed"), &ColorPicker::_value_changed); ClassDB::bind_method(D_METHOD("_html_entered"), &ColorPicker::_html_entered); ClassDB::bind_method(D_METHOD("_text_type_toggled"), &ColorPicker::_text_type_toggled); diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index a9034b738b..ee908428d9 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "control.h" -#include "global_config.h" +#include "project_settings.h" #include "scene/main/canvas_layer.h" #include "scene/main/viewport.h" #include "servers/visual_server.h" @@ -2469,7 +2469,7 @@ void Control::_bind_methods() { ClassDB::bind_method(D_METHOD("set_focus_neighbour", "margin", "neighbour"), &Control::set_focus_neighbour); ClassDB::bind_method(D_METHOD("get_focus_neighbour", "margin"), &Control::get_focus_neighbour); - ClassDB::bind_method(D_METHOD("force_drag", "data", "preview"), &Control::force_drag); + ClassDB::bind_method(D_METHOD("force_drag", "data", "preview:Control"), &Control::force_drag); ClassDB::bind_method(D_METHOD("set_mouse_filter", "filter"), &Control::set_mouse_filter); ClassDB::bind_method(D_METHOD("get_mouse_filter"), &Control::get_mouse_filter); diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index 9d45b6e70a..1d37529a87 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -1193,7 +1193,7 @@ void GraphEdit::_bind_methods() { ClassDB::bind_method(D_METHOD("_update_scroll_offset"), &GraphEdit::_update_scroll_offset); ClassDB::bind_method(D_METHOD("_connections_layer_draw"), &GraphEdit::_connections_layer_draw); - ClassDB::bind_method(D_METHOD("set_selected", "node"), &GraphEdit::set_selected); + ClassDB::bind_method(D_METHOD("set_selected", "node:Node"), &GraphEdit::set_selected); ADD_SIGNAL(MethodInfo("connection_request", PropertyInfo(Variant::STRING, "from"), PropertyInfo(Variant::INT, "from_slot"), PropertyInfo(Variant::STRING, "to"), PropertyInfo(Variant::INT, "to_slot"))); ADD_SIGNAL(MethodInfo("disconnection_request", PropertyInfo(Variant::STRING, "from"), PropertyInfo(Variant::INT, "from_slot"), PropertyInfo(Variant::STRING, "to"), PropertyInfo(Variant::INT, "to_slot"))); diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index 19768d344a..97f49da2be 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "item_list.h" -#include "global_config.h" #include "os/os.h" +#include "project_settings.h" void ItemList::add_item(const String &p_item, const Ref<Texture> &p_texture, bool p_selectable) { @@ -534,7 +534,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) { uint64_t now = OS::get_singleton()->get_ticks_msec(); uint64_t diff = now - search_time_msec; - if (diff < int(GlobalConfig::get_singleton()->get("gui/timers/incremental_search_max_interval_msec")) * 2) { + if (diff < int(ProjectSettings::get_singleton()->get("gui/timers/incremental_search_max_interval_msec")) * 2) { for (int i = current - 1; i >= 0; i--) { @@ -569,7 +569,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) { uint64_t now = OS::get_singleton()->get_ticks_msec(); uint64_t diff = now - search_time_msec; - if (diff < int(GlobalConfig::get_singleton()->get("gui/timers/incremental_search_max_interval_msec")) * 2) { + if (diff < int(ProjectSettings::get_singleton()->get("gui/timers/incremental_search_max_interval_msec")) * 2) { for (int i = current + 1; i < items.size(); i++) { @@ -743,12 +743,10 @@ void ItemList::_notification(int p_what) { Size2 size = get_size(); - float page = size.height - bg->get_minimum_size().height; int width = size.width - bg->get_minimum_size().width; if (scroll_bar->is_visible()) { width -= mw + bg->get_margin(MARGIN_RIGHT); } - scroll_bar->set_page(page); draw_style_box(bg, Rect2(Point2(), size)); @@ -883,8 +881,12 @@ void ItemList::_notification(int p_what) { } if (all_fit) { + float page = size.height - bg->get_minimum_size().height; float max = MAX(page, ofs.y + max_h); + if (auto_height) + auto_height_value = ofs.y + max_h + bg->get_minimum_size().height; scroll_bar->set_max(max); + scroll_bar->set_page(page); //print_line("max: "+rtos(max)+" page "+rtos(page)); if (max <= page) { scroll_bar->set_value(0); @@ -1253,6 +1255,26 @@ Array ItemList::_get_items() const { return items; } +Size2 ItemList::get_minimum_size() const { + + if (auto_height) { + return Size2(0, auto_height_value); + } + return Size2(); +} + +void ItemList::set_auto_height(bool p_enable) { + + auto_height = p_enable; + shape_changed = true; + update(); +} + +bool ItemList::has_auto_height() const { + + return auto_height; +} + void ItemList::_bind_methods() { ClassDB::bind_method(D_METHOD("add_item", "text", "icon:Texture", "selectable"), &ItemList::add_item, DEFVAL(Variant()), DEFVAL(true)); @@ -1323,11 +1345,14 @@ void ItemList::_bind_methods() { ClassDB::bind_method(D_METHOD("set_allow_rmb_select", "allow"), &ItemList::set_allow_rmb_select); ClassDB::bind_method(D_METHOD("get_allow_rmb_select"), &ItemList::get_allow_rmb_select); + ClassDB::bind_method(D_METHOD("set_auto_height", "enable"), &ItemList::set_auto_height); + ClassDB::bind_method(D_METHOD("has_auto_height"), &ItemList::has_auto_height); + ClassDB::bind_method(D_METHOD("get_item_at_pos", "pos", "exact"), &ItemList::get_item_at_pos, DEFVAL(false)); ClassDB::bind_method(D_METHOD("ensure_current_is_visible"), &ItemList::ensure_current_is_visible); - ClassDB::bind_method(D_METHOD("get_v_scroll"), &ItemList::get_v_scroll); + ClassDB::bind_method(D_METHOD("get_v_scroll:VScrollBar"), &ItemList::get_v_scroll); ClassDB::bind_method(D_METHOD("_scroll_changed"), &ItemList::_scroll_changed); ClassDB::bind_method(D_METHOD("_gui_input"), &ItemList::_gui_input); @@ -1340,6 +1365,7 @@ void ItemList::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "select_mode", PROPERTY_HINT_ENUM, "Single,Multi"), "set_select_mode", "get_select_mode"); ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "allow_rmb_select"), "set_allow_rmb_select", "get_allow_rmb_select"); ADD_PROPERTYNO(PropertyInfo(Variant::INT, "max_text_lines"), "set_max_text_lines", "get_max_text_lines"); + ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "auto_height"), "set_auto_height", "has_auto_height"); ADD_GROUP("Columns", ""); ADD_PROPERTYNO(PropertyInfo(Variant::INT, "max_columns"), "set_max_columns", "get_max_columns"); ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL, "same_column_width"), "set_same_column_width", "is_same_column_width"); @@ -1372,6 +1398,8 @@ ItemList::ItemList() { same_column_width = false; max_text_lines = 1; max_columns = 1; + auto_height = false; + auto_height_value = 0.0f; scroll_bar = memnew(VScrollBar); add_child(scroll_bar); diff --git a/scene/gui/item_list.h b/scene/gui/item_list.h index 9cb7016b60..137eff8885 100644 --- a/scene/gui/item_list.h +++ b/scene/gui/item_list.h @@ -78,6 +78,9 @@ private: bool ensure_selected_visible; bool same_column_width; + bool auto_height; + float auto_height_value; + Vector<Item> items; Vector<int> separators; @@ -198,6 +201,11 @@ public: void set_icon_scale(real_t p_scale); real_t get_icon_scale() const; + void set_auto_height(bool p_enable); + bool has_auto_height() const; + + Size2 get_minimum_size() const; + VScrollBar *get_v_scroll() { return scroll_bar; } ItemList(); diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp index f02e01d85a..159d81eb09 100644 --- a/scene/gui/label.cpp +++ b/scene/gui/label.cpp @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "label.h" -#include "global_config.h" +#include "project_settings.h" #include "print_string.h" #include "translation.h" diff --git a/scene/gui/patch_9_rect.cpp b/scene/gui/patch_9_rect.cpp index 735f36b55d..16f2bb6b6f 100644 --- a/scene/gui/patch_9_rect.cpp +++ b/scene/gui/patch_9_rect.cpp @@ -54,8 +54,8 @@ Size2 NinePatchRect::get_minimum_size() const { } void NinePatchRect::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_texture", "texture"), &NinePatchRect::set_texture); - ClassDB::bind_method(D_METHOD("get_texture"), &NinePatchRect::get_texture); + ClassDB::bind_method(D_METHOD("set_texture", "texture:Texture"), &NinePatchRect::set_texture); + ClassDB::bind_method(D_METHOD("get_texture:Texture"), &NinePatchRect::get_texture); ClassDB::bind_method(D_METHOD("set_patch_margin", "margin", "value"), &NinePatchRect::set_patch_margin); ClassDB::bind_method(D_METHOD("get_patch_margin", "margin"), &NinePatchRect::get_patch_margin); ClassDB::bind_method(D_METHOD("set_region_rect", "rect"), &NinePatchRect::set_region_rect); diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp index 7158592bb1..68afe8150a 100644 --- a/scene/gui/range.cpp +++ b/scene/gui/range.cpp @@ -273,8 +273,8 @@ Range::Range() { shared = memnew(Shared); shared->min = 0; shared->max = 100; - shared->val = - shared->step = 1; + shared->val = 0; + shared->step = 1; shared->page = 0; shared->owners.insert(this); shared->exp_ratio = false; diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index ffa23ce771..c32dafc809 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -33,7 +33,7 @@ #include "os/keyboard.h" #include "os/os.h" -#include "global_config.h" +#include "project_settings.h" #include "message_queue.h" #include "scene/main/viewport.h" diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 44f71a2c4e..8527ead01f 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -28,11 +28,11 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "tree.h" -#include "global_config.h" #include "os/input.h" #include "os/keyboard.h" #include "os/os.h" #include "print_string.h" +#include "project_settings.h" #include "scene/main/viewport.h" void TreeItem::move_to_top() { @@ -70,7 +70,7 @@ Size2 TreeItem::Cell::get_icon_size() const { return icon_region.size; } -void TreeItem::Cell::draw_icon(const RID &p_where, const Point2 &p_pos, const Size2 &p_size) const { +void TreeItem::Cell::draw_icon(const RID &p_where, const Point2 &p_pos, const Size2 &p_size, const Color &p_color) const { if (icon.is_null()) return; @@ -79,10 +79,10 @@ void TreeItem::Cell::draw_icon(const RID &p_where, const Point2 &p_pos, const Si if (icon_region == Rect2i()) { - icon->draw_rect_region(p_where, Rect2(p_pos, dsize), Rect2(Point2(), icon->get_size())); + icon->draw_rect_region(p_where, Rect2(p_pos, dsize), Rect2(Point2(), icon->get_size()), p_color); } else { - icon->draw_rect_region(p_where, Rect2(p_pos, dsize), icon_region); + icon->draw_rect_region(p_where, Rect2(p_pos, dsize), icon_region, p_color); } } @@ -203,6 +203,19 @@ Rect2 TreeItem::get_icon_region(int p_column) const { return cells[p_column].icon_region; } +void TreeItem::set_icon_color(int p_column, const Color &p_icon_color) { + + ERR_FAIL_INDEX(p_column, cells.size()); + cells[p_column].icon_color = p_icon_color; + _changed_notify(p_column); +} + +Color TreeItem::get_icon_color(int p_column) const { + + ERR_FAIL_INDEX_V(p_column, cells.size(), Color()); + return cells[p_column].icon_color; +} + void TreeItem::set_icon_max_width(int p_column, int p_max) { ERR_FAIL_INDEX(p_column, cells.size()); @@ -933,7 +946,7 @@ int Tree::get_item_height(TreeItem *p_item) const { return height; } -void Tree::draw_item_rect(const TreeItem::Cell &p_cell, const Rect2i &p_rect, const Color &p_color) { +void Tree::draw_item_rect(const TreeItem::Cell &p_cell, const Rect2i &p_rect, const Color &p_color, const Color &p_icon_color) { Rect2i rect = p_rect; Ref<Font> font = cache.font; @@ -972,7 +985,7 @@ void Tree::draw_item_rect(const TreeItem::Cell &p_cell, const Rect2i &p_rect, co bmsize.width = p_cell.icon_max_w; } - p_cell.draw_icon(ci, rect.position + Size2i(0, Math::floor((real_t)(rect.size.y - bmsize.y) / 2)), bmsize); + p_cell.draw_icon(ci, rect.position + Size2i(0, Math::floor((real_t)(rect.size.y - bmsize.y) / 2)), bmsize, p_icon_color); rect.position.x += bmsize.x + cache.hseparation; rect.size.x -= bmsize.x + cache.hseparation; } @@ -1176,6 +1189,7 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 } Color col = p_item->cells[i].custom_color ? p_item->cells[i].color : get_color(p_item->cells[i].selected ? "font_color_selected" : "font_color"); + Color icon_col = p_item->cells[i].icon_color; Point2i text_pos = item_rect.position; text_pos.y += Math::floor((item_rect.size.y - font->get_height()) / 2) + font_ascent; @@ -1184,7 +1198,7 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 case TreeItem::CELL_MODE_STRING: { - draw_item_rect(p_item->cells[i], item_rect, col); + draw_item_rect(p_item->cells[i], item_rect, col, icon_col); } break; case TreeItem::CELL_MODE_CHECK: { @@ -1195,9 +1209,9 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 if (p_item->cells[i].checked) { - checked->draw(ci, check_ofs); + checked->draw(ci, check_ofs, icon_col); } else { - unchecked->draw(ci, check_ofs); + unchecked->draw(ci, check_ofs, icon_col); } int check_w = checked->get_width() + cache.hseparation; @@ -1207,7 +1221,7 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 item_rect.size.x -= check_w; item_rect.position.x += check_w; - draw_item_rect(p_item->cells[i], item_rect, col); + draw_item_rect(p_item->cells[i], item_rect, col, icon_col); //font->draw( ci, text_pos, p_item->cells[i].text, col,item_rect.size.x-check_w ); @@ -1237,7 +1251,7 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 arrow_pos.x += item_rect.size.x - downarrow->get_width(); arrow_pos.y += Math::floor(((item_rect.size.y - downarrow->get_height())) / 2.0); - downarrow->draw(ci, arrow_pos); + downarrow->draw(ci, arrow_pos, icon_col); } else { Ref<Texture> updown = cache.updown; @@ -1257,7 +1271,7 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 updown_pos.x += item_rect.size.x - updown->get_width(); updown_pos.y += Math::floor(((item_rect.size.y - updown->get_height())) / 2.0); - updown->draw(ci, updown_pos); + updown->draw(ci, updown_pos, icon_col); } } break; @@ -1274,7 +1288,7 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 Point2i icon_ofs = (item_rect.size - icon_size) / 2; icon_ofs += item_rect.position; - draw_texture_rect(p_item->cells[i].icon, Rect2(icon_ofs, icon_size)); + draw_texture_rect(p_item->cells[i].icon, Rect2(icon_ofs, icon_size), false, icon_col); //p_item->cells[i].icon->draw(ci, icon_ofs); } break; @@ -1291,7 +1305,7 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 if (!p_item->cells[i].editable) { - draw_item_rect(p_item->cells[i], item_rect, col); + draw_item_rect(p_item->cells[i], item_rect, col, icon_col); break; } @@ -1319,7 +1333,7 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 ir.position += cache.custom_button->get_offset(); } - draw_item_rect(p_item->cells[i], ir, col); + draw_item_rect(p_item->cells[i], ir, col, icon_col); downarrow->draw(ci, arrow_pos); diff --git a/scene/gui/tree.h b/scene/gui/tree.h index 59e35bb230..694f91f9a6 100644 --- a/scene/gui/tree.h +++ b/scene/gui/tree.h @@ -89,6 +89,7 @@ private: Color bg_color; bool custom_button; bool expand_right; + Color icon_color; TextAlign text_align; @@ -133,10 +134,11 @@ private: icon_max_w = 0; text_align = ALIGN_LEFT; expand_right = false; + icon_color = Color(1, 1, 1); } Size2 get_icon_size() const; - void draw_icon(const RID &p_where, const Point2 &p_pos, const Size2 &p_size = Size2()) const; + void draw_icon(const RID &p_where, const Point2 &p_pos, const Size2 &p_size = Size2(), const Color &p_color = Color()) const; }; Vector<Cell> cells; @@ -193,6 +195,9 @@ public: void set_icon_region(int p_column, const Rect2 &p_icon_region); Rect2 get_icon_region(int p_column) const; + void set_icon_color(int p_column, const Color &p_icon_color); + Color get_icon_color(int p_column) const; + void set_icon_max_width(int p_column, int p_max); int get_icon_max_width(int p_column) const; @@ -361,7 +366,7 @@ private: int compute_item_height(TreeItem *p_item) const; int get_item_height(TreeItem *p_item) const; //void draw_item_text(String p_text,const Ref<Texture>& p_icon,int p_icon_max_w,bool p_tool,Rect2i p_rect,const Color& p_color); - void draw_item_rect(const TreeItem::Cell &p_cell, const Rect2i &p_rect, const Color &p_color); + void draw_item_rect(const TreeItem::Cell &p_cell, const Rect2i &p_rect, const Color &p_color, const Color &p_icon_color); int draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 &p_draw_size, TreeItem *p_item); void select_single_item(TreeItem *p_selected, TreeItem *p_current, int p_col, TreeItem *p_prev = NULL, bool *r_in_range = NULL, bool p_force_deselect = false); int propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool p_doubleclick, TreeItem *p_item, int p_button, const Ref<InputEventWithModifiers> &p_mod); diff --git a/scene/io/resource_format_image.cpp b/scene/io/resource_format_image.cpp index 6c0a6128d2..8b3f939f1a 100644 --- a/scene/io/resource_format_image.cpp +++ b/scene/io/resource_format_image.cpp @@ -30,7 +30,7 @@ #include "resource_format_image.h" #if 0 -#include "global_config.h" +#include "project_settings.h" #include "io/image_loader.h" #include "os/os.h" #include "scene/resources/texture.h" @@ -128,7 +128,7 @@ RES ResourceFormatLoaderImage::load(const String &p_path, const String& p_origin if (max_texture_size && (image.get_width() > max_texture_size || image.get_height() > max_texture_size)) { - if (bool(GlobalConfig::get_singleton()->get("debug/image_loader/max_texture_size_alert"))) { + if (bool(ProjectSettings::get_singleton()->get("debug/image_loader/max_texture_size_alert"))) { OS::get_singleton()->alert("Texture is too large: '"+p_path+"', at "+itos(image.get_width())+"x"+itos(image.get_height())+". Max allowed size is: "+itos(max_texture_size)+"x"+itos(max_texture_size)+".","BAD ARTIST, NO COOKIE!"); } diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 61e563143c..26d1deadf9 100755 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -1258,7 +1258,7 @@ String Node::_generate_serial_child_name(Node *p_child) { name = p_child->get_class(); // Adjust casing according to project setting. The current type name is expected to be in PascalCase. - switch (GlobalConfig::get_singleton()->get("node/name_casing").operator int()) { + switch (ProjectSettings::get_singleton()->get("node/name_casing").operator int()) { case NAME_CASING_PASCAL_CASE: break; case NAME_CASING_CAMEL_CASE: @@ -2712,9 +2712,9 @@ void Node::request_ready() { void Node::_bind_methods() { GLOBAL_DEF("node/name_num_separator", 0); - GlobalConfig::get_singleton()->set_custom_property_info("node/name_num_separator", PropertyInfo(Variant::INT, "node/name_num_separator", PROPERTY_HINT_ENUM, "None,Space,Underscore,Dash")); + ProjectSettings::get_singleton()->set_custom_property_info("node/name_num_separator", PropertyInfo(Variant::INT, "node/name_num_separator", PROPERTY_HINT_ENUM, "None,Space,Underscore,Dash")); GLOBAL_DEF("node/name_casing", NAME_CASING_PASCAL_CASE); - GlobalConfig::get_singleton()->set_custom_property_info("node/name_casing", PropertyInfo(Variant::INT, "node/name_casing", PROPERTY_HINT_ENUM, "PascalCase,camelCase,snake_case")); + ProjectSettings::get_singleton()->set_custom_property_info("node/name_casing", PropertyInfo(Variant::INT, "node/name_casing", PROPERTY_HINT_ENUM, "PascalCase,camelCase,snake_case")); ClassDB::bind_method(D_METHOD("_add_child_below_node", "node:Node", "child_node:Node", "legible_unique_name"), &Node::add_child_below_node, DEFVAL(false)); @@ -2786,7 +2786,7 @@ void Node::_bind_methods() { ClassDB::bind_method(D_METHOD("set_scene_instance_load_placeholder", "load_placeholder"), &Node::set_scene_instance_load_placeholder); ClassDB::bind_method(D_METHOD("get_scene_instance_load_placeholder"), &Node::get_scene_instance_load_placeholder); - ClassDB::bind_method(D_METHOD("get_viewport"), &Node::get_viewport); + ClassDB::bind_method(D_METHOD("get_viewport:Viewport"), &Node::get_viewport); ClassDB::bind_method(D_METHOD("queue_free"), &Node::queue_delete); @@ -2890,7 +2890,7 @@ void Node::_bind_methods() { } String Node::_get_name_num_separator() { - switch (GlobalConfig::get_singleton()->get("node/name_num_separator").operator int()) { + switch (ProjectSettings::get_singleton()->get("node/name_num_separator").operator int()) { case 0: return ""; case 1: return " "; case 2: return "_"; diff --git a/scene/main/node.h b/scene/main/node.h index 7baa65c022..cfd5c07921 100644 --- a/scene/main/node.h +++ b/scene/main/node.h @@ -31,7 +31,7 @@ #define NODE_H #include "class_db.h" -#include "global_config.h" +#include "project_settings.h" #include "map.h" #include "object.h" #include "path_db.h" diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index 65c7c1a36f..c5278b8595 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -29,12 +29,12 @@ /*************************************************************************/ #include "scene_tree.h" -#include "global_config.h" #include "message_queue.h" #include "node.h" #include "os/keyboard.h" #include "os/os.h" #include "print_string.h" +#include "project_settings.h" #include <stdio.h> //#include "servers/spatial_sound_2d_server.h" @@ -614,7 +614,7 @@ bool SceneTree::idle(float p_time) { if (is_editor_hint()) { //simple hack to reload fallback environment if it changed from editor - String env_path = GlobalConfig::get_singleton()->get("rendering/environment/default_environment"); + String env_path = ProjectSettings::get_singleton()->get("rendering/environment/default_environment"); env_path = env_path.strip_edges(); //user may have added a space or two String cpath; Ref<Environment> fallback = get_root()->get_world()->get_fallback_environment(); @@ -2351,9 +2351,13 @@ SceneTree::SceneTree() { int ref_atlas_size = GLOBAL_DEF("rendering/quality/reflections/atlas_size", 2048); int ref_atlas_subdiv = GLOBAL_DEF("rendering/quality/reflections/atlas_subdiv", 8); int msaa_mode = GLOBAL_DEF("rendering/quality/filters/msaa", 0); - GlobalConfig::get_singleton()->set_custom_property_info("rendering/quality/filters/msaa", PropertyInfo(Variant::INT, "rendering/quality/filters/msaa", PROPERTY_HINT_ENUM, "Disabled,2x,4x,8x,16x")); + ProjectSettings::get_singleton()->set_custom_property_info("rendering/quality/filters/msaa", PropertyInfo(Variant::INT, "rendering/quality/filters/msaa", PROPERTY_HINT_ENUM, "Disabled,2x,4x,8x,16x")); root->set_msaa(Viewport::MSAA(msaa_mode)); - bool hdr = GLOBAL_DEF("rendering/quality/depth/hdr", true); + + GLOBAL_DEF("rendering/quality/depth/hdr", true); + GLOBAL_DEF("rendering/quality/depth/hdr.mobile", false); + + bool hdr = GLOBAL_GET("rendering/quality/depth/hdr"); root->set_hdr(hdr); VS::get_singleton()->scenario_set_reflection_atlas_size(root->get_world()->get_scenario(), ref_atlas_size, ref_atlas_subdiv); @@ -2371,7 +2375,7 @@ SceneTree::SceneTree() { //get path String env_path = GLOBAL_DEF("rendering/environment/default_environment", ""); //setup property - GlobalConfig::get_singleton()->set_custom_property_info("rendering/environment/default_environment", PropertyInfo(Variant::STRING, "rendering/viewport/default_environment", PROPERTY_HINT_FILE, ext_hint)); + ProjectSettings::get_singleton()->set_custom_property_info("rendering/environment/default_environment", PropertyInfo(Variant::STRING, "rendering/viewport/default_environment", PROPERTY_HINT_FILE, ext_hint)); env_path = env_path.strip_edges(); if (env_path != String()) { Ref<Environment> env = ResourceLoader::load(env_path); @@ -2380,7 +2384,7 @@ SceneTree::SceneTree() { } else { if (is_editor_hint()) { //file was erased, clear the field. - GlobalConfig::get_singleton()->set("rendering/environment/default_environment", ""); + ProjectSettings::get_singleton()->set("rendering/environment/default_environment", ""); } else { //file was erased, notify user. ERR_PRINTS(RTR("Default Environment as specified in Project Setings (Rendering -> Viewport -> Default Environment) could not be loaded.")); diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 824f968c49..ce7950285d 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -48,7 +48,7 @@ #include "scene/main/timer.h" #include "scene/scene_string_names.h" -#include "global_config.h" +#include "project_settings.h" #include "scene/3d/scenario_fx.h" void ViewportTexture::setup_local_to_scene() { diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index c6d26f4d4c..74c556931c 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "register_scene_types.h" -#include "global_config.h" +#include "project_settings.h" #include "os/os.h" #include "scene/io/resource_format_image.h" #include "scene/io/resource_format_wav.h" @@ -271,11 +271,11 @@ void register_scene_types() { ResourceLoader::add_resource_format_loader(resource_loader_theme); bool default_theme_hidpi = GLOBAL_DEF("gui/theme/use_hidpi", false); - GlobalConfig::get_singleton()->set_custom_property_info("gui/theme/use_hidpi", PropertyInfo(Variant::BOOL, "gui/theme/use_hidpi", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED)); + ProjectSettings::get_singleton()->set_custom_property_info("gui/theme/use_hidpi", PropertyInfo(Variant::BOOL, "gui/theme/use_hidpi", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED)); String theme_path = GLOBAL_DEF("gui/theme/custom", ""); - GlobalConfig::get_singleton()->set_custom_property_info("gui/theme/custom", PropertyInfo(Variant::STRING, "gui/theme/custom", PROPERTY_HINT_FILE, "*.tres,*.res", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED)); + ProjectSettings::get_singleton()->set_custom_property_info("gui/theme/custom", PropertyInfo(Variant::STRING, "gui/theme/custom", PROPERTY_HINT_FILE, "*.tres,*.res", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED)); String font_path = GLOBAL_DEF("gui/theme/custom_font", ""); - GlobalConfig::get_singleton()->set_custom_property_info("gui/theme/custom_font", PropertyInfo(Variant::STRING, "gui/theme/custom_font", PROPERTY_HINT_FILE, "*.tres,*.res,*.font", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED)); + ProjectSettings::get_singleton()->set_custom_property_info("gui/theme/custom_font", PropertyInfo(Variant::STRING, "gui/theme/custom_font", PROPERTY_HINT_FILE, "*.tres,*.res,*.font", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED)); if (theme_path != String()) { Ref<Theme> theme = ResourceLoader::load(theme_path); diff --git a/scene/resources/audio_stream_resampled.cpp b/scene/resources/audio_stream_resampled.cpp index 213ac4400b..1b1d6f8587 100644 --- a/scene/resources/audio_stream_resampled.cpp +++ b/scene/resources/audio_stream_resampled.cpp @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "audio_stream_resampled.h" -#include "global_config.h" +#include "project_settings.h" #if 0 int AudioStreamResampled::get_channel_count() const { diff --git a/scene/resources/bit_mask.cpp b/scene/resources/bit_mask.cpp index a473067937..73a759278b 100644 --- a/scene/resources/bit_mask.cpp +++ b/scene/resources/bit_mask.cpp @@ -170,7 +170,7 @@ Dictionary BitMap::_get_data() const { void BitMap::_bind_methods() { ClassDB::bind_method(D_METHOD("create", "size"), &BitMap::create); - ClassDB::bind_method(D_METHOD("create_from_image_alpha", "image"), &BitMap::create_from_image_alpha); + ClassDB::bind_method(D_METHOD("create_from_image_alpha", "image:Image"), &BitMap::create_from_image_alpha); ClassDB::bind_method(D_METHOD("set_bit", "pos", "bit"), &BitMap::set_bit); ClassDB::bind_method(D_METHOD("get_bit", "pos"), &BitMap::get_bit); diff --git a/scene/resources/curve.cpp b/scene/resources/curve.cpp index 338311b87b..fe0759fcba 100644 --- a/scene/resources/curve.cpp +++ b/scene/resources/curve.cpp @@ -1188,7 +1188,7 @@ void Curve2D::_set_data(const Dictionary &p_data) { baked_cache_dirty = true; } -PoolVector2Array Curve2D::tesselate(int p_max_stages, float p_tolerance) const { +PoolVector2Array Curve2D::tessellate(int p_max_stages, float p_tolerance) const { PoolVector2Array tess; @@ -1250,7 +1250,7 @@ void Curve2D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_baked_length"), &Curve2D::get_baked_length); ClassDB::bind_method(D_METHOD("interpolate_baked", "offset", "cubic"), &Curve2D::interpolate_baked, DEFVAL(false)); ClassDB::bind_method(D_METHOD("get_baked_points"), &Curve2D::get_baked_points); - ClassDB::bind_method(D_METHOD("tesselate", "max_stages", "tolerance_degrees"), &Curve2D::tesselate, DEFVAL(5), DEFVAL(4)); + ClassDB::bind_method(D_METHOD("tessellate", "max_stages", "tolerance_degrees"), &Curve2D::tessellate, DEFVAL(5), DEFVAL(4)); ClassDB::bind_method(D_METHOD("_get_data"), &Curve2D::_get_data); ClassDB::bind_method(D_METHOD("_set_data"), &Curve2D::_set_data); @@ -1683,7 +1683,7 @@ void Curve3D::_set_data(const Dictionary &p_data) { baked_cache_dirty = true; } -PoolVector3Array Curve3D::tesselate(int p_max_stages, float p_tolerance) const { +PoolVector3Array Curve3D::tessellate(int p_max_stages, float p_tolerance) const { PoolVector3Array tess; @@ -1748,7 +1748,7 @@ void Curve3D::_bind_methods() { ClassDB::bind_method(D_METHOD("interpolate_baked", "offset", "cubic"), &Curve3D::interpolate_baked, DEFVAL(false)); ClassDB::bind_method(D_METHOD("get_baked_points"), &Curve3D::get_baked_points); ClassDB::bind_method(D_METHOD("get_baked_tilts"), &Curve3D::get_baked_tilts); - ClassDB::bind_method(D_METHOD("tesselate", "max_stages", "tolerance_degrees"), &Curve3D::tesselate, DEFVAL(5), DEFVAL(4)); + ClassDB::bind_method(D_METHOD("tessellate", "max_stages", "tolerance_degrees"), &Curve3D::tessellate, DEFVAL(5), DEFVAL(4)); ClassDB::bind_method(D_METHOD("_get_data"), &Curve3D::_get_data); ClassDB::bind_method(D_METHOD("_set_data"), &Curve3D::_set_data); diff --git a/scene/resources/curve.h b/scene/resources/curve.h index 83a4357bfb..2815c12c4b 100644 --- a/scene/resources/curve.h +++ b/scene/resources/curve.h @@ -249,7 +249,7 @@ public: Vector2 interpolate_baked(float p_offset, bool p_cubic = false) const; PoolVector2Array get_baked_points() const; //useful for going through - PoolVector2Array tesselate(int p_max_stages = 5, float p_tolerance = 4) const; //useful for display + PoolVector2Array tessellate(int p_max_stages = 5, float p_tolerance = 4) const; //useful for display Curve2D(); }; @@ -318,7 +318,7 @@ public: PoolVector3Array get_baked_points() const; //useful for going through PoolRealArray get_baked_tilts() const; //useful for going through - PoolVector3Array tesselate(int p_max_stages = 5, float p_tolerance = 4) const; //useful for display + PoolVector3Array tessellate(int p_max_stages = 5, float p_tolerance = 4) const; //useful for display Curve3D(); }; diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp index 125bbd2d64..ae89d8ed94 100644 --- a/scene/resources/environment.cpp +++ b/scene/resources/environment.cpp @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "environment.h" -#include "global_config.h" +#include "project_settings.h" #include "servers/visual_server.h" #include "texture.h" @@ -1103,8 +1103,8 @@ void Environment::_bind_methods() { ClassDB::bind_method(D_METHOD("set_adjustment_saturation", "saturation"), &Environment::set_adjustment_saturation); ClassDB::bind_method(D_METHOD("get_adjustment_saturation"), &Environment::get_adjustment_saturation); - ClassDB::bind_method(D_METHOD("set_adjustment_color_correction", "color_correction"), &Environment::set_adjustment_color_correction); - ClassDB::bind_method(D_METHOD("get_adjustment_color_correction"), &Environment::get_adjustment_color_correction); + ClassDB::bind_method(D_METHOD("set_adjustment_color_correction", "color_correction:Texture"), &Environment::set_adjustment_color_correction); + ClassDB::bind_method(D_METHOD("get_adjustment_color_correction:Texture"), &Environment::get_adjustment_color_correction); ADD_GROUP("Adjustments", "adjustment_"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "adjustment_enabled"), "set_adjustment_enable", "is_adjustment_enabled"); diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp index 225a42f651..3668dda604 100644 --- a/scene/resources/font.cpp +++ b/scene/resources/font.cpp @@ -570,8 +570,8 @@ void BitmapFont::_bind_methods() { ClassDB::bind_method(D_METHOD("_set_textures"), &BitmapFont::_set_textures); ClassDB::bind_method(D_METHOD("_get_textures"), &BitmapFont::_get_textures); - ClassDB::bind_method(D_METHOD("set_fallback", "fallback"), &BitmapFont::set_fallback); - ClassDB::bind_method(D_METHOD("get_fallback"), &BitmapFont::get_fallback); + ClassDB::bind_method(D_METHOD("set_fallback", "fallback:BitmapFont"), &BitmapFont::set_fallback); + ClassDB::bind_method(D_METHOD("get_fallback:BitmapFont"), &BitmapFont::get_fallback); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "textures", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_textures", "_get_textures"); ADD_PROPERTY(PropertyInfo(Variant::POOL_INT_ARRAY, "chars", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_chars", "_get_chars"); diff --git a/scene/resources/mesh_data_tool.cpp b/scene/resources/mesh_data_tool.cpp index bf1b3d40be..5dc596abff 100644 --- a/scene/resources/mesh_data_tool.cpp +++ b/scene/resources/mesh_data_tool.cpp @@ -520,8 +520,8 @@ void MeshDataTool::set_material(const Ref<Material> &p_material) { void MeshDataTool::_bind_methods() { ClassDB::bind_method(D_METHOD("clear"), &MeshDataTool::clear); - ClassDB::bind_method(D_METHOD("create_from_surface", "mesh", "surface"), &MeshDataTool::create_from_surface); - ClassDB::bind_method(D_METHOD("commit_to_surface", "mesh"), &MeshDataTool::commit_to_surface); + ClassDB::bind_method(D_METHOD("create_from_surface", "mesh:ArrayMesh", "surface"), &MeshDataTool::create_from_surface); + ClassDB::bind_method(D_METHOD("commit_to_surface", "mesh:ArrayMesh"), &MeshDataTool::commit_to_surface); ClassDB::bind_method(D_METHOD("get_format"), &MeshDataTool::get_format); @@ -574,7 +574,7 @@ void MeshDataTool::_bind_methods() { ClassDB::bind_method(D_METHOD("get_face_normal", "idx"), &MeshDataTool::get_face_normal); ClassDB::bind_method(D_METHOD("set_material", "material:Material"), &MeshDataTool::set_material); - ClassDB::bind_method(D_METHOD("get_material", "material"), &MeshDataTool::get_material); + ClassDB::bind_method(D_METHOD("get_material:Material", "material"), &MeshDataTool::get_material); } MeshDataTool::MeshDataTool() { diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index 1afaed2284..01a8342fed 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "packed_scene.h" #include "core/core_string_names.h" -#include "global_config.h" +#include "project_settings.h" #include "io/resource_loader.h" #include "scene/2d/node_2d.h" #include "scene/3d/spatial.h" diff --git a/scene/resources/scene_format_text.cpp b/scene/resources/scene_format_text.cpp index 8ad2970005..585579aad5 100644 --- a/scene/resources/scene_format_text.cpp +++ b/scene/resources/scene_format_text.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "scene_format_text.h" -#include "global_config.h" +#include "project_settings.h" #include "os/dir_access.h" #include "version.h" @@ -110,7 +110,7 @@ Error ResourceInteractiveLoaderText::_parse_ext_resource(VariantParser::Stream * 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)); } r_res = ResourceLoader::load(path, type); @@ -165,7 +165,7 @@ Error ResourceInteractiveLoaderText::poll() { 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(local_path.get_base_dir().plus_file(path)); + path = ProjectSettings::get_singleton()->localize_path(local_path.get_base_dir().plus_file(path)); } if (remaps.has(path)) { @@ -648,7 +648,7 @@ void ResourceInteractiveLoaderText::get_dependencies(FileAccess *f, List<String> 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(local_path.get_base_dir().plus_file(path)); + path = ProjectSettings::get_singleton()->localize_path(local_path.get_base_dir().plus_file(path)); } if (p_add_types) { @@ -905,9 +905,9 @@ Ref<ResourceInteractiveLoader> ResourceFormatLoaderText::load_interactive(const } Ref<ResourceInteractiveLoaderText> ria = memnew(ResourceInteractiveLoaderText); - 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( GlobalConfig::get_singleton()->localize_path(p_path) ); + //ria->set_local_path( ProjectSettings::get_singleton()->localize_path(p_path) ); ria->open(f); return ria; @@ -953,9 +953,9 @@ String ResourceFormatLoaderText::get_resource_type(const String &p_path) const { } Ref<ResourceInteractiveLoaderText> ria = memnew(ResourceInteractiveLoaderText); - 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( GlobalConfig::get_singleton()->localize_path(p_path) ); + //ria->set_local_path( ProjectSettings::get_singleton()->localize_path(p_path) ); String r = ria->recognize(f); return r; } @@ -969,9 +969,9 @@ void ResourceFormatLoaderText::get_dependencies(const String &p_path, List<Strin } Ref<ResourceInteractiveLoaderText> ria = memnew(ResourceInteractiveLoaderText); - 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( GlobalConfig::get_singleton()->localize_path(p_path) ); + //ria->set_local_path( ProjectSettings::get_singleton()->localize_path(p_path) ); ria->get_dependencies(f, p_dependencies, p_add_types); } @@ -984,9 +984,9 @@ Error ResourceFormatLoaderText::rename_dependencies(const String &p_path, const } Ref<ResourceInteractiveLoaderText> ria = memnew(ResourceInteractiveLoaderText); - 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( GlobalConfig::get_singleton()->localize_path(p_path) ); + //ria->set_local_path( ProjectSettings::get_singleton()->localize_path(p_path) ); return ria->rename_dependencies(f, p_path, p_map); } @@ -1118,7 +1118,7 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const RES &p_r ERR_FAIL_COND_V(err, ERR_CANT_OPEN); FileAccessRef _fref(f); - local_path = GlobalConfig::get_singleton()->localize_path(p_path); + local_path = ProjectSettings::get_singleton()->localize_path(p_path); relative_paths = p_flags & ResourceSaver::FLAG_RELATIVE_PATHS; skip_editor = p_flags & ResourceSaver::FLAG_OMIT_EDITOR_PROPERTIES; diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp index f108809c83..e0a9de6062 100644 --- a/scene/resources/style_box.cpp +++ b/scene/resources/style_box.cpp @@ -482,7 +482,7 @@ void StyleBoxLine::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::COLOR, "color"), "set_color", "get_color"); ADD_PROPERTY(PropertyInfo(Variant::INT, "thickness", PROPERTY_HINT_RANGE, "0,10"), "set_thickness", "get_thickness"); - ADD_PROPERTY(PropertyInfo(Variant::BOOL, "vertical"), "set_vertical", "get_vertical"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "vertical"), "set_vertical", "is_vertical"); } float StyleBoxLine::get_style_margin(Margin p_margin) const { return thickness; diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index 171826cb2f..5cd75b5a69 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -1323,8 +1323,8 @@ void CubeMap::_bind_methods() { ClassDB::bind_method(D_METHOD("set_flags", "flags"), &CubeMap::set_flags); ClassDB::bind_method(D_METHOD("get_flags"), &CubeMap::get_flags); - ClassDB::bind_method(D_METHOD("set_side", "side", "image"), &CubeMap::set_side); - ClassDB::bind_method(D_METHOD("get_side", "side"), &CubeMap::get_side); + ClassDB::bind_method(D_METHOD("set_side", "side", "image:Image"), &CubeMap::set_side); + ClassDB::bind_method(D_METHOD("get_side:Image", "side"), &CubeMap::get_side); ClassDB::bind_method(D_METHOD("set_storage", "mode"), &CubeMap::set_storage); ClassDB::bind_method(D_METHOD("get_storage"), &CubeMap::get_storage); ClassDB::bind_method(D_METHOD("set_lossy_storage_quality", "quality"), &CubeMap::set_lossy_storage_quality); diff --git a/scene/resources/world_2d.cpp b/scene/resources/world_2d.cpp index 9ec89e4003..056c49f1ae 100644 --- a/scene/resources/world_2d.cpp +++ b/scene/resources/world_2d.cpp @@ -31,7 +31,7 @@ #include "servers/physics_2d_server.h" #include "servers/visual_server.h" //#include "servers/spatial_sound_2d_server.h" -#include "global_config.h" +#include "project_settings.h" #include "scene/2d/camera_2d.h" #include "scene/2d/visibility_notifier_2d.h" #include "scene/main/viewport.h" diff --git a/scene/resources/world_2d.h b/scene/resources/world_2d.h index 35c8ce390f..f968b08a15 100644 --- a/scene/resources/world_2d.h +++ b/scene/resources/world_2d.h @@ -30,7 +30,7 @@ #ifndef WORLD_2D_H #define WORLD_2D_H -#include "global_config.h" +#include "project_settings.h" #include "resource.h" #include "servers/physics_2d_server.h" diff --git a/servers/audio/audio_driver_dummy.cpp b/servers/audio/audio_driver_dummy.cpp index 3aaf73df03..e20990cdce 100644 --- a/servers/audio/audio_driver_dummy.cpp +++ b/servers/audio/audio_driver_dummy.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "audio_driver_dummy.h" -#include "global_config.h" +#include "project_settings.h" #include "os/os.h" Error AudioDriverDummy::init() { diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp index 43f1175c79..253bf6e2ee 100644 --- a/servers/audio_server.cpp +++ b/servers/audio_server.cpp @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "audio_server.h" -#include "global_config.h" +#include "project_settings.h" #include "io/resource_loader.h" #include "os/file_access.h" #include "os/os.h" @@ -984,10 +984,10 @@ void AudioServer::_bind_methods() { ClassDB::bind_method(D_METHOD("set_bus_bypass_effects", "bus_idx", "enable"), &AudioServer::set_bus_bypass_effects); ClassDB::bind_method(D_METHOD("is_bus_bypassing_effects", "bus_idx"), &AudioServer::is_bus_bypassing_effects); - ClassDB::bind_method(D_METHOD("add_bus_effect", "bus_idx", "effect:AudioEffect"), &AudioServer::add_bus_effect, DEFVAL(-1)); + ClassDB::bind_method(D_METHOD("add_bus_effect", "bus_idx", "effect:AudioEffect", "at_pos"), &AudioServer::add_bus_effect, DEFVAL(-1)); ClassDB::bind_method(D_METHOD("remove_bus_effect", "bus_idx", "effect_idx"), &AudioServer::remove_bus_effect); - ClassDB::bind_method(D_METHOD("get_bus_effect_count", "bus_idx"), &AudioServer::add_bus_effect); + ClassDB::bind_method(D_METHOD("get_bus_effect_count", "bus_idx"), &AudioServer::get_bus_effect_count); ClassDB::bind_method(D_METHOD("get_bus_effect:AudioEffect", "bus_idx", "effect_idx"), &AudioServer::get_bus_effect); ClassDB::bind_method(D_METHOD("swap_bus_effects", "bus_idx", "effect_idx", "by_effect_idx"), &AudioServer::swap_bus_effects); diff --git a/servers/physics/space_sw.cpp b/servers/physics/space_sw.cpp index 2d71fd6061..9e84fce000 100644 --- a/servers/physics/space_sw.cpp +++ b/servers/physics/space_sw.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "space_sw.h" #include "collision_solver_sw.h" -#include "global_config.h" +#include "project_settings.h" #include "physics_server_sw.h" _FORCE_INLINE_ static bool _match_object_type_query(CollisionObjectSW *p_object, uint32_t p_collision_layer, uint32_t p_type_mask) { diff --git a/servers/physics/space_sw.h b/servers/physics/space_sw.h index 6ef12dbeae..6c6c433230 100644 --- a/servers/physics/space_sw.h +++ b/servers/physics/space_sw.h @@ -36,7 +36,7 @@ #include "body_sw.h" #include "broad_phase_sw.h" #include "collision_object_sw.h" -#include "global_config.h" +#include "project_settings.h" #include "hash_map.h" #include "typedefs.h" diff --git a/servers/physics_2d/broad_phase_2d_hash_grid.cpp b/servers/physics_2d/broad_phase_2d_hash_grid.cpp index 29f3396a1d..5b6c7e2f38 100644 --- a/servers/physics_2d/broad_phase_2d_hash_grid.cpp +++ b/servers/physics_2d/broad_phase_2d_hash_grid.cpp @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "broad_phase_2d_hash_grid.h" -#include "global_config.h" +#include "project_settings.h" #define LARGE_ELEMENT_FI 1.01239812 diff --git a/servers/physics_2d/physics_2d_server_sw.cpp b/servers/physics_2d/physics_2d_server_sw.cpp index fe016d4d0c..6eb1106de8 100644 --- a/servers/physics_2d/physics_2d_server_sw.cpp +++ b/servers/physics_2d/physics_2d_server_sw.cpp @@ -31,7 +31,7 @@ #include "broad_phase_2d_basic.h" #include "broad_phase_2d_hash_grid.h" #include "collision_solver_2d_sw.h" -#include "global_config.h" +#include "project_settings.h" #include "os/os.h" #include "script_language.h" @@ -1264,7 +1264,7 @@ Physics2DServerSW::Physics2DServerSW() { island_count = 0; active_objects = 0; collision_pairs = 0; - using_threads = int(GlobalConfig::get_singleton()->get("physics/2d/thread_model")) == 2; + using_threads = int(ProjectSettings::get_singleton()->get("physics/2d/thread_model")) == 2; }; Physics2DServerSW::~Physics2DServerSW(){ diff --git a/servers/physics_2d/physics_2d_server_wrap_mt.h b/servers/physics_2d/physics_2d_server_wrap_mt.h index ac9066582e..5b00416b61 100644 --- a/servers/physics_2d/physics_2d_server_wrap_mt.h +++ b/servers/physics_2d/physics_2d_server_wrap_mt.h @@ -31,7 +31,7 @@ #define PHYSICS2DSERVERWRAPMT_H #include "command_queue_mt.h" -#include "global_config.h" +#include "project_settings.h" #include "os/thread.h" #include "servers/physics_2d_server.h" diff --git a/servers/physics_2d/space_2d_sw.h b/servers/physics_2d/space_2d_sw.h index a28233a4a6..c5bdfa3323 100644 --- a/servers/physics_2d/space_2d_sw.h +++ b/servers/physics_2d/space_2d_sw.h @@ -36,7 +36,7 @@ #include "body_pair_2d_sw.h" #include "broad_phase_2d_sw.h" #include "collision_object_2d_sw.h" -#include "global_config.h" +#include "project_settings.h" #include "hash_map.h" #include "typedefs.h" diff --git a/servers/register_server_types.cpp b/servers/register_server_types.cpp index 8ee431cc68..c5029d1e13 100644 --- a/servers/register_server_types.cpp +++ b/servers/register_server_types.cpp @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "register_server_types.h" -#include "global_config.h" +#include "project_settings.h" #include "audio/audio_effect.h" #include "audio/audio_stream.h" @@ -73,10 +73,10 @@ ShaderTypes *shader_types = NULL; void register_server_types() { - GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("VisualServer", VisualServer::get_singleton())); - GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("AudioServer", AudioServer::get_singleton())); - GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("PhysicsServer", PhysicsServer::get_singleton())); - GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("Physics2DServer", Physics2DServer::get_singleton())); + ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("VisualServer", VisualServer::get_singleton())); + ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("AudioServer", AudioServer::get_singleton())); + ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("PhysicsServer", PhysicsServer::get_singleton())); + ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("Physics2DServer", Physics2DServer::get_singleton())); shader_types = memnew(ShaderTypes); diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp index 8d332b3e6c..da6174cd5c 100644 --- a/servers/visual/visual_server_raster.cpp +++ b/servers/visual/visual_server_raster.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "visual_server_raster.h" #include "default_mouse_cursor.xpm" -#include "global_config.h" +#include "project_settings.h" #include "io/marshalls.h" #include "os/os.h" #include "sort.h" diff --git a/servers/visual/visual_server_viewport.cpp b/servers/visual/visual_server_viewport.cpp index 4d53181b43..2a37b64759 100644 --- a/servers/visual/visual_server_viewport.cpp +++ b/servers/visual/visual_server_viewport.cpp @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "visual_server_viewport.h" -#include "global_config.h" +#include "project_settings.h" #include "visual_server_canvas.h" #include "visual_server_global.h" #include "visual_server_scene.h" diff --git a/servers/visual/visual_server_wrap_mt.cpp b/servers/visual/visual_server_wrap_mt.cpp index a358e99fb3..bdd41b0a57 100644 --- a/servers/visual/visual_server_wrap_mt.cpp +++ b/servers/visual/visual_server_wrap_mt.cpp @@ -27,7 +27,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "visual_server_wrap_mt.h" -#include "global_config.h" +#include "project_settings.h" #include "os/os.h" void VisualServerWrapMT::thread_exit() { diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp index 1e217649ba..fc274fa8e1 100644 --- a/servers/visual_server.cpp +++ b/servers/visual_server.cpp @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "visual_server.h" -#include "global_config.h" #include "method_bind_ext.gen.inc" +#include "project_settings.h" VisualServer *VisualServer::singleton = NULL; VisualServer *(*VisualServer::create_func)() = NULL; @@ -1573,16 +1573,25 @@ VisualServer::VisualServer() { GLOBAL_DEF("rendering/vram_compression/import_pvrtc", false); GLOBAL_DEF("rendering/quality/directional_shadow/size", 4096); + GLOBAL_DEF("rendering/quality/directional_shadow/size.mobile", 2048); GLOBAL_DEF("rendering/quality/shadow_atlas/size", 4096); - GlobalConfig::get_singleton()->set_custom_property_info("rendering/shadow_atlas/size", PropertyInfo(Variant::INT, "rendering/shadow_atlas/size", PROPERTY_HINT_RANGE, "256,16384")); + GLOBAL_DEF("rendering/quality/shadow_atlas/size.mobile", 2048); + ProjectSettings::get_singleton()->set_custom_property_info("rendering/shadow_atlas/size", PropertyInfo(Variant::INT, "rendering/shadow_atlas/size", PROPERTY_HINT_RANGE, "256,16384")); GLOBAL_DEF("rendering/quality/shadow_atlas/quadrant_0_subdiv", 1); GLOBAL_DEF("rendering/quality/shadow_atlas/quadrant_1_subdiv", 2); GLOBAL_DEF("rendering/quality/shadow_atlas/quadrant_2_subdiv", 3); GLOBAL_DEF("rendering/quality/shadow_atlas/quadrant_3_subdiv", 4); - GlobalConfig::get_singleton()->set_custom_property_info("rendering/quality/shadow_atlas/quadrant_0_subdiv", PropertyInfo(Variant::INT, "rendering/quality/shadow_atlas/quadrant_0_subdiv", PROPERTY_HINT_ENUM, "Disabled,1 Shadow,4 Shadows,16 Shadows,64 Shadows,256 Shadows,1024 Shadows")); - GlobalConfig::get_singleton()->set_custom_property_info("rendering/quality/shadow_atlas/quadrant_1_subdiv", PropertyInfo(Variant::INT, "rendering/quality/shadow_atlas/quadrant_1_subdiv", PROPERTY_HINT_ENUM, "Disabled,1 Shadow,4 Shadows,16 Shadows,64 Shadows,256 Shadows,1024 Shadows")); - GlobalConfig::get_singleton()->set_custom_property_info("rendering/quality/shadow_atlas/quadrant_2_subdiv", PropertyInfo(Variant::INT, "rendering/quality/shadow_atlas/quadrant_2_subdiv", PROPERTY_HINT_ENUM, "Disabled,1 Shadow,4 Shadows,16 Shadows,64 Shadows,256 Shadows,1024 Shadows")); - GlobalConfig::get_singleton()->set_custom_property_info("rendering/quality/shadow_atlas/quadrant_3_subdiv", PropertyInfo(Variant::INT, "rendering/quality/shadow_atlas/quadrant_3_subdiv", PROPERTY_HINT_ENUM, "Disabled,1 Shadow,4 Shadows,16 Shadows,64 Shadows,256 Shadows,1024 Shadows")); + ProjectSettings::get_singleton()->set_custom_property_info("rendering/quality/shadow_atlas/quadrant_0_subdiv", PropertyInfo(Variant::INT, "rendering/quality/shadow_atlas/quadrant_0_subdiv", PROPERTY_HINT_ENUM, "Disabled,1 Shadow,4 Shadows,16 Shadows,64 Shadows,256 Shadows,1024 Shadows")); + ProjectSettings::get_singleton()->set_custom_property_info("rendering/quality/shadow_atlas/quadrant_1_subdiv", PropertyInfo(Variant::INT, "rendering/quality/shadow_atlas/quadrant_1_subdiv", PROPERTY_HINT_ENUM, "Disabled,1 Shadow,4 Shadows,16 Shadows,64 Shadows,256 Shadows,1024 Shadows")); + ProjectSettings::get_singleton()->set_custom_property_info("rendering/quality/shadow_atlas/quadrant_2_subdiv", PropertyInfo(Variant::INT, "rendering/quality/shadow_atlas/quadrant_2_subdiv", PROPERTY_HINT_ENUM, "Disabled,1 Shadow,4 Shadows,16 Shadows,64 Shadows,256 Shadows,1024 Shadows")); + ProjectSettings::get_singleton()->set_custom_property_info("rendering/quality/shadow_atlas/quadrant_3_subdiv", PropertyInfo(Variant::INT, "rendering/quality/shadow_atlas/quadrant_3_subdiv", PROPERTY_HINT_ENUM, "Disabled,1 Shadow,4 Shadows,16 Shadows,64 Shadows,256 Shadows,1024 Shadows")); + + GLOBAL_DEF("rendering/quality/shadows/filter_mode", 1); + GLOBAL_DEF("rendering/quality/shadows/filter_mode.mobile", 0); + ProjectSettings::get_singleton()->set_custom_property_info("rendering/quality/shadows/filter_mode", PropertyInfo(Variant::INT, "rendering/quality/shadows/filter_mode", PROPERTY_HINT_ENUM, "Disabled,PCF5,PCF13")); + + GLOBAL_DEF("rendering/quality/reflections/texture_array_reflections", true); + GLOBAL_DEF("rendering/quality/reflections/texture_array_reflections.mobile", false); } VisualServer::~VisualServer() { diff --git a/thirdparty/libpng/pngpriv.h b/thirdparty/libpng/pngpriv.h index a062a8da16..77d30420a5 100644 --- a/thirdparty/libpng/pngpriv.h +++ b/thirdparty/libpng/pngpriv.h @@ -464,7 +464,7 @@ static_cast<type>(static_cast<void*>(value)) # define png_aligncastconst(type, value) \ static_cast<type>(static_cast<const void*>(value)) -#else +#elif !defined(__ASSEMBLER__) # define png_voidcast(type, value) (value) # ifdef _WIN64 # ifdef __GNUC__ |