diff options
Diffstat (limited to 'editor/editor_settings.cpp')
-rw-r--r-- | editor/editor_settings.cpp | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index ec7e7597d5..485f8236de 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -292,6 +292,12 @@ void EditorSettings::create() { dir->change_dir(".."); } + if (dir->change_dir("script_templates") != OK) { + dir->make_dir("script_templates"); + } else { + dir->change_dir(".."); + } + if (dir->change_dir("tmp") != OK) { dir->make_dir("tmp"); } else { @@ -502,7 +508,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { set("interface/source_font_size", 14); hints["interface/source_font_size"] = PropertyInfo(Variant::INT, "interface/source_font_size", PROPERTY_HINT_RANGE, "8,96,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); set("interface/custom_font", ""); - hints["interface/custom_font"] = PropertyInfo(Variant::STRING, "interface/custom_font", PROPERTY_HINT_GLOBAL_FILE, "*.fnt", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); + hints["interface/custom_font"] = PropertyInfo(Variant::STRING, "interface/custom_font", PROPERTY_HINT_GLOBAL_FILE, "*.font", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); set("interface/dim_editor_on_dialog_popup", true); set("interface/dim_amount", 0.6f); hints["interface/dim_amount"] = PropertyInfo(Variant::REAL, "interface/dim_amount", PROPERTY_HINT_RANGE, "0,1,0.01", PROPERTY_USAGE_DEFAULT); @@ -522,6 +528,12 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { set("interface/theme/custom_theme", ""); hints["interface/theme/custom_theme"] = PropertyInfo(Variant::STRING, "interface/theme/custom_theme", PROPERTY_HINT_GLOBAL_FILE, "*.res,*.tres,*.theme", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); + set("interface/scene_tabs/show_extension", false); + set("interface/scene_tabs/show_thumbnail_on_hover", true); + set("interface/scene_tabs/resize_if_many_tabs", true); + set("interface/scene_tabs/minimum_width", 50); + hints["interface/scene_tabs/minimum_width"] = PropertyInfo(Variant::INT, "interface/scene_tabs/minimum_width", PROPERTY_HINT_RANGE, "50,500,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); + set("filesystem/directories/autoscan_project_path", ""); hints["filesystem/directories/autoscan_project_path"] = PropertyInfo(Variant::STRING, "filesystem/directories/autoscan_project_path", PROPERTY_HINT_GLOBAL_DIR); set("filesystem/directories/default_project_path", ""); @@ -569,7 +581,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { hints["text_editor/cursor/caret_blink_speed"] = PropertyInfo(Variant::REAL, "text_editor/cursor/caret_blink_speed", PROPERTY_HINT_RANGE, "0.1, 10, 0.1"); set("text_editor/theme/font", ""); - hints["text_editor/theme/font"] = PropertyInfo(Variant::STRING, "text_editor/theme/font", PROPERTY_HINT_GLOBAL_FILE, "*.fnt"); + hints["text_editor/theme/font"] = PropertyInfo(Variant::STRING, "text_editor/theme/font", PROPERTY_HINT_GLOBAL_FILE, "*.font"); set("text_editor/completion/auto_brace_complete", false); set("text_editor/files/restore_scripts_on_load", true); set("text_editor/completion/complete_file_paths", true); @@ -586,7 +598,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { set("editors/3d/grid_color", Color(0, 1, 0, 0.2)); hints["editors/3d/grid_color"] = PropertyInfo(Variant::COLOR, "editors/3d/grid_color", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); - set("editors/3d/default_fov", 45.0); + set("editors/3d/default_fov", 55.0); set("editors/3d/default_z_near", 0.1); set("editors/3d/default_z_far", 500.0); @@ -619,7 +631,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { set("editors/poly_editor/point_grab_radius", 8); - set("run/window_placement/rect", 0); + set("run/window_placement/rect", 1); hints["run/window_placement/rect"] = PropertyInfo(Variant::INT, "run/window_placement/rect", PROPERTY_HINT_ENUM, "Default,Centered,Custom Position,Force Maximized,Force Full Screen"); String screen_hints = TTR("Default (Same as Editor)"); for (int i = 0; i < OS::get_singleton()->get_screen_count(); i++) { @@ -946,6 +958,25 @@ bool EditorSettings::save_text_editor_theme_as(String p_file) { return false; } +Vector<String> EditorSettings::get_script_templates(const String &p_extension) { + + Vector<String> templates; + DirAccess *d = DirAccess::open(settings_path + "/script_templates"); + if (d) { + d->list_dir_begin(); + String file = d->get_next(); + while (file != String()) { + if (file.get_extension() == p_extension) { + templates.push_back(file.get_basename()); + } + file = d->get_next(); + } + d->list_dir_end(); + memdelete(d); + } + return templates; +} + bool EditorSettings::_save_text_editor_theme(String p_file) { String theme_section = "color_theme"; Ref<ConfigFile> cf = memnew(ConfigFile); // hex is better? |