diff options
author | Juan Linietsky <reduzio@gmail.com> | 2015-12-15 23:40:29 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2015-12-15 23:40:29 -0300 |
commit | 686c65a354535366ff22718b974e9dd0d25dbfdd (patch) | |
tree | cdffcb81d7e96333b04c6dd940de201b3ebf877f /tools/editor | |
parent | a1142225bf513e4afe0527ca604486d3988449cc (diff) | |
parent | 08cab3a17a4eba874c17cec41425f149846663a4 (diff) |
Merge branch 'master' of https://github.com/godotengine/godot
Diffstat (limited to 'tools/editor')
-rw-r--r-- | tools/editor/editor_file_dialog.cpp | 19 | ||||
-rw-r--r-- | tools/editor/editor_file_dialog.h | 2 | ||||
-rw-r--r-- | tools/editor/editor_node.cpp | 2 | ||||
-rw-r--r-- | tools/editor/editor_settings.cpp | 2 | ||||
-rw-r--r-- | tools/editor/project_settings.cpp | 5 | ||||
-rw-r--r-- | tools/editor/scenes_dock.cpp | 10 | ||||
-rw-r--r-- | tools/editor/scenes_dock.h | 1 |
7 files changed, 32 insertions, 9 deletions
diff --git a/tools/editor/editor_file_dialog.cpp b/tools/editor/editor_file_dialog.cpp index 61ad7b6cbb..fc7ee2bde7 100644 --- a/tools/editor/editor_file_dialog.cpp +++ b/tools/editor/editor_file_dialog.cpp @@ -55,11 +55,8 @@ void EditorFileDialog::_notification(int p_what) { //get_stylebox("panel","PopupMenu")->draw(ci,Rect2(Point2(),get_size())); } else if (p_what==EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) { - bool show_hidden = EditorSettings::get_singleton()->get("file_dialog/show_hidden_files"); - - if (show_hidden != show_hidden_files) { - set_show_hidden_files(show_hidden); - } + set_show_hidden_files(EditorSettings::get_singleton()->get("file_dialog/show_hidden_files")); + set_display_mode((DisplayMode)EditorSettings::get_singleton()->get("file_dialog/display_mode").operator int()); } } @@ -1026,6 +1023,8 @@ void EditorFileDialog::_go_forward(){ bool EditorFileDialog::default_show_hidden_files=false; +EditorFileDialog::DisplayMode EditorFileDialog::default_display_mode=DISPLAY_THUMBNAILS; + void EditorFileDialog::set_display_mode(DisplayMode p_mode) { if (display_mode==p_mode) @@ -1125,6 +1124,10 @@ void EditorFileDialog::set_default_show_hidden_files(bool p_show) { default_show_hidden_files=p_show; } +void EditorFileDialog::set_default_display_mode(DisplayMode p_mode) { + default_display_mode=p_mode; +} + void EditorFileDialog::_save_to_recent() { String dir = get_current_dir(); @@ -1154,7 +1157,7 @@ void EditorFileDialog::_save_to_recent() { EditorFileDialog::EditorFileDialog() { show_hidden_files=default_show_hidden_files; - display_mode=DISPLAY_THUMBNAILS; + display_mode=default_display_mode; local_history_pos=0; VBoxContainer *vbc = memnew( VBoxContainer ); @@ -1194,11 +1197,13 @@ EditorFileDialog::EditorFileDialog() { mode_thumbnails = memnew( ToolButton ); mode_thumbnails->connect("pressed",this,"set_display_mode",varray(DISPLAY_THUMBNAILS)); mode_thumbnails->set_toggle_mode(true); - mode_thumbnails->set_pressed(true); + mode_thumbnails->set_pressed(display_mode==DISPLAY_THUMBNAILS); pathhb->add_child(mode_thumbnails); + mode_list = memnew( ToolButton ); mode_list->connect("pressed",this,"set_display_mode",varray(DISPLAY_LIST)); mode_list->set_toggle_mode(true); + mode_list->set_pressed(display_mode==DISPLAY_LIST); pathhb->add_child(mode_list); drives = memnew( OptionButton ); diff --git a/tools/editor/editor_file_dialog.h b/tools/editor/editor_file_dialog.h index eb38c3c02f..b72b1fa4ef 100644 --- a/tools/editor/editor_file_dialog.h +++ b/tools/editor/editor_file_dialog.h @@ -128,6 +128,7 @@ private: int preview_wheel_index; float preview_wheel_timeout; static bool default_show_hidden_files; + static DisplayMode default_display_mode; bool show_hidden_files; DisplayMode display_mode; @@ -211,6 +212,7 @@ public: bool is_showing_hidden_files() const; static void set_default_show_hidden_files(bool p_show); + static void set_default_display_mode(DisplayMode p_mode); void invalidate(); diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 4b4fd01ee0..6352a235f7 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -4766,6 +4766,7 @@ EditorNode::EditorNode() { ResourceLoader::set_abort_on_missing_resources(false); FileDialog::set_default_show_hidden_files(EditorSettings::get_singleton()->get("file_dialog/show_hidden_files")); EditorFileDialog::set_default_show_hidden_files(EditorSettings::get_singleton()->get("file_dialog/show_hidden_files")); + EditorFileDialog::set_default_display_mode((EditorFileDialog::DisplayMode)EditorSettings::get_singleton()->get("file_dialog/display_mode").operator int()); ResourceLoader::set_error_notify_func(this,_load_error_notify); ResourceLoader::set_dependency_error_notify_func(this,_dependency_error_report); @@ -5612,6 +5613,7 @@ EditorNode::EditorNode() { scenes_dock = memnew( ScenesDock(this) ); scenes_dock->set_name("FileSystem"); + scenes_dock->set_use_thumbnails(int(EditorSettings::get_singleton()->get("file_dialog/display_mode"))==EditorFileDialog::DISPLAY_THUMBNAILS); dock_slot[DOCK_SLOT_LEFT_BR]->add_child(scenes_dock); //prop_pallete->add_child(scenes_dock); scenes_dock->connect("open",this,"open_request"); diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp index 15de6e7266..5c36b842c7 100644 --- a/tools/editor/editor_settings.cpp +++ b/tools/editor/editor_settings.cpp @@ -515,6 +515,8 @@ void EditorSettings::_load_defaults() { set("text_editor/create_signal_callbacks",true); set("file_dialog/show_hidden_files", false); + set("file_dialog/display_mode", 0); + hints["file_dialog/display_mode"]=PropertyInfo(Variant::INT,"file_dialog/display_mode",PROPERTY_HINT_ENUM,"Thumbnails,List"); set("file_dialog/thumbnail_size", 64); hints["file_dialog/thumbnail_size"]=PropertyInfo(Variant::INT,"file_dialog/thumbnail_size",PROPERTY_HINT_RANGE,"32,128,16"); diff --git a/tools/editor/project_settings.cpp b/tools/editor/project_settings.cpp index e994b7524c..879fe1bda5 100644 --- a/tools/editor/project_settings.cpp +++ b/tools/editor/project_settings.cpp @@ -427,9 +427,10 @@ 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 (!Globals::get_singleton()->get_input_presets().find(pi.name)) { item->add_button(0,get_icon("Rename","EditorIcons"),2); - item->add_button(0,get_icon("Remove","EditorIcons"),3); + item->add_button(0,get_icon("Remove","EditorIcons"),3); + } item->set_custom_bg_color(0,get_color("prop_subsection","Editor")); item->set_editable(0,true); item->set_checked(0,pi.usage&PROPERTY_USAGE_CHECKED); diff --git a/tools/editor/scenes_dock.cpp b/tools/editor/scenes_dock.cpp index c9b376ebec..5880a6eef6 100644 --- a/tools/editor/scenes_dock.cpp +++ b/tools/editor/scenes_dock.cpp @@ -195,7 +195,12 @@ void ScenesDock::_notification(int p_what) { case NOTIFICATION_EXIT_TREE: { } break; + case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { + display_mode->set_pressed(int(EditorSettings::get_singleton()->get("file_dialog/display_mode"))==EditorFileDialog::DISPLAY_LIST); + + _change_file_display(); + } break; } } @@ -1063,6 +1068,11 @@ void ScenesDock::open(const String& p_path) { } +void ScenesDock::set_use_thumbnails(bool p_use) { + + display_mode->set_pressed(!p_use); +} + void ScenesDock::_bind_methods() { ObjectTypeDB::bind_method(_MD("_update_tree"),&ScenesDock::_update_tree); diff --git a/tools/editor/scenes_dock.h b/tools/editor/scenes_dock.h index d045124bf7..e5e0eafc24 100644 --- a/tools/editor/scenes_dock.h +++ b/tools/editor/scenes_dock.h @@ -153,6 +153,7 @@ public: void fix_dependencies(const String& p_for_file); + void set_use_thumbnails(bool p_use); ScenesDock(EditorNode *p_editor); ~ScenesDock(); |