summaryrefslogtreecommitdiff
path: root/editor/filesystem_dock.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/filesystem_dock.cpp')
-rw-r--r--editor/filesystem_dock.cpp59
1 files changed, 22 insertions, 37 deletions
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index 0ad7b25e4a..69c1424403 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -215,9 +215,6 @@ void FileSystemDock::_notification(int p_what) {
button_hist_next->set_icon(get_icon("Forward", "EditorIcons"));
button_hist_prev->set_icon(get_icon("Back", "EditorIcons"));
- Theme::get_default()->clear_icon("ResizedFolder", "EditorIcons");
- Theme::get_default()->clear_icon("ResizedFile", "EditorIcons");
-
if (new_mode != display_mode) {
set_display_mode(new_mode);
} else {
@@ -437,39 +434,15 @@ void FileSystemDock::_update_files(bool p_keep_selection) {
files->set_max_text_lines(2);
files->set_fixed_icon_size(Size2(thumbnail_size, thumbnail_size));
- if (!has_icon("ResizedFolder", "EditorIcons")) {
- Ref<ImageTexture> folder = get_icon("FolderBig", "EditorIcons");
- Ref<Image> img = folder->get_data();
- img = img->duplicate();
- img->resize(thumbnail_size, thumbnail_size);
- Ref<ImageTexture> resized_folder = Ref<ImageTexture>(memnew(ImageTexture));
- resized_folder->create_from_image(img, 0);
- Theme::get_default()->set_icon("ResizedFolder", "EditorIcons", resized_folder);
- }
-
- folder_thumbnail = get_icon("ResizedFolder", "EditorIcons");
-
- if (!has_icon("ResizedFile", "EditorIcons")) {
- Ref<ImageTexture> file = get_icon("FileBig", "EditorIcons");
- Ref<Image> img = file->get_data();
- img->resize(thumbnail_size, thumbnail_size);
- Ref<ImageTexture> resized_file = Ref<ImageTexture>(memnew(ImageTexture));
- resized_file->create_from_image(img, 0);
- Theme::get_default()->set_icon("ResizedFile", "EditorIcons", resized_file);
- }
-
- if (!has_icon("ResizedFileBroken", "EditorIcons")) {
- Ref<ImageTexture> file = get_icon("FileBigBroken", "EditorIcons");
- Ref<Image> img = file->get_data();
- img->resize(thumbnail_size, thumbnail_size);
- Ref<ImageTexture> resized_file = Ref<ImageTexture>(memnew(ImageTexture));
- resized_file->create_from_image(img, 0);
- Theme::get_default()->set_icon("ResizedFileBroken", "EditorIcons", resized_file);
+ if (thumbnail_size < 64) {
+ folder_thumbnail = get_icon("FolderMediumThumb", "EditorIcons");
+ file_thumbnail = get_icon("FileMediumThumb", "EditorIcons");
+ file_thumbnail_broken = get_icon("FileDeadMediumThumb", "EditorIcons");
+ } else {
+ folder_thumbnail = get_icon("FolderBigThumb", "EditorIcons");
+ file_thumbnail = get_icon("FileBigThumb", "EditorIcons");
+ file_thumbnail_broken = get_icon("FileDeadBigThumb", "EditorIcons");
}
-
- file_thumbnail = get_icon("ResizedFile", "EditorIcons");
-
- file_thumbnail_broken = get_icon("ResizedFileBroken", "EditorIcons");
} else {
files->set_icon_mode(ItemList::ICON_MODE_LEFT);
@@ -828,7 +801,12 @@ void FileSystemDock::_move_operation(const String &p_to_path) {
//make list of remaps
Map<String, String> renames;
String repfrom = path == "res://" ? path : String(path + "/");
- String repto = p_to_path == "res://" ? p_to_path : String(p_to_path + "/");
+ String repto = p_to_path;
+ if (!repto.ends_with("/")) {
+ repto += "/";
+ }
+
+ print_line("reprfrom: " + repfrom + " repto " + repto);
for (int i = 0; i < move_files.size(); i++) {
renames[move_files[i]] = move_files[i].replace_first(repfrom, repto);
@@ -868,6 +846,13 @@ void FileSystemDock::_move_operation(const String &p_to_path) {
if (err != OK) {
EditorNode::get_singleton()->add_io_error(TTR("Error moving file:\n") + move_files[i] + "\n");
}
+ if (FileAccess::exists(move_files[i] + ".import")) { //move imported files too
+ //@todo should remove the files in .import folder
+ err = da->rename(move_files[i] + ".import", to + ".import");
+ if (err != OK) {
+ EditorNode::get_singleton()->add_io_error(TTR("Error moving file:\n") + move_files[i] + ".import\n");
+ }
+ }
}
for (int i = 0; i < move_dirs.size(); i++) {
@@ -1827,7 +1812,7 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
path = "res://";
- add_constant_override("separation", 3);
+ add_constant_override("separation", 4);
}
FileSystemDock::~FileSystemDock() {