diff options
Diffstat (limited to 'editor/editor_settings.cpp')
-rw-r--r-- | editor/editor_settings.cpp | 56 |
1 files changed, 29 insertions, 27 deletions
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 5c8e166730..6398bd1623 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -29,23 +29,23 @@ /*************************************************************************/ #include "editor_settings.h" -#include "editor_node.h" -#include "io/compression.h" -#include "io/config_file.h" -#include "io/file_access_memory.h" -#include "io/resource_loader.h" -#include "io/resource_saver.h" -#include "io/translation_loader_po.h" -#include "os/dir_access.h" -#include "os/file_access.h" -#include "os/keyboard.h" -#include "os/os.h" -#include "project_settings.h" +#include "core/io/compression.h" +#include "core/io/config_file.h" +#include "core/io/file_access_memory.h" +#include "core/io/resource_loader.h" +#include "core/io/resource_saver.h" +#include "core/io/translation_loader_po.h" +#include "core/os/dir_access.h" +#include "core/os/file_access.h" +#include "core/os/keyboard.h" +#include "core/os/os.h" +#include "core/project_settings.h" +#include "core/version.h" +#include "editor/editor_node.h" +#include "editor/translations.gen.h" #include "scene/main/node.h" #include "scene/main/scene_tree.h" #include "scene/main/viewport.h" -#include "translations.gen.h" -#include "version.h" Ref<EditorSettings> EditorSettings::singleton = NULL; @@ -93,6 +93,7 @@ bool EditorSettings::_set(const StringName &p_name, const Variant &p_value) { emit_signal("settings_changed"); return true; } + bool EditorSettings::_get(const StringName &p_name, Variant &r_ret) const { _THREAD_SAFE_METHOD_ @@ -216,6 +217,12 @@ Variant _EDITOR_DEF(const String &p_var, const Variant &p_default) { return p_default; } +Variant _EDITOR_GET(const String &p_var) { + + ERR_FAIL_COND_V(!EditorSettings::get_singleton()->has(p_var), Variant()) + return EditorSettings::get_singleton()->get(p_var); +} + static Dictionary _get_builtin_script_templates() { Dictionary templates; @@ -246,13 +253,14 @@ static void _create_script_templates(const String &p_path) { dir->change_dir(p_path); for (int i = 0; i < keys.size(); i++) { if (!dir->file_exists(keys[i])) { - file->reopen(p_path.plus_file((String)keys[i]), FileAccess::WRITE); - ERR_FAIL_COND(!file); + Error err = file->reopen(p_path.plus_file((String)keys[i]), FileAccess::WRITE); + ERR_FAIL_COND(err != OK); file->store_string(templates[keys[i]]); file->close(); } } + memdelete(dir); memdelete(file); } @@ -266,7 +274,6 @@ void EditorSettings::create() { String config_path; String config_dir; - //String config_file="editor_settings.xml"; Ref<ConfigFile> extra_config = memnew(ConfigFile); String exe_path = OS::get_singleton()->get_executable_path().get_base_dir(); @@ -280,6 +287,7 @@ void EditorSettings::create() { self_contained = true; extra_config->load(exe_path + "/_sc_"); } + memdelete(d); if (self_contained) { // editor is self contained @@ -593,6 +601,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { hints["text_editor/theme/color_theme"] = PropertyInfo(Variant::STRING, "text_editor/theme/color_theme", PROPERTY_HINT_ENUM, "Default"); set("text_editor/theme/line_spacing", 4); + set("text_editor/theme/adapted_code_editor_background_color", true); _load_default_text_editor_theme(); @@ -637,7 +646,6 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { set("text_editor/files/maximum_recent_files", 20); hints["text_editor/files/maximum_recent_files"] = PropertyInfo(Variant::INT, "text_editor/files/maximum_recent_files", PROPERTY_HINT_RANGE, "1, 200, 0"); - //set("docks/scene_tree/display_old_action_buttons",false); set("docks/scene_tree/start_create_dialog_fully_expanded", false); set("docks/scene_tree/draw_relationship_lines", false); set("docks/scene_tree/relationship_line_color", Color::html("464646")); @@ -666,6 +674,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { set("editors/3d/warped_mouse_panning", true); set("editors/3d/orbit_sensitivity", 0.4); + set("editors/3d/freelook_inertia", 3); set("editors/3d/freelook_base_speed", 1); @@ -685,6 +694,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { set("editors/2d/pan_speed", 20); set("editors/poly_editor/point_grab_radius", 8); + set("editors/poly_editor/show_previous_outline", true); set("run/window_placement/rect", 1); hints["run/window_placement/rect"] = PropertyInfo(Variant::INT, "run/window_placement/rect", PROPERTY_HINT_ENUM, "Top Left,Centered,Custom Position,Force Maximized,Force Fullscreen"); @@ -698,8 +708,6 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { set("filesystem/on_save/compress_binary_resources", true); set("filesystem/on_save/save_modified_external_resources", true); - //set("filesystem/on_save/save_paths_as_relative",false); - //set("filesystem/on_save/save_paths_without_extension",false); set("text_editor/tools/create_signal_callbacks", true); @@ -803,10 +811,7 @@ void EditorSettings::notify_changes() { _THREAD_SAFE_METHOD_ - SceneTree *sml = NULL; - - if (OS::get_singleton()->get_main_loop()) - sml = OS::get_singleton()->get_main_loop()->cast_to<SceneTree>(); + SceneTree *sml = Object::cast_to<SceneTree>(OS::get_singleton()->get_main_loop()); if (!sml) { return; @@ -1147,7 +1152,6 @@ void EditorSettings::_bind_methods() { EditorSettings::EditorSettings() { - //singleton=this; last_order = 0; optimize_save = true; save_changed_setting = true; @@ -1177,8 +1181,6 @@ EditorSettings::EditorSettings() { } EditorSettings::~EditorSettings() { - - //singleton=NULL; } Ref<ShortCut> ED_GET_SHORTCUT(const String &p_path) { |