diff --git a/bin/tests/test_io.cpp b/bin/tests/test_io.cpp index a8e8d7d0fde..42664e73cd4 100644 --- a/bin/tests/test_io.cpp +++ b/bin/tests/test_io.cpp @@ -101,10 +101,10 @@ MainLoop* test() { ResourceSaver::save("test_data/rock.xml",texture); print_line("localize paths"); - print_line(Globals::get_singleton()->localize_path("algo.xml")); - print_line(Globals::get_singleton()->localize_path("c:\\windows\\algo.xml")); - print_line(Globals::get_singleton()->localize_path(Globals::get_singleton()->get_resource_path()+"/something/something.xml")); - print_line(Globals::get_singleton()->localize_path("somedir/algo.xml")); + 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")); { diff --git a/core/SCsub b/core/SCsub index caae3a1c9be..8d89f6427bb 100644 --- a/core/SCsub +++ b/core/SCsub @@ -15,7 +15,7 @@ for x in env.global_defaults: gd_cpp = '#include "globals.h"\n' gd_cpp += gd_inc -gd_cpp += "void Globals::register_global_defaults() {\n" + gd_call + "\n}\n" +gd_cpp += "void GlobalConfig::register_global_defaults() {\n" + gd_call + "\n}\n" f = open("global_defaults.cpp", "wb") f.write(gd_cpp) diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 02f3c4c5f31..0d89659cef0 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -102,7 +102,7 @@ StringArray _ResourceLoader::get_dependencies(const String& p_path) { bool _ResourceLoader::has(const String &p_path) { - String local_path = Globals::get_singleton()->localize_path(p_path); + String local_path = GlobalConfig::get_singleton()->localize_path(p_path); return ResourceCache::has(local_path); }; diff --git a/core/globals.cpp b/core/globals.cpp index 8b335b8a0de..6609b47147c 100644 --- a/core/globals.cpp +++ b/core/globals.cpp @@ -37,19 +37,19 @@ #include "io/file_access_pack.h" #include "io/file_access_network.h" -Globals *Globals::singleton=NULL; +GlobalConfig *GlobalConfig::singleton=NULL; -Globals *Globals::get_singleton() { +GlobalConfig *GlobalConfig::get_singleton() { return singleton; } -String Globals::get_resource_path() const { +String GlobalConfig::get_resource_path() const { return resource_path; }; -String Globals::localize_path(const String& p_path) const { +String GlobalConfig::localize_path(const String& p_path) const { if (resource_path=="") return p_path; //not initialied yet @@ -96,21 +96,14 @@ String Globals::localize_path(const String& p_path) const { } -void Globals::set_persisting(const String& p_name, bool p_persist) { +void GlobalConfig::set_initial_value(const String& p_name, const Variant & p_value) { ERR_FAIL_COND(!props.has(p_name)); - props[p_name].persist=p_persist; -} - -bool Globals::is_persisting(const String& p_name) const { - - ERR_FAIL_COND_V(!props.has(p_name),false); - return props[p_name].persist; - + props[p_name].initial=p_value; } -String Globals::globalize_path(const String& p_path) const { +String GlobalConfig::globalize_path(const String& p_path) const { if (p_path.begins_with("res://")) { @@ -125,7 +118,7 @@ String Globals::globalize_path(const String& p_path) const { } -bool Globals::_set(const StringName& p_name, const Variant& p_value) { +bool GlobalConfig::_set(const StringName& p_name, const Variant& p_value) { _THREAD_SAFE_METHOD_ @@ -169,7 +162,7 @@ bool Globals::_set(const StringName& p_name, const Variant& p_value) { return true; } -bool Globals::_get(const StringName& p_name,Variant &r_ret) const { +bool GlobalConfig::_get(const StringName& p_name,Variant &r_ret) const { _THREAD_SAFE_METHOD_ @@ -190,7 +183,7 @@ struct _VCSort { bool operator<(const _VCSort& p_vcs) const{ return order==p_vcs.order?name *p_list) const { +void GlobalConfig::_get_property_list(List *p_list) const { _THREAD_SAFE_METHOD_ @@ -208,13 +201,9 @@ void Globals::_get_property_list(List *p_list) const { vc.order=v->order; vc.type=v->variant.get_type(); if (vc.name.begins_with("input/") || vc.name.begins_with("import/") || vc.name.begins_with("export/") || vc.name.begins_with("/remap") || vc.name.begins_with("/locale") || vc.name.begins_with("/autoload")) - vc.flags=PROPERTY_USAGE_CHECKABLE|PROPERTY_USAGE_STORAGE; + vc.flags=PROPERTY_USAGE_STORAGE; else - vc.flags=PROPERTY_USAGE_CHECKABLE|PROPERTY_USAGE_EDITOR|PROPERTY_USAGE_STORAGE; - - if (v->persist) { - vc.flags|=PROPERTY_USAGE_CHECKED; - } + vc.flags=PROPERTY_USAGE_EDITOR|PROPERTY_USAGE_STORAGE; vclist.insert(vc); } @@ -233,7 +222,7 @@ void Globals::_get_property_list(List *p_list) const { -bool Globals::_load_resource_pack(const String& p_pack) { +bool GlobalConfig::_load_resource_pack(const String& p_pack) { if (PackedData::get_singleton()->is_disabled()) return false; @@ -250,7 +239,7 @@ bool Globals::_load_resource_pack(const String& p_pack) { return true; } -Error Globals::setup(const String& p_path,const String & p_main_pack) { +Error GlobalConfig::setup(const String& p_path,const String & p_main_pack) { //an absolute mess of a function, must be cleaned up and reorganized somehow at some point @@ -397,7 +386,7 @@ Error Globals::setup(const String& p_path,const String & p_main_pack) { return OK; } -bool Globals::has(String p_var) const { +bool GlobalConfig::has(String p_var) const { _THREAD_SAFE_METHOD_ @@ -751,12 +740,12 @@ static Variant _decode_variant(const String& p_string) { return Variant(); } -void Globals::set_registering_order(bool p_enable) { +void GlobalConfig::set_registering_order(bool p_enable) { registering_order=p_enable; } -Error Globals::_load_settings_binary(const String p_path) { +Error GlobalConfig::_load_settings_binary(const String p_path) { Error err; FileAccess *f= FileAccess::open(p_path,FileAccess::READ,&err); @@ -797,7 +786,7 @@ Error Globals::_load_settings_binary(const String p_path) { ERR_EXPLAIN("Error decoding property: "+key); ERR_CONTINUE(err!=OK); set(key,value); - set_persisting(key,true); + } set_registering_order(true); @@ -805,7 +794,7 @@ Error Globals::_load_settings_binary(const String p_path) { return OK; } -Error Globals::_load_settings(const String p_path) { +Error GlobalConfig::_load_settings(const String p_path) { Error err; @@ -884,8 +873,10 @@ Error Globals::_load_settings(const String p_path) { Variant val = _decode_variant(value); - set(subpath+var,val); - set_persisting(subpath+var,true); + StringName path = subpath+var; + + set(path,val); + //props[subpath+var]=VariantContainer(val,last_order++,true); } else { @@ -1062,31 +1053,31 @@ static String _encode_variant(const Variant& p_variant) { } -int Globals::get_order(const String& p_name) const { +int GlobalConfig::get_order(const String& p_name) const { ERR_FAIL_COND_V(!props.has(p_name),-1); return props[p_name].order; } -void Globals::set_order(const String& p_name, int p_order){ +void GlobalConfig::set_order(const String& p_name, int p_order){ ERR_FAIL_COND(!props.has(p_name)); props[p_name].order=p_order; } -void Globals::clear(const String& p_name) { +void GlobalConfig::clear(const String& p_name) { ERR_FAIL_COND(!props.has(p_name)); props.erase(p_name); } -Error Globals::save() { +Error GlobalConfig::save() { return save_custom(get_resource_path()+"/engine.cfg"); } -Error Globals::_save_settings_binary(const String& p_file,const Map > &props,const CustomMap& p_custom) { +Error GlobalConfig::_save_settings_binary(const String& p_file,const Map > &props,const CustomMap& p_custom) { Error err; @@ -1155,7 +1146,7 @@ Error Globals::_save_settings_binary(const String& p_file,const Map > &props,const CustomMap& p_custom) { +Error GlobalConfig::_save_settings_text(const String& p_file,const Map > &props,const CustomMap& p_custom) { Error err; FileAccess *file = FileAccess::open(p_file,FileAccess::WRITE,&err); @@ -1194,12 +1185,12 @@ Error Globals::_save_settings_text(const String& p_file,const Map& p_ignore_masks) { +Error GlobalConfig::save_custom(const String& p_path,const CustomMap& p_custom,const Set& p_ignore_masks) { ERR_FAIL_COND_V(p_path=="",ERR_INVALID_PARAMETER); @@ -1232,8 +1223,8 @@ Error Globals::save_custom(const String& p_path,const CustomMap& p_custom,const vc.name=G->key();//*k; vc.order=v->order; vc.type=v->variant.get_type(); - vc.flags=PROPERTY_USAGE_CHECKABLE|PROPERTY_USAGE_EDITOR|PROPERTY_USAGE_STORAGE; - if (!v->persist) + vc.flags=PROPERTY_USAGE_EDITOR|PROPERTY_USAGE_STORAGE; + if (v->variant==v->initial) continue; @@ -1327,20 +1318,23 @@ Error Globals::save_custom(const String& p_path,const CustomMap& p_custom,const Variant _GLOBAL_DEF( const String& p_var, const Variant& p_default) { - if (Globals::get_singleton()->has(p_var)) - return Globals::get_singleton()->get(p_var); - Globals::get_singleton()->set(p_var,p_default); + if (GlobalConfig::get_singleton()->has(p_var)) { + GlobalConfig::get_singleton()->set_initial_value(p_var,p_default); + return GlobalConfig::get_singleton()->get(p_var); + } + GlobalConfig::get_singleton()->set(p_var,p_default); + GlobalConfig::get_singleton()->set_initial_value(p_var,p_default); return p_default; } -void Globals::add_singleton(const Singleton &p_singleton) { +void GlobalConfig::add_singleton(const Singleton &p_singleton) { singletons.push_back(p_singleton); singleton_ptrs[p_singleton.name]=p_singleton.ptr; } -Object* Globals::get_singleton_object(const String& p_name) const { +Object* GlobalConfig::get_singleton_object(const String& p_name) const { const Map::Element *E=singleton_ptrs.find(p_name); @@ -1351,21 +1345,21 @@ Object* Globals::get_singleton_object(const String& p_name) const { }; -bool Globals::has_singleton(const String& p_name) const { +bool GlobalConfig::has_singleton(const String& p_name) const { return get_singleton_object(p_name) != NULL; }; -void Globals::get_singletons(List *p_singletons) { +void GlobalConfig::get_singletons(List *p_singletons) { for(List::Element *E=singletons.front();E;E=E->next()) p_singletons->push_back(E->get()); } -Vector Globals::get_optimizer_presets() const { +Vector GlobalConfig::get_optimizer_presets() const { List pi; - Globals::get_singleton()->get_property_list(&pi); + GlobalConfig::get_singleton()->get_property_list(&pi); Vector names; for (List::Element *E=pi.front();E;E=E->next()) { @@ -1381,7 +1375,7 @@ Vector Globals::get_optimizer_presets() const { } -void Globals::_add_property_info_bind(const Dictionary& p_info) { +void GlobalConfig::_add_property_info_bind(const Dictionary& p_info) { ERR_FAIL_COND(!p_info.has("name")); ERR_FAIL_COND(!p_info.has("type")); @@ -1400,7 +1394,7 @@ void Globals::_add_property_info_bind(const Dictionary& p_info) { set_custom_property_info(pinfo.name, pinfo); } -void Globals::set_custom_property_info(const String& p_prop,const PropertyInfo& p_info) { +void GlobalConfig::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; @@ -1408,37 +1402,55 @@ void Globals::set_custom_property_info(const String& p_prop,const PropertyInfo& } -void Globals::set_disable_platform_override(bool p_disable) { +void GlobalConfig::set_disable_platform_override(bool p_disable) { disable_platform_override=p_disable; } -bool Globals::is_using_datapack() const { +bool GlobalConfig::is_using_datapack() const { return using_datapack; } -void Globals::_bind_methods() { +bool GlobalConfig::property_can_revert(const String& p_name) { - ClassDB::bind_method(_MD("has","name"),&Globals::has); - ClassDB::bind_method(_MD("set_order","name","pos"),&Globals::set_order); - ClassDB::bind_method(_MD("get_order","name"),&Globals::get_order); - ClassDB::bind_method(_MD("set_persisting","name","enable"),&Globals::set_persisting); - ClassDB::bind_method(_MD("is_persisting","name"),&Globals::is_persisting); - ClassDB::bind_method(_MD("add_property_info", "hint"),&Globals::_add_property_info_bind); - ClassDB::bind_method(_MD("clear","name"),&Globals::clear); - ClassDB::bind_method(_MD("localize_path","path"),&Globals::localize_path); - ClassDB::bind_method(_MD("globalize_path","path"),&Globals::globalize_path); - ClassDB::bind_method(_MD("save"),&Globals::save); - ClassDB::bind_method(_MD("has_singleton","name"),&Globals::has_singleton); - ClassDB::bind_method(_MD("get_singleton","name"),&Globals::get_singleton_object); - ClassDB::bind_method(_MD("load_resource_pack","pack"),&Globals::_load_resource_pack); + if (!props.has(p_name)) + return false; - ClassDB::bind_method(_MD("save_custom","file"),&Globals::_save_custom_bnd); + return props[p_name].initial!=props[p_name].variant; } -Globals::Globals() { +Variant GlobalConfig::property_get_revert(const String& p_name) { + + if (!props.has(p_name)) + return Variant(); + + return props[p_name].initial; +} + +void GlobalConfig::_bind_methods() { + + ClassDB::bind_method(_MD("has","name"),&GlobalConfig::has); + ClassDB::bind_method(_MD("set_order","name","pos"),&GlobalConfig::set_order); + ClassDB::bind_method(_MD("get_order","name"),&GlobalConfig::get_order); + ClassDB::bind_method(_MD("set_initial_value","name","value"),&GlobalConfig::set_initial_value); + ClassDB::bind_method(_MD("add_property_info", "hint"),&GlobalConfig::_add_property_info_bind); + ClassDB::bind_method(_MD("clear","name"),&GlobalConfig::clear); + ClassDB::bind_method(_MD("localize_path","path"),&GlobalConfig::localize_path); + ClassDB::bind_method(_MD("globalize_path","path"),&GlobalConfig::globalize_path); + ClassDB::bind_method(_MD("save"),&GlobalConfig::save); + ClassDB::bind_method(_MD("has_singleton","name"),&GlobalConfig::has_singleton); + ClassDB::bind_method(_MD("get_singleton","name"),&GlobalConfig::get_singleton_object); + ClassDB::bind_method(_MD("load_resource_pack","pack"),&GlobalConfig::_load_resource_pack); + ClassDB::bind_method(_MD("property_can_revert","name"),&GlobalConfig::property_can_revert); + ClassDB::bind_method(_MD("property_get_revert","name"),&GlobalConfig::property_get_revert); + + ClassDB::bind_method(_MD("save_custom","file"),&GlobalConfig::_save_custom_bnd); + +} + +GlobalConfig::GlobalConfig() { singleton=this; @@ -1454,11 +1466,11 @@ Globals::Globals() { joyb.type=InputEvent::JOYSTICK_BUTTON; - set("application/name","" ); - set("application/main_scene",""); + GLOBAL_DEF("application/name","" ); + GLOBAL_DEF("application/main_scene",""); custom_prop_info["application/main_scene"]=PropertyInfo(Variant::STRING,"application/main_scene",PROPERTY_HINT_FILE,"tscn,scn,xscn,xml,res"); - set("application/disable_stdout",false); - set("application/use_shared_user_dir",true); + GLOBAL_DEF("application/disable_stdout",false); + GLOBAL_DEF("application/use_shared_user_dir",true); key.key.scancode=KEY_RETURN; @@ -1469,7 +1481,7 @@ Globals::Globals() { va.push_back(key); joyb.joy_button.button_index=JOY_BUTTON_0; va.push_back(joyb); - set("input/ui_accept",va); + GLOBAL_DEF("input/ui_accept",va); input_presets.push_back("input/ui_accept"); va=Array(); @@ -1477,7 +1489,7 @@ Globals::Globals() { va.push_back(key); joyb.joy_button.button_index=JOY_BUTTON_3; va.push_back(joyb); - set("input/ui_select",va); + GLOBAL_DEF("input/ui_select",va); input_presets.push_back("input/ui_select"); va=Array(); @@ -1485,20 +1497,20 @@ Globals::Globals() { va.push_back(key); joyb.joy_button.button_index=JOY_BUTTON_1; va.push_back(joyb); - set("input/ui_cancel",va); + GLOBAL_DEF("input/ui_cancel",va); input_presets.push_back("input/ui_cancel"); va=Array(); key.key.scancode=KEY_TAB; va.push_back(key); - set("input/ui_focus_next",va); + GLOBAL_DEF("input/ui_focus_next",va); input_presets.push_back("input/ui_focus_next"); va=Array(); key.key.scancode=KEY_TAB; key.key.mod.shift=true; va.push_back(key); - set("input/ui_focus_prev",va); + GLOBAL_DEF("input/ui_focus_prev",va); input_presets.push_back("input/ui_focus_prev"); key.key.mod.shift=false; @@ -1507,7 +1519,7 @@ Globals::Globals() { va.push_back(key); joyb.joy_button.button_index=JOY_DPAD_LEFT; va.push_back(joyb); - set("input/ui_left",va); + GLOBAL_DEF("input/ui_left",va); input_presets.push_back("input/ui_left"); va=Array(); @@ -1515,7 +1527,7 @@ Globals::Globals() { va.push_back(key); joyb.joy_button.button_index=JOY_DPAD_RIGHT; va.push_back(joyb); - set("input/ui_right",va); + GLOBAL_DEF("input/ui_right",va); input_presets.push_back("input/ui_right"); va=Array(); @@ -1523,7 +1535,7 @@ Globals::Globals() { va.push_back(key); joyb.joy_button.button_index=JOY_DPAD_UP; va.push_back(joyb); - set("input/ui_up",va); + GLOBAL_DEF("input/ui_up",va); input_presets.push_back("input/ui_up"); va=Array(); @@ -1531,36 +1543,35 @@ Globals::Globals() { va.push_back(key); joyb.joy_button.button_index=JOY_DPAD_DOWN; va.push_back(joyb); - set("input/ui_down",va); + GLOBAL_DEF("input/ui_down",va); input_presets.push_back("input/ui_down"); va=Array(); key.key.scancode=KEY_PAGEUP; va.push_back(key); - set("input/ui_page_up",va); + GLOBAL_DEF("input/ui_page_up",va); input_presets.push_back("input/ui_page_up"); va=Array(); key.key.scancode=KEY_PAGEDOWN; va.push_back(key); - set("input/ui_page_down",va); + GLOBAL_DEF("input/ui_page_down",va); input_presets.push_back("input/ui_page_down"); -// set("display/orientation", "landscape"); +// GLOBAL_DEF("display/handheld/orientation", "landscape"); - custom_prop_info["display/orientation"]=PropertyInfo(Variant::STRING,"display/orientation",PROPERTY_HINT_ENUM,"landscape,portrait,reverse_landscape,reverse_portrait,sensor_landscape,sensor_portrait,sensor"); - custom_prop_info["render/mipmap_policy"]=PropertyInfo(Variant::INT,"render/mipmap_policy",PROPERTY_HINT_ENUM,"Allow,Allow For Po2,Disallow"); - custom_prop_info["render/thread_model"]=PropertyInfo(Variant::INT,"render/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["display/handheld/orientation"]=PropertyInfo(Variant::STRING,"display/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"); - set("debug/profiler_max_functions",16384); + GLOBAL_DEF("debug/profiler/max_functions",16384); using_datapack=false; } -Globals::~Globals() { +GlobalConfig::~GlobalConfig() { singleton=NULL; } diff --git a/core/globals.h b/core/globals.h index 67937c56d84..faf077f2a54 100644 --- a/core/globals.h +++ b/core/globals.h @@ -37,9 +37,9 @@ */ -class Globals : public Object { +class GlobalConfig : public Object { - GDCLASS( Globals, Object ); + GDCLASS( GlobalConfig, Object ); _THREAD_SAFE_CLASS_ public: @@ -62,6 +62,7 @@ protected: int order; bool persist; Variant variant; + Variant initial; bool hide_from_editor; bool overrided; VariantContainer(){ order=0; hide_from_editor=false; persist=false; overrided=false; } @@ -82,7 +83,7 @@ protected: bool _get(const StringName& p_name,Variant &r_ret) const; void _get_property_list(List *p_list) const; - static Globals *singleton; + static GlobalConfig *singleton; Error _load_settings(const String p_path); Error _load_settings_binary(const String p_path); @@ -109,12 +110,14 @@ public: String localize_path(const String& p_path) const; String globalize_path(const String& p_path) const; - void set_persisting(const String& p_name, bool p_persist); - bool is_persisting(const String& p_name) const; + + void set_initial_value(const String& p_name, const Variant & p_value); + bool property_can_revert(const String& p_name); + Variant property_get_revert(const String& p_name); String get_resource_path() const; - static Globals *get_singleton(); + static GlobalConfig *get_singleton(); void clear(const String& p_name); int get_order(const String& p_name) const; @@ -144,12 +147,14 @@ public: void set_registering_order(bool p_registering); - Globals(); - ~Globals(); + GlobalConfig(); + ~GlobalConfig(); }; //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) + #endif diff --git a/core/input_map.cpp b/core/input_map.cpp index 439bf4b7666..27cd0f5596c 100644 --- a/core/input_map.cpp +++ b/core/input_map.cpp @@ -241,7 +241,7 @@ void InputMap::load_from_globals() { input_map.clear();; List pinfo; - Globals::get_singleton()->get_property_list(&pinfo); + GlobalConfig::get_singleton()->get_property_list(&pinfo); for(List::Element *E=pinfo.front();E;E=E->next()) { const PropertyInfo &pi=E->get(); @@ -253,7 +253,7 @@ void InputMap::load_from_globals() { add_action(name); - Array va = Globals::get_singleton()->get(pi.name);; + Array va = GlobalConfig::get_singleton()->get(pi.name);; for(int i=0;i p_data) { } String name; - if (Globals::get_singleton()) - name = Globals::get_singleton()->globalize_path(p_name); + if (GlobalConfig::get_singleton()) + name = GlobalConfig::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 3516ad88080..19076b57be4 100644 --- a/core/io/file_access_network.cpp +++ b/core/io/file_access_network.cpp @@ -528,6 +528,14 @@ uint64_t FileAccessNetwork::_get_modified_time(const String& p_file){ } +void FileAccessNetwork::configure() { + + GLOBAL_DEF("network/remote_fs/page_size",65536); + GLOBAL_DEF("network/remote_fs/page_read_ahead",4); + GLOBAL_DEF("network/remote_fs/max_pages",20); + +} + FileAccessNetwork::FileAccessNetwork() { eof_flag=false; @@ -541,9 +549,9 @@ FileAccessNetwork::FileAccessNetwork() { id=nc->last_id++; nc->accesses[id]=this; nc->unlock_mutex(); - page_size = GLOBAL_DEF("remote_fs/page_size",65536); - read_ahead = GLOBAL_DEF("remote_fs/page_read_ahead",4); - max_pages = GLOBAL_DEF("remote_fs/max_pages",20); + page_size = GLOBAL_GET("network/remote_fs/page_size"); + read_ahead = GLOBAL_GET("network/remote_fs/page_read_ahead"); + max_pages = GLOBAL_GET("network/remote_fs/max_pages"); last_activity_val=0; waiting_on_page=-1; last_page=-1; diff --git a/core/io/file_access_network.h b/core/io/file_access_network.h index 867991bcbee..4dbfb04b10a 100644 --- a/core/io/file_access_network.h +++ b/core/io/file_access_network.h @@ -162,6 +162,8 @@ public: virtual uint64_t _get_modified_time(const String& p_file); + static void configure(); + FileAccessNetwork(); ~FileAccessNetwork(); }; diff --git a/core/io/packet_peer.cpp b/core/io/packet_peer.cpp index 1d05e95010b..720e912e719 100644 --- a/core/io/packet_peer.cpp +++ b/core/io/packet_peer.cpp @@ -265,7 +265,8 @@ void PacketPeerStream::set_input_buffer_max_size(int p_max_size) { PacketPeerStream::PacketPeerStream() { - int rbsize=GLOBAL_DEF( "core/packet_stream_peer_max_buffer_po2",(16)); + int rbsize=GLOBAL_GET( "network/packets/packet_stream_peer_max_buffer_po2"); + ring_buffer.resize(rbsize); temp_buffer.resize(1<& p_peer); void set_input_buffer_max_size(int p_max_size); PacketPeerStream(); diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index 5328bb68fe3..512031b1282 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -355,7 +355,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=Globals::get_singleton()->localize_path(res_path.get_base_dir().plus_file(path)); + path=GlobalConfig::get_singleton()->localize_path(res_path.get_base_dir().plus_file(path)); } @@ -385,7 +385,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=Globals::get_singleton()->localize_path(res_path.get_base_dir().plus_file(path)); + path=GlobalConfig::get_singleton()->localize_path(res_path.get_base_dir().plus_file(path)); } @@ -1047,7 +1047,7 @@ Ref ResourceFormatLoaderBinary::load_interactive(cons } Ref ria = memnew( ResourceInteractiveLoaderBinary ); - ria->local_path=Globals::get_singleton()->localize_path(p_path); + ria->local_path=GlobalConfig::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); @@ -1102,7 +1102,7 @@ Error ResourceFormatLoaderBinary::load_import_metadata(const String &p_path, Ref } Ref ria = memnew( ResourceInteractiveLoaderBinary ); - ria->local_path=Globals::get_singleton()->localize_path(p_path); + ria->local_path=GlobalConfig::get_singleton()->localize_path(p_path); ria->res_path=ria->local_path; // ria->set_local_path( Globals::get_singleton()->localize_path(p_path) ); ria->recognize(f); @@ -1147,7 +1147,7 @@ void ResourceFormatLoaderBinary::get_dependencies(const String& p_path,List ria = memnew( ResourceInteractiveLoaderBinary ); - ria->local_path=Globals::get_singleton()->localize_path(p_path); + ria->local_path=GlobalConfig::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); @@ -1237,7 +1237,7 @@ Error ResourceFormatLoaderBinary::rename_dependencies(const String &p_path,const } Ref ria = memnew( ResourceInteractiveLoaderBinary ); - ria->local_path=Globals::get_singleton()->localize_path(p_path); + ria->local_path=GlobalConfig::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) ); @@ -1372,7 +1372,7 @@ String ResourceFormatLoaderBinary::get_resource_type(const String &p_path) const } Ref ria = memnew( ResourceInteractiveLoaderBinary ); - ria->local_path=Globals::get_singleton()->localize_path(p_path); + ria->local_path=GlobalConfig::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); @@ -2192,7 +2192,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 = Globals::get_singleton()->localize_path(p_path); + String local_path = GlobalConfig::get_singleton()->localize_path(p_path); ResourceFormatSaverBinaryInstance saver; return saver.save(local_path,p_resource,p_flags); diff --git a/core/io/resource_format_xml.cpp b/core/io/resource_format_xml.cpp index 7bb9e2efb79..d4808d47419 100644 --- a/core/io/resource_format_xml.cpp +++ b/core/io/resource_format_xml.cpp @@ -467,7 +467,7 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name) path=path.replace("local://",local_path+"::"); else if (path.find("://")==-1 && path.is_rel_path()) { // path is relative to file being loaded, so convert to a resource path - path=Globals::get_singleton()->localize_path(local_path.get_base_dir().plus_file(path)); + path=GlobalConfig::get_singleton()->localize_path(local_path.get_base_dir().plus_file(path)); } @@ -1425,7 +1425,7 @@ Error ResourceInteractiveLoaderXML::poll() { if (path.find("://")==-1 && path.is_rel_path()) { // path is relative to file being loaded, so convert to a resource path - path=Globals::get_singleton()->localize_path(local_path.get_base_dir().plus_file(path)); + path=GlobalConfig::get_singleton()->localize_path(local_path.get_base_dir().plus_file(path)); } if (remaps.has(path)) { @@ -1622,7 +1622,7 @@ void ResourceInteractiveLoaderXML::get_dependencies(FileAccess *f,List * if (path.find("://")==-1 && path.is_rel_path()) { // path is relative to file being loaded, so convert to a resource path - path=Globals::get_singleton()->localize_path(local_path.get_base_dir().plus_file(path)); + path=GlobalConfig::get_singleton()->localize_path(local_path.get_base_dir().plus_file(path)); } if (path.ends_with("*")) { @@ -1760,7 +1760,7 @@ Error ResourceInteractiveLoaderXML::rename_dependencies(FileAccess *p_f, const S } Ref ria = memnew( ResourceInteractiveLoaderXML ); - ria->local_path=Globals::get_singleton()->localize_path(p_path); + ria->local_path=GlobalConfig::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) ); @@ -1924,7 +1924,7 @@ Ref ResourceFormatLoaderXML::load_interactive(const S } Ref ria = memnew( ResourceInteractiveLoaderXML ); - ria->local_path=Globals::get_singleton()->localize_path(p_path); + ria->local_path=GlobalConfig::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); @@ -1989,7 +1989,7 @@ String ResourceFormatLoaderXML::get_resource_type(const String &p_path) const{ } Ref ria = memnew( ResourceInteractiveLoaderXML ); - ria->local_path=Globals::get_singleton()->localize_path(p_path); + ria->local_path=GlobalConfig::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); @@ -2006,7 +2006,7 @@ void ResourceFormatLoaderXML::get_dependencies(const String& p_path,List } Ref ria = memnew( ResourceInteractiveLoaderXML ); - ria->local_path=Globals::get_singleton()->localize_path(p_path); + ria->local_path=GlobalConfig::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); @@ -2023,7 +2023,7 @@ Error ResourceFormatLoaderXML::rename_dependencies(const String &p_path,const Ma } Ref ria = memnew( ResourceInteractiveLoaderXML ); - ria->local_path=Globals::get_singleton()->localize_path(p_path); + ria->local_path=GlobalConfig::get_singleton()->localize_path(p_path); ria->res_path=ria->local_path; // ria->set_local_path( Globals::get_singleton()->localize_path(p_path) ); return ria->rename_dependencies(f,p_path,p_map); @@ -2716,7 +2716,7 @@ Error ResourceFormatSaverXMLInstance::save(const String &p_path,const RES& p_res ERR_FAIL_COND_V( err, ERR_CANT_OPEN ); FileAccessRef _fref(f); - local_path = Globals::get_singleton()->localize_path(p_path); + local_path = GlobalConfig::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/core/io/resource_loader.cpp b/core/io/resource_loader.cpp index f299a75d855..cc3c8ce0062 100644 --- a/core/io/resource_loader.cpp +++ b/core/io/resource_loader.cpp @@ -164,7 +164,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 = Globals::get_singleton()->localize_path(p_path); + local_path = GlobalConfig::get_singleton()->localize_path(p_path); local_path=find_complete_path(local_path,p_type_hint); ERR_FAIL_COND_V(local_path=="",RES()); @@ -228,7 +228,7 @@ Ref ResourceLoader::load_import_metadata(const String &p if (p_path.is_rel_path()) local_path="res://"+p_path; else - local_path = Globals::get_singleton()->localize_path(p_path); + local_path = GlobalConfig::get_singleton()->localize_path(p_path); String extension=p_path.extension(); Ref ret; @@ -307,7 +307,7 @@ Ref ResourceLoader::load_interactive(const String &p_ if (p_path.is_rel_path()) local_path="res://"+p_path; else - local_path = Globals::get_singleton()->localize_path(p_path); + local_path = GlobalConfig::get_singleton()->localize_path(p_path); local_path=find_complete_path(local_path,p_type_hint); ERR_FAIL_COND_V(local_path=="",Ref()); @@ -381,7 +381,7 @@ void ResourceLoader::get_dependencies(const String& p_path, List *p_depe if (p_path.is_rel_path()) local_path="res://"+p_path; else - local_path = Globals::get_singleton()->localize_path(p_path); + local_path = GlobalConfig::get_singleton()->localize_path(p_path); String remapped_path = PathRemap::get_singleton()->get_remap(local_path); @@ -406,7 +406,7 @@ Error ResourceLoader::rename_dependencies(const String &p_path,const Maplocalize_path(p_path); + local_path = GlobalConfig::get_singleton()->localize_path(p_path); String remapped_path = PathRemap::get_singleton()->get_remap(local_path); @@ -434,7 +434,7 @@ String ResourceLoader::guess_full_filename(const String &p_path,const String& p_ if (p_path.is_rel_path()) local_path="res://"+p_path; else - local_path = Globals::get_singleton()->localize_path(p_path); + local_path = GlobalConfig::get_singleton()->localize_path(p_path); return find_complete_path(local_path,p_type); @@ -446,7 +446,7 @@ String ResourceLoader::get_resource_type(const String &p_path) { if (p_path.is_rel_path()) local_path="res://"+p_path; else - local_path = Globals::get_singleton()->localize_path(p_path); + local_path = GlobalConfig::get_singleton()->localize_path(p_path); String remapped_path = PathRemap::get_singleton()->get_remap(local_path); String extension=remapped_path.extension(); diff --git a/core/io/resource_saver.cpp b/core/io/resource_saver.cpp index 704603f9ff7..9081adaa8ff 100644 --- a/core/io/resource_saver.cpp +++ b/core/io/resource_saver.cpp @@ -64,7 +64,7 @@ Error ResourceSaver::save(const String &p_path,const RES& p_resource,uint32_t p_ String old_path=p_resource->get_path(); - String local_path=Globals::get_singleton()->localize_path(p_path); + String local_path=GlobalConfig::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 11fe2337f61..fe46e1671cd 100644 --- a/core/message_queue.cpp +++ b/core/message_queue.cpp @@ -398,7 +398,7 @@ MessageQueue::MessageQueue() { buffer_end=0; buffer_max_used=0; - buffer_size=GLOBAL_DEF( "core/message_queue_size_kb", DEFAULT_QUEUE_SIZE_KB ); + buffer_size=GLOBAL_DEF( "memory/buffers/message_queue_max_size_kb", DEFAULT_QUEUE_SIZE_KB ); buffer_size*=1024; buffer = memnew_arr( uint8_t, buffer_size ); } diff --git a/core/os/dir_access.cpp b/core/os/dir_access.cpp index 7b60baeeb77..804fe15c39d 100644 --- a/core/os/dir_access.cpp +++ b/core/os/dir_access.cpp @@ -37,7 +37,7 @@ String DirAccess::_get_root_path() const { switch(_access_type) { - case ACCESS_RESOURCES: return Globals::get_singleton()->get_resource_path(); + case ACCESS_RESOURCES: return GlobalConfig::get_singleton()->get_resource_path(); case ACCESS_USERDATA: return OS::get_singleton()->get_data_dir(); default: return ""; } @@ -204,10 +204,10 @@ String DirAccess::fix_path(String p_path) const { case ACCESS_RESOURCES: { - if (Globals::get_singleton()) { + if (GlobalConfig::get_singleton()) { if (p_path.begins_with("res://")) { - String resource_path = Globals::get_singleton()->get_resource_path(); + String resource_path = GlobalConfig::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 388c598ac38..06723c51319 100644 --- a/core/os/file_access.cpp +++ b/core/os/file_access.cpp @@ -139,10 +139,10 @@ String FileAccess::fix_path(const String& p_path) const { case ACCESS_RESOURCES: { - if (Globals::get_singleton()) { + if (GlobalConfig::get_singleton()) { if (r_path.begins_with("res://")) { - String resource_path = Globals::get_singleton()->get_resource_path(); + String resource_path = GlobalConfig::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 c662fafe790..259108802f6 100644 --- a/core/os/input.cpp +++ b/core/os/input.cpp @@ -97,7 +97,7 @@ void Input::get_argument_options(const StringName& p_function,int p_idx,List pinfo; - Globals::get_singleton()->get_property_list(&pinfo); + GlobalConfig::get_singleton()->get_property_list(&pinfo); for(List::Element *E=pinfo.front();E;E=E->next()) { const PropertyInfo &pi=E->get(); diff --git a/core/os/os.cpp b/core/os/os.cpp index f615e54430e..75773a9076a 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -297,7 +297,7 @@ String OS::get_locale() const { String OS::get_resource_dir() const { - return Globals::get_singleton()->get_resource_path(); + return GlobalConfig::get_singleton()->get_resource_path(); } @@ -307,7 +307,7 @@ String OS::get_system_dir(SystemDir p_dir) const { } String OS::get_safe_application_name() const { - String an = Globals::get_singleton()->get("application/name"); + String an = GlobalConfig::get_singleton()->get("application/name"); Vector invalid_char = String("\\ / : * ? \" < > |").split(" "); for (int i=0;i remaps = Globals::get_singleton()->get("remap/all"); + DVector remaps = GlobalConfig::get_singleton()->get("remap/all"); { int rlen = remaps.size(); @@ -141,7 +141,7 @@ void PathRemap::load_remaps() { // platform remaps second, so override - remaps = Globals::get_singleton()->get("remap/"+OS::get_singleton()->get_name()); + remaps = GlobalConfig::get_singleton()->get("remap/"+OS::get_singleton()->get_name()); // remaps = Globals::get_singleton()->get("remap/PSP"); { int rlen = remaps.size(); @@ -160,9 +160,9 @@ void PathRemap::load_remaps() { //locale based remaps - if (Globals::get_singleton()->has("locale/translation_remaps")) { + if (GlobalConfig::get_singleton()->has("locale/translation_remaps")) { - Dictionary remaps = Globals::get_singleton()->get("locale/translation_remaps"); + Dictionary remaps = GlobalConfig::get_singleton()->get("locale/translation_remaps"); List rk; remaps.get_key_list(&rk); for(List::Element *E=rk.front();E;E=E->next()) { diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp index 0e1dec075bb..e3c18217e9b 100644 --- a/core/register_core_types.cpp +++ b/core/register_core_types.cpp @@ -170,23 +170,30 @@ void register_core_types() { +} + +void register_core_settings() { + //since in register core types, globals may not e present + GLOBAL_DEF( "network/packets/packet_stream_peer_max_buffer_po2",(16)); + } void register_core_singletons() { - Globals::get_singleton()->add_singleton( Globals::Singleton("Globals",Globals::get_singleton()) ); - Globals::get_singleton()->add_singleton( Globals::Singleton("IP",IP::get_singleton()) ); - Globals::get_singleton()->add_singleton( Globals::Singleton("Geometry",_Geometry::get_singleton()) ); - Globals::get_singleton()->add_singleton( Globals::Singleton("ResourceLoader",_ResourceLoader::get_singleton()) ); - Globals::get_singleton()->add_singleton( Globals::Singleton("ResourceSaver",_ResourceSaver::get_singleton()) ); - Globals::get_singleton()->add_singleton( Globals::Singleton("PathRemap",PathRemap::get_singleton() ) ); - Globals::get_singleton()->add_singleton( Globals::Singleton("OS",_OS::get_singleton() ) ); - Globals::get_singleton()->add_singleton( Globals::Singleton("ClassDB",_classdb ) ); - Globals::get_singleton()->add_singleton( Globals::Singleton("Marshalls",_Marshalls::get_singleton() ) ); - Globals::get_singleton()->add_singleton( Globals::Singleton("TranslationServer",TranslationServer::get_singleton() ) ); - Globals::get_singleton()->add_singleton( Globals::Singleton("TS",TranslationServer::get_singleton() ) ); - Globals::get_singleton()->add_singleton( Globals::Singleton("Input",Input::get_singleton() ) ); - Globals::get_singleton()->add_singleton( Globals::Singleton("InputMap",InputMap::get_singleton() ) ); + + 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("PathRemap",PathRemap::get_singleton() ) ); + GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("OS",_OS::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("TS",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() ) ); } diff --git a/core/register_core_types.h b/core/register_core_types.h index c9e0d276867..c664d0ebf4b 100644 --- a/core/register_core_types.h +++ b/core/register_core_types.h @@ -34,6 +34,7 @@ */ void register_core_types(); +void register_core_settings(); void register_core_singletons(); void unregister_core_types(); diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp index c1d78f129ad..62fcd5247f0 100644 --- a/core/script_debugger_remote.cpp +++ b/core/script_debugger_remote.cpp @@ -134,7 +134,7 @@ void ScriptDebuggerRemote::debug(ScriptLanguage *p_script,bool p_can_continue) { ERR_FAIL(); } - OS::get_singleton()->enable_for_stealing_focus(Globals::get_singleton()->get("editor_pid")); + OS::get_singleton()->enable_for_stealing_focus(GlobalConfig::get_singleton()->get("editor_pid")); packet_peer_stream->put_var("debug_enter"); packet_peer_stream->put_var(2); @@ -1009,12 +1009,12 @@ ScriptDebuggerRemote::ScriptDebuggerRemote() { phl.userdata=this; add_print_handler(&phl); requested_quit=false; - performance = Globals::get_singleton()->get_singleton_object("Performance"); + performance = GlobalConfig::get_singleton()->get_singleton_object("Performance"); last_perf_time=0; poll_every=0; request_scene_tree=NULL; live_edit_funcs=NULL; - max_cps = GLOBAL_DEF("debug/max_remote_stdout_chars_per_second",2048); + max_cps = GLOBAL_DEF("network/debug/max_remote_stdout_chars_per_second",2048); char_count=0; msec_count=0; last_msec=0; @@ -1024,7 +1024,7 @@ ScriptDebuggerRemote::ScriptDebuggerRemote() { eh.userdata=this; add_error_handler(&eh); - profile_info.resize(CLAMP(int(Globals::get_singleton()->get("debug/profiler_max_functions")),128,65535)); + profile_info.resize(CLAMP(int(GlobalConfig::get_singleton()->get("debug/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 9ac1d6a31ee..8e58b45565e 100644 --- a/core/translation.cpp +++ b/core/translation.cpp @@ -1047,8 +1047,8 @@ TranslationServer *TranslationServer::singleton=NULL; bool TranslationServer::_load_translations(const String& p_from) { - if (Globals::get_singleton()->has(p_from)) { - DVector translations=Globals::get_singleton()->get(p_from); + if (GlobalConfig::get_singleton()->has(p_from)) { + DVector translations=GlobalConfig::get_singleton()->get(p_from); int tcount=translations.size(); @@ -1089,7 +1089,7 @@ void TranslationServer::setup() { options+=locale_list[idx]; idx++; } - Globals::get_singleton()->set_custom_property_info("locale/fallback",PropertyInfo(Variant::STRING,"locale/fallback",PROPERTY_HINT_ENUM,options)); + GlobalConfig::get_singleton()->set_custom_property_info("locale/fallback",PropertyInfo(Variant::STRING,"locale/fallback",PROPERTY_HINT_ENUM,options)); } #endif //load translations diff --git a/core/undo_redo.cpp b/core/undo_redo.cpp index 5bdc8ef72d6..acb262d4005 100644 --- a/core/undo_redo.cpp +++ b/core/undo_redo.cpp @@ -27,7 +27,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "undo_redo.h" - +#include "os/os.h" void UndoRedo::_discard_redo() { @@ -54,12 +54,14 @@ void UndoRedo::_discard_redo() { void UndoRedo::create_action(const String& p_name,MergeMode p_mode) { + uint32_t ticks = OS::get_singleton()->get_ticks_msec(); + if (action_level==0) { _discard_redo(); // Check if the merge operation is valid - if (p_mode!=MERGE_DISABLE && actions.size() && actions[actions.size()-1].name==p_name) { + if (p_mode!=MERGE_DISABLE && actions.size() && actions[actions.size()-1].name==p_name && actions[actions.size()-1].last_tick+800 > ticks) { current_action=actions.size()-2; @@ -83,12 +85,15 @@ void UndoRedo::create_action(const String& p_name,MergeMode p_mode) { } } + actions[actions.size()-1].last_tick=ticks; + merge_mode=p_mode; } else { Action new_action; new_action.name=p_name; + new_action.last_tick=ticks; actions.push_back(new_action); merge_mode=MERGE_DISABLE; diff --git a/core/undo_redo.h b/core/undo_redo.h index 3d14dd9ee22..7664cf7cb56 100644 --- a/core/undo_redo.h +++ b/core/undo_redo.h @@ -76,6 +76,7 @@ private: String name; List do_ops; List undo_ops; + uint64_t last_tick; }; Vector actions; diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp index 32e8a4de823..b49f8171885 100644 --- a/drivers/gles2/rasterizer_gles2.cpp +++ b/drivers/gles2/rasterizer_gles2.cpp @@ -4205,7 +4205,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("display/use_2d_pixel_snap",false)); - shadow_filter=ShadowFilterTechnique(int(Globals::get_singleton()->get("rasterizer/shadow_filter"))); + shadow_filter=ShadowFilterTechnique(int(GlobalConfig::get_singleton()->get("rasterizer/shadow_filter"))); #endif canvas_shader.set_conditional(CanvasShaderGLES2::SHADOW_PCF5,shadow_filter==SHADOW_FILTER_PCF5); @@ -7307,7 +7307,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 = Globals::get_singleton()->get("render/default_clear_color"); + bgcolor = GlobalConfig::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); @@ -11452,7 +11452,7 @@ RasterizerGLES2::RasterizerGLES2(bool p_compress_arrays,bool p_keep_ram_copy,boo 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))); - Globals::get_singleton()->set_custom_property_info("rasterizer/shadow_filter",PropertyInfo(Variant::INT,"rasterizer/shadow_filter",PROPERTY_HINT_ENUM,"None,PCF5,PCF13,ESM")); + GlobalConfig::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_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp index 0998d9c423c..7d5f488edc7 100644 --- a/drivers/gles3/rasterizer_gles3.cpp +++ b/drivers/gles3/rasterizer_gles3.cpp @@ -334,9 +334,9 @@ void RasterizerGLES3::make_current() { void RasterizerGLES3::register_config() { GLOBAL_DEF("rendering/gles3/render_architecture",0); - Globals::get_singleton()->set_custom_property_info("rendering/gles3/render_architecture",PropertyInfo(Variant::INT,"",PROPERTY_HINT_ENUM,"Desktop,Mobile")); - GLOBAL_DEF("rendering/gles3/use_nearest_mipmap_filter",false); - GLOBAL_DEF("rendering/gles3/anisotropic_filter_level",4.0); + GlobalConfig::get_singleton()->set_custom_property_info("rendering/gles3/render_architecture",PropertyInfo(Variant::INT,"",PROPERTY_HINT_ENUM,"Desktop,Mobile")); + GLOBAL_DEF("rendering/quality/use_nearest_mipmap_filter",false); + GLOBAL_DEF("rendering/quality/anisotropic_filter_level",4.0); } diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 17e429657bf..5f82e1691bc 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -4775,7 +4775,7 @@ void RasterizerSceneGLES3::initialize() { { //directional light shadow directional_shadow.light_count=0; - directional_shadow.size=nearest_power_of_2(GLOBAL_DEF("renderer/directional_shadow_size",2048)); + directional_shadow.size=nearest_power_of_2(GLOBAL_DEF("rendering/shadows/directional_shadow_size",2048)); glGenFramebuffers(1,&directional_shadow.fbo); glBindFramebuffer(GL_FRAMEBUFFER,directional_shadow.fbo); glGenTextures(1,&directional_shadow.depth); @@ -4847,7 +4847,7 @@ void RasterizerSceneGLES3::initialize() { } GLOBAL_DEF("rendering/gles3/shadow_filter_mode",1); - Globals::get_singleton()->set_custom_property_info("rendering/gles3/shadow_filter_mode",PropertyInfo(Variant::INT,"rendering/gles3/shadow_filter_mode",PROPERTY_HINT_ENUM,"Disabled,PCF5,PCF13")); + GlobalConfig::get_singleton()->set_custom_property_info("rendering/gles3/shadow_filter_mode",PropertyInfo(Variant::INT,"rendering/gles3/shadow_filter_mode",PROPERTY_HINT_ENUM,"Disabled,PCF5,PCF13")); shadow_filter_mode=SHADOW_FILTER_NEAREST; { //reflection cubemaps @@ -4913,7 +4913,7 @@ void RasterizerSceneGLES3::initialize() { { - uint32_t immediate_buffer_size=GLOBAL_DEF("rendering/gles3/immediate_buffer_size_kb",2048); + uint32_t immediate_buffer_size=GLOBAL_DEF("rendering/buffers/immediate_buffer_size_kb",2048); glGenBuffers(1, &state.immediate_buffer); glBindBuffer(GL_ARRAY_BUFFER, state.immediate_buffer); @@ -4944,13 +4944,13 @@ void RasterizerSceneGLES3::initialize() { { - GLOBAL_DEF("rendering/gles3/subsurface_scattering/quality",1); - Globals::get_singleton()->set_custom_property_info("rendering/gles3/subsurface_scattering/quality",PropertyInfo(Variant::INT,"rendering/gles3/subsurface_scattering/quality",PROPERTY_HINT_ENUM,"Low,Medium,High")); - GLOBAL_DEF("rendering/gles3/subsurface_scattering/max_size",1.0); - Globals::get_singleton()->set_custom_property_info("rendering/gles3/subsurface_scattering/max_size",PropertyInfo(Variant::INT,"rendering/gles3/subsurface_scattering/max_size",PROPERTY_HINT_RANGE,"0.01,8,0.01")); - GLOBAL_DEF("rendering/gles3/subsurface_scattering/follow_surface",false); + GLOBAL_DEF("rendering/ssurf_scattering/quality",1); + GlobalConfig::get_singleton()->set_custom_property_info("rendering/ssurf_scattering/quality",PropertyInfo(Variant::INT,"rendering/ssurf_scattering/quality",PROPERTY_HINT_ENUM,"Low,Medium,High")); + GLOBAL_DEF("rendering/ssurf_scattering/max_size",1.0); + GlobalConfig::get_singleton()->set_custom_property_info("rendering/ssurf_scattering/max_size",PropertyInfo(Variant::INT,"rendering/ssurf_scattering/max_size",PROPERTY_HINT_RANGE,"0.01,8,0.01")); + GLOBAL_DEF("rendering/ssurf_scattering/follow_surface",false); - GLOBAL_DEF("rendering/gles3/high_quality_vct_gi",true); + GLOBAL_DEF("rendering/reflections/high_quality_vct_gi",true); } @@ -4987,13 +4987,13 @@ void RasterizerSceneGLES3::initialize() { void RasterizerSceneGLES3::iteration() { - shadow_filter_mode=ShadowFilterMode(int(Globals::get_singleton()->get("rendering/gles3/shadow_filter_mode"))); - subsurface_scatter_follow_surface=Globals::get_singleton()->get("rendering/gles3/subsurface_scattering/follow_surface"); - subsurface_scatter_quality=SubSurfaceScatterQuality(int(Globals::get_singleton()->get("rendering/gles3/subsurface_scattering/quality"))); - subsurface_scatter_size=Globals::get_singleton()->get("rendering/gles3/subsurface_scattering/max_size"); + shadow_filter_mode=ShadowFilterMode(int(GlobalConfig::get_singleton()->get("rendering/gles3/shadow_filter_mode"))); + subsurface_scatter_follow_surface=GlobalConfig::get_singleton()->get("rendering/gles3/subsurface_scattering/follow_surface"); + subsurface_scatter_quality=SubSurfaceScatterQuality(int(GlobalConfig::get_singleton()->get("rendering/gles3/subsurface_scattering/quality"))); + subsurface_scatter_size=GlobalConfig::get_singleton()->get("rendering/gles3/subsurface_scattering/max_size"); - state.scene_shader.set_conditional(SceneShaderGLES3::VCT_QUALITY_HIGH,Globals::get_singleton()->get("rendering/gles3/high_quality_vct_gi")); + state.scene_shader.set_conditional(SceneShaderGLES3::VCT_QUALITY_HIGH,GlobalConfig::get_singleton()->get("rendering/gles3/high_quality_vct_gi")); } void RasterizerSceneGLES3::finalize(){ diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index c632d1c2daf..689d7ab8c4a 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -6317,7 +6317,7 @@ void RasterizerStorageGLES3::initialize() { } config.shrink_textures_x2=false; - config.use_fast_texture_filter=int(Globals::get_singleton()->get("rendering/gles3/use_nearest_mipmap_filter")); + config.use_fast_texture_filter=int(GlobalConfig::get_singleton()->get("rendering/quality/use_nearest_mipmap_filter")); config.use_anisotropic_filter = config.extensions.has("GL_EXT_texture_filter_anisotropic"); 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"); @@ -6338,7 +6338,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(Globals::get_singleton()->get("rendering/gles3/anisotropic_filter_level")),config.anisotropic_level); + config.anisotropic_level=MIN(int(GlobalConfig::get_singleton()->get("rendering/quality/anisotropic_filter_level")),config.anisotropic_level); } @@ -6455,7 +6455,7 @@ void RasterizerStorageGLES3::initialize() { { //transform feedback buffers - uint32_t xf_feedback_size = GLOBAL_DEF("rendering/gles3/blend_shape_max_buffer_size_kb",4096); + uint32_t xf_feedback_size = GLOBAL_DEF("rendering/buffers/blend_shape_max_buffer_size_kb",4096); for(int i=0;i<2;i++) { glGenBuffers(1,&resources.transform_feedback_buffers[i]); diff --git a/drivers/png/resource_saver_png.cpp b/drivers/png/resource_saver_png.cpp index bb5a034b6b7..b06b02b2001 100644 --- a/drivers/png/resource_saver_png.cpp +++ b/drivers/png/resource_saver_png.cpp @@ -56,9 +56,9 @@ Error ResourceSaverPNG::save(const String &p_path,const RES& p_resource,uint32_t if (err == OK) { - bool global_filter = Globals::get_singleton()->get("image_loader/filter"); - bool global_mipmaps = Globals::get_singleton()->get("image_loader/gen_mipmaps"); - bool global_repeat = Globals::get_singleton()->get("image_loader/repeat"); + bool global_filter = GlobalConfig::get_singleton()->get("image_loader/filter"); + bool global_mipmaps = GlobalConfig::get_singleton()->get("image_loader/gen_mipmaps"); + bool global_repeat = GlobalConfig::get_singleton()->get("image_loader/repeat"); String text; diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index 89fd108476b..f6266c8fc5e 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -472,7 +472,7 @@ String OS_Unix::get_data_dir() const { if (has_environment("HOME")) { - bool use_godot = Globals::get_singleton()->get("application/use_shared_user_dir"); + bool use_godot = GlobalConfig::get_singleton()->get("application/use_shared_user_dir"); if (use_godot) return get_environment("HOME")+"/.godot/app_userdata/"+an; else @@ -480,7 +480,7 @@ String OS_Unix::get_data_dir() const { } } - return Globals::get_singleton()->get_resource_path(); + return GlobalConfig::get_singleton()->get_resource_path(); } diff --git a/main/main.cpp b/main/main.cpp index 6703da8b013..12995f2a14a 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -78,7 +78,7 @@ #include "main/input_default.h" #include "performance.h" -static Globals *globals=NULL; +static GlobalConfig *globals=NULL; static InputMap *input_map=NULL; static bool _start_success=false; static ScriptDebugger *script_debugger=NULL; @@ -207,14 +207,15 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas Thread::_main_thread_id = Thread::get_caller_ID(); - globals = memnew( Globals ); + globals = memnew( GlobalConfig ); input_map = memnew( InputMap ); + register_core_settings(); //here globals is present path_remap = memnew( PathRemap ); translation_server = memnew( TranslationServer ); performance = memnew( Performance ); - globals->add_singleton(Globals::Singleton("Performance",performance)); + globals->add_singleton(GlobalConfig::Singleton("Performance",performance)); MAIN_PRINT("Main: Parse CMDLine"); @@ -538,7 +539,7 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas if (I->next()) { - Globals::get_singleton()->set("editor_scene",game_path=I->next()->get()); + GlobalConfig::get_singleton()->set("editor_scene",game_path=I->next()->get()); } else { goto error; @@ -562,7 +563,7 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas if (I->next()) { int editor_pid=I->next()->get().to_int(); - Globals::get_singleton()->set("editor_pid",editor_pid); + GlobalConfig::get_singleton()->set("editor_pid",editor_pid); N=I->next()->next(); } else { goto error; @@ -592,11 +593,13 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas } - GLOBAL_DEF("debug/max_remote_stdout_chars_per_second",2048); + GLOBAL_DEF("network/debug/max_remote_stdout_chars_per_second",2048); + GLOBAL_DEF("network/debug/remote_port",6007); + if (debug_mode == "remote") { ScriptDebuggerRemote *sdr = memnew( ScriptDebuggerRemote ); - uint16_t debug_port = GLOBAL_DEF("debug/remote_port",6007); + uint16_t debug_port = GLOBAL_GET("network/debug/remote_port"); if (debug_host.find(":")!=-1) { debug_port=debug_host.get_slicec(':',1).to_int(); debug_host=debug_host.get_slicec(':',0); @@ -614,6 +617,7 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas } + FileAccessNetwork::configure(); if (remotefs!="") { @@ -678,10 +682,10 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas use_custom_res=false; } - if (bool(Globals::get_singleton()->get("application/disable_stdout"))) { + if (bool(GlobalConfig::get_singleton()->get("application/disable_stdout"))) { quiet_stdout=true; } - if (bool(Globals::get_singleton()->get("application/disable_stderr"))) { + if (bool(GlobalConfig::get_singleton()->get("application/disable_stderr"))) { _print_error_enabled = false; }; @@ -692,7 +696,7 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas #ifdef TOOLS_ENABLED - if (main_args.size()==0 && (!Globals::get_singleton()->has("application/main_loop_type")) && (!Globals::get_singleton()->has("application/main_scene") || String(Globals::get_singleton()->get("application/main_scene"))=="")) + if (main_args.size()==0 && (!GlobalConfig::get_singleton()->has("application/main_loop_type")) && (!GlobalConfig::get_singleton()->has("application/main_scene") || String(GlobalConfig::get_singleton()->get("application/main_scene"))=="")) use_custom_res=false; //project manager (run without arguments) #endif @@ -703,25 +707,25 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas input_map->load_from_globals(); //keys for game if (video_driver=="") // specified in engine.cfg - video_driver=_GLOBAL_DEF("display/driver",Variant((const char*)OS::get_singleton()->get_video_driver_name(0))); + video_driver=_GLOBAL_DEF("display/driver/name",Variant((const char*)OS::get_singleton()->get_video_driver_name(0))); - if (!force_res && use_custom_res && globals->has("display/width")) - video_mode.width=globals->get("display/width"); - if (!force_res &&use_custom_res && globals->has("display/height")) - video_mode.height=globals->get("display/height"); - if (!editor && (!bool(globals->get("display/allow_hidpi")) || force_lowdpi)) { + if (!force_res && use_custom_res && globals->has("display/window/width")) + video_mode.width=globals->get("display/window/width"); + if (!force_res &&use_custom_res && globals->has("display/window/height")) + video_mode.height=globals->get("display/window/height"); + if (!editor && (!bool(globals->get("display/window/allow_hidpi")) || force_lowdpi)) { OS::get_singleton()->_allow_hidpi=false; } - if (use_custom_res && globals->has("display/fullscreen")) - video_mode.fullscreen=globals->get("display/fullscreen"); - if (use_custom_res && globals->has("display/resizable")) - video_mode.resizable=globals->get("display/resizable"); - if (use_custom_res && globals->has("display/borderless_window")) - video_mode.borderless_window = globals->get("display/borderless_window"); + if (use_custom_res && globals->has("display/window/fullscreen")) + video_mode.fullscreen=globals->get("display/window/fullscreen"); + if (use_custom_res && globals->has("display/window/resizable")) + video_mode.resizable=globals->get("display/window/resizable"); + if (use_custom_res && globals->has("display/window/borderless")) + video_mode.borderless_window = globals->get("display/window/borderless"); - if (!force_res && use_custom_res && globals->has("display/test_width") && globals->has("display/test_height")) { - int tw = globals->get("display/test_width"); - int th = globals->get("display/test_height"); + if (!force_res && use_custom_res && globals->has("display/window/test_width") && globals->has("display/window/test_height")) { + int tw = globals->get("display/window/test_width"); + int th = globals->get("display/window/test_height"); if (tw>0 && th>0) { video_mode.width=tw; video_mode.height=th; @@ -729,19 +733,19 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas } - GLOBAL_DEF("display/width",video_mode.width); - GLOBAL_DEF("display/height",video_mode.height); - GLOBAL_DEF("display/allow_hidpi",false); - GLOBAL_DEF("display/fullscreen",video_mode.fullscreen); - GLOBAL_DEF("display/resizable",video_mode.resizable); - GLOBAL_DEF("display/borderless_window", video_mode.borderless_window); - use_vsync = GLOBAL_DEF("display/use_vsync", use_vsync); - GLOBAL_DEF("display/test_width",0); - GLOBAL_DEF("display/test_height",0); - OS::get_singleton()->_pixel_snap=GLOBAL_DEF("display/use_2d_pixel_snap",false); - OS::get_singleton()->_keep_screen_on=GLOBAL_DEF("display/keep_screen_on",true); + GLOBAL_DEF("display/window/width",video_mode.width); + GLOBAL_DEF("display/window/height",video_mode.height); + GLOBAL_DEF("display/window/allow_hidpi",false); + GLOBAL_DEF("display/window/fullscreen",video_mode.fullscreen); + GLOBAL_DEF("display/window/resizable",video_mode.resizable); + GLOBAL_DEF("display/window/borderless", video_mode.borderless_window); + use_vsync = GLOBAL_DEF("display/window/use_vsync", use_vsync); + GLOBAL_DEF("display/window/test_width",0); + GLOBAL_DEF("display/window/test_height",0); + OS::get_singleton()->_pixel_snap=GLOBAL_DEF("rendering/2d/use_pixel_snap",false); + OS::get_singleton()->_keep_screen_on=GLOBAL_DEF("display/energy_saving/keep_screen_on",true); if (rtm==-1) { - rtm=GLOBAL_DEF("render/thread_model",OS::RENDER_THREAD_SAFE); + rtm=GLOBAL_DEF("rendering/threads/thread_model",OS::RENDER_THREAD_SAFE); if (rtm>=1) //hack for now rtm=1; @@ -796,7 +800,7 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas } { - String orientation = GLOBAL_DEF("display/orientation","landscape"); + String orientation = GLOBAL_DEF("display/handheld/orientation","landscape"); if (orientation=="portrait") OS::get_singleton()->set_screen_orientation(OS::SCREEN_PORTRAIT); @@ -815,11 +819,13 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas } - OS::get_singleton()->set_iterations_per_second(GLOBAL_DEF("physics/fixed_fps",60)); - OS::get_singleton()->set_target_fps(GLOBAL_DEF("debug/force_fps",0)); + OS::get_singleton()->set_iterations_per_second(GLOBAL_DEF("physics/common/fixed_fps",60)); + OS::get_singleton()->set_target_fps(GLOBAL_DEF("debug/fps/force_fps",0)); + + GLOBAL_DEF("debug/stdout/print_fps", OS::get_singleton()->is_stdout_verbose()); if (!OS::get_singleton()->_verbose_stdout) //overrided - OS::get_singleton()->_verbose_stdout=GLOBAL_DEF("debug/verbose_stdout",false); + OS::get_singleton()->_verbose_stdout=GLOBAL_DEF("debug/stdout/verbose_stdout",false); if (frame_delay==0) { frame_delay=GLOBAL_DEF("application/frame_delay_msec",0); @@ -829,7 +835,7 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas message_queue = memnew( MessageQueue ); - Globals::get_singleton()->register_global_defaults(); + GlobalConfig::get_singleton()->register_global_defaults(); if (p_second_phase) return setup2(); @@ -918,10 +924,13 @@ Error Main::setup2() { path_remap->load_remaps(); + Color clear = GLOBAL_DEF("rendering/viewport/default_clear_color",Color(0.3,0.3,0.3)); + VisualServer::get_singleton()->set_default_clear_color(clear); + if (show_logo) { //boot logo! String boot_logo_path=GLOBAL_DEF("application/boot_splash",String()); bool boot_logo_scale=GLOBAL_DEF("application/boot_splash_fullsize",true); - Globals::get_singleton()->set_custom_property_info("application/boot_splash",PropertyInfo(Variant::STRING,"application/boot_splash",PROPERTY_HINT_FILE,"*.png")); + GlobalConfig::get_singleton()->set_custom_property_info("application/boot_splash",PropertyInfo(Variant::STRING,"application/boot_splash",PROPERTY_HINT_FILE,"*.png")); Image boot_logo; @@ -936,13 +945,11 @@ Error Main::setup2() { if (!boot_logo.empty()) { OS::get_singleton()->_msec_splash=OS::get_singleton()->get_ticks_msec(); - Color clear = GLOBAL_DEF("render/default_clear_color",Color(0.3,0.3,0.3)); - VisualServer::get_singleton()->set_default_clear_color(clear); Color boot_bg = GLOBAL_DEF("application/boot_bg_color", clear); 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) - // Globals::get_singleton()->set("application/boot_logo",Image()); + // GlobalConfig::get_singleton()->set("application/boot_logo",Image()); #endif } else { @@ -963,13 +970,13 @@ Error Main::setup2() { } MAIN_PRINT("Main: DCC"); - VisualServer::get_singleton()->set_default_clear_color(GLOBAL_DEF("render/default_clear_color",Color(0.3,0.3,0.3))); + VisualServer::get_singleton()->set_default_clear_color(GLOBAL_DEF("rendering/viewport/default_clear_color",Color(0.3,0.3,0.3))); MAIN_PRINT("Main: END"); GLOBAL_DEF("application/icon",String()); - Globals::get_singleton()->set_custom_property_info("application/icon",PropertyInfo(Variant::STRING,"application/icon",PROPERTY_HINT_FILE,"*.png,*.webp")); + GlobalConfig::get_singleton()->set_custom_property_info("application/icon",PropertyInfo(Variant::STRING,"application/icon",PROPERTY_HINT_FILE,"*.png,*.webp")); - if (bool(GLOBAL_DEF("display/emulate_touchscreen",false))) { + if (bool(GLOBAL_DEF("display/handheld/emulate_touchscreen",false))) { if (!OS::get_singleton()->has_touchscreen_ui_hint() && Input::get_singleton() && !editor) { //only if no touchscreen ui hint, set emulation InputDefault *id = Input::get_singleton()->cast_to(); @@ -987,17 +994,17 @@ Error Main::setup2() { register_scene_types(); register_server_types(); - GLOBAL_DEF("display/custom_mouse_cursor",String()); - GLOBAL_DEF("display/custom_mouse_cursor_hotspot",Vector2()); - Globals::get_singleton()->set_custom_property_info("display/custom_mouse_cursor",PropertyInfo(Variant::STRING,"display/custom_mouse_cursor",PROPERTY_HINT_FILE,"*.png,*.webp")); + 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")); - if (String(Globals::get_singleton()->get("display/custom_mouse_cursor"))!=String()) { + if (String(GlobalConfig::get_singleton()->get("display/mouse_cursor/custom_image"))!=String()) { //print_line("use custom cursor"); - Ref cursor=ResourceLoader::load(Globals::get_singleton()->get("display/custom_mouse_cursor")); + Ref cursor=ResourceLoader::load(GlobalConfig::get_singleton()->get("display/mouse_cursor/custom_image")); if (cursor.is_valid()) { // print_line("loaded ok"); - Vector2 hotspot = Globals::get_singleton()->get("display/custom_mouse_cursor_hotspot"); + Vector2 hotspot = GlobalConfig::get_singleton()->get("display/mouse_cursor/custom_image_hotspot"); Input::get_singleton()->set_custom_mouse_cursor(cursor,hotspot); } } @@ -1122,8 +1129,7 @@ bool Main::start() { } } - if (editor) - Globals::get_singleton()->set("editor_active",true); + GLOBAL_DEF("editor/active",editor); String main_loop_type; @@ -1274,9 +1280,9 @@ bool Main::start() { if (!editor) { //standard helpers that can be changed from main config - String stretch_mode = GLOBAL_DEF("display/stretch_mode","disabled"); - String stretch_aspect = GLOBAL_DEF("display/stretch_aspect","ignore"); - Size2i stretch_size = Size2(GLOBAL_DEF("display/width",0),GLOBAL_DEF("display/height",0)); + String stretch_mode = GLOBAL_DEF("display/stretch/mode","disabled"); + String stretch_aspect = GLOBAL_DEF("display/stretch/aspect","ignore"); + Size2i stretch_size = Size2(GLOBAL_DEF("display/screen/width",0),GLOBAL_DEF("display/screen/height",0)); SceneTree::StretchMode sml_sm=SceneTree::STRETCH_MODE_DISABLED; if (stretch_mode=="2d") @@ -1295,7 +1301,7 @@ bool Main::start() { sml->set_screen_stretch(sml_sm,sml_aspect,stretch_size); sml->set_auto_accept_quit(GLOBAL_DEF("application/auto_accept_quit",true)); - String appname = Globals::get_singleton()->get("application/name"); + String appname = GlobalConfig::get_singleton()->get("application/name"); appname = TranslationServer::get_singleton()->translate(appname); OS::get_singleton()->set_window_title(appname); @@ -1312,23 +1318,23 @@ bool Main::start() { sml->get_root()->set_shadow_atlas_quadrant_subdiv(3,Viewport::ShadowAtlasQuadrantSubdiv(shadow_atlas_q3_subdiv)); } else { - GLOBAL_DEF("display/stretch_mode","disabled"); - Globals::get_singleton()->set_custom_property_info("display/stretch_mode",PropertyInfo(Variant::STRING,"display/stretch_mode",PROPERTY_HINT_ENUM,"disabled,2d,viewport")); - GLOBAL_DEF("display/stretch_aspect","ignore"); - Globals::get_singleton()->set_custom_property_info("display/stretch_aspect",PropertyInfo(Variant::STRING,"display/stretch_aspect",PROPERTY_HINT_ENUM,"ignore,keep,keep_width,keep_height")); + GLOBAL_DEF("display/stretch/mode","disabled"); + GlobalConfig::get_singleton()->set_custom_property_info("display/stretch/mode",PropertyInfo(Variant::STRING,"display/stretch/mode",PROPERTY_HINT_ENUM,"disabled,2d,viewport")); + GLOBAL_DEF("display/stretch/aspect","ignore"); + GlobalConfig::get_singleton()->set_custom_property_info("display/stretch/aspect",PropertyInfo(Variant::STRING,"display/stretch/aspect",PROPERTY_HINT_ENUM,"ignore,keep,keep_width,keep_height")); sml->set_auto_accept_quit(GLOBAL_DEF("application/auto_accept_quit",true)); GLOBAL_DEF("rendering/shadow_atlas/size",2048); - Globals::get_singleton()->set_custom_property_info("rendering/shadow_atlas/size",PropertyInfo(Variant::INT,"rendering/shadow_atlas/size",PROPERTY_HINT_RANGE,"256,16384")); + 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/shadow_atlas/quadrant_0_subdiv",2); GLOBAL_DEF("rendering/shadow_atlas/quadrant_1_subdiv",2); GLOBAL_DEF("rendering/shadow_atlas/quadrant_2_subdiv",3); GLOBAL_DEF("rendering/shadow_atlas/quadrant_3_subdiv",4); - Globals::get_singleton()->set_custom_property_info("rendering/shadow_atlas/quadrant_0_subdiv",PropertyInfo(Variant::INT,"rendering/shadow_atlas/quadrant_0_subdiv",PROPERTY_HINT_ENUM,"Disabled,1 Shadow,4 Shadows,16 Shadows,64 Shadows,256 Shadows,1024 Shadows")); - Globals::get_singleton()->set_custom_property_info("rendering/shadow_atlas/quadrant_1_subdiv",PropertyInfo(Variant::INT,"rendering/shadow_atlas/quadrant_1_subdiv",PROPERTY_HINT_ENUM,"Disabled,1 Shadow,4 Shadows,16 Shadows,64 Shadows,256 Shadows,1024 Shadows")); - Globals::get_singleton()->set_custom_property_info("rendering/shadow_atlas/quadrant_2_subdiv",PropertyInfo(Variant::INT,"rendering/shadow_atlas/quadrant_2_subdiv",PROPERTY_HINT_ENUM,"Disabled,1 Shadow,4 Shadows,16 Shadows,64 Shadows,256 Shadows,1024 Shadows")); - Globals::get_singleton()->set_custom_property_info("rendering/shadow_atlas/quadrant_3_subdiv",PropertyInfo(Variant::INT,"rendering/shadow_atlas/quadrant_3_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/shadow_atlas/quadrant_0_subdiv",PropertyInfo(Variant::INT,"rendering/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/shadow_atlas/quadrant_1_subdiv",PropertyInfo(Variant::INT,"rendering/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/shadow_atlas/quadrant_2_subdiv",PropertyInfo(Variant::INT,"rendering/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/shadow_atlas/quadrant_3_subdiv",PropertyInfo(Variant::INT,"rendering/shadow_atlas/quadrant_3_subdiv",PROPERTY_HINT_ENUM,"Disabled,1 Shadow,4 Shadows,16 Shadows,64 Shadows,256 Shadows,1024 Shadows")); } @@ -1342,7 +1348,7 @@ bool Main::start() { if (!absolute) { - if (Globals::get_singleton()->is_using_datapack()) { + if (GlobalConfig::get_singleton()->is_using_datapack()) { local_game_path="res://"+local_game_path; @@ -1366,7 +1372,7 @@ bool Main::start() { } } - local_game_path=Globals::get_singleton()->localize_path(local_game_path); + local_game_path=GlobalConfig::get_singleton()->localize_path(local_game_path); #ifdef TOOLS_ENABLED if (editor) { @@ -1410,7 +1416,7 @@ bool Main::start() { if (game_path!="" || script!="") { //autoload List props; - Globals::get_singleton()->get_property_list(&props); + GlobalConfig::get_singleton()->get_property_list(&props); //first pass, add the constants so they exist before any script is loaded for(List::Element *E=props.front();E;E=E->next()) { @@ -1419,7 +1425,7 @@ bool Main::start() { if (!s.begins_with("autoload/")) continue; String name = s.get_slicec('/',1); - String path = Globals::get_singleton()->get(s); + String path = GlobalConfig::get_singleton()->get(s); bool global_var=false; if (path.begins_with("*")) { global_var=true; @@ -1441,7 +1447,7 @@ bool Main::start() { if (!s.begins_with("autoload/")) continue; String name = s.get_slicec('/',1); - String path = Globals::get_singleton()->get(s); + String path = GlobalConfig::get_singleton()->get(s); bool global_var=false; if (path.begins_with("*")) { global_var=true; @@ -1684,7 +1690,7 @@ bool Main::iteration() { if (frame>1000000) { - if (GLOBAL_DEF("debug/print_fps", OS::get_singleton()->is_stdout_verbose())) { + if (GLOBAL_DEF("debug/stdout/print_fps", OS::get_singleton()->is_stdout_verbose())) { print_line("FPS: "+itos(frames)); }; @@ -1694,10 +1700,6 @@ bool Main::iteration() { idle_process_max=0; fixed_process_max=0; - if (GLOBAL_DEF("debug/print_metrics", false)) { - - //PerformanceMetrics::print(); - }; frame%=1000000; frames=0; diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp index 6be47fe8aab..fbd81a61bf9 100644 --- a/modules/gdscript/gd_editor.cpp +++ b/modules/gdscript/gd_editor.cpp @@ -650,7 +650,7 @@ static bool _guess_expression_type(GDCompletionContext& context,const GDParser:: String which = arg1.get_slice("/",2); if (which!="") { List props; - Globals::get_singleton()->get_property_list(&props); + GlobalConfig::get_singleton()->get_property_list(&props); //print_line("find singleton"); for(List::Element *E=props.front();E;E=E->next()) { @@ -662,7 +662,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 = Globals::get_singleton()->get(s); + String script = GlobalConfig::get_singleton()->get(s); if (!script.begins_with("res://")) { script="res://"+script; @@ -1151,7 +1151,7 @@ static bool _guess_identifier_type(GDCompletionContext& context,int p_line,const //autoloads as singletons List props; - Globals::get_singleton()->get_property_list(&props); + GlobalConfig::get_singleton()->get_property_list(&props); for(List::Element *E=props.front();E;E=E->next()) { @@ -1161,7 +1161,7 @@ static bool _guess_identifier_type(GDCompletionContext& context,int p_line,const String name = s.get_slice("/",1); if (name==String(p_identifier)) { - String path = Globals::get_singleton()->get(s); + String path = GlobalConfig::get_singleton()->get(s); if (path.begins_with("*")) { String script =path.substr(1,path.length()); @@ -1403,7 +1403,7 @@ static void _find_identifiers(GDCompletionContext& context,int p_line,bool p_onl //autoload singletons List props; - Globals::get_singleton()->get_property_list(&props); + GlobalConfig::get_singleton()->get_property_list(&props); for(List::Element *E=props.front();E;E=E->next()) { @@ -1411,7 +1411,7 @@ static void _find_identifiers(GDCompletionContext& context,int p_line,bool p_onl if (!s.begins_with("autoload/")) continue; String name = s.get_slice("/",1); - String path = Globals::get_singleton()->get(s); + String path = GlobalConfig::get_singleton()->get(s); if (path.begins_with("*")) { result.insert(name); } @@ -1496,7 +1496,7 @@ static void _find_type_arguments(GDCompletionContext& context,const GDParser::No if (id.type==Variant::INPUT_EVENT && String(p_method)=="is_action" && p_argidx==0) { List pinfo; - Globals::get_singleton()->get_property_list(&pinfo); + GlobalConfig::get_singleton()->get_property_list(&pinfo); for(List::Element *E=pinfo.front();E;E=E->next()) { const PropertyInfo &pi=E->get(); @@ -1764,7 +1764,7 @@ static void _find_type_arguments(GDCompletionContext& context,const GDParser::No if (p_argidx==0 && (String(p_method)=="get_node" || String(p_method)=="has_node") && ClassDB::is_parent_class(id.obj_type,"Node")) { List props; - Globals::get_singleton()->get_property_list(&props); + GlobalConfig::get_singleton()->get_property_list(&props); for(List::Element *E=props.front();E;E=E->next()) { @@ -2794,7 +2794,7 @@ Error GDScriptLanguage::lookup_code(const String& p_code, const String& p_symbol //guess in autoloads as singletons List props; - Globals::get_singleton()->get_property_list(&props); + GlobalConfig::get_singleton()->get_property_list(&props); for(List::Element *E=props.front();E;E=E->next()) { @@ -2804,7 +2804,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 = Globals::get_singleton()->get(s); + String path = GlobalConfig::get_singleton()->get(s); if (path.begins_with("*")) { String script =path.substr(1,path.length()); diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp index 9c10411dcff..b205a0a8907 100644 --- a/modules/gdscript/gd_script.cpp +++ b/modules/gdscript/gd_script.cpp @@ -1493,9 +1493,9 @@ void GDScriptLanguage::init() { //populate singletons - List singletons; - Globals::get_singleton()->get_singletons(&singletons); - for(List::Element *E=singletons.front();E;E=E->next()) { + List singletons; + GlobalConfig::get_singleton()->get_singletons(&singletons); + for(List::Element *E=singletons.front();E;E=E->next()) { _add_global(E->get().name,E->get().ptr); } @@ -1940,7 +1940,7 @@ GDScriptLanguage::GDScriptLanguage() { script_frame_time=0; _debug_call_stack_pos=0; - int dmcs=GLOBAL_DEF("debug/script_max_call_stack",1024); + int dmcs=GLOBAL_DEF("debug/script/max_call_stack",1024); if (ScriptDebugger::get_singleton()) { //debugging enabled! diff --git a/modules/openssl/stream_peer_openssl.cpp b/modules/openssl/stream_peer_openssl.cpp index a1d07d9116c..eca13533e48 100644 --- a/modules/openssl/stream_peer_openssl.cpp +++ b/modules/openssl/stream_peer_openssl.cpp @@ -590,8 +590,8 @@ void StreamPeerOpenSSL::initialize_ssl() { SSL_load_error_strings(); // Load SSL error strings ERR_load_BIO_strings(); // Load BIO error strings OpenSSL_add_all_algorithms(); // Load all available encryption algorithms - String certs_path =GLOBAL_DEF("ssl/certificates",""); - Globals::get_singleton()->set_custom_property_info("ssl/certificates",PropertyInfo(Variant::STRING,"ssl/certificates",PROPERTY_HINT_FILE,"*.crt")); + 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")); if (certs_path!="") { @@ -613,8 +613,8 @@ void StreamPeerOpenSSL::initialize_ssl() { print_line("Loaded certs from '"+certs_path+"': "+itos(certs.size())); } } - String config_path =GLOBAL_DEF("ssl/config",""); - Globals::get_singleton()->set_custom_property_info("ssl/config",PropertyInfo(Variant::STRING,"ssl/config",PROPERTY_HINT_FILE,"*.cnf")); + 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")); if (config_path!="") { Vector data = FileAccess::get_file_as_array(config_path); diff --git a/modules/theora/video_stream_theora.cpp b/modules/theora/video_stream_theora.cpp index b7fa3ac5ec5..e6bf55185eb 100644 --- a/modules/theora/video_stream_theora.cpp +++ b/modules/theora/video_stream_theora.cpp @@ -747,7 +747,7 @@ void VideoStreamPlaybackTheora::play() { } playing = true; - delay_compensation=Globals::get_singleton()->get("audio/video_delay_compensation_ms"); + delay_compensation=GlobalConfig::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 64b949bb6f1..418a42bc18c 100644 --- a/modules/visual_script/visual_script.cpp +++ b/modules/visual_script/visual_script.cpp @@ -2815,7 +2815,7 @@ VisualScriptLanguage::VisualScriptLanguage() { _debug_parse_err_node=-1; _debug_parse_err_file=""; _debug_call_stack_pos=0; - int dmcs=GLOBAL_DEF("debug/script_max_call_stack",1024); + int dmcs=GLOBAL_DEF("debug/script/max_call_stack",1024); if (ScriptDebugger::get_singleton()) { //debugging enabled! _debug_max_call_stack = dmcs; diff --git a/modules/visual_script/visual_script_flow_control.cpp b/modules/visual_script/visual_script_flow_control.cpp index 606a2f47a8c..bc980d5b250 100644 --- a/modules/visual_script/visual_script_flow_control.cpp +++ b/modules/visual_script/visual_script_flow_control.cpp @@ -908,7 +908,7 @@ String VisualScriptInputFilter::get_output_sequence_port_text(int p_port) const List pinfo; - Globals::get_singleton()->get_property_list(&pinfo); + GlobalConfig::get_singleton()->get_property_list(&pinfo); int index=1; text="No Action"; @@ -1164,7 +1164,7 @@ bool VisualScriptInputFilter::_set(const StringName& p_name, const Variant& p_va if (what=="action_name") { List pinfo; - Globals::get_singleton()->get_property_list(&pinfo); + GlobalConfig::get_singleton()->get_property_list(&pinfo); int index=1; for(List::Element *E=pinfo.front();E;E=E->next()) { @@ -1378,7 +1378,7 @@ bool VisualScriptInputFilter::_get(const StringName& p_name,Variant &r_ret) cons if (what=="action_name") { List pinfo; - Globals::get_singleton()->get_property_list(&pinfo); + GlobalConfig::get_singleton()->get_property_list(&pinfo); int index=1; for(List::Element *E=pinfo.front();E;E=E->next()) { @@ -1517,7 +1517,7 @@ void VisualScriptInputFilter::_get_property_list( List *p_list) co actions="None"; List pinfo; - Globals::get_singleton()->get_property_list(&pinfo); + GlobalConfig::get_singleton()->get_property_list(&pinfo); Vector al; for(List::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 f1424af2fe6..bf2b4016c7b 100644 --- a/modules/visual_script/visual_script_func_nodes.cpp +++ b/modules/visual_script/visual_script_func_nodes.cpp @@ -332,7 +332,7 @@ void VisualScriptFunctionCall::set_singleton(const StringName& p_path) { return; singleton=p_path; - Object *obj = Globals::get_singleton()->get_singleton_object(singleton); + Object *obj = GlobalConfig::get_singleton()->get_singleton_object(singleton); if (obj) { base_type=obj->get_class(); } @@ -370,7 +370,7 @@ void VisualScriptFunctionCall::_update_method_cache() { } else if (call_mode==CALL_MODE_SINGLETON) { - Object *obj = Globals::get_singleton()->get_singleton_object(singleton); + Object *obj = GlobalConfig::get_singleton()->get_singleton_object(singleton); if (obj) { type=obj->get_class(); script=obj->get_script(); @@ -567,11 +567,11 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo& property) const if (call_mode!=CALL_MODE_SINGLETON) { property.usage=0; } else { - List names; - Globals::get_singleton()->get_singletons(&names); + List names; + GlobalConfig::get_singleton()->get_singletons(&names); property.hint=PROPERTY_HINT_ENUM; String sl; - for (List::Element *E=names.front();E;E=E->next()) { + for (List::Element *E=names.front();E;E=E->next()) { if (sl!=String()) sl+=","; sl+=E->get().name; @@ -607,7 +607,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 = Globals::get_singleton()->get_singleton_object(singleton); + Object *obj = GlobalConfig::get_singleton()->get_singleton_object(singleton); if (obj) { property.hint=PROPERTY_HINT_METHOD_OF_INSTANCE; property.hint_string=itos(obj->get_instance_ID()); @@ -881,7 +881,7 @@ public: } break; case VisualScriptFunctionCall::CALL_MODE_SINGLETON: { - Object *object=Globals::get_singleton()->get_singleton_object(singleton); + Object *object=GlobalConfig::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 07d234207ed..e442cd48e7b 100644 --- a/modules/visual_script/visual_script_nodes.cpp +++ b/modules/visual_script/visual_script_nodes.cpp @@ -1933,13 +1933,13 @@ public: VisualScriptNodeInstance* VisualScriptEngineSingleton::instance(VisualScriptInstance* p_instance) { VisualScriptNodeInstanceEngineSingleton * instance = memnew(VisualScriptNodeInstanceEngineSingleton ); - instance->singleton=Globals::get_singleton()->get_singleton_object(singleton); + instance->singleton=GlobalConfig::get_singleton()->get_singleton_object(singleton); return instance; } VisualScriptEngineSingleton::TypeGuess VisualScriptEngineSingleton::guess_output_type(TypeGuess* p_inputs, int p_output) const { - Object *obj=Globals::get_singleton()->get_singleton_object(singleton); + Object *obj=GlobalConfig::get_singleton()->get_singleton_object(singleton); TypeGuess tg; tg.type=Variant::OBJECT; if (obj) { @@ -1958,11 +1958,11 @@ void VisualScriptEngineSingleton::_bind_methods() { String cc; - List singletons; + List singletons; - Globals::get_singleton()->get_singletons(&singletons); + GlobalConfig::get_singleton()->get_singletons(&singletons); - for (List::Element *E=singletons.front();E;E=E->next()) { + for (List::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 @@ -3600,7 +3600,7 @@ void VisualScriptInputAction::_validate_property(PropertyInfo& property) const { String actions; List pinfo; - Globals::get_singleton()->get_property_list(&pinfo); + GlobalConfig::get_singleton()->get_property_list(&pinfo); Vector al; for(List::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 f47e254f4bb..35b215cb525 100644 --- a/modules/webm/video_stream_webm.cpp +++ b/modules/webm/video_stream_webm.cpp @@ -167,7 +167,7 @@ void VideoStreamPlaybackWebm::play() { stop(); - delay_compensation = Globals::get_singleton()->get("audio/video_delay_compensation_ms"); + delay_compensation = GlobalConfig::get_singleton()->get("audio/video_delay_compensation_ms"); delay_compensation /= 1000.0; playing = true; diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index 0bbb45b8f5a..3259f0a165c 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -553,8 +553,8 @@ void EditorExportPlatformAndroid::_fix_resources(Vector& p_manifest) { String lang = str.substr(str.find_last("-")+1,str.length()).replace("-","_"); String prop = "application/name_"+lang; - if (Globals::get_singleton()->has(prop)) { - str = Globals::get_singleton()->get(prop); + if (GlobalConfig::get_singleton()->has(prop)) { + str = GlobalConfig::get_singleton()->get(prop); } else { str = get_project_name(); } @@ -626,7 +626,7 @@ String EditorExportPlatformAndroid::get_project_name() const { if (this->name!="") { aname=this->name; } else { - aname = Globals::get_singleton()->get("application/name"); + aname = GlobalConfig::get_singleton()->get("application/name"); } @@ -1148,7 +1148,7 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d if (!found) { - String appicon = Globals::get_singleton()->get("application/icon"); + String appicon = GlobalConfig::get_singleton()->get("application/icon"); if (appicon!="" && appicon.ends_with(".png")) { FileAccess*f = FileAccess::open(appicon,FileAccess::READ); if (f) { @@ -1719,7 +1719,7 @@ Error EditorExportPlatformAndroid::run(int p_device, int p_flags) { args.push_back("--remove-all"); err = OS::get_singleton()->execute(adb,args,true,NULL,NULL,&rv); - int port = Globals::get_singleton()->get("debug/debug_port"); + int port = GlobalConfig::get_singleton()->get("network/debug/remote_port"); args.clear(); args.push_back("reverse"); args.push_back("tcp:"+itos(port)); @@ -1766,7 +1766,7 @@ Error EditorExportPlatformAndroid::run(int p_device, int p_flags) { String EditorExportPlatformAndroid::get_package_name() { String pname = package; - String basename = Globals::get_singleton()->get("application/name"); + String basename = GlobalConfig::get_singleton()->get("application/name"); basename=basename.to_lower(); String name; diff --git a/platform/android/globals/global_defaults.cpp b/platform/android/globals/global_defaults.cpp index 3ec1094ee10..52b59b2dc17 100644 --- a/platform/android/globals/global_defaults.cpp +++ b/platform/android/globals/global_defaults.cpp @@ -32,10 +32,11 @@ void register_android_global_defaults() { - GLOBAL_DEF("rasterizer.Android/use_fragment_lighting",false); +/* GLOBAL_DEF("rasterizer.Android/use_fragment_lighting",false); GLOBAL_DEF("rasterizer.Android/fp16_framebuffer",false); GLOBAL_DEF("display.Android/driver","GLES2"); // GLOBAL_DEF("rasterizer.Android/trilinear_mipmap_filter",false); - Globals::get_singleton()->set_custom_property_info("display.Android/driver",PropertyInfo(Variant::STRING,"display.Android/driver",PROPERTY_HINT_ENUM,"GLES2")); + GlobalConfig::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 4ef66191461..715021db338 100644 --- a/platform/android/godot_android.cpp +++ b/platform/android/godot_android.cpp @@ -654,7 +654,7 @@ static void engine_handle_cmd(struct android_app* app, int32_t cmd) { #else Error err = Main::setup("apk",0,NULL); - String modules = Globals::get_singleton()->get("android/modules"); + String modules = GlobalConfig::get_singleton()->get("android/modules"); Vector mods = modules.split(",",false); mods.push_back("GodotOS"); __android_log_print(ANDROID_LOG_INFO,"godot","mod count: %i",mods.size()); @@ -912,7 +912,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_Godot_registerSingleton(JNIEnv s->set_instance(env->NewGlobalRef(p_object)); jni_singletons[singname]=s; - Globals::get_singleton()->add_singleton(Globals::Singleton(singname,s)); + GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton(singname,s)); } @@ -983,7 +983,7 @@ JNIEXPORT jstring JNICALL Java_org_godotengine_godot_Godot_getGlobal(JNIEnv * en String js = env->GetStringUTFChars( path, NULL ); - return env->NewStringUTF(Globals::get_singleton()->get(js).operator String().utf8().get_data()); + return env->NewStringUTF(GlobalConfig::get_singleton()->get(js).operator String().utf8().get_data()); } diff --git a/platform/android/java_glue.cpp b/platform/android/java_glue.cpp index c8dc3ce3c3c..602d22dfa2c 100644 --- a/platform/android/java_glue.cpp +++ b/platform/android/java_glue.cpp @@ -921,7 +921,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv * e __android_log_print(ANDROID_LOG_INFO,"godot","*****SETUP OK"); //video driver is determined here, because once initialized, it cant be changed - String vd = Globals::get_singleton()->get("display/driver"); + String vd = GlobalConfig::get_singleton()->get("display/driver"); env->CallVoidMethod(_godot_instance, _on_video_init, (jboolean)true); @@ -976,7 +976,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_quit(JNIEnv * env, jo static void _initialize_java_modules() { - String modules = Globals::get_singleton()->get("android/modules"); + String modules = GlobalConfig::get_singleton()->get("android/modules"); Vector mods = modules.split(",",false); print_line("ANDROID MODULES : " + modules); __android_log_print(ANDROID_LOG_INFO,"godot","mod count: %i",mods.size()); @@ -1051,7 +1051,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv * env, jo // because of the way android forces you to do everything with threads java_class_wrapper = memnew( JavaClassWrapper(_godot_instance )); - Globals::get_singleton()->add_singleton(Globals::Singleton("JavaClassWrapper",java_class_wrapper)); + GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("JavaClassWrapper",java_class_wrapper)); _initialize_java_modules(); Main::setup2(); @@ -1570,8 +1570,8 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_singleton(JNIEnv * en s->set_instance(env->NewGlobalRef(p_object)); jni_singletons[singname]=s; - Globals::get_singleton()->add_singleton(Globals::Singleton(singname,s)); - Globals::get_singleton()->set(singname,s); + GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton(singname,s)); + GlobalConfig::get_singleton()->set(singname,s); } @@ -1649,7 +1649,7 @@ JNIEXPORT jstring JNICALL Java_org_godotengine_godot_GodotLib_getGlobal(JNIEnv * String js = env->GetStringUTFChars( path, NULL ); - return env->NewStringUTF(Globals::get_singleton()->get(js).operator String().utf8().get_data()); + return env->NewStringUTF(GlobalConfig::get_singleton()->get(js).operator String().utf8().get_data()); } diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp index 54af4cde130..093064104a2 100644 --- a/platform/android/os_android.cpp +++ b/platform/android/os_android.cpp @@ -748,7 +748,7 @@ String OS_Android::get_data_dir() const { return "."; - //return Globals::get_singleton()->get_singleton_object("GodotOS")->call("get_data_dir"); + //return GlobalConfig::get_singleton()->get_singleton_object("GodotOS")->call("get_data_dir"); } diff --git a/platform/bb10/export/export.cpp b/platform/bb10/export/export.cpp index a79d0807aa3..6ba97b8b6e7 100644 --- a/platform/bb10/export/export.cpp +++ b/platform/bb10/export/export.cpp @@ -248,7 +248,7 @@ void EditorExportPlatformBB10::_fix_descriptor(Vector& p_descriptor) { if (this->name!="") { aname=this->name; } else { - aname = Globals::get_singleton()->get("application/name"); + aname = GlobalConfig::get_singleton()->get("application/name"); } @@ -432,7 +432,7 @@ Error EditorExportPlatformBB10::export_project(const String& p_path, bool p_debu if (!found) { - String appicon = Globals::get_singleton()->get("application/icon"); + String appicon = GlobalConfig::get_singleton()->get("application/icon"); if (appicon!="" && appicon.ends_with(".png")) { FileAccess*f = FileAccess::open(appicon,FileAccess::READ); if (f) { diff --git a/platform/iphone/app_delegate.mm b/platform/iphone/app_delegate.mm index 86c3eecd47c..feb87e742fd 100644 --- a/platform/iphone/app_delegate.mm +++ b/platform/iphone/app_delegate.mm @@ -162,14 +162,14 @@ static int frame_count = 0; NSString* str = (NSString*)value; String uval = String::utf8([str UTF8String]); - Globals::get_singleton()->set("Info.plist/"+ukey, uval); + GlobalConfig::get_singleton()->set("Info.plist/"+ukey, uval); } else if ([value isKindOfClass:[NSNumber class]]) { NSNumber* n = (NSNumber*)value; double dval = [n doubleValue]; - Globals::get_singleton()->set("Info.plist/"+ukey, dval); + GlobalConfig::get_singleton()->set("Info.plist/"+ukey, dval); }; // do stuff } @@ -186,7 +186,7 @@ static int frame_count = 0; ++frame_count; #ifdef APPIRATER_ENABLED - int aid = Globals::get_singleton()->get("ios/app_id"); + int aid = GlobalConfig::get_singleton()->get("ios/app_id"); [Appirater appLaunched:YES app_id:aid]; #endif @@ -266,11 +266,11 @@ static int frame_count = 0; #ifdef MODULE_GAME_ANALYTICS_ENABLED printf("********************* didFinishLaunchingWithOptions\n"); - if(!Globals::get_singleton()->has("mobileapptracker/advertiser_id")) + if(!GlobalConfig::get_singleton()->has("mobileapptracker/advertiser_id")) { return; } - if(!Globals::get_singleton()->has("mobileapptracker/conversion_key")) + if(!GlobalConfig::get_singleton()->has("mobileapptracker/conversion_key")) { return; } diff --git a/platform/iphone/gl_view.mm b/platform/iphone/gl_view.mm index d8ed9301574..3df29c51785 100755 --- a/platform/iphone/gl_view.mm +++ b/platform/iphone/gl_view.mm @@ -76,7 +76,7 @@ void _hide_keyboard() { }; bool _play_video(String p_path, float p_volume, String p_audio_track, String p_subtitle_track) { - p_path = Globals::get_singleton()->globalize_path(p_path); + p_path = GlobalConfig::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 0a67566398c..76b5c9aa012 100755 --- a/platform/iphone/globals/global_defaults.cpp +++ b/platform/iphone/globals/global_defaults.cpp @@ -32,9 +32,10 @@ void register_iphone_global_defaults() { - GLOBAL_DEF("rasterizer.iOS/use_fragment_lighting",false); + /*GLOBAL_DEF("rasterizer.iOS/use_fragment_lighting",false); GLOBAL_DEF("rasterizer.iOS/fp16_framebuffer",false); GLOBAL_DEF("display.iOS/driver","GLES2"); - Globals::get_singleton()->set_custom_property_info("display.iOS/driver",PropertyInfo(Variant::STRING,"display.iOS/driver",PROPERTY_HINT_ENUM,"GLES1,GLES2")); + GlobalConfig::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/javascript/export/export.cpp b/platform/javascript/export/export.cpp index 77aab98e0ca..c151bff45c7 100644 --- a/platform/javascript/export/export.cpp +++ b/platform/javascript/export/export.cpp @@ -181,9 +181,9 @@ void EditorExportPlatformJavaScript::_fix_html(Vector& p_html, const St String current_line = lines[i]; current_line = current_line.replace("$GODOT_TMEM",itos((1<<(max_memory+5))*1024*1024)); current_line = current_line.replace("$GODOT_BASE",p_name); - current_line = current_line.replace("$GODOT_CANVAS_WIDTH",Globals::get_singleton()->get("display/width")); - current_line = current_line.replace("$GODOT_CANVAS_HEIGHT",Globals::get_singleton()->get("display/height")); - current_line = current_line.replace("$GODOT_HEAD_TITLE",!html_title.empty()?html_title:(String) Globals::get_singleton()->get("application/name")); + current_line = current_line.replace("$GODOT_CANVAS_WIDTH",GlobalConfig::get_singleton()->get("display/width")); + current_line = current_line.replace("$GODOT_CANVAS_HEIGHT",GlobalConfig::get_singleton()->get("display/height")); + current_line = current_line.replace("$GODOT_HEAD_TITLE",!html_title.empty()?html_title:(String) GlobalConfig::get_singleton()->get("application/name")); current_line = current_line.replace("$GODOT_HEAD_INCLUDE",html_head_include); current_line = current_line.replace("$GODOT_STYLE_FONT_FAMILY",html_font_family); current_line = current_line.replace("$GODOT_STYLE_INCLUDE",html_style_include); diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp index f1b67021f0e..3553bdc7a6c 100644 --- a/platform/javascript/os_javascript.cpp +++ b/platform/javascript/os_javascript.cpp @@ -309,7 +309,7 @@ void OS_JavaScript::initialize(const VideoMode& p_desired,int p_video_driver,int #ifdef JAVASCRIPT_EVAL_ENABLED javascript_eval = memnew(JavaScript); - Globals::get_singleton()->add_singleton(Globals::Singleton("JavaScript", javascript_eval)); + GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("JavaScript", javascript_eval)); #endif } @@ -807,7 +807,7 @@ String OS_JavaScript::get_data_dir() const { //if (get_data_dir_func) // return get_data_dir_func(); return "/userfs"; - //return Globals::get_singleton()->get_singleton_object("GodotOS")->call("get_data_dir"); + //return GlobalConfig::get_singleton()->get_singleton_object("GodotOS")->call("get_data_dir"); }; String OS_JavaScript::get_executable_path() const { diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp index d8298eee73b..1cb41cede21 100644 --- a/platform/osx/export/export.cpp +++ b/platform/osx/export/export.cpp @@ -324,8 +324,8 @@ Error EditorExportPlatformOSX::export_project(const String& p_path, bool p_debug String pkg_name; if (app_name!="") pkg_name=app_name; - else if (String(Globals::get_singleton()->get("application/name"))!="") - pkg_name=String(Globals::get_singleton()->get("application/name")); + else if (String(GlobalConfig::get_singleton()->get("application/name"))!="") + pkg_name=String(GlobalConfig::get_singleton()->get("application/name")); else pkg_name="Unnamed"; @@ -371,7 +371,7 @@ Error EditorExportPlatformOSX::export_project(const String& p_path, bool p_debug if (file=="Contents/Resources/icon.icns") { //see if there is an icon - String iconpath = Globals::get_singleton()->get("application/icon"); + String iconpath = GlobalConfig::get_singleton()->get("application/icon"); print_line("icon? "+iconpath); if (iconpath!="") { Image icon; diff --git a/platform/uwp/export/export.cpp b/platform/uwp/export/export.cpp index 186c509ca5c..1844df5eef1 100644 --- a/platform/uwp/export/export.cpp +++ b/platform/uwp/export/export.cpp @@ -1571,7 +1571,7 @@ Vector EditorExportPlatformUWP::_fix_manifest(const Vector &p_ String architecture = arch == ARM ? "ARM" : arch == X86 ? "x86" : "x64"; result = result.replace("$architecture$", architecture); - result = result.replace("$display_name$", display_name.empty() ? (String)Globals::get_singleton()->get("application/name") : display_name); + result = result.replace("$display_name$", display_name.empty() ? (String)GlobalConfig::get_singleton()->get("application/name") : display_name); result = result.replace("$publisher_display_name$", publisher_display_name); result = result.replace("$app_description$", description); result = result.replace("$bg_color$", background_color); diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 445f4fc3282..11e5fd13871 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -2382,7 +2382,7 @@ String OS_Windows::get_data_dir() const { if (has_environment("APPDATA")) { - bool use_godot = Globals::get_singleton()->get("application/use_shared_user_dir"); + bool use_godot = GlobalConfig::get_singleton()->get("application/use_shared_user_dir"); if (!use_godot) return (OS::get_singleton()->get_environment("APPDATA")+"/"+an).replace("\\","/"); else @@ -2390,7 +2390,7 @@ String OS_Windows::get_data_dir() const { } } - return Globals::get_singleton()->get_resource_path(); + return GlobalConfig::get_singleton()->get_resource_path(); } diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index 74d78392b19..d16a647fca0 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -578,7 +578,7 @@ void ItemList::_input_event(const InputEvent& p_event) { uint64_t now = OS::get_singleton()->get_ticks_msec(); uint64_t diff = now-search_time_msec; - if (diffget("gui/incr_search_max_interval_msec"))*2) { + if (diffget("gui/timers/incremental_search_max_interval_msec"))*2) { for(int i=current-1;i>=0;i--) { @@ -614,7 +614,7 @@ void ItemList::_input_event(const InputEvent& p_event) { uint64_t now = OS::get_singleton()->get_ticks_msec(); uint64_t diff = now-search_time_msec; - if (diffget("gui/incr_search_max_interval_msec"))*2) { + if (diffget("gui/timers/incremental_search_max_interval_msec"))*2) { for(int i=current+1;iget_ticks_msec(); uint64_t diff = now-search_time_msec; - uint64_t max_interval = uint64_t(GLOBAL_DEF("gui/incr_search_max_interval_msec",2000)); + uint64_t max_interval = uint64_t(GLOBAL_DEF("gui/timers/incremental_search_max_interval_msec",2000)); search_time_msec = now; if (diff>max_interval) { @@ -1372,6 +1372,8 @@ void ItemList::_bind_methods(){ ADD_SIGNAL( MethodInfo("item_rmb_selected",PropertyInfo(Variant::INT,"index"),PropertyInfo(Variant::VECTOR2,"atpos"))); ADD_SIGNAL( MethodInfo("multi_selected",PropertyInfo(Variant::INT,"index"),PropertyInfo(Variant::BOOL,"selected"))); ADD_SIGNAL( MethodInfo("item_activated",PropertyInfo(Variant::INT,"index"))); + + GLOBAL_DEF("gui/timers/incremental_search_max_interval_msec",2000); } ItemList::ItemList() { diff --git a/scene/gui/menu_button.cpp b/scene/gui/menu_button.cpp index 44d315eedc6..372e4657e12 100644 --- a/scene/gui/menu_button.cpp +++ b/scene/gui/menu_button.cpp @@ -39,11 +39,9 @@ void MenuButton::_unhandled_key_input(InputEvent p_event) { if (!get_parent() || !is_visible() || is_disabled()) return; - if (get_viewport()->get_modal_stack_top() && !get_viewport()->get_modal_stack_top()->is_a_parent_of(this)) - return; //ignore because of modal window + bool global_only = (get_viewport()->get_modal_stack_top() && !get_viewport()->get_modal_stack_top()->is_a_parent_of(this)); - - if (popup->activate_item_by_event(p_event)) + if (popup->activate_item_by_event(p_event,global_only)) accept_event(); } } diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index 8686156a8ee..e4a03f6e2b3 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -585,7 +585,7 @@ void PopupMenu::add_check_item(const String& p_label,int p_ID,uint32_t p_accel) } -void PopupMenu::add_icon_shortcut(const Ref& p_icon,const Ref& p_shortcut,int p_ID) { +void PopupMenu::add_icon_shortcut(const Ref& p_icon, const Ref& p_shortcut, int p_ID, bool p_global) { ERR_FAIL_COND(p_shortcut.is_null()); @@ -595,12 +595,13 @@ void PopupMenu::add_icon_shortcut(const Ref& p_icon,const Ref item.ID=p_ID; item.icon=p_icon; item.shortcut=p_shortcut; + item.shortcut_is_global=p_global; items.push_back(item); update(); } -void PopupMenu::add_shortcut(const Ref& p_shortcut,int p_ID){ +void PopupMenu::add_shortcut(const Ref& p_shortcut, int p_ID, bool p_global){ ERR_FAIL_COND(p_shortcut.is_null()); @@ -609,11 +610,12 @@ void PopupMenu::add_shortcut(const Ref& p_shortcut,int p_ID){ Item item; item.ID=p_ID; item.shortcut=p_shortcut; + item.shortcut_is_global=p_global; items.push_back(item); update(); } -void PopupMenu::add_icon_check_shortcut(const Ref& p_icon,const Ref& p_shortcut,int p_ID){ +void PopupMenu::add_icon_check_shortcut(const Ref& p_icon, const Ref& p_shortcut, int p_ID, bool p_global){ ERR_FAIL_COND(p_shortcut.is_null()); @@ -624,11 +626,12 @@ void PopupMenu::add_icon_check_shortcut(const Ref& p_icon,const Ref& p_shortcut,int p_ID){ +void PopupMenu::add_check_shortcut(const Ref& p_shortcut, int p_ID, bool p_global){ ERR_FAIL_COND(p_shortcut.is_null()); @@ -637,6 +640,7 @@ void PopupMenu::add_check_shortcut(const Ref& p_shortcut,int p_ID){ Item item; item.ID=p_ID; item.shortcut=p_shortcut; + item.shortcut_is_global=p_global; item.checkable=true; items.push_back(item); update(); @@ -815,12 +819,14 @@ void PopupMenu::set_item_tooltip(int p_idx,const String& p_tooltip) { update(); } -void PopupMenu::set_item_shortcut(int p_idx, const Ref& p_shortcut) { +void PopupMenu::set_item_shortcut(int p_idx, const Ref& p_shortcut, bool p_global) { ERR_FAIL_INDEX(p_idx,items.size()); if (items[p_idx].shortcut.is_valid()) { _unref_shortcut(items[p_idx].shortcut); } items[p_idx].shortcut=p_shortcut; + items[p_idx].shortcut_is_global=p_global; + if (items[p_idx].shortcut.is_valid()) { _ref_shortcut(items[p_idx].shortcut); @@ -849,7 +855,7 @@ int PopupMenu::get_item_count() const { return items.size(); } -bool PopupMenu::activate_item_by_event(const InputEvent& p_event) { +bool PopupMenu::activate_item_by_event(const InputEvent& p_event, bool p_for_global_only) { uint32_t code=0; if (p_event.type==InputEvent::KEY) { @@ -873,7 +879,7 @@ bool PopupMenu::activate_item_by_event(const InputEvent& p_event) { continue; - if (items[i].shortcut.is_valid() && items[i].shortcut->is_shortcut(p_event)) { + if (items[i].shortcut.is_valid() && items[i].shortcut->is_shortcut(p_event) && (items[i].shortcut_is_global || !p_for_global_only)) { activate_item(i); return true; } @@ -892,7 +898,7 @@ bool PopupMenu::activate_item_by_event(const InputEvent& p_event) { if(!pm) continue; - if(pm->activate_item_by_event(p_event)) { + if(pm->activate_item_by_event(p_event,p_for_global_only)) { return true; } } @@ -1099,10 +1105,10 @@ void PopupMenu::_bind_methods() { ClassDB::bind_method(_MD("add_check_item","label","id","accel"),&PopupMenu::add_check_item,DEFVAL(-1),DEFVAL(0)); ClassDB::bind_method(_MD("add_submenu_item","label","submenu","id"),&PopupMenu::add_submenu_item,DEFVAL(-1)); - ClassDB::bind_method(_MD("add_icon_shortcut","texture","shortcut:ShortCut","id"),&PopupMenu::add_icon_shortcut,DEFVAL(-1)); - ClassDB::bind_method(_MD("add_shortcut","shortcut:ShortCut","id"),&PopupMenu::add_shortcut,DEFVAL(-1)); - ClassDB::bind_method(_MD("add_icon_check_shortcut","texture","shortcut:ShortCut","id"),&PopupMenu::add_icon_check_shortcut,DEFVAL(-1)); - ClassDB::bind_method(_MD("add_check_shortcut","shortcut:ShortCut","id"),&PopupMenu::add_check_shortcut,DEFVAL(-1)); + ClassDB::bind_method(_MD("add_icon_shortcut","texture","shortcut:ShortCut","id","global"),&PopupMenu::add_icon_shortcut,DEFVAL(-1),DEFVAL(false)); + ClassDB::bind_method(_MD("add_shortcut","shortcut:ShortCut","id","global"),&PopupMenu::add_shortcut,DEFVAL(-1),DEFVAL(false)); + ClassDB::bind_method(_MD("add_icon_check_shortcut","texture","shortcut:ShortCut","id","global"),&PopupMenu::add_icon_check_shortcut,DEFVAL(-1),DEFVAL(false)); + ClassDB::bind_method(_MD("add_check_shortcut","shortcut:ShortCut","id","global"),&PopupMenu::add_check_shortcut,DEFVAL(-1),DEFVAL(false)); ClassDB::bind_method(_MD("set_item_text","idx","text"),&PopupMenu::set_item_text); ClassDB::bind_method(_MD("set_item_icon","idx","icon"),&PopupMenu::set_item_icon); @@ -1115,7 +1121,7 @@ void PopupMenu::_bind_methods() { ClassDB::bind_method(_MD("set_item_as_separator","idx","enable"),&PopupMenu::set_item_as_separator); ClassDB::bind_method(_MD("set_item_as_checkable","idx","enable"),&PopupMenu::set_item_as_checkable); ClassDB::bind_method(_MD("set_item_tooltip","idx","tooltip"),&PopupMenu::set_item_tooltip); - ClassDB::bind_method(_MD("set_item_shortcut","idx","shortcut:ShortCut"),&PopupMenu::set_item_shortcut); + ClassDB::bind_method(_MD("set_item_shortcut","idx","shortcut:ShortCut","global"),&PopupMenu::set_item_shortcut,DEFVAL(false)); ClassDB::bind_method(_MD("toggle_item_checked","idx"), &PopupMenu::toggle_item_checked); diff --git a/scene/gui/popup_menu.h b/scene/gui/popup_menu.h index 282e1522878..9cc3daa8fee 100644 --- a/scene/gui/popup_menu.h +++ b/scene/gui/popup_menu.h @@ -56,8 +56,9 @@ class PopupMenu : public Popup { int _ofs_cache; int h_ofs; Ref shortcut; + bool shortcut_is_global; - Item() { checked=false; checkable=false; separator=false; accel=0; disabled=false; _ofs_cache=0; h_ofs=0; } + Item() { checked=false; checkable=false; separator=false; accel=0; disabled=false; _ofs_cache=0; h_ofs=0; shortcut_is_global=false; } }; @@ -100,10 +101,10 @@ public: void add_check_item(const String& p_label,int p_ID=-1,uint32_t p_accel=0); void add_submenu_item(const String& p_label,const String& p_submenu, int p_ID=-1); - void add_icon_shortcut(const Ref& p_icon,const Ref& p_shortcut,int p_ID=-1); - void add_shortcut(const Ref& p_shortcut,int p_ID=-1); - void add_icon_check_shortcut(const Ref& p_icon,const Ref& p_shortcut,int p_ID=-1); - void add_check_shortcut(const Ref& p_shortcut,int p_ID=-1); + void add_icon_shortcut(const Ref& p_icon,const Ref& p_shortcut,int p_ID=-1,bool p_global=false); + void add_shortcut(const Ref& p_shortcut,int p_ID=-1,bool p_global=false); + void add_icon_check_shortcut(const Ref& p_icon,const Ref& p_shortcut,int p_ID=-1,bool p_global=false); + void add_check_shortcut(const Ref& p_shortcut,int p_ID=-1,bool p_global=false); void set_item_text(int p_idx,const String& p_text); void set_item_icon(int p_idx,const Ref& p_icon); @@ -116,7 +117,7 @@ public: void set_item_as_separator(int p_idx, bool p_separator); void set_item_as_checkable(int p_idx, bool p_checkable); void set_item_tooltip(int p_idx,const String& p_tooltip); - void set_item_shortcut(int p_idx, const Ref& p_shortcut); + void set_item_shortcut(int p_idx, const Ref& p_shortcut,bool p_global=false); void set_item_h_offset(int p_idx, int p_offset); void toggle_item_checked(int p_idx); @@ -137,7 +138,7 @@ public: int get_item_count() const; - bool activate_item_by_event(const InputEvent& p_event); + bool activate_item_by_event(const InputEvent& p_event,bool p_for_global_only=false); void activate_item(int p_item); void remove_item(int p_idx); diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 4394f4b2377..397edbf3b64 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -4707,6 +4707,7 @@ void TextEdit::_bind_methods() { BIND_CONSTANT( MENU_MAX ); + GLOBAL_DEF("gui/timers/text_edit_idle_detect_sec",3); } TextEdit::TextEdit() { @@ -4767,7 +4768,7 @@ TextEdit::TextEdit() { idle_detect = memnew( Timer ); add_child(idle_detect); idle_detect->set_one_shot(true); - idle_detect->set_wait_time(GLOBAL_DEF("display/text_edit_idle_detect_sec",3)); + idle_detect->set_wait_time(GLOBAL_GET("gui/timers/text_edit_idle_detect_sec")); idle_detect->connect("timeout", this,"_push_current_op"); click_select_held = memnew( Timer ); diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 40caae48fd0..86fe9cd682a 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -3302,7 +3302,7 @@ void Tree::_do_incr_search(const String& p_add) { uint64_t time = OS::get_singleton()->get_ticks_usec() / 1000; // convert to msec uint64_t diff = time - last_keypress; - if (diff > uint64_t(GLOBAL_DEF("gui/incr_search_max_interval_msec",2000))) + if (diff > uint64_t(GLOBAL_DEF("gui/timers/incremental_search_max_interval_msec",2000))) incr_search=p_add; else incr_search+=p_add; diff --git a/scene/io/resource_format_image.cpp b/scene/io/resource_format_image.cpp index b1034041ba6..cc3d9baa74c 100644 --- a/scene/io/resource_format_image.cpp +++ b/scene/io/resource_format_image.cpp @@ -125,7 +125,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(Globals::get_singleton()->get("debug/max_texture_size_alert"))) { + if (bool(GlobalConfig::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!"); } @@ -185,7 +185,7 @@ uint32_t ResourceFormatLoaderImage::load_image_flags(const String &p_path) { if (flags_found.has("filter")) { if (flags_found["filter"]) flags|=Texture::FLAG_FILTER; - } else if (bool(GLOBAL_DEF("image_loader/filter",true))) { + } else if (bool(GLOBAL_DEF("rendering/image_loader/filter",true))) { flags|=Texture::FLAG_FILTER; } @@ -193,14 +193,14 @@ uint32_t ResourceFormatLoaderImage::load_image_flags(const String &p_path) { if (flags_found.has("gen_mipmaps")) { if (flags_found["gen_mipmaps"]) flags|=Texture::FLAG_MIPMAPS; - } else if (bool(GLOBAL_DEF("image_loader/gen_mipmaps",true))) { + } else if (bool(GLOBAL_DEF("rendering/image_loader/gen_mipmaps",true))) { flags|=Texture::FLAG_MIPMAPS; } if (flags_found.has("repeat")) { if (flags_found["repeat"]) flags|=Texture::FLAG_REPEAT; - } else if (bool(GLOBAL_DEF("image_loader/repeat",true))) { + } else if (bool(GLOBAL_DEF("rendering/image_loader/repeat",true))) { flags|=Texture::FLAG_REPEAT; } @@ -252,11 +252,11 @@ String ResourceFormatLoaderImage::get_resource_type(const String &p_path) const ResourceFormatLoaderImage::ResourceFormatLoaderImage() { - max_texture_size = GLOBAL_DEF("debug/max_texture_size",0); - GLOBAL_DEF("debug/max_texture_size_alert",false); - debug_load_times=GLOBAL_DEF("debug/image_load_times",false); - GLOBAL_DEF("image_loader/filter",true); - GLOBAL_DEF("image_loader/gen_mipmaps",true); - GLOBAL_DEF("image_loader/repeat",false); + max_texture_size = GLOBAL_DEF("debug/image_loader/max_texture_size",0); + GLOBAL_DEF("debug/image_loader/max_texture_size_alert",false); + debug_load_times=GLOBAL_DEF("debug/image_loader/image_load_times",false); + GLOBAL_DEF("rendering/image_loader/filter",true); + GLOBAL_DEF("rendering/image_loader/gen_mipmaps",true); + GLOBAL_DEF("rendering/image_loader/repeat",false); } diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 5ea83a3b6e5..58829dbee38 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -2815,8 +2815,8 @@ bool Node::is_displayed_folded() const { void Node::_bind_methods() { - _GLOBAL_DEF("node/name_num_separator",0); - Globals::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("editor/node_name_num_separator",0); + GlobalConfig::get_singleton()->set_custom_property_info("editor/node_name_num_separator",PropertyInfo(Variant::INT,"editor/node_name_num_separator",PROPERTY_HINT_ENUM, "None,Space,Underscore,Dash")); ClassDB::bind_method(_MD("_add_child_below_node","node:Node","child_node:Node","legible_unique_name"),&Node::add_child_below_node,DEFVAL(false)); @@ -2989,7 +2989,7 @@ void Node::_bind_methods() { String Node::_get_name_num_separator() { - switch(Globals::get_singleton()->get("node/name_num_separator").operator int()) { + switch(GlobalConfig::get_singleton()->get("node/name_num_separator").operator int()) { case 0: return ""; case 1: return " "; case 2: return "_"; diff --git a/scene/main/scene_main_loop.cpp b/scene/main/scene_main_loop.cpp index 966d4c82efb..af6d6b18db4 100644 --- a/scene/main/scene_main_loop.cpp +++ b/scene/main/scene_main_loop.cpp @@ -2289,11 +2289,11 @@ SceneTree::SceneTree() { editor_hint=false; debug_collisions_hint=false; debug_navigation_hint=false; - debug_collisions_color=GLOBAL_DEF("debug/collision_shape_color",Color(0.0,0.6,0.7,0.5)); - debug_collision_contact_color=GLOBAL_DEF("debug/collision_contact_color",Color(1.0,0.2,0.1,0.8)); - debug_navigation_color=GLOBAL_DEF("debug/navigation_geometry_color",Color(0.1,1.0,0.7,0.4)); - debug_navigation_disabled_color=GLOBAL_DEF("debug/navigation_disabled_geometry_color",Color(1.0,0.7,0.1,0.4)); - collision_debug_contacts=GLOBAL_DEF("debug/collision_max_contacts_displayed",10000); + debug_collisions_color=GLOBAL_DEF("debug/collision/shape_color",Color(0.0,0.6,0.7,0.5)); + debug_collision_contact_color=GLOBAL_DEF("debug/collision/contact_color",Color(1.0,0.2,0.1,0.8)); + debug_navigation_color=GLOBAL_DEF("debug/navigation/geometry_color",Color(0.1,1.0,0.7,0.4)); + debug_navigation_disabled_color=GLOBAL_DEF("debug/navigation/disabled_geometry_color",Color(1.0,0.7,0.1,0.4)); + collision_debug_contacts=GLOBAL_DEF("debug/collision/max_contacts_displayed",10000); @@ -2322,10 +2322,10 @@ SceneTree::SceneTree() { int ref_atlas_size = GLOBAL_DEF("rendering/reflections/atlas_size",2048); int ref_atlas_subdiv = GLOBAL_DEF("rendering/reflections/atlas_subdiv",8); - int msaa_mode = GLOBAL_DEF("rendering/antialias/msaa",0); - Globals::get_singleton()->set_custom_property_info("rendering/antialias/msaa",PropertyInfo(Variant::INT,"rendering/antialias/msaa",PROPERTY_HINT_ENUM,"Disabled,2x,4x,8x,16x")); + int msaa_mode = GLOBAL_DEF("rendering/quality/msaa",0); + GlobalConfig::get_singleton()->set_custom_property_info("rendering/quality/msaa",PropertyInfo(Variant::INT,"rendering/quality/msaa",PROPERTY_HINT_ENUM,"Disabled,2x,4x,8x,16x")); root->set_msaa(Viewport::MSAA(msaa_mode)); - bool hdr = GLOBAL_DEF("rendering/dynamic_range/hdr",true); + bool hdr = GLOBAL_DEF("rendering/quality/hdr",true); root->set_hdr(hdr); VS::get_singleton()->scenario_set_reflection_atlas_size(root->get_world()->get_scenario(),ref_atlas_size,ref_atlas_subdiv); @@ -2341,7 +2341,7 @@ SceneTree::SceneTree() { ScriptDebugger::get_singleton()->set_request_scene_tree_message_func(_debugger_request_tree,this); } - root->set_physics_object_picking(GLOBAL_DEF("physics/enable_object_picking",true)); + root->set_physics_object_picking(GLOBAL_DEF("physics/common/enable_object_picking",true)); #ifdef TOOLS_ENABLED edited_scene_root=NULL; diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index f2a5648eae1..11ae03b1d01 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -2835,7 +2835,7 @@ Viewport::Viewport() { gui.tooltip_timer = -1; //gui.tooltip_timer->force_parent_owned(); - gui.tooltip_delay=GLOBAL_DEF("display/tooltip_delay",0.7); + gui.tooltip_delay=GLOBAL_DEF("gui/timers/tooltip_delay_sec",0.7); gui.tooltip=NULL; gui.tooltip_label=NULL; diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index ebdf84271ba..42262559ce3 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -273,12 +273,12 @@ void register_scene_types() { ResourceLoader::add_resource_format_loader( resource_loader_theme ); - bool default_theme_hidpi=GLOBAL_DEF("display/use_hidpi_theme",false); - Globals::get_singleton()->set_custom_property_info("display/use_hidpi_theme",PropertyInfo(Variant::BOOL,"display/use_hidpi_theme",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_RESTART_IF_CHANGED)); - String theme_path = GLOBAL_DEF("display/custom_theme",""); - Globals::get_singleton()->set_custom_property_info("display/custom_theme",PropertyInfo(Variant::STRING,"display/custom_theme",PROPERTY_HINT_FILE,"*.tres,*.res",PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_RESTART_IF_CHANGED)); - String font_path = GLOBAL_DEF("display/custom_theme_font",""); - Globals::get_singleton()->set_custom_property_info("display/custom_theme_font",PropertyInfo(Variant::STRING,"display/custom_theme_font",PROPERTY_HINT_FILE,"*.tres,*.res,*.fnt",PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_RESTART_IF_CHANGED)); + 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)); + 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)); + 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,*.fnt",PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_RESTART_IF_CHANGED)); if (theme_path!=String()) { @@ -481,7 +481,7 @@ void register_scene_types() { #endif ClassDB::register_class(); - AcceptDialog::set_swap_ok_cancel( GLOBAL_DEF("display/swap_ok_cancel",bool(OS::get_singleton()->get_swap_ok_cancel())) ); + AcceptDialog::set_swap_ok_cancel( GLOBAL_DEF("gui/common/swap_ok_cancel",bool(OS::get_singleton()->get_swap_ok_cancel())) ); ClassDB::register_class(); ClassDB::register_class(); @@ -515,12 +515,6 @@ void register_scene_types() { ClassDB::register_class(); ClassDB::register_class(); ClassDB::register_class(); - if (bool(GLOBAL_DEF("physics/remove_collision_helpers_at_runtime",false))) { - ClassDB::set_class_enabled("CollisionShape2D",false); - ClassDB::set_class_enabled("CollisionPolygon2D",false); - ClassDB::set_class_enabled("CollisionShape",false); - ClassDB::set_class_enabled("CollisionPolygon",false); - } OS::get_singleton()->yield(); //may take time to init diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp index 728ee69f21d..ffc0a38fc21 100644 --- a/scene/resources/environment.cpp +++ b/scene/resources/environment.cpp @@ -955,7 +955,6 @@ void Environment::_bind_methods() { GLOBAL_DEF("rendering/skybox/irradiance_cube_resolution",256); - GLOBAL_DEF("rendering/skybox/radiance_cube_resolution",64); BIND_CONSTANT(BG_KEEP); BIND_CONSTANT(BG_CLEAR_COLOR); diff --git a/scene/resources/scene_format_text.cpp b/scene/resources/scene_format_text.cpp index af38bdd82bc..fa56f634658 100644 --- a/scene/resources/scene_format_text.cpp +++ b/scene/resources/scene_format_text.cpp @@ -112,7 +112,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=Globals::get_singleton()->localize_path(res_path.get_base_dir().plus_file(path)); + path=GlobalConfig::get_singleton()->localize_path(res_path.get_base_dir().plus_file(path)); } @@ -172,7 +172,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=Globals::get_singleton()->localize_path(local_path.get_base_dir().plus_file(path)); + path=GlobalConfig::get_singleton()->localize_path(local_path.get_base_dir().plus_file(path)); } if (remaps.has(path)) { @@ -661,7 +661,7 @@ void ResourceInteractiveLoaderText::get_dependencies(FileAccess *f,List if (path.find("://")==-1 && path.is_rel_path()) { // path is relative to file being loaded, so convert to a resource path - path=Globals::get_singleton()->localize_path(local_path.get_base_dir().plus_file(path)); + path=GlobalConfig::get_singleton()->localize_path(local_path.get_base_dir().plus_file(path)); } @@ -948,9 +948,9 @@ Ref ResourceFormatLoaderText::load_interactive(const } Ref ria = memnew( ResourceInteractiveLoaderText ); - ria->local_path=Globals::get_singleton()->localize_path(p_path); + ria->local_path=GlobalConfig::get_singleton()->localize_path(p_path); ria->res_path=ria->local_path; -// ria->set_local_path( Globals::get_singleton()->localize_path(p_path) ); +// ria->set_local_path( GlobalConfig::get_singleton()->localize_path(p_path) ); ria->open(f); return ria; @@ -999,9 +999,9 @@ String ResourceFormatLoaderText::get_resource_type(const String &p_path) const{ } Ref ria = memnew( ResourceInteractiveLoaderText ); - ria->local_path=Globals::get_singleton()->localize_path(p_path); + ria->local_path=GlobalConfig::get_singleton()->localize_path(p_path); ria->res_path=ria->local_path; -// ria->set_local_path( Globals::get_singleton()->localize_path(p_path) ); +// ria->set_local_path( GlobalConfig::get_singleton()->localize_path(p_path) ); String r = ria->recognize(f); return r; } @@ -1016,9 +1016,9 @@ void ResourceFormatLoaderText::get_dependencies(const String& p_path,List ria = memnew( ResourceInteractiveLoaderText ); - ria->local_path=Globals::get_singleton()->localize_path(p_path); + ria->local_path=GlobalConfig::get_singleton()->localize_path(p_path); ria->res_path=ria->local_path; -// ria->set_local_path( Globals::get_singleton()->localize_path(p_path) ); +// ria->set_local_path( GlobalConfig::get_singleton()->localize_path(p_path) ); ria->get_dependencies(f,p_dependencies,p_add_types); @@ -1033,9 +1033,9 @@ Error ResourceFormatLoaderText::rename_dependencies(const String &p_path,const M } Ref ria = memnew( ResourceInteractiveLoaderText ); - ria->local_path=Globals::get_singleton()->localize_path(p_path); + ria->local_path=GlobalConfig::get_singleton()->localize_path(p_path); ria->res_path=ria->local_path; -// ria->set_local_path( Globals::get_singleton()->localize_path(p_path) ); +// ria->set_local_path( GlobalConfig::get_singleton()->localize_path(p_path) ); return ria->rename_dependencies(f,p_path,p_map); } @@ -1173,7 +1173,7 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path,const RES& p_re ERR_FAIL_COND_V( err, ERR_CANT_OPEN ); FileAccessRef _fref(f); - local_path = Globals::get_singleton()->localize_path(p_path); + local_path = GlobalConfig::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/world.cpp b/scene/resources/world.cpp index e89a4605588..64f3dd8b973 100644 --- a/scene/resources/world.cpp +++ b/scene/resources/world.cpp @@ -332,10 +332,10 @@ World::World() { sound_space = SpatialSoundServer::get_singleton()->space_create(); PhysicsServer::get_singleton()->space_set_active(space,true); - PhysicsServer::get_singleton()->area_set_param(space,PhysicsServer::AREA_PARAM_GRAVITY,GLOBAL_DEF("physics/default_gravity",9.8)); - PhysicsServer::get_singleton()->area_set_param(space,PhysicsServer::AREA_PARAM_GRAVITY_VECTOR,GLOBAL_DEF("physics/default_gravity_vector",Vector3(0,-1,0))); - PhysicsServer::get_singleton()->area_set_param(space,PhysicsServer::AREA_PARAM_LINEAR_DAMP,GLOBAL_DEF("physics/default_linear_damp",0.1)); - PhysicsServer::get_singleton()->area_set_param(space,PhysicsServer::AREA_PARAM_ANGULAR_DAMP,GLOBAL_DEF("physics/default_angular_damp",0.1)); + PhysicsServer::get_singleton()->area_set_param(space,PhysicsServer::AREA_PARAM_GRAVITY,GLOBAL_DEF("physics/3d/default_gravity",9.8)); + PhysicsServer::get_singleton()->area_set_param(space,PhysicsServer::AREA_PARAM_GRAVITY_VECTOR,GLOBAL_DEF("physics/3d/default_gravity_vector",Vector3(0,-1,0))); + PhysicsServer::get_singleton()->area_set_param(space,PhysicsServer::AREA_PARAM_LINEAR_DAMP,GLOBAL_DEF("physics/3d/default_linear_damp",0.1)); + PhysicsServer::get_singleton()->area_set_param(space,PhysicsServer::AREA_PARAM_ANGULAR_DAMP,GLOBAL_DEF("physics/3d/default_angular_damp",0.1)); #ifdef _3D_DISABLED indexer = NULL; diff --git a/scene/resources/world_2d.cpp b/scene/resources/world_2d.cpp index 46434bfd608..98c5ae3bb97 100644 --- a/scene/resources/world_2d.cpp +++ b/scene/resources/world_2d.cpp @@ -404,18 +404,16 @@ World2D::World2D() { //set space2D to be more friendly with pixels than meters, by adjusting some constants Physics2DServer::get_singleton()->space_set_active(space,true); - Physics2DServer::get_singleton()->area_set_param(space,Physics2DServer::AREA_PARAM_GRAVITY,GLOBAL_DEF("physics_2d/default_gravity",98)); - Physics2DServer::get_singleton()->area_set_param(space,Physics2DServer::AREA_PARAM_GRAVITY_VECTOR,GLOBAL_DEF("physics_2d/default_gravity_vector",Vector2(0,1))); + Physics2DServer::get_singleton()->area_set_param(space,Physics2DServer::AREA_PARAM_GRAVITY,GLOBAL_DEF("physics/2d/default_gravity",98)); + Physics2DServer::get_singleton()->area_set_param(space,Physics2DServer::AREA_PARAM_GRAVITY_VECTOR,GLOBAL_DEF("physics/2d/default_gravity_vector",Vector2(0,1))); // TODO: Remove this deprecation warning and compatibility code for 2.2 or 3.0 - if (Globals::get_singleton()->get("physics_2d/default_density") && !Globals::get_singleton()->get("physics_2d/default_linear_damp")) { - WARN_PRINT("Deprecated parameter 'physics_2d/default_density'. It was renamed to 'physics_2d/default_linear_damp', adjusting your project settings accordingly (make sure to adjust scripts that potentially rely on 'physics_2d/default_density'."); - Globals::get_singleton()->set("physics_2d/default_linear_damp", Globals::get_singleton()->get("physics_2d/default_density")); - Globals::get_singleton()->set_persisting("physics_2d/default_linear_damp", true); - Globals::get_singleton()->set_persisting("physics_2d/default_density", false); - Globals::get_singleton()->save(); + if (GlobalConfig::get_singleton()->get("physics/2d/default_density") && !GlobalConfig::get_singleton()->get("physics/2d/default_linear_damp")) { + WARN_PRINT("Deprecated parameter 'physics/2d/default_density'. It was renamed to 'physics/2d/default_linear_damp', adjusting your project settings accordingly (make sure to adjust scripts that potentially rely on 'physics/2d/default_density'."); + GlobalConfig::get_singleton()->set("physics/2d/default_linear_damp", GlobalConfig::get_singleton()->get("physics/2d/default_density")); + GlobalConfig::get_singleton()->save(); } - Physics2DServer::get_singleton()->area_set_param(space,Physics2DServer::AREA_PARAM_LINEAR_DAMP,GLOBAL_DEF("physics_2d/default_linear_damp",0.1)); - Physics2DServer::get_singleton()->area_set_param(space,Physics2DServer::AREA_PARAM_ANGULAR_DAMP,GLOBAL_DEF("physics_2d/default_angular_damp",1)); + Physics2DServer::get_singleton()->area_set_param(space,Physics2DServer::AREA_PARAM_LINEAR_DAMP,GLOBAL_DEF("physics/2d/default_linear_damp",0.1)); + Physics2DServer::get_singleton()->area_set_param(space,Physics2DServer::AREA_PARAM_ANGULAR_DAMP,GLOBAL_DEF("physics/2d/default_angular_damp",1)); indexer = memnew( SpatialIndexer2D ); } diff --git a/servers/audio/audio_server_sw.cpp b/servers/audio/audio_server_sw.cpp index b786d9d5322..edf8143eb57 100644 --- a/servers/audio/audio_server_sw.cpp +++ b/servers/audio/audio_server_sw.cpp @@ -943,7 +943,7 @@ AudioServerSW::AudioServerSW(SampleManagerSW *p_sample_manager) { sample_manager=p_sample_manager; String interp = GLOBAL_DEF("audio/mixer_interp","linear"); - Globals::get_singleton()->set_custom_property_info("audio/mixer_interp",PropertyInfo(Variant::STRING,"audio/mixer_interp",PROPERTY_HINT_ENUM,"raw,linear,cubic")); + GlobalConfig::get_singleton()->set_custom_property_info("audio/mixer_interp",PropertyInfo(Variant::STRING,"audio/mixer_interp",PROPERTY_HINT_ENUM,"raw,linear,cubic")); if (interp=="raw") mixer_interp=AudioMixerSW::INTERPOLATION_RAW; else if (interp=="cubic") diff --git a/servers/physics/space_sw.cpp b/servers/physics/space_sw.cpp index 237b6a7ce23..596c7af2149 100644 --- a/servers/physics/space_sw.cpp +++ b/servers/physics/space_sw.cpp @@ -719,9 +719,9 @@ SpaceSW::SpaceSW() { contact_max_allowed_penetration= 0.01; constraint_bias = 0.01; - body_linear_velocity_sleep_threshold=GLOBAL_DEF("physics/sleep_threshold_linear",0.1); - body_angular_velocity_sleep_threshold=GLOBAL_DEF("physics/sleep_threshold_angular", (8.0 / 180.0 * Math_PI) ); - body_time_to_sleep=GLOBAL_DEF("physics/time_before_sleep",0.5); + body_linear_velocity_sleep_threshold=GLOBAL_DEF("physics/3d/sleep_threshold_linear",0.1); + body_angular_velocity_sleep_threshold=GLOBAL_DEF("physics/3d/sleep_threshold_angular", (8.0 / 180.0 * Math_PI) ); + body_time_to_sleep=GLOBAL_DEF("physics/3d/time_before_sleep",0.5); body_angular_velocity_damp_ratio=10; diff --git a/servers/physics_2d/broad_phase_2d_hash_grid.cpp b/servers/physics_2d/broad_phase_2d_hash_grid.cpp index 82d77735743..efa12c37cb6 100644 --- a/servers/physics_2d/broad_phase_2d_hash_grid.cpp +++ b/servers/physics_2d/broad_phase_2d_hash_grid.cpp @@ -683,12 +683,12 @@ BroadPhase2DSW *BroadPhase2DHashGrid::_create() { BroadPhase2DHashGrid::BroadPhase2DHashGrid() { - hash_table_size = GLOBAL_DEF("physics_2d/bp_hash_table_size",4096); + hash_table_size = GLOBAL_DEF("physics/2d/bp_hash_table_size",4096); hash_table_size = Math::larger_prime(hash_table_size); hash_table = memnew_arr( PosBin*, hash_table_size); - cell_size = GLOBAL_DEF("physics_2d/cell_size",128); - large_object_min_surface = GLOBAL_DEF("physics_2d/large_object_surface_treshold_in_cells",512); + cell_size = GLOBAL_DEF("physics/2d/cell_size",128); + large_object_min_surface = GLOBAL_DEF("physics/2d/large_object_surface_treshold_in_cells",512); for(int i=0;iget("physics_2d/thread_model"))==2; + using_threads=int(GlobalConfig::get_singleton()->get("physics/2d/thread_model"))==2; }; diff --git a/servers/physics_2d/physics_2d_server_wrap_mt.cpp b/servers/physics_2d/physics_2d_server_wrap_mt.cpp index 8a60af725f8..8730bb9ee89 100644 --- a/servers/physics_2d/physics_2d_server_wrap_mt.cpp +++ b/servers/physics_2d/physics_2d_server_wrap_mt.cpp @@ -168,12 +168,12 @@ Physics2DServerWrapMT::Physics2DServerWrapMT(Physics2DServer* p_contained,bool p step_thread_up=false; alloc_mutex=Mutex::create(); - shape_pool_max_size=GLOBAL_DEF("core/thread_rid_pool_prealloc",20); - area_pool_max_size=GLOBAL_DEF("core/thread_rid_pool_prealloc",20); - body_pool_max_size=GLOBAL_DEF("core/thread_rid_pool_prealloc",20); - pin_joint_pool_max_size=GLOBAL_DEF("core/thread_rid_pool_prealloc",20); - groove_joint_pool_max_size=GLOBAL_DEF("core/thread_rid_pool_prealloc",20); - damped_spring_joint_pool_max_size=GLOBAL_DEF("core/thread_rid_pool_prealloc",20); + shape_pool_max_size=GLOBAL_GET("memory/multithread/thread_rid_pool_prealloc"); + area_pool_max_size=GLOBAL_GET("memory/multithread/thread_rid_pool_prealloc"); + body_pool_max_size=GLOBAL_GET("memory/multithread/thread_rid_pool_prealloc"); + pin_joint_pool_max_size=GLOBAL_GET("memory/multithread/thread_rid_pool_prealloc"); + groove_joint_pool_max_size=GLOBAL_GET("memory/multithread/thread_rid_pool_prealloc"); + damped_spring_joint_pool_max_size=GLOBAL_GET("memory/multithread/thread_rid_pool_prealloc"); if (!p_create_thread) { server_thread=Thread::get_caller_ID(); diff --git a/servers/physics_2d/physics_2d_server_wrap_mt.h b/servers/physics_2d/physics_2d_server_wrap_mt.h index 71928d77a60..a8e150d8f2a 100644 --- a/servers/physics_2d/physics_2d_server_wrap_mt.h +++ b/servers/physics_2d/physics_2d_server_wrap_mt.h @@ -320,7 +320,7 @@ public: template static Physics2DServer* init_server() { - int tm = GLOBAL_DEF("physics_2d/thread_model",1); + int tm = GLOBAL_DEF("physics/2d/thread_model",1); if (tm==0) //single unsafe return memnew( T ); else if (tm==1) //single saef diff --git a/servers/physics_2d/space_2d_sw.cpp b/servers/physics_2d/space_2d_sw.cpp index 42834ee4e4c..8b277aa4b9a 100644 --- a/servers/physics_2d/space_2d_sw.cpp +++ b/servers/physics_2d/space_2d_sw.cpp @@ -1329,9 +1329,9 @@ Space2DSW::Space2DSW() { contact_max_allowed_penetration= 0.3; constraint_bias = 0.2; - body_linear_velocity_sleep_treshold=GLOBAL_DEF("physics_2d/sleep_threashold_linear",2.0); - body_angular_velocity_sleep_treshold=GLOBAL_DEF("physics_2d/sleep_threshold_angular",(8.0 / 180.0 * Math_PI)); - body_time_to_sleep=GLOBAL_DEF("physics_2d/time_before_sleep",0.5); + body_linear_velocity_sleep_treshold=GLOBAL_DEF("physics/2d/sleep_threashold_linear",2.0); + body_angular_velocity_sleep_treshold=GLOBAL_DEF("physics/2d/sleep_threshold_angular",(8.0 / 180.0 * Math_PI)); + body_time_to_sleep=GLOBAL_DEF("physics/2d/time_before_sleep",0.5); broadphase = BroadPhase2DSW::create_func(); diff --git a/servers/register_server_types.cpp b/servers/register_server_types.cpp index a3f21fad6e0..87ccc5c6c3c 100644 --- a/servers/register_server_types.cpp +++ b/servers/register_server_types.cpp @@ -59,18 +59,20 @@ ShaderTypes *shader_types=NULL; void register_server_types() { - Globals::get_singleton()->add_singleton( Globals::Singleton("VisualServer",VisualServer::get_singleton()) ); - Globals::get_singleton()->add_singleton( Globals::Singleton("VS",VisualServer::get_singleton()) ); - Globals::get_singleton()->add_singleton( Globals::Singleton("AudioServer",AudioServer::get_singleton()) ); - Globals::get_singleton()->add_singleton( Globals::Singleton("AS",AudioServer::get_singleton()) ); - Globals::get_singleton()->add_singleton( Globals::Singleton("PhysicsServer",PhysicsServer::get_singleton()) ); - Globals::get_singleton()->add_singleton( Globals::Singleton("PS",PhysicsServer::get_singleton()) ); - Globals::get_singleton()->add_singleton( Globals::Singleton("Physics2DServer",Physics2DServer::get_singleton()) ); - Globals::get_singleton()->add_singleton( Globals::Singleton("PS2D",Physics2DServer::get_singleton()) ); - Globals::get_singleton()->add_singleton( Globals::Singleton("SpatialSoundServer",SpatialSoundServer::get_singleton()) ); - Globals::get_singleton()->add_singleton( Globals::Singleton("SS",SpatialSoundServer::get_singleton()) ); - Globals::get_singleton()->add_singleton( Globals::Singleton("SpatialSound2DServer",SpatialSound2DServer::get_singleton()) ); - Globals::get_singleton()->add_singleton( Globals::Singleton("SS2D",SpatialSound2DServer::get_singleton()) ); + GLOBAL_DEF("memory/multithread/thread_rid_pool_prealloc",20); + + GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("VisualServer",VisualServer::get_singleton()) ); + GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("VS",VisualServer::get_singleton()) ); + GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("AudioServer",AudioServer::get_singleton()) ); + GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("AS",AudioServer::get_singleton()) ); + GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("PhysicsServer",PhysicsServer::get_singleton()) ); + GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("PS",PhysicsServer::get_singleton()) ); + GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("Physics2DServer",Physics2DServer::get_singleton()) ); + GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("PS2D",Physics2DServer::get_singleton()) ); + GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("SpatialSoundServer",SpatialSoundServer::get_singleton()) ); + GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("SS",SpatialSoundServer::get_singleton()) ); + GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("SpatialSound2DServer",SpatialSound2DServer::get_singleton()) ); + GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("SS2D",SpatialSound2DServer::get_singleton()) ); shader_types = memnew( ShaderTypes ); diff --git a/servers/visual/visual_server_viewport.cpp b/servers/visual/visual_server_viewport.cpp index 558a3e4c239..7ecf041d2a2 100644 --- a/servers/visual/visual_server_viewport.cpp +++ b/servers/visual/visual_server_viewport.cpp @@ -243,7 +243,7 @@ void VisualServerViewport::draw_viewports() { //draw viewports - clear_color=GLOBAL_DEF("rendering/viewport/default_clear_color",Color(0.5,0.5,0.5)); + clear_color=GLOBAL_GET("rendering/viewport/default_clear_color"); active_viewports.sort_custom(); diff --git a/tools/collada/collada.cpp b/tools/collada/collada.cpp index 204de450820..9f2416223e8 100644 --- a/tools/collada/collada.cpp +++ b/tools/collada/collada.cpp @@ -322,7 +322,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=Globals::get_singleton()->localize_path(state.local_path.get_base_dir()+"/"+path.percent_decode()); + image.path=GlobalConfig::get_singleton()->localize_path(state.local_path.get_base_dir()+"/"+path.percent_decode()); } } else { @@ -342,11 +342,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=Globals::get_singleton()->localize_path(state.local_path.get_base_dir()+"/"+path); + path=GlobalConfig::get_singleton()->localize_path(state.local_path.get_base_dir()+"/"+path); } else if (path.find("file:///")==0) { path=path.replace_first("file:///",""); - path=Globals::get_singleton()->localize_path(path); + path=GlobalConfig::get_singleton()->localize_path(path); } image.path=path; @@ -2720,7 +2720,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 = Globals::get_singleton()->localize_path(p_path); + state.local_path = GlobalConfig::get_singleton()->localize_path(p_path); state.import_flags=p_flags; /* Skip headers */ err=OK; diff --git a/tools/doc/doc_data.cpp b/tools/doc/doc_data.cpp index 10d4b6461dd..f66a8aff221 100644 --- a/tools/doc/doc_data.cpp +++ b/tools/doc/doc_data.cpp @@ -608,14 +608,14 @@ void DocData::generate(bool p_basic_types) { c.constants.push_back(cd); } - List singletons; - Globals::get_singleton()->get_singletons(&singletons); + List singletons; + GlobalConfig::get_singleton()->get_singletons(&singletons); //servers (this is kind of hackish) - for(List::Element *E=singletons.front();E;E=E->next()) { + for(List::Element *E=singletons.front();E;E=E->next()) { PropertyDoc pd; - Globals::Singleton &s=E->get(); + GlobalConfig::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/tools/editor/editor_autoload_settings.cpp b/tools/editor/editor_autoload_settings.cpp index e5758e41ee9..516863eae2d 100644 --- a/tools/editor/editor_autoload_settings.cpp +++ b/tools/editor/editor_autoload_settings.cpp @@ -116,13 +116,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(Globals::get_singleton(), name, "*" + path); - undo_redo->add_do_method(Globals::get_singleton(), "set_persisting", name, true); + undo_redo->add_do_property(GlobalConfig::get_singleton(), name, "*" + path); - if (Globals::get_singleton()->has(name)) { - undo_redo->add_undo_property(Globals::get_singleton(), name, Globals::get_singleton()->get(name)); + if (GlobalConfig::get_singleton()->has(name)) { + undo_redo->add_undo_property(GlobalConfig::get_singleton(), name, GlobalConfig::get_singleton()->get(name)); } else { - undo_redo->add_undo_property(Globals::get_singleton(), name, Variant()); + undo_redo->add_undo_property(GlobalConfig::get_singleton(), name, Variant()); } undo_redo->add_do_method(this, "update_autoload"); @@ -171,7 +170,7 @@ void EditorAutoloadSettings::_autoload_edited() { return; } - if (Globals::get_singleton()->has("autoload/" + name)) { + if (GlobalConfig::get_singleton()->has("autoload/" + name)) { ti->set_text(0, old_name); EditorNode::get_singleton()->show_warning(vformat(TTR("Autoload '%s' already exists!"), name)); return; @@ -181,21 +180,18 @@ void EditorAutoloadSettings::_autoload_edited() { name = "autoload/" + name; - bool persisting = Globals::get_singleton()->get(selected_autoload); - int order = Globals::get_singleton()->get(selected_autoload); - String path = Globals::get_singleton()->get(selected_autoload); + int order = GlobalConfig::get_singleton()->get_order(selected_autoload); + String path = GlobalConfig::get_singleton()->get(selected_autoload); undo_redo->create_action(TTR("Rename Autoload")); - undo_redo->add_do_property(Globals::get_singleton(), name, path); - undo_redo->add_do_method(Globals::get_singleton(), "set_persisting", name, persisting); - undo_redo->add_do_method(Globals::get_singleton(), "set_order", name, order); - undo_redo->add_do_method(Globals::get_singleton(), "clear", selected_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_undo_property(Globals::get_singleton(), selected_autoload, path); - undo_redo->add_undo_method(Globals::get_singleton(), "set_persisting", selected_autoload, persisting); - undo_redo->add_undo_method(Globals::get_singleton(), "set_order", selected_autoload, order); - undo_redo->add_undo_method(Globals::get_singleton(), "clear", name); + 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_do_method(this, "update_autoload"); undo_redo->add_undo_method(this, "update_autoload"); @@ -212,8 +208,8 @@ void EditorAutoloadSettings::_autoload_edited() { bool checked = ti->is_checked(2); String base = "autoload/" + ti->get_text(0); - int order = Globals::get_singleton()->get_order(base); - String path = Globals::get_singleton()->get(base); + int order = GlobalConfig::get_singleton()->get_order(base); + String path = GlobalConfig::get_singleton()->get(base); if (path.begins_with("*")) path = path.substr(1, path.length()); @@ -223,11 +219,11 @@ void EditorAutoloadSettings::_autoload_edited() { undo_redo->create_action(TTR("Toggle AutoLoad Globals")); - undo_redo->add_do_property(Globals::get_singleton(), base, path); - undo_redo->add_undo_property(Globals::get_singleton(), base, Globals::get_singleton()->get(base)); + 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_method(Globals::get_singleton(),"set_order", base, order); - undo_redo->add_undo_method(Globals::get_singleton(),"set_order", base, order); + 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(this, "update_autoload"); undo_redo->add_undo_method(this, "update_autoload"); @@ -267,16 +263,16 @@ void EditorAutoloadSettings::_autoload_button_pressed(Object *p_item, int p_colu String swap_name = "autoload/" + swap->get_text(0); - int order = Globals::get_singleton()->get_order(name); - int swap_order = Globals::get_singleton()->get_order(swap_name); + int order = GlobalConfig::get_singleton()->get_order(name); + int swap_order = GlobalConfig::get_singleton()->get_order(swap_name); undo_redo->create_action(TTR("Move Autoload")); - undo_redo->add_do_method(Globals::get_singleton(), "set_order", name, swap_order); - undo_redo->add_undo_method(Globals::get_singleton(), "set_order", name, order); + 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(Globals::get_singleton(), "set_order", swap_name, order); - undo_redo->add_undo_method(Globals::get_singleton(), "set_order", swap_name, swap_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(this, "update_autoload"); undo_redo->add_undo_method(this, "update_autoload"); @@ -288,15 +284,15 @@ void EditorAutoloadSettings::_autoload_button_pressed(Object *p_item, int p_colu } break; case BUTTON_DELETE: { - int order = Globals::get_singleton()->get_order(name); + int order = GlobalConfig::get_singleton()->get_order(name); undo_redo->create_action(TTR("Remove Autoload")); - undo_redo->add_do_property(Globals::get_singleton(), name, Variant()); + undo_redo->add_do_property(GlobalConfig::get_singleton(), name, Variant()); - undo_redo->add_undo_property(Globals::get_singleton(), name, Globals::get_singleton()->get(name)); - undo_redo->add_undo_method(Globals::get_singleton(), "set_persisting", name, true); - undo_redo->add_undo_method(Globals::get_singleton(), "set_order", order); + 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_do_method(this, "update_autoload"); undo_redo->add_undo_method(this, "update_autoload"); @@ -327,7 +323,7 @@ void EditorAutoloadSettings::update_autoload() { TreeItem *root = tree->create_item(); List props; - Globals::get_singleton()->get_property_list(&props); + GlobalConfig::get_singleton()->get_property_list(&props); for (List::Element *E = props.front(); E; E = E->next()) { @@ -337,14 +333,14 @@ void EditorAutoloadSettings::update_autoload() { continue; String name = pi.name.get_slice("/", 1); - String path = Globals::get_singleton()->get(pi.name); + String path = GlobalConfig::get_singleton()->get(pi.name); if (name.empty()) continue; AutoLoadInfo info; info.name = pi.name; - info.order = Globals::get_singleton()->get_order(pi.name); + info.order = GlobalConfig::get_singleton()->get_order(pi.name); autoload_cache.push_back(info); @@ -464,7 +460,7 @@ void EditorAutoloadSettings::drop_data_fw(const Point2& p_point, const Variant& move_to_back = true; } - int order = Globals::get_singleton()->get_order("autoload/" + name); + int order = GlobalConfig::get_singleton()->get_order("autoload/" + name); AutoLoadInfo aux; List::Element *E = NULL; @@ -481,7 +477,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 = Globals::get_singleton()->get_order("autoload/" + autoloads[i]); + aux.order = GlobalConfig::get_singleton()->get_order("autoload/" + autoloads[i]); List::Element *I = autoload_cache.find(aux); @@ -511,8 +507,8 @@ void EditorAutoloadSettings::drop_data_fw(const Point2& p_point, const Variant& i = 0; for (List::Element *E = autoload_cache.front(); E; E = E->next()) { - undo_redo->add_do_method(Globals::get_singleton(), "set_order", E->get().name, orders[i++]); - undo_redo->add_undo_method(Globals::get_singleton(), "set_order", E->get().name, E->get().order); + 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); } orders.clear(); diff --git a/tools/editor/editor_file_system.cpp b/tools/editor/editor_file_system.cpp index 496ebf383c0..5fb274f38f7 100644 --- a/tools/editor/editor_file_system.cpp +++ b/tools/editor/editor_file_system.cpp @@ -286,7 +286,7 @@ void EditorFileSystem::_scan_filesystem() { sources_changed.clear(); file_cache.clear(); - String project=Globals::get_singleton()->get_resource_path(); + String project=GlobalConfig::get_singleton()->get_resource_path(); String fscache = EditorSettings::get_singleton()->get_project_settings_path().plus_file("filesystem_cache"); FileAccess *f =FileAccess::open(fscache,FileAccess::READ); @@ -488,7 +488,7 @@ bool EditorFileSystem::_update_scan_actions() { void EditorFileSystem::scan() { - if (bool(Globals::get_singleton()->get("debug/disable_scan"))) + if (false /*&& bool(Globals::get_singleton()->get("debug/disable_scan"))*/) return; if (scanning || scanning_sources|| thread) @@ -1088,7 +1088,7 @@ bool EditorFileSystem::_find_file(const String& p_file,EditorFileSystemDirectory return false; - String f = Globals::get_singleton()->localize_path(p_file); + String f = GlobalConfig::get_singleton()->localize_path(p_file); if (!f.begins_with("res://")) return false; @@ -1204,7 +1204,7 @@ EditorFileSystemDirectory *EditorFileSystem::get_path(const String& p_path) { return NULL; - String f = Globals::get_singleton()->localize_path(p_path); + String f = GlobalConfig::get_singleton()->localize_path(p_path); if (!f.begins_with("res://")) return NULL; diff --git a/tools/editor/editor_import_export.cpp b/tools/editor/editor_import_export.cpp index e921fd49b97..d0525af482b 100644 --- a/tools/editor/editor_import_export.cpp +++ b/tools/editor/editor_import_export.cpp @@ -46,8 +46,8 @@ String EditorImportPlugin::validate_source_path(const String& p_path) { - String gp = Globals::get_singleton()->globalize_path(p_path); - String rp = Globals::get_singleton()->get_resource_path(); + String gp = GlobalConfig::get_singleton()->globalize_path(p_path); + String rp = GlobalConfig::get_singleton()->get_resource_path(); if (!rp.ends_with("/")) rp+="/"; @@ -57,7 +57,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 Globals::get_singleton()->get_resource_path().plus_file(p_path).simplify_path(); + return GlobalConfig::get_singleton()->get_resource_path().plus_file(p_path).simplify_path(); } else { return p_path; } @@ -765,7 +765,7 @@ Error EditorExportPlatform::export_project_files(EditorExportSaveFunction p_func { MD5_CTX ctx; MD5Init(&ctx); - String path = Globals::get_singleton()->get_resource_path()+"::"+String(E->get())+"::"+get_name(); + String path = GlobalConfig::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); @@ -874,11 +874,11 @@ Error EditorExportPlatform::export_project_files(EditorExportSaveFunction p_func int flags=0; - if (Globals::get_singleton()->get("image_loader/filter")) + if (GlobalConfig::get_singleton()->get("image_loader/filter")) flags|=EditorTextureImportPlugin::IMAGE_FLAG_FILTER; - if (!Globals::get_singleton()->get("image_loader/gen_mipmaps")) + if (!GlobalConfig::get_singleton()->get("image_loader/gen_mipmaps")) flags|=EditorTextureImportPlugin::IMAGE_FLAG_NO_MIPMAPS; - if (!Globals::get_singleton()->get("image_loader/repeat")) + if (!GlobalConfig::get_singleton()->get("image_loader/repeat")) flags|=EditorTextureImportPlugin::IMAGE_FLAG_REPEAT; flags|=EditorTextureImportPlugin::IMAGE_FLAG_FIX_BORDER_ALPHA; @@ -987,7 +987,7 @@ Error EditorExportPlatform::export_project_files(EditorExportSaveFunction p_func StringName engine_cfg="res://engine.cfg"; StringName boot_splash; { - String splash=Globals::get_singleton()->get("application/boot_splash"); //avoid splash from being converted + String splash=GlobalConfig::get_singleton()->get("application/boot_splash"); //avoid splash from being converted splash=splash.strip_edges(); if (splash!=String()) { if (!splash.begins_with("res://")) @@ -998,7 +998,7 @@ Error EditorExportPlatform::export_project_files(EditorExportSaveFunction p_func } StringName custom_cursor; { - String splash=Globals::get_singleton()->get("display/custom_mouse_cursor"); //avoid splash from being converted + String splash=GlobalConfig::get_singleton()->get("display/custom_mouse_cursor"); //avoid splash from being converted splash=splash.strip_edges(); if (splash!=String()) { if (!splash.begins_with("res://")) @@ -1084,7 +1084,7 @@ Error EditorExportPlatform::export_project_files(EditorExportSaveFunction p_func String remap_file="engine.cfb"; String engine_cfb =EditorSettings::get_singleton()->get_settings_path()+"/tmp/tmp"+remap_file; - Globals::get_singleton()->save_custom(engine_cfb,custom); + GlobalConfig::get_singleton()->save_custom(engine_cfb,custom); Vector data = FileAccess::get_file_as_array(engine_cfb); Error err = p_func(p_udata,"res://"+remap_file,data,counter,files.size()); @@ -1129,7 +1129,7 @@ void EditorExportPlatform::gen_export_flags(Vector &r_flags, int p_flags r_flags.push_back("-rdebug"); - r_flags.push_back(host+":"+String::num(GLOBAL_DEF("debug/debug_port", 6007))); + r_flags.push_back(host+":"+String::num(GLOBAL_DEF("network/debug/remote_port", 6007))); List breakpoints; ScriptEditor::get_singleton()->get_breakpoints(&breakpoints); diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index cac8195a24c..2fd9216b661 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -157,7 +157,7 @@ void EditorNode::_update_scene_tabs() { void EditorNode::_update_title() { - String appname = Globals::get_singleton()->get("application/name"); + String appname = GlobalConfig::get_singleton()->get("application/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()) @@ -560,7 +560,7 @@ void EditorNode::save_resource_in_path(const Ref& p_resource,const Str //if (EditorSettings::get_singleton()->get("on_save/save_paths_as_relative")) // flg|=ResourceSaver::FLAG_RELATIVE_PATHS; - String path = Globals::get_singleton()->localize_path(p_path); + String path = GlobalConfig::get_singleton()->localize_path(p_path); Error err = ResourceSaver::save(path,p_resource,flg|ResourceSaver::FLAG_REPLACE_SUBRESOURCE_PATHS); if (err!=OK) { @@ -1015,7 +1015,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( Globals::get_singleton()->localize_path(p_file) ); + scene->set_filename( GlobalConfig::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()); @@ -1059,7 +1059,7 @@ void EditorNode::_import_action(const String& p_action) { EditorImport::generate_version_hashes(src); - Node *dst = SceneLoader::load(editor_data.get_imported_scene(Globals::get_singleton()->localize_path(_tmp_import_path))); + Node *dst = SceneLoader::load(editor_data.get_imported_scene(GlobalConfig::get_singleton()->localize_path(_tmp_import_path))); if (!dst) { @@ -1167,9 +1167,8 @@ void EditorNode::_dialog_action(String p_file) { } break; case SETTINGS_PICK_MAIN_SCENE: { - Globals::get_singleton()->set("application/main_scene",p_file); - Globals::get_singleton()->set_persisting("application/main_scene",true); - Globals::get_singleton()->save(); + GlobalConfig::get_singleton()->set("application/main_scene",p_file); + GlobalConfig::get_singleton()->save(); //would be nice to show the project manager opened with the hilighted field.. } break; case FILE_SAVE_OPTIMIZED: { @@ -1929,7 +1928,7 @@ void EditorNode::_run(bool p_current,const String& p_custom) { List breakpoints; editor_data.get_editor_breakpoints(&breakpoints); - args = Globals::get_singleton()->get("editor/main_run_args"); + args = GlobalConfig::get_singleton()->get("editor/main_run_args"); Error error = editor_run.run(run_filename,args,breakpoints,current_filename); @@ -2498,7 +2497,7 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { } instanced_scene->generate_instance_state(); - instanced_scene->set_filename( Globals::get_singleton()->localize_path(external_file) ); + instanced_scene->set_filename( GlobalConfig::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); @@ -3082,11 +3081,9 @@ void EditorNode::_update_addon_config() { } if (enabled_addons.size()==0) { - Globals::get_singleton()->set("editor_plugins/enabled",Variant()); - Globals::get_singleton()->set_persisting("editor_plugins/enabled",false); + GlobalConfig::get_singleton()->set("editor_plugins/enabled",Variant()); } else { - Globals::get_singleton()->set("editor_plugins/enabled",enabled_addons); - Globals::get_singleton()->set_persisting("editor_plugins/enabled",true); + GlobalConfig::get_singleton()->set("editor_plugins/enabled",enabled_addons); } project_settings->queue_save(); @@ -3351,7 +3348,7 @@ Error EditorNode::save_optimized_copy(const String& p_scene,const String& p_pres } - String src_scene=Globals::get_singleton()->localize_path(get_edited_scene()->get_filename()); + String src_scene=GlobalConfig::get_singleton()->localize_path(get_edited_scene()->get_filename()); String path=p_scene; @@ -3362,13 +3359,13 @@ Error EditorNode::save_optimized_copy(const String& p_scene,const String& p_pres print_line("rel path!?"); path=src_scene.get_base_dir()+"/"+path; } - path = Globals::get_singleton()->localize_path(path); + path = GlobalConfig::get_singleton()->localize_path(path); print_line("path: "+path); String preset = "optimizer_presets/"+p_preset; - if (!Globals::get_singleton()->has(preset)) { + if (!GlobalConfig::get_singleton()->has(preset)) { //accept->"()->hide(); accept->get_ok()->set_text("I see.."); @@ -3379,7 +3376,7 @@ Error EditorNode::save_optimized_copy(const String& p_scene,const String& p_pres } - Dictionary d = Globals::get_singleton()->get(preset); + Dictionary d = GlobalConfig::get_singleton()->get(preset); ERR_FAIL_COND_V(!d.has("__type__"),ERR_INVALID_DATA); String type=d["__type__"]; @@ -3665,7 +3662,7 @@ Error EditorNode::load_scene(const String& p_scene, bool p_ignore_broken_deps,bo if (p_clear_errors) load_errors->clear(); - String lpath = Globals::get_singleton()->localize_path(p_scene); + String lpath = GlobalConfig::get_singleton()->localize_path(p_scene); if (!lpath.begins_with("res://")) { @@ -3956,7 +3953,7 @@ void EditorNode::animation_editor_make_visible(bool p_visible) { #endif void EditorNode::_add_to_recent_scenes(const String& p_scene) { - String base="_"+Globals::get_singleton()->get_resource_path().replace("\\","::").replace("/","::"); + String base="_"+GlobalConfig::get_singleton()->get_resource_path().replace("\\","::").replace("/","::"); Vector rc = EDITOR_DEF(base+"/_recent_scenes",Array()); String name = p_scene; name=name.replace("res://",""); @@ -3974,7 +3971,7 @@ void EditorNode::_add_to_recent_scenes(const String& p_scene) { void EditorNode::_open_recent_scene(int p_idx) { - String base="_"+Globals::get_singleton()->get_resource_path().replace("\\","::").replace("/","::"); + String base="_"+GlobalConfig::get_singleton()->get_resource_path().replace("\\","::").replace("/","::"); Vector rc = EDITOR_DEF(base+"/_recent_scenes",Array()); ERR_FAIL_INDEX(p_idx,rc.size()); @@ -4030,13 +4027,13 @@ void EditorNode::_save_optimized() { } - project_settings->add_remapped_path(Globals::get_singleton()->localize_path(get_edited_scene()->get_filename()),Globals::get_singleton()->localize_path(path),platform); + project_settings->add_remapped_path(GlobalConfig::get_singleton()->localize_path(get_edited_scene()->get_filename()),GlobalConfig::get_singleton()->localize_path(path),platform); #endif } void EditorNode::_update_recent_scenes() { - String base="_"+Globals::get_singleton()->get_resource_path().replace("\\","::").replace("/","::"); + String base="_"+GlobalConfig::get_singleton()->get_resource_path().replace("\\","::").replace("/","::"); Vector rc = EDITOR_DEF(base+"/_recent_scenes",Array()); recent_scenes->clear(); for(int i=0;iviewport_set_hide_scenario(scene_root->get_viewport(),true); scene_root->set_disable_input(true); scene_root->set_as_audio_listener_2d(true); - //scene_root->set_size_override(true,Size2(Globals::get_singleton()->get("display/width"),Globals::get_singleton()->get("display/height"))); + //scene_root->set_size_override(true,Size2(GlobalConfig::get_singleton()->get("display/width"),GlobalConfig::get_singleton()->get("display/height"))); // scene_root->set_world_2d( Ref( memnew( World2D )) ); @@ -5777,8 +5774,8 @@ EditorNode::EditorNode() { pm_export->connect("item_pressed",this,"_menu_option"); p->add_separator(); - p->add_item(TTR("Undo"),EDIT_UNDO,KEY_MASK_CMD+KEY_Z); - p->add_item(TTR("Redo"),EDIT_REDO,KEY_MASK_CMD+KEY_MASK_SHIFT+KEY_Z); + p->add_shortcut(ED_SHORTCUT("editor/undo", TTR("Undo"),KEY_MASK_CMD+KEY_Z),EDIT_UNDO,true); + p->add_shortcut(ED_SHORTCUT("editor/redo", TTR("Redo"),KEY_MASK_SHIFT+KEY_MASK_CMD+KEY_Z),EDIT_REDO,true); p->add_separator(); p->add_item(TTR("Run Script"),FILE_RUN_SCRIPT,KEY_MASK_SHIFT+KEY_MASK_CMD+KEY_R); p->add_separator(); @@ -6634,8 +6631,8 @@ 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 - Globals::get_singleton()->set("debug/indicators_enabled",true); - Globals::get_singleton()->set("render/room_cull_enabled",false); + +// GlobalConfig::get_singleton()->set("render/room_cull_enabled",false); reference_resource_mem=true; save_external_resources_mem=true; @@ -6649,7 +6646,7 @@ EditorNode::EditorNode() { //store project name in ssettings String project_name; //figure it out from path - project_name=Globals::get_singleton()->get_resource_path().replace("\\","/"); + project_name=GlobalConfig::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); @@ -6657,7 +6654,7 @@ EditorNode::EditorNode() { project_name=project_name.replace("/","::"); if (project_name!="") { - EditorSettings::get_singleton()->set("projects/"+project_name,Globals::get_singleton()->get_resource_path()); + EditorSettings::get_singleton()->set("projects/"+project_name,GlobalConfig::get_singleton()->get_resource_path()); EditorSettings::get_singleton()->raise_order("projects/"+project_name); EditorSettings::get_singleton()->save(); } @@ -6739,7 +6736,7 @@ EditorNode::EditorNode() { { _initializing_addons=true; - Vector addons = Globals::get_singleton()->get("editor_plugins/enabled"); + Vector addons = GlobalConfig::get_singleton()->get("editor_plugins/enabled"); for(int i=0;i active_plugins = Globals::get_singleton()->get("plugins/active"); + Vector active_plugins = GlobalConfig::get_singleton()->get("plugins/active"); for(int i=0;iget_settings_path().plus_file("tmp"); - String cache_base = Globals::get_singleton()->globalize_path(item.path).md5_text(); + String cache_base = GlobalConfig::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/tools/editor/editor_run.cpp b/tools/editor/editor_run.cpp index d4082915318..2a0212f29eb 100644 --- a/tools/editor/editor_run.cpp +++ b/tools/editor/editor_run.cpp @@ -39,7 +39,7 @@ Error EditorRun::run(const String& p_scene,const String p_custom_args,const List List args; - String resource_path = Globals::get_singleton()->get_resource_path(); + String resource_path = GlobalConfig::get_singleton()->get_resource_path(); if (resource_path!="") { args.push_back("-path"); @@ -49,7 +49,7 @@ Error EditorRun::run(const String& p_scene,const String p_custom_args,const List if (true) { args.push_back("-rdebug"); - args.push_back("localhost:"+String::num(GLOBAL_DEF("debug/debug_port", 6007))); + args.push_back("localhost:"+String::num(GLOBAL_GET("network/debug/remote_port"))); } args.push_back("-epid"); @@ -78,12 +78,12 @@ Error EditorRun::run(const String& p_scene,const String p_custom_args,const List Size2 desired_size; - desired_size.x=Globals::get_singleton()->get("display/width"); - desired_size.y=Globals::get_singleton()->get("display/height"); + desired_size.x=GlobalConfig::get_singleton()->get("display/width"); + desired_size.y=GlobalConfig::get_singleton()->get("display/height"); Size2 test_size; - test_size.x=Globals::get_singleton()->get("display/test_width"); - test_size.y=Globals::get_singleton()->get("display/test_height"); + test_size.x=GlobalConfig::get_singleton()->get("display/test_width"); + test_size.y=GlobalConfig::get_singleton()->get("display/test_height"); if (test_size.x>0 && test_size.y>0) { desired_size=test_size; diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp index e7de62e4cb2..2724bd7d3ef 100644 --- a/tools/editor/editor_settings.cpp +++ b/tools/editor/editor_settings.cpp @@ -307,7 +307,7 @@ void EditorSettings::create() { dir->change_dir("config"); - String pcp=Globals::get_singleton()->get_resource_path(); + String pcp=GlobalConfig::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/tools/editor/file_type_cache.cpp b/tools/editor/file_type_cache.cpp index d9b6f36783b..176205a7df3 100644 --- a/tools/editor/file_type_cache.cpp +++ b/tools/editor/file_type_cache.cpp @@ -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=Globals::get_singleton()->get_resource_path(); + String project=GlobalConfig::get_singleton()->get_resource_path(); FileAccess *f =FileAccess::open(project+"/file_type_cache.cch",FileAccess::READ); if (!f) { @@ -81,7 +81,7 @@ void FileTypeCache::load() { void FileTypeCache::save() { GLOBAL_LOCK_FUNCTION - String project=Globals::get_singleton()->get_resource_path(); + String project=GlobalConfig::get_singleton()->get_resource_path(); FileAccess *f =FileAccess::open(project+"/file_type_cache.cch",FileAccess::WRITE); if (!f) { diff --git a/tools/editor/filesystem_dock.cpp b/tools/editor/filesystem_dock.cpp index 2b117812fbe..d8dcb092dbf 100644 --- a/tools/editor/filesystem_dock.cpp +++ b/tools/editor/filesystem_dock.cpp @@ -927,7 +927,7 @@ void FileSystemDock::_file_option(int p_option) { String path = files->get_item_metadata(idx); if (p_option == FILE_SHOW_IN_EXPLORER) { - String dir = Globals::get_singleton()->globalize_path(path); + String dir = GlobalConfig::get_singleton()->globalize_path(path); dir = dir.substr(0, dir.find_last("/")); OS::get_singleton()->shell_open(String("file://")+dir); return; diff --git a/tools/editor/io_plugins/editor_export_scene.cpp b/tools/editor/io_plugins/editor_export_scene.cpp index a88643d53b5..c2e037cfd7b 100644 --- a/tools/editor/io_plugins/editor_export_scene.cpp +++ b/tools/editor/io_plugins/editor_export_scene.cpp @@ -61,7 +61,7 @@ Vector EditorSceneExportPlugin::custom_export(String& p_path,const Ref< uint64_t sd=0; String smd5; - String gp = Globals::get_singleton()->globalize_path(p_path); + String gp = GlobalConfig::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/tools/editor/io_plugins/editor_scene_import_plugin.cpp b/tools/editor/io_plugins/editor_scene_import_plugin.cpp index 972076f106d..c387e503e60 100644 --- a/tools/editor/io_plugins/editor_scene_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_scene_import_plugin.cpp @@ -670,9 +670,9 @@ void EditorSceneImportDialog::_choose_save_file(const String& p_path) { void EditorSceneImportDialog::_choose_script(const String& p_path) { - String p = Globals::get_singleton()->localize_path(p_path); + String p = GlobalConfig::get_singleton()->localize_path(p_path); if (!p.is_resource_file()) - p=Globals::get_singleton()->get_resource_path().path_to(p_path.get_base_dir())+p_path.get_file(); + p=GlobalConfig::get_singleton()->get_resource_path().path_to(p_path.get_base_dir())+p_path.get_file(); script_path->set_text(p); } @@ -725,7 +725,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=Globals::get_singleton()->get("import/shared_textures"); + dst_path=GlobalConfig::get_singleton()->get("import/shared_textures"); uint32_t flags=0; @@ -1275,7 +1275,7 @@ EditorSceneImportDialog::EditorSceneImportDialog(EditorNode *p_editor, EditorSce set_hide_on_ok(false); GLOBAL_DEF("import/shared_textures","res://"); - Globals::get_singleton()->set_custom_property_info("import/shared_textures",PropertyInfo(Variant::STRING,"import/shared_textures",PROPERTY_HINT_DIR)); + GlobalConfig::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); @@ -2801,7 +2801,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 = Globals::get_singleton()->localize_path(target_res_path.plus_file(fname)); + String target_path = GlobalConfig::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/tools/editor/io_plugins/editor_texture_import_plugin.cpp b/tools/editor/io_plugins/editor_texture_import_plugin.cpp index bab11d7a93c..28462438fc2 100644 --- a/tools/editor/io_plugins/editor_texture_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_texture_import_plugin.cpp @@ -1639,7 +1639,7 @@ Vector EditorTextureImportPlugin::custom_export(const String& p_path, c uint8_t f4[4]; encode_uint32(flags,&f4[0]); MD5Init(&ctx); - String gp = Globals::get_singleton()->globalize_path(p_path); + String gp = GlobalConfig::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/tools/editor/plugins/animation_player_editor_plugin.cpp b/tools/editor/plugins/animation_player_editor_plugin.cpp index 17ed3842b2b..23e2f2e7129 100644 --- a/tools/editor/plugins/animation_player_editor_plugin.cpp +++ b/tools/editor/plugins/animation_player_editor_plugin.cpp @@ -380,7 +380,7 @@ void AnimationPlayerEditor::_animation_save_in_path(const Ref& p_resou //if (EditorSettings::get_singleton()->get("on_save/save_paths_as_relative")) // flg |= ResourceSaver::FLAG_RELATIVE_PATHS; - String path = Globals::get_singleton()->localize_path(p_path); + String path = GlobalConfig::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/tools/editor/plugins/animation_tree_editor_plugin.cpp b/tools/editor/plugins/animation_tree_editor_plugin.cpp index d1933d3286b..27976a6f160 100644 --- a/tools/editor/plugins/animation_tree_editor_plugin.cpp +++ b/tools/editor/plugins/animation_tree_editor_plugin.cpp @@ -1464,7 +1464,7 @@ AnimationTreeEditor::AnimationTreeEditor() { file_dialog = memnew( EditorFileDialog ); file_dialog->set_enable_multiple_selection(true); - file_dialog->set_current_dir(Globals::get_singleton()->get_resource_path()); + file_dialog->set_current_dir(GlobalConfig::get_singleton()->get_resource_path()); add_child(file_dialog); file_dialog->connect("file_selected", this, "_file_dialog_selected"); diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp index ef43992c3a9..04b8f7ce65b 100644 --- a/tools/editor/plugins/canvas_item_editor_plugin.cpp +++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp @@ -2074,7 +2074,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( Globals::get_singleton()->get("display/width"), Globals::get_singleton()->get("display/height") ); + Size2 screen_size = Size2( GlobalConfig::get_singleton()->get("display/width"), GlobalConfig::get_singleton()->get("display/height") ); Vector2 screen_endpoints[4]= { transform.xform(Vector2(0,0)), @@ -2409,7 +2409,7 @@ void CanvasItemEditor::_update_scrollbars() { h_scroll->set_end( Point2(size.width-vmin.width, size.height) ); - Size2 screen_rect = Size2( Globals::get_singleton()->get("display/width"), Globals::get_singleton()->get("display/height") ); + Size2 screen_rect = Size2( GlobalConfig::get_singleton()->get("display/width"), GlobalConfig::get_singleton()->get("display/height") ); Rect2 local_rect = Rect2(Point2(),viewport->get_size()-Size2(vmin.width,hmin.height)); @@ -3810,7 +3810,7 @@ bool CanvasItemEditorViewport::_create_instance(Node* parent, String& path, cons } } - instanced_scene->set_filename( Globals::get_singleton()->localize_path(path) ); + instanced_scene->set_filename( GlobalConfig::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/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index c25f8191fe3..d441fa7a112 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -1495,7 +1495,7 @@ void ScriptEditor::edit(const Ref