Merge pull request #12583 from volzhs/select-multiple-files

Not to be slow when select multiple files
This commit is contained in:
Rémi Verschelde 2017-11-17 00:37:01 +01:00 committed by GitHub
commit b44cb4e3b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 1 deletions

View File

@ -1454,11 +1454,21 @@ void FileSystemDock::select_file(const String &p_file) {
void FileSystemDock::_file_multi_selected(int p_index, bool p_selected) {
_file_selected();
import_dock_needs_update = true;
call_deferred("_update_import_dock");
}
void FileSystemDock::_file_selected() {
import_dock_needs_update = true;
_update_import_dock();
}
void FileSystemDock::_update_import_dock() {
if (!import_dock_needs_update)
return;
//check import
Vector<String> imports;
String import_type;
@ -1498,6 +1508,8 @@ void FileSystemDock::_file_selected() {
} else {
EditorNode::get_singleton()->get_import_dock()->set_edit_multiple_paths(imports);
}
import_dock_needs_update = false;
}
void FileSystemDock::_bind_methods() {
@ -1534,6 +1546,7 @@ void FileSystemDock::_bind_methods() {
ClassDB::bind_method(D_METHOD("_preview_invalidated"), &FileSystemDock::_preview_invalidated);
ClassDB::bind_method(D_METHOD("_file_selected"), &FileSystemDock::_file_selected);
ClassDB::bind_method(D_METHOD("_file_multi_selected"), &FileSystemDock::_file_multi_selected);
ClassDB::bind_method(D_METHOD("_update_import_dock"), &FileSystemDock::_update_import_dock);
ADD_SIGNAL(MethodInfo("instance", PropertyInfo(Variant::POOL_STRING_ARRAY, "files")));
ADD_SIGNAL(MethodInfo("open"));
@ -1705,6 +1718,7 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
updating_tree = false;
initialized = false;
import_dock_needs_update = false;
history_pos = 0;
history_max_size = 20;

View File

@ -147,6 +147,7 @@ private:
bool updating_tree;
Tree *tree; //directories
ItemList *files;
bool import_dock_needs_update;
bool _create_tree(TreeItem *p_parent, EditorFileSystemDirectory *p_dir, Vector<String> &uncollapsed_paths);
void _update_tree(bool keep_collapse_state);
@ -161,6 +162,7 @@ private:
void _select_file(int p_idx);
void _file_multi_selected(int p_index, bool p_selected);
void _update_import_dock();
void _file_selected();
void _dir_selected();