Add editor setting for display mode on file dialog and filesystem dock
This commit is contained in:
parent
9e9e4f96a2
commit
d9f4d3952d
6 changed files with 29 additions and 7 deletions
|
@ -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 );
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -4769,6 +4769,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);
|
||||
|
||||
|
@ -5615,6 +5616,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");
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue