From 204d3ccf5fb491c0ce4dda618ee9c268d84c943d Mon Sep 17 00:00:00 2001 From: Ramesh Ravone Date: Tue, 25 Apr 2017 17:18:35 +0530 Subject: [PATCH] Separate fullscreen state for scene & script editor --- editor/editor_node.cpp | 31 ++++++++++++++++++++++++++++++- editor/editor_node.h | 3 +++ editor/editor_settings.cpp | 2 ++ 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 04d369fed4e..14ac3cafe4e 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -2688,6 +2688,14 @@ void EditorNode::_editor_select(int p_which) { editor_plugin_screen = new_editor; editor_plugin_screen->make_visible(true); editor_plugin_screen->selected_notify(); + + if (EditorSettings::get_singleton()->get("interface/separate_distraction_mode")) { + if (p_which == EDITOR_SCRIPT) { + set_distraction_free_mode(script_distraction); + } else { + set_distraction_free_mode(scene_distraction); + } + } } void EditorNode::add_editor_plugin(EditorPlugin *p_editor) { @@ -4381,7 +4389,25 @@ bool EditorNode::get_docks_visible() const { void EditorNode::_toggle_distraction_free_mode() { - set_distraction_free_mode(distraction_free->is_pressed()); + if (EditorSettings::get_singleton()->get("interface/separate_distraction_mode")) { + int screen = -1; + for (int i = 0; i < editor_table.size(); i++) { + if (editor_plugin_screen == editor_table[i]) { + screen = i; + break; + } + } + + if (screen == EDITOR_SCRIPT) { + script_distraction = not script_distraction; + set_distraction_free_mode(script_distraction); + } else { + scene_distraction = not scene_distraction; + set_distraction_free_mode(scene_distraction); + } + } else { + set_distraction_free_mode(distraction_free->is_pressed()); + } } void EditorNode::set_distraction_free_mode(bool p_enter) { @@ -4805,6 +4831,9 @@ EditorNode::EditorNode() { _initializing_addons = false; docks_visible = true; + scene_distraction = false; + script_distraction = false; + FileAccess::set_backup_save(true); TranslationServer::get_singleton()->set_enabled(false); diff --git a/editor/editor_node.h b/editor/editor_node.h index 7de713eae9b..fc107bb5053 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -357,6 +357,9 @@ private: bool docks_visible; ToolButton *distraction_free; + bool scene_distraction; + bool script_distraction; + String _tmp_import_path; EditorExport *editor_export; diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 9beffa3c677..ff87e9ef84b 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -509,6 +509,8 @@ void EditorSettings::_load_defaults(Ref p_extra_config) { set("interface/dim_transition_time", 0.08f); hints["interface/dim_transition_time"] = PropertyInfo(Variant::REAL, "interface/dim_transition_time", PROPERTY_HINT_RANGE, "0,1,0.001", PROPERTY_USAGE_DEFAULT); + set("interface/separate_distraction_mode", false); + 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", "");