Merge pull request #8532 from RameshRavone/patch-4

Separate distraction mode for scene & script editor
This commit is contained in:
Rémi Verschelde 2017-05-05 22:40:57 +02:00 committed by GitHub
commit 1f9266cbff
3 changed files with 35 additions and 1 deletions

View File

@ -2689,6 +2689,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) {
@ -4382,7 +4390,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) {
@ -4806,6 +4832,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);

View File

@ -357,6 +357,9 @@ private:
bool docks_visible;
ToolButton *distraction_free;
bool scene_distraction;
bool script_distraction;
String _tmp_import_path;
EditorExport *editor_export;

View File

@ -509,6 +509,8 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> 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", "");