diff options
Diffstat (limited to 'tools')
28 files changed, 315 insertions, 305 deletions
diff --git a/tools/collada/collada.cpp b/tools/collada/collada.cpp index 204de45082..9f2416223e 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 10d4b6461d..f66a8aff22 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<Globals::Singleton> singletons; - Globals::get_singleton()->get_singletons(&singletons); + List<GlobalConfig::Singleton> singletons; + GlobalConfig::get_singleton()->get_singletons(&singletons); //servers (this is kind of hackish) - for(List<Globals::Singleton>::Element *E=singletons.front();E;E=E->next()) { + for(List<GlobalConfig::Singleton>::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 e5758e41ee..516863eae2 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<PropertyInfo> props; - Globals::get_singleton()->get_property_list(&props); + GlobalConfig::get_singleton()->get_property_list(&props); for (List<PropertyInfo>::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<AutoLoadInfo>::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<AutoLoadInfo>::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<AutoLoadInfo>::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 496ebf383c..5fb274f38f 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 e921fd49b9..d0525af482 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<uint8_t> 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<String> &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<String> breakpoints; ScriptEditor::get_singleton()->get_breakpoints(&breakpoints); diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index cac8195a24..2fd9216b66 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<Resource>& 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<String> 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<String> 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<String> 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<String> rc = EDITOR_DEF(base+"/_recent_scenes",Array()); recent_scenes->clear(); for(int i=0;i<rc.size();i++) { @@ -5701,7 +5698,7 @@ EditorNode::EditorNode() { VisualServer::get_singleton()->viewport_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<World2D>( 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<String> addons = Globals::get_singleton()->get("editor_plugins/enabled"); + Vector<String> addons = GlobalConfig::get_singleton()->get("editor_plugins/enabled"); for(int i=0;i<addons.size();i++) { set_addon_plugin_enabled(addons[i],true); diff --git a/tools/editor/editor_plugin_settings.cpp b/tools/editor/editor_plugin_settings.cpp index 6031448bbd..208e576a8a 100644 --- a/tools/editor/editor_plugin_settings.cpp +++ b/tools/editor/editor_plugin_settings.cpp @@ -81,7 +81,7 @@ void EditorPluginSettings::update_plugins() { plugins.sort(); - Vector<String> active_plugins = Globals::get_singleton()->get("plugins/active"); + Vector<String> active_plugins = GlobalConfig::get_singleton()->get("plugins/active"); for(int i=0;i<plugins.size();i++) { diff --git a/tools/editor/editor_resource_preview.cpp b/tools/editor/editor_resource_preview.cpp index 5f7157781d..c43aea06dd 100644 --- a/tools/editor/editor_resource_preview.cpp +++ b/tools/editor/editor_resource_preview.cpp @@ -221,7 +221,7 @@ void EditorResourcePreview::_thread() { String temp_path=EditorSettings::get_singleton()->get_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 d408291531..2a0212f29e 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<String> 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 e7de62e4cb..2724bd7d3e 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 d9b6f36783..176205a7df 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 2b117812fb..d8dcb092db 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 a88643d53b..c2e037cfd7 100644 --- a/tools/editor/io_plugins/editor_export_scene.cpp +++ b/tools/editor/io_plugins/editor_export_scene.cpp @@ -61,7 +61,7 @@ Vector<uint8_t> 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 972076f106..c387e503e6 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 bab11d7a93..28462438fc 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<uint8_t> 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 17ed3842b2..23e2f2e712 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<Resource>& 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 d1933d3286..27976a6f16 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 ef43992c3a..04b8f7ce65 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 c25f8191fe..d441fa7a11 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<Script>& p_script, bool p_grab_focus) { args.push_back(flagss[i]); } - args.push_back(Globals::get_singleton()->globalize_path(p_script->get_path())); + args.push_back(GlobalConfig::get_singleton()->globalize_path(p_script->get_path())); Error err = OS::get_singleton()->execute(path,args,false); if (err==OK) return; diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index a577e97843..79ce7a44c3 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -1825,11 +1825,11 @@ void SpatialEditorViewport::_notification(int p_what) { //update shadow atlas if changed - int shadowmap_size = Globals::get_singleton()->get("rendering/shadow_atlas/size"); - int atlas_q0 = Globals::get_singleton()->get("rendering/shadow_atlas/quadrant_0_subdiv"); - int atlas_q1 = Globals::get_singleton()->get("rendering/shadow_atlas/quadrant_1_subdiv"); - int atlas_q2 = Globals::get_singleton()->get("rendering/shadow_atlas/quadrant_2_subdiv"); - int atlas_q3 = Globals::get_singleton()->get("rendering/shadow_atlas/quadrant_3_subdiv"); + int shadowmap_size = GlobalConfig::get_singleton()->get("rendering/shadow_atlas/size"); + int atlas_q0 = GlobalConfig::get_singleton()->get("rendering/shadow_atlas/quadrant_0_subdiv"); + int atlas_q1 = GlobalConfig::get_singleton()->get("rendering/shadow_atlas/quadrant_1_subdiv"); + int atlas_q2 = GlobalConfig::get_singleton()->get("rendering/shadow_atlas/quadrant_2_subdiv"); + int atlas_q3 = GlobalConfig::get_singleton()->get("rendering/shadow_atlas/quadrant_3_subdiv"); viewport->set_shadow_atlas_size(shadowmap_size); @@ -1840,10 +1840,10 @@ void SpatialEditorViewport::_notification(int p_what) { //update msaa if changed - int msaa_mode = Globals::get_singleton()->get("rendering/antialias/msaa"); + int msaa_mode = GlobalConfig::get_singleton()->get("rendering/antialias/msaa"); viewport->set_msaa(Viewport::MSAA(msaa_mode)); - bool hdr = Globals::get_singleton()->get("rendering/dynamic_range/hdr"); + bool hdr = GlobalConfig::get_singleton()->get("rendering/dynamic_range/hdr"); viewport->set_hdr(hdr); @@ -1914,7 +1914,7 @@ void SpatialEditorViewport::_draw() { if (previewing) { - Size2 ss = Size2( Globals::get_singleton()->get("display/width"), Globals::get_singleton()->get("display/height") ); + Size2 ss = Size2( GlobalConfig::get_singleton()->get("display/width"), GlobalConfig::get_singleton()->get("display/height") ); float aspect = ss.get_aspect(); Size2 s = get_size(); diff --git a/tools/editor/project_export.cpp b/tools/editor/project_export.cpp index 3ee480c083..095ae747a7 100644 --- a/tools/editor/project_export.cpp +++ b/tools/editor/project_export.cpp @@ -448,7 +448,7 @@ void ProjectExportDialog::_export_mode_changed(int p_idx) { void ProjectExportDialog::_export_action(const String& p_file) { - String location = Globals::get_singleton()->globalize_path(p_file).get_base_dir().replace("\\","/"); + String location = GlobalConfig::get_singleton()->globalize_path(p_file).get_base_dir().replace("\\","/"); while(true) { @@ -1243,11 +1243,11 @@ void ProjectExportDialog::_group_atlas_preview() { 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; @@ -1702,7 +1702,7 @@ void ProjectExport::popup_export() { presets.insert("default"); List<PropertyInfo> pi; - Globals::get_singleton()->get_property_list(&pi); + GlobalConfig::get_singleton()->get_property_list(&pi); export_preset->clear(); for (List<PropertyInfo>::Element *E=pi.front();E;E=E->next()) { @@ -1732,8 +1732,8 @@ Error ProjectExport::export_project(const String& p_preset) { String selected=p_preset; - DVector<String> preset_settings = Globals::get_singleton()->get("export_presets/"+selected); - String preset_path=Globals::get_singleton()->get("export_presets_path/"+selected); + DVector<String> preset_settings = GlobalConfig::get_singleton()->get("export_presets/"+selected); + String preset_path=GlobalConfig::get_singleton()->get("export_presets_path/"+selected); if (preset_path=="") { error->set_text("Export path empty, see export options"); @@ -1787,7 +1787,7 @@ Error ProjectExport::export_project(const String& p_preset) { } } - Vector<String> names = Globals::get_singleton()->get_optimizer_presets(); + Vector<String> names = GlobalConfig::get_singleton()->get_optimizer_presets(); //prepare base paths @@ -1897,7 +1897,7 @@ Error ProjectExport::export_project(const String& p_preset) { print_line("Exporting "+itos(idx)+"/"+itos(export_action.size())+": "+path); - String base_dir = Globals::get_singleton()->localize_path(path.get_base_dir()).replace("\\","/").replace("res://",""); + String base_dir = GlobalConfig::get_singleton()->localize_path(path.get_base_dir()).replace("\\","/").replace("res://",""); DirAccess *da=DirAccess::create(DirAccess::ACCESS_FILESYSTEM); String cwd = d->get_current_dir(); da->change_dir(cwd); @@ -1947,14 +1947,14 @@ Error ProjectExport::export_project(const String& p_preset) { delete_source=true; //create an optimized source file - if (!Globals::get_singleton()->has("optimizer_presets/"+preset)) { + if (!GlobalConfig::get_singleton()->has("optimizer_presets/"+preset)) { memdelete(d); ERR_EXPLAIN("Unknown optimizer preset: "+preset); ERR_FAIL_V(ERR_INVALID_DATA); } - Dictionary dc = Globals::get_singleton()->get("optimizer_presets/"+preset); + Dictionary dc = GlobalConfig::get_singleton()->get("optimizer_presets/"+preset); ERR_FAIL_COND_V(!dc.has("__type__"),ERR_INVALID_DATA); String type=dc["__type__"]; @@ -2099,7 +2099,7 @@ Error ProjectExport::export_project(const String& p_preset) { String engine_cfg_path=d->get_current_dir()+"/engine.cfg"; print_line("enginecfg: "+engine_cfg_path); - Globals::get_singleton()->save_custom(engine_cfg_path,added_settings); + GlobalConfig::get_singleton()->save_custom(engine_cfg_path,added_settings); memdelete(d); return OK; diff --git a/tools/editor/project_settings.cpp b/tools/editor/project_settings.cpp index be070019ed..0f267f2fbb 100644 --- a/tools/editor/project_settings.cpp +++ b/tools/editor/project_settings.cpp @@ -74,7 +74,7 @@ void ProjectSettings::_notification(int p_what) { if (p_what==NOTIFICATION_ENTER_TREE) { - globals_editor->edit(Globals::get_singleton()); + globals_editor->edit(GlobalConfig::get_singleton()); search_button->set_icon(get_icon("Zoom","EditorIcons")); clear_button->set_icon(get_icon("Close","EditorIcons")); @@ -136,7 +136,7 @@ void ProjectSettings::_action_edited() { String action_prop="input/"+new_name; - if (Globals::get_singleton()->has(action_prop)) { + if (GlobalConfig::get_singleton()->has(action_prop)) { ti->set_text(0,old_name); add_at="input/"+old_name; @@ -146,20 +146,17 @@ void ProjectSettings::_action_edited() { return; } - int order = Globals::get_singleton()->get_order(add_at); - Array va = Globals::get_singleton()->get(add_at); - bool persisting = Globals::get_singleton()->is_persisting(add_at); + int order = GlobalConfig::get_singleton()->get_order(add_at); + Array va = GlobalConfig::get_singleton()->get(add_at); setting=true; undo_redo->create_action(TTR("Rename Input Action Event")); - undo_redo->add_do_method(Globals::get_singleton(),"clear",add_at); - undo_redo->add_do_method(Globals::get_singleton(),"set",action_prop,va); - undo_redo->add_do_method(Globals::get_singleton(),"set_persisting",action_prop,persisting); - undo_redo->add_do_method(Globals::get_singleton(),"set_order",action_prop,order); - undo_redo->add_undo_method(Globals::get_singleton(),"clear",action_prop); - undo_redo->add_undo_method(Globals::get_singleton(),"set",add_at,va); - undo_redo->add_undo_method(Globals::get_singleton(),"set_persisting",add_at,persisting); - undo_redo->add_undo_method(Globals::get_singleton(),"set_order",add_at,order); + undo_redo->add_do_method(GlobalConfig::get_singleton(),"clear",add_at); + undo_redo->add_do_method(GlobalConfig::get_singleton(),"set",action_prop,va); + undo_redo->add_do_method(GlobalConfig::get_singleton(),"set_order",action_prop,order); + undo_redo->add_undo_method(GlobalConfig::get_singleton(),"clear",action_prop); + undo_redo->add_undo_method(GlobalConfig::get_singleton(),"set",add_at,va); + undo_redo->add_undo_method(GlobalConfig::get_singleton(),"set_order",add_at,order); undo_redo->add_do_method(this,"_update_actions"); undo_redo->add_undo_method(this,"_update_actions"); undo_redo->add_do_method(this,"_settings_changed"); @@ -179,7 +176,7 @@ void ProjectSettings::_device_input_add() { InputEvent ie; String name=add_at; - Variant old_val = Globals::get_singleton()->get(name); + Variant old_val = GlobalConfig::get_singleton()->get(name); Array arr=old_val; ie.device=device_id->get_value(); @@ -236,9 +233,8 @@ void ProjectSettings::_device_input_add() { arr.push_back(ie); undo_redo->create_action(TTR("Add Input Action Event")); - undo_redo->add_do_method(Globals::get_singleton(),"set",name,arr); - undo_redo->add_do_method(Globals::get_singleton(),"set_persisting",name,true); - undo_redo->add_undo_method(Globals::get_singleton(),"set",name,old_val); + undo_redo->add_do_method(GlobalConfig::get_singleton(),"set",name,arr); + undo_redo->add_undo_method(GlobalConfig::get_singleton(),"set",name,old_val); undo_redo->add_do_method(this,"_update_actions"); undo_redo->add_undo_method(this,"_update_actions"); undo_redo->add_do_method(this,"_settings_changed"); @@ -260,7 +256,7 @@ void ProjectSettings::_press_a_key_confirm() { ie.key.mod=last_wait_for_key.key.mod; String name=add_at; - Variant old_val = Globals::get_singleton()->get(name); + Variant old_val = GlobalConfig::get_singleton()->get(name); Array arr=old_val; for(int i=0;i<arr.size();i++) { @@ -274,9 +270,8 @@ void ProjectSettings::_press_a_key_confirm() { arr.push_back(ie); undo_redo->create_action(TTR("Add Input Action Event")); - undo_redo->add_do_method(Globals::get_singleton(),"set",name,arr); - undo_redo->add_do_method(Globals::get_singleton(),"set_persisting",name,true); - undo_redo->add_undo_method(Globals::get_singleton(),"set",name,old_val); + undo_redo->add_do_method(GlobalConfig::get_singleton(),"set",name,arr); + undo_redo->add_undo_method(GlobalConfig::get_singleton(),"set",name,old_val); undo_redo->add_do_method(this,"_update_actions"); undo_redo->add_undo_method(this,"_update_actions"); undo_redo->add_do_method(this,"_settings_changed"); @@ -423,14 +418,13 @@ void ProjectSettings::_action_button_pressed(Object* p_obj, int p_column,int p_i //remove main thing String name="input/"+ti->get_text(0); - Variant old_val = Globals::get_singleton()->get(name); - int order=Globals::get_singleton()->get_order(name); + Variant old_val = GlobalConfig::get_singleton()->get(name); + int order=GlobalConfig::get_singleton()->get_order(name); undo_redo->create_action(TTR("Add Input Action")); - undo_redo->add_do_method(Globals::get_singleton(),"clear",name); - undo_redo->add_undo_method(Globals::get_singleton(),"set",name,old_val); - undo_redo->add_undo_method(Globals::get_singleton(),"set_order",name,order); - undo_redo->add_undo_method(Globals::get_singleton(),"set_persisting",name,Globals::get_singleton()->is_persisting(name)); + undo_redo->add_do_method(GlobalConfig::get_singleton(),"clear",name); + undo_redo->add_undo_method(GlobalConfig::get_singleton(),"set",name,old_val); + undo_redo->add_undo_method(GlobalConfig::get_singleton(),"set_order",name,order); undo_redo->add_do_method(this,"_update_actions"); undo_redo->add_undo_method(this,"_update_actions"); undo_redo->add_do_method(this,"_settings_changed"); @@ -440,7 +434,7 @@ void ProjectSettings::_action_button_pressed(Object* p_obj, int p_column,int p_i } else { //remove action String name="input/"+ti->get_parent()->get_text(0); - Variant old_val = Globals::get_singleton()->get(name); + Variant old_val = GlobalConfig::get_singleton()->get(name); int idx = ti->get_metadata(0); Array va = old_val; @@ -456,8 +450,8 @@ void ProjectSettings::_action_button_pressed(Object* p_obj, int p_column,int p_i undo_redo->create_action(TTR("Erase Input Action Event")); - undo_redo->add_do_method(Globals::get_singleton(),"set",name,va); - undo_redo->add_undo_method(Globals::get_singleton(),"set",name,old_val); + undo_redo->add_do_method(GlobalConfig::get_singleton(),"set",name,va); + undo_redo->add_undo_method(GlobalConfig::get_singleton(),"set",name,old_val); undo_redo->add_do_method(this,"_update_actions"); undo_redo->add_undo_method(this,"_update_actions"); undo_redo->add_do_method(this,"_settings_changed"); @@ -480,7 +474,7 @@ void ProjectSettings::_update_actions() { input_editor->set_hide_root(true); List<PropertyInfo> props; - Globals::get_singleton()->get_property_list(&props); + GlobalConfig::get_singleton()->get_property_list(&props); for(List<PropertyInfo>::Element *E=props.front();E;E=E->next()) { @@ -496,7 +490,7 @@ void ProjectSettings::_update_actions() { //item->set_cell_mode(0,TreeItem::CELL_MODE_CHECK); item->set_text(0,name); item->add_button(0,get_icon("Add","EditorIcons"),1); - if (!Globals::get_singleton()->get_input_presets().find(pi.name)) { + if (!GlobalConfig::get_singleton()->get_input_presets().find(pi.name)) { item->add_button(0,get_icon("Remove","EditorIcons"),2); item->set_editable(0,true); } @@ -504,7 +498,7 @@ void ProjectSettings::_update_actions() { //item->set_checked(0,pi.usage&PROPERTY_USAGE_CHECKED); - Array actions=Globals::get_singleton()->get(pi.name); + Array actions=GlobalConfig::get_singleton()->get(pi.name); for(int i=0;i<actions.size();i++) { @@ -636,13 +630,12 @@ void ProjectSettings::_item_add() { undo_redo->create_action("Add Global Property"); - undo_redo->add_do_property(Globals::get_singleton(), name, value); - undo_redo->add_do_method(Globals::get_singleton(), "set_persisting", name, true); + undo_redo->add_do_property(GlobalConfig::get_singleton(), name, value); - 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(globals_editor, "update_category_list"); @@ -669,10 +662,9 @@ void ProjectSettings::_item_del() { undo_redo->create_action("Delete Global Property"); - 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, Globals::get_singleton()->is_persisting(name)); + undo_redo->add_undo_property(GlobalConfig::get_singleton(), name, GlobalConfig::get_singleton()->get(name)); undo_redo->add_do_method(globals_editor, "update_category_list"); undo_redo->add_undo_method(globals_editor, "update_category_list"); @@ -699,7 +691,7 @@ void ProjectSettings::_action_add() { return; } - if (Globals::get_singleton()->has("input/"+action)) { + if (GlobalConfig::get_singleton()->has("input/"+action)) { message->set_text(vformat(TTR("Action '%s' already exists!"),action)); message->popup_centered(Size2(300,100)); return; @@ -708,9 +700,8 @@ void ProjectSettings::_action_add() { Array va; String name = "input/"+action; undo_redo->create_action(TTR("Add Input Action Event")); - undo_redo->add_do_method(Globals::get_singleton(),"set",name,va); - undo_redo->add_do_method(Globals::get_singleton(),"set_persisting",name,true); - undo_redo->add_undo_method(Globals::get_singleton(),"clear",name); + undo_redo->add_do_method(GlobalConfig::get_singleton(),"set",name,va); + undo_redo->add_undo_method(GlobalConfig::get_singleton(),"clear",name); undo_redo->add_do_method(this,"_update_actions"); undo_redo->add_undo_method(this,"_update_actions"); undo_redo->add_do_method(this,"_settings_changed"); @@ -737,23 +728,14 @@ void ProjectSettings::_action_add() { void ProjectSettings::_item_checked(const String& p_item, bool p_check) { - undo_redo->create_action(TTR("Toggle Persisting")); - String full_item = globals_editor->get_full_item_path(p_item); - undo_redo->add_do_method(Globals::get_singleton(),"set_persisting",full_item,p_check); - undo_redo->add_undo_method(Globals::get_singleton(),"set_persisting",full_item,!p_check); - undo_redo->add_do_method(this,"_settings_changed"); - undo_redo->add_undo_method(this,"_settings_changed"); - undo_redo->add_do_method(globals_editor->get_property_editor(),"update_tree"); - undo_redo->add_undo_method(globals_editor->get_property_editor(),"update_tree"); - undo_redo->commit_action(); } void ProjectSettings::_save() { - Error err = Globals::get_singleton()->save(); + Error err = GlobalConfig::get_singleton()->save(); message->set_text(err!=OK?TTR("Error saving settings."):TTR("Settings saved OK.")); message->popup_centered(Size2(300,100)); } @@ -764,21 +746,6 @@ void ProjectSettings::_settings_prop_edited(const String& p_name) { String full_item = globals_editor->get_full_item_path(p_name); - if (!Globals::get_singleton()->is_persisting(full_item)) { - Globals::get_singleton()->set_persisting(full_item,true); - - { - //small usability workaround, if anything related to resolution scaling or size is modified, change all of them together - if (full_item=="display/width" || full_item=="display/height" || full_item=="display/stretch_mode") { - Globals::get_singleton()->set_persisting("display/height",true); - Globals::get_singleton()->set_persisting("display/width",true); - } - } - - -// globals_editor->update_property(p_name); - globals_editor->get_property_editor()->update_tree(); - } _settings_changed(); } @@ -810,12 +777,12 @@ void ProjectSettings::_copy_to_platform(int p_which) { } String name = catname+"/"+propname; - Variant value=Globals::get_singleton()->get(name); + Variant value=GlobalConfig::get_singleton()->get(name); catname+="."+popup_platform->get_popup()->get_item_text(p_which);; name = catname+"/"+propname; - Globals::get_singleton()->set(name,value); + GlobalConfig::get_singleton()->set(name,value); globals_editor->get_property_editor()->update_tree(); } @@ -828,7 +795,7 @@ void ProjectSettings::add_translation(const String& p_translation) { void ProjectSettings::_translation_add(const String& p_path) { - StringArray translations = Globals::get_singleton()->get("locale/translations"); + StringArray translations = GlobalConfig::get_singleton()->get("locale/translations"); for(int i=0;i<translations.size();i++) { @@ -839,9 +806,8 @@ void ProjectSettings::_translation_add(const String& p_path) { translations.push_back(p_path); undo_redo->create_action(TTR("Add Translation")); - undo_redo->add_do_property(Globals::get_singleton(),"locale/translations",translations); - undo_redo->add_undo_property(Globals::get_singleton(),"locale/translations",Globals::get_singleton()->get("locale/translations")); - undo_redo->add_do_method(Globals::get_singleton(),"set_persisting","locale/translations",true); + undo_redo->add_do_property(GlobalConfig::get_singleton(),"locale/translations",translations); + undo_redo->add_undo_property(GlobalConfig::get_singleton(),"locale/translations",GlobalConfig::get_singleton()->get("locale/translations")); undo_redo->add_do_method(this,"_update_translations"); undo_redo->add_undo_method(this,"_update_translations"); undo_redo->add_do_method(this,"_settings_changed"); @@ -862,15 +828,15 @@ void ProjectSettings::_translation_delete(Object *p_item,int p_column, int p_but int idx=ti->get_metadata(0); - StringArray translations = Globals::get_singleton()->get("locale/translations"); + StringArray translations = GlobalConfig::get_singleton()->get("locale/translations"); ERR_FAIL_INDEX(idx,translations.size()); translations.remove(idx); undo_redo->create_action(TTR("Remove Translation")); - undo_redo->add_do_property(Globals::get_singleton(),"locale/translations",translations); - undo_redo->add_undo_property(Globals::get_singleton(),"locale/translations",Globals::get_singleton()->get("locale/translations")); + undo_redo->add_do_property(GlobalConfig::get_singleton(),"locale/translations",translations); + undo_redo->add_undo_property(GlobalConfig::get_singleton(),"locale/translations",GlobalConfig::get_singleton()->get("locale/translations")); undo_redo->add_do_method(this,"_update_translations"); undo_redo->add_undo_method(this,"_update_translations"); undo_redo->add_do_method(this,"_settings_changed"); @@ -891,8 +857,8 @@ void ProjectSettings::_translation_res_add(const String& p_path){ Variant prev; Dictionary remaps; - if (Globals::get_singleton()->has("locale/translation_remaps")) { - remaps = Globals::get_singleton()->get("locale/translation_remaps"); + if (GlobalConfig::get_singleton()->has("locale/translation_remaps")) { + remaps = GlobalConfig::get_singleton()->get("locale/translation_remaps"); prev=remaps; } @@ -902,9 +868,8 @@ void ProjectSettings::_translation_res_add(const String& p_path){ remaps[p_path]=StringArray(); undo_redo->create_action(TTR("Add Remapped Path")); - undo_redo->add_do_property(Globals::get_singleton(),"locale/translation_remaps",remaps); - undo_redo->add_do_method(Globals::get_singleton(),"set_persisting","locale/translation_remaps",true); - undo_redo->add_undo_property(Globals::get_singleton(),"locale/translation_remaps",prev); + undo_redo->add_do_property(GlobalConfig::get_singleton(),"locale/translation_remaps",remaps); + undo_redo->add_undo_property(GlobalConfig::get_singleton(),"locale/translation_remaps",prev); undo_redo->add_do_method(this,"_update_translations"); undo_redo->add_undo_method(this,"_update_translations"); undo_redo->add_do_method(this,"_settings_changed"); @@ -920,9 +885,9 @@ void ProjectSettings::_translation_res_option_file_open(){ } void ProjectSettings::_translation_res_option_add(const String& p_path) { - ERR_FAIL_COND(!Globals::get_singleton()->has("locale/translation_remaps")); + ERR_FAIL_COND(!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"); TreeItem *k = translation_remap->get_selected(); ERR_FAIL_COND(!k); @@ -936,9 +901,8 @@ void ProjectSettings::_translation_res_option_add(const String& p_path) { undo_redo->create_action(TTR("Resource Remap Add Remap")); - undo_redo->add_do_property(Globals::get_singleton(),"locale/translation_remaps",remaps); - undo_redo->add_do_method(Globals::get_singleton(),"set_persisting","locale/translation_remaps",true); - undo_redo->add_undo_property(Globals::get_singleton(),"locale/translation_remaps",Globals::get_singleton()->get("locale/translation_remaps")); + undo_redo->add_do_property(GlobalConfig::get_singleton(),"locale/translation_remaps",remaps); + undo_redo->add_undo_property(GlobalConfig::get_singleton(),"locale/translation_remaps",GlobalConfig::get_singleton()->get("locale/translation_remaps")); undo_redo->add_do_method(this,"_update_translations"); undo_redo->add_undo_method(this,"_update_translations"); undo_redo->add_do_method(this,"_settings_changed"); @@ -963,10 +927,10 @@ void ProjectSettings::_translation_res_option_changed() { if (updating_translations) return; - if (!Globals::get_singleton()->has("locale/translation_remaps")) + if (!GlobalConfig::get_singleton()->has("locale/translation_remaps")) return; - Dictionary remaps = Globals::get_singleton()->get("locale/translation_remaps"); + Dictionary remaps = GlobalConfig::get_singleton()->get("locale/translation_remaps"); TreeItem *k = translation_remap->get_selected(); ERR_FAIL_COND(!k); @@ -991,9 +955,8 @@ void ProjectSettings::_translation_res_option_changed() { updating_translations=true; undo_redo->create_action(TTR("Change Resource Remap Language")); - undo_redo->add_do_property(Globals::get_singleton(),"locale/translation_remaps",remaps); - undo_redo->add_do_method(Globals::get_singleton(),"set_persisting","locale/translation_remaps",true); - undo_redo->add_undo_property(Globals::get_singleton(),"locale/translation_remaps",Globals::get_singleton()->get("locale/translation_remaps")); + undo_redo->add_do_property(GlobalConfig::get_singleton(),"locale/translation_remaps",remaps); + undo_redo->add_undo_property(GlobalConfig::get_singleton(),"locale/translation_remaps",GlobalConfig::get_singleton()->get("locale/translation_remaps")); undo_redo->add_do_method(this,"_update_translations"); undo_redo->add_undo_method(this,"_update_translations"); undo_redo->add_do_method(this,"_settings_changed"); @@ -1010,10 +973,10 @@ void ProjectSettings::_translation_res_delete(Object *p_item,int p_column, int p if (updating_translations) return; - if (!Globals::get_singleton()->has("locale/translation_remaps")) + if (!GlobalConfig::get_singleton()->has("locale/translation_remaps")) return; - Dictionary remaps = Globals::get_singleton()->get("locale/translation_remaps"); + Dictionary remaps = GlobalConfig::get_singleton()->get("locale/translation_remaps"); TreeItem *k = p_item->cast_to<TreeItem>(); @@ -1023,9 +986,8 @@ void ProjectSettings::_translation_res_delete(Object *p_item,int p_column, int p remaps.erase(key); undo_redo->create_action(TTR("Remove Resource Remap")); - undo_redo->add_do_property(Globals::get_singleton(),"locale/translation_remaps",remaps); - undo_redo->add_do_method(Globals::get_singleton(),"set_persisting","locale/translation_remaps",true); - undo_redo->add_undo_property(Globals::get_singleton(),"locale/translation_remaps",Globals::get_singleton()->get("locale/translation_remaps")); + undo_redo->add_do_property(GlobalConfig::get_singleton(),"locale/translation_remaps",remaps); + undo_redo->add_undo_property(GlobalConfig::get_singleton(),"locale/translation_remaps",GlobalConfig::get_singleton()->get("locale/translation_remaps")); undo_redo->add_do_method(this,"_update_translations"); undo_redo->add_undo_method(this,"_update_translations"); undo_redo->add_do_method(this,"_settings_changed"); @@ -1038,10 +1000,10 @@ void ProjectSettings::_translation_res_option_delete(Object *p_item,int p_column if (updating_translations) return; - if (!Globals::get_singleton()->has("locale/translation_remaps")) + if (!GlobalConfig::get_singleton()->has("locale/translation_remaps")) return; - Dictionary remaps = Globals::get_singleton()->get("locale/translation_remaps"); + Dictionary remaps = GlobalConfig::get_singleton()->get("locale/translation_remaps"); TreeItem *k = translation_remap->get_selected(); ERR_FAIL_COND(!k); @@ -1059,9 +1021,8 @@ void ProjectSettings::_translation_res_option_delete(Object *p_item,int p_column undo_redo->create_action(TTR("Remove Resource Remap Option")); - undo_redo->add_do_property(Globals::get_singleton(),"locale/translation_remaps",remaps); - undo_redo->add_do_method(Globals::get_singleton(),"set_persisting","locale/translation_remaps",true); - undo_redo->add_undo_property(Globals::get_singleton(),"locale/translation_remaps",Globals::get_singleton()->get("locale/translation_remaps")); + undo_redo->add_do_property(GlobalConfig::get_singleton(),"locale/translation_remaps",remaps); + undo_redo->add_undo_property(GlobalConfig::get_singleton(),"locale/translation_remaps",GlobalConfig::get_singleton()->get("locale/translation_remaps")); undo_redo->add_do_method(this,"_update_translations"); undo_redo->add_undo_method(this,"_update_translations"); undo_redo->add_do_method(this,"_settings_changed"); @@ -1082,9 +1043,9 @@ void ProjectSettings::_update_translations() { translation_list->clear(); TreeItem *root = translation_list->create_item(NULL); translation_list->set_hide_root(true); - if (Globals::get_singleton()->has("locale/translations")) { + if (GlobalConfig::get_singleton()->has("locale/translations")) { - StringArray translations = Globals::get_singleton()->get("locale/translations"); + StringArray translations = GlobalConfig::get_singleton()->get("locale/translations"); for(int i=0;i<translations.size();i++) { TreeItem *t = translation_list->create_item(root); @@ -1121,9 +1082,9 @@ void ProjectSettings::_update_translations() { langnames+=names[i]; } - 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<Variant> rk; remaps.get_key_list(&rk); Vector<String> keys; @@ -1347,6 +1308,7 @@ ProjectSettings::ProjectSettings(EditorData *p_data) { globals_editor = memnew( SectionedPropertyEditor ); props_base->add_child(globals_editor); + globals_editor->get_property_editor()->set_undo_redo(EditorNode::get_singleton()->get_undo_redo()); //globals_editor->hide_top_label(); globals_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL); globals_editor->get_property_editor()->register_text_enter(search_box); @@ -1606,7 +1568,7 @@ ProjectSettings::ProjectSettings(EditorData *p_data) { timer = memnew( Timer ); timer->set_wait_time(1.5); - timer->connect("timeout",Globals::get_singleton(),"save"); + timer->connect("timeout",GlobalConfig::get_singleton(),"save"); timer->set_one_shot(true); add_child(timer); diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp index 959e564b8e..7fd067a22a 100644 --- a/tools/editor/property_editor.cpp +++ b/tools/editor/property_editor.cpp @@ -1012,7 +1012,7 @@ void CustomPropertyEditor::_file_selected(String p_file) { if (hint==PROPERTY_HINT_FILE || hint==PROPERTY_HINT_DIR) { - v=Globals::get_singleton()->localize_path(p_file); + v=GlobalConfig::get_singleton()->localize_path(p_file); emit_signal("variant_changed"); hide(); } @@ -2509,6 +2509,12 @@ void PropertyEditor::_check_reload_status(const String&p_name, TreeItem* item) { } + if (obj->call("property_can_revert",p_name).operator bool()) { + + has_reload=true; + } + + if (!has_reload && !obj->get_script().is_null()) { Ref<Script> scr = obj->get_script(); Variant orig_value; @@ -3742,6 +3748,12 @@ void PropertyEditor::update_tree() { } + if (obj->call("property_can_revert",p.name).operator bool()) { + + item->add_button(1,get_icon("ReloadSmall","EditorIcons"),3); + has_reload=true; + } + if (!has_reload && !obj->get_script().is_null()) { Ref<Script> scr = obj->get_script(); Variant orig_value; @@ -3792,13 +3804,12 @@ void PropertyEditor::_edit_set(const String& p_name, const Variant& p_value) { } else { - undo_redo->create_action(TTR("Set")+" "+p_name,UndoRedo::MERGE_ENDS); undo_redo->add_do_property(obj,p_name,p_value); undo_redo->add_undo_property(obj,p_name,obj->get(p_name)); undo_redo->add_do_method(this,"_changed_callback",obj,p_name); undo_redo->add_undo_method(this,"_changed_callback",obj,p_name); - undo_redo->add_undo_method(this,"_changed_callback",obj,p_name); + Resource *r = obj->cast_to<Resource>(); if (r) { if (!r->is_edited() && String(p_name)!="resource/edited") { @@ -3806,8 +3817,8 @@ void PropertyEditor::_edit_set(const String& p_name, const Variant& p_value) { undo_redo->add_undo_method(r,"set_edited",false); } } - _prop_edited_name[0]=p_name; - undo_redo->add_do_method(this,"emit_signal",_prop_edited,_prop_edited_name); + undo_redo->add_do_method(this,"emit_signal",_prop_edited,p_name); + undo_redo->add_undo_method(this,"emit_signal",_prop_edited,p_name); undo_redo->commit_action(); } } @@ -4070,6 +4081,11 @@ void PropertyEditor::_edit_button(Object *p_item, int p_column, int p_button) { return; } + if (obj->call("property_can_revert",prop).operator bool()) { + Variant rev = obj->call("property_get_revert",prop); + _edit_set(prop,rev); + } + if (!obj->get_script().is_null()) { Ref<Script> scr = obj->get_script(); Variant orig_value; @@ -4344,7 +4360,7 @@ void PropertyEditor::set_subsection_selectable(bool p_selectable) { PropertyEditor::PropertyEditor() { _prop_edited="property_edited"; - _prop_edited_name.push_back(String()); + undo_redo=NULL; obj=NULL; search_box=NULL; @@ -4429,6 +4445,7 @@ class SectionedPropertyEditorFilter : public Object { Object *edited; String section; + bool allow_sub; bool _set(const StringName& p_name, const Variant& p_value) { @@ -4442,6 +4459,7 @@ class SectionedPropertyEditorFilter : public Object { bool valid; edited->set(name,p_value,&valid); + //_change_notify(p_name.operator String().utf8().get_data()); return valid; } @@ -4473,25 +4491,45 @@ class SectionedPropertyEditorFilter : public Object { PropertyInfo pi=E->get(); int sp = pi.name.find("/"); - if (sp!=-1) { - String ss = pi.name.substr(0,sp); - if (ss==section) { - pi.name=pi.name.substr(sp+1,pi.name.length()); - p_list->push_back(pi); - } - } else { - if (section=="") - p_list->push_back(pi); + if (sp==-1) { + pi.name="Global/"+pi.name; + + } + + if (pi.name.begins_with(section+"/")) { + pi.name=pi.name.replace_first(section+"/",""); + if (!allow_sub && pi.name.find("/")!=-1) + continue; + p_list->push_back(pi); } } } + + bool property_can_revert(const String& p_name) { + + return edited->call("property_can_revert",section+"/"+p_name); + } + + Variant property_get_revert(const String& p_name) { + + return edited->call("property_get_revert",section+"/"+p_name); + } + +protected: + static void _bind_methods() { + + ClassDB::bind_method("property_can_revert",&SectionedPropertyEditorFilter::property_can_revert); + ClassDB::bind_method("property_get_revert",&SectionedPropertyEditorFilter::property_get_revert); + } + public: - void set_section(const String& p_section) { + void set_section(const String& p_section,bool p_allow_sub) { section=p_section; + allow_sub=p_allow_sub; _change_notify(); } @@ -4514,31 +4552,25 @@ void SectionedPropertyEditor::_bind_methods() { ClassDB::bind_method("update_category_list", &SectionedPropertyEditor::update_category_list); } -void SectionedPropertyEditor::_section_selected(int p_which) { +void SectionedPropertyEditor::_section_selected() { + + if (!sections->get_selected()) + return; - filter->set_section( sections->get_item_metadata(p_which) ); + filter->set_section( sections->get_selected()->get_metadata(0), sections->get_selected()->get_children()==NULL); } void SectionedPropertyEditor::set_current_section(const String& p_section) { - int section_idx = sections->find_metadata(p_section); - - if (section_idx==sections->get_current()) - return; - - if (section_idx!=-1) { - sections->select(section_idx); - _section_selected(section_idx); - } else if (sections->get_item_count()) { - sections->select(0); - _section_selected(0); + if (section_map.has(p_section)) { + section_map[p_section]->select(0);; } } String SectionedPropertyEditor::get_current_section() const { - if (sections->get_current()!=-1) - return sections->get_item_metadata( sections->get_current() ); + if (sections->get_selected()) + return sections->get_selected()->get_metadata(0); else return ""; } @@ -4575,8 +4607,9 @@ void SectionedPropertyEditor::edit(Object* p_object) { filter->set_edited(p_object); editor->edit(filter); - sections->select(0); - _section_selected(0); + if (sections->get_root()->get_children()) { + sections->get_root()->get_children()->select(0); + } } else { update_category_list(); @@ -4596,7 +4629,12 @@ void SectionedPropertyEditor::update_category_list() { List<PropertyInfo> pinfo; o->get_property_list(&pinfo); - Set<String> existing_sections; + section_map.clear(); + + TreeItem *root = sections->create_item(); + section_map[""]=root; + + for (List<PropertyInfo>::Element *E=pinfo.front();E;E=E->next()) { PropertyInfo pi=E->get(); @@ -4609,24 +4647,38 @@ void SectionedPropertyEditor::update_category_list() { if (pi.name.find(":")!=-1 || pi.name=="script/script" || pi.name.begins_with("resource/")) continue; int sp = pi.name.find("/"); - if (sp!=-1) { - String sname=pi.name.substr(0,sp); - if (!existing_sections.has(sname)) { - existing_sections.insert(sname); - sections->add_item(sname.capitalize()); - sections->set_item_metadata(sections->get_item_count()-1,sname); + if (sp==-1) + pi.name="Global/"+pi.name; + + Vector<String> sectionarr = pi.name.split("/"); + String metasection; + + + for(int i=0;i<MIN(2,sectionarr.size()-1);i++) { + + TreeItem *parent = section_map[metasection]; + + if (i>0) { + metasection+="/"+sectionarr[i]; + } else { + metasection=sectionarr[i]; } - } else { - if (!existing_sections.has("")) { - existing_sections.insert(""); - sections->add_item(TTR("Global")); - sections->set_item_metadata(sections->get_item_count()-1,""); + + if (!section_map.has(metasection)) { + TreeItem *ms = sections->create_item(parent); + section_map[metasection]=ms; + ms->set_text(0,sectionarr[i].capitalize()); + ms->set_metadata(0,metasection); + } } + } - set_current_section(selected_category); + if (section_map.has(selected_category)) { + section_map[selected_category]->select(0); + } } PropertyEditor *SectionedPropertyEditor::get_property_editor() { @@ -4642,8 +4694,9 @@ SectionedPropertyEditor::SectionedPropertyEditor() { left_vb->set_custom_minimum_size(Size2(160,0)*EDSCALE); add_child(left_vb); - sections = memnew( ItemList ); + sections = memnew( Tree ); sections->set_v_size_flags(SIZE_EXPAND_FILL); + sections->set_hide_root(true); left_vb->add_margin_child(TTR("Sections:"),sections,true); @@ -4661,7 +4714,7 @@ SectionedPropertyEditor::SectionedPropertyEditor() { editor->hide_top_label(); - sections->connect("item_selected",this,"_section_selected"); + sections->connect("cell_selected",this,"_section_selected"); } diff --git a/tools/editor/property_editor.h b/tools/editor/property_editor.h index cc78546d05..df180cab18 100644 --- a/tools/editor/property_editor.h +++ b/tools/editor/property_editor.h @@ -174,7 +174,7 @@ class PropertyEditor : public Control { Object* obj; - Array _prop_edited_name; + StringName _prop_edited; bool capitalize_paths; @@ -293,13 +293,15 @@ class SectionedPropertyEditor : public HBoxContainer { ObjectID obj; - ItemList *sections; + Tree *sections; SectionedPropertyEditorFilter *filter; + + Map<String,TreeItem*> section_map; PropertyEditor *editor; static void _bind_methods(); - void _section_selected(int p_which); + void _section_selected(); public: diff --git a/tools/editor/resources_dock.cpp b/tools/editor/resources_dock.cpp index c881b000e9..40876f08b7 100644 --- a/tools/editor/resources_dock.cpp +++ b/tools/editor/resources_dock.cpp @@ -129,7 +129,7 @@ void ResourcesDock::save_resource(const String& p_path,const Ref<Resource>& p_re //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/scene_tree_dock.cpp b/tools/editor/scene_tree_dock.cpp index 111478f7c8..c6f6f226ff 100644 --- a/tools/editor/scene_tree_dock.cpp +++ b/tools/editor/scene_tree_dock.cpp @@ -198,7 +198,7 @@ void SceneTreeDock::_perform_instance_scenes(const Vector<String>& p_files,Node* } } - instanced_scene->set_filename( Globals::get_singleton()->localize_path(p_files[i]) ); + instanced_scene->set_filename( GlobalConfig::get_singleton()->localize_path(p_files[i]) ); instances.push_back(instanced_scene); } diff --git a/tools/editor/script_create_dialog.cpp b/tools/editor/script_create_dialog.cpp index d0c25442b6..76f941ef7f 100644 --- a/tools/editor/script_create_dialog.cpp +++ b/tools/editor/script_create_dialog.cpp @@ -133,7 +133,7 @@ void ScriptCreateDialog::_create_new() { scr->set_name(cname); if (!internal->is_pressed()) { - String lpath = Globals::get_singleton()->localize_path(file_path->get_text()); + String lpath = GlobalConfig::get_singleton()->localize_path(file_path->get_text()); scr->set_path(lpath); if (!path_valid) { alert->set_text(TTR("Invalid path!")); @@ -243,7 +243,7 @@ void ScriptCreateDialog::_browse_path() { void ScriptCreateDialog::_file_selected(const String& p_file) { - String p = Globals::get_singleton()->localize_path(p_file); + String p = GlobalConfig::get_singleton()->localize_path(p_file); file_path->set_text(p); _path_changed(p); @@ -262,7 +262,7 @@ void ScriptCreateDialog::_path_changed(const String& p_path) { } - p = Globals::get_singleton()->localize_path(p); + p = GlobalConfig::get_singleton()->localize_path(p); if (!p.begins_with("res://")) { path_error_label->set_text(TTR("Path is not local")); diff --git a/tools/editor/script_editor_debugger.cpp b/tools/editor/script_editor_debugger.cpp index bc587e7ef6..24b7befb9f 100644 --- a/tools/editor/script_editor_debugger.cpp +++ b/tools/editor/script_editor_debugger.cpp @@ -1091,7 +1091,7 @@ void ScriptEditorDebugger::start() { EditorNode::get_singleton()->make_bottom_panel_item_visible(this); } - uint16_t port = GLOBAL_DEF("debug/remote_port",6007); + uint16_t port = GLOBAL_GET("network/debug/remote_port"); perf_history.clear(); for(int i=0;i<Performance::MONITOR_MAX;i++) { |