diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2017-11-17 00:37:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-17 00:37:01 +0100 |
commit | b44cb4e3b9b573a3cbbd6f71aff81e6c3465d84b (patch) | |
tree | b544d83d79190fa0c397d12847902e1bdaaaf668 /editor/filesystem_dock.cpp | |
parent | d629fd9a361c8eb55960d3653a878115a2662210 (diff) | |
parent | 3babb19515465989814baeefa3cb200161eee1c1 (diff) |
Merge pull request #12583 from volzhs/select-multiple-files
Not to be slow when select multiple files
Diffstat (limited to 'editor/filesystem_dock.cpp')
-rw-r--r-- | editor/filesystem_dock.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index 7abddb9f67..533401b317 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -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; |