|
@@ -973,35 +973,6 @@ void EditorFileDialog::update_file_name() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// TODO: Could use a unit test.
|
|
|
-Color EditorFileDialog::get_dir_icon_color(const String &p_dir_path) {
|
|
|
- if (!FileSystemDock::get_singleton()) { // This dialog can be called from the project manager.
|
|
|
- return theme_cache.folder_icon_color;
|
|
|
- }
|
|
|
-
|
|
|
- const HashMap<String, Color> &folder_colors = FileSystemDock::get_singleton()->get_folder_colors();
|
|
|
- Dictionary assigned_folder_colors = FileSystemDock::get_singleton()->get_assigned_folder_colors();
|
|
|
-
|
|
|
- Color folder_icon_color = theme_cache.folder_icon_color;
|
|
|
-
|
|
|
- // Check for a folder color to inherit (if one is assigned).
|
|
|
- String parent_dir = ProjectSettings::get_singleton()->localize_path(p_dir_path);
|
|
|
- while (!parent_dir.is_empty() && parent_dir != "res://") {
|
|
|
- if (!parent_dir.ends_with("/")) {
|
|
|
- parent_dir += "/";
|
|
|
- }
|
|
|
- if (assigned_folder_colors.has(parent_dir)) {
|
|
|
- folder_icon_color = folder_colors[assigned_folder_colors[parent_dir]];
|
|
|
- if (folder_icon_color != theme_cache.folder_icon_color) {
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- parent_dir = parent_dir.trim_suffix("/").get_base_dir();
|
|
|
- }
|
|
|
-
|
|
|
- return folder_icon_color;
|
|
|
-}
|
|
|
-
|
|
|
// DO NOT USE THIS FUNCTION UNLESS NEEDED, CALL INVALIDATE() INSTEAD.
|
|
|
void EditorFileDialog::update_file_list() {
|
|
|
int thumbnail_size = EDITOR_GET("filesystem/file_dialog/thumbnail_size");
|
|
@@ -1155,7 +1126,7 @@ void EditorFileDialog::update_file_list() {
|
|
|
d["bundle"] = bundle;
|
|
|
|
|
|
item_list->set_item_metadata(-1, d);
|
|
|
- item_list->set_item_icon_modulate(-1, get_dir_icon_color(String(d["path"])));
|
|
|
+ item_list->set_item_icon_modulate(-1, FileSystemDock::get_dir_icon_color(String(d["path"]), theme_cache.folder_icon_color));
|
|
|
}
|
|
|
|
|
|
dirs.pop_front();
|
|
@@ -1840,7 +1811,7 @@ void EditorFileDialog::_update_favorites() {
|
|
|
favorites->add_item(favorited_names[i], theme_cache.folder);
|
|
|
favorites->set_item_tooltip(-1, favorited_paths[i]);
|
|
|
favorites->set_item_metadata(-1, favorited_paths[i]);
|
|
|
- favorites->set_item_icon_modulate(-1, get_dir_icon_color(favorited_paths[i]));
|
|
|
+ favorites->set_item_icon_modulate(-1, FileSystemDock::get_dir_icon_color(favorited_paths[i], theme_cache.folder_icon_color));
|
|
|
|
|
|
if (i == current_favorite) {
|
|
|
favorite->set_pressed(true);
|
|
@@ -1925,7 +1896,7 @@ void EditorFileDialog::_update_recent() {
|
|
|
recent->add_item(recentd_names[i], theme_cache.folder);
|
|
|
recent->set_item_tooltip(-1, recentd_paths[i]);
|
|
|
recent->set_item_metadata(-1, recentd_paths[i]);
|
|
|
- recent->set_item_icon_modulate(-1, get_dir_icon_color(recentd_paths[i]));
|
|
|
+ recent->set_item_icon_modulate(-1, FileSystemDock::get_dir_icon_color(recentd_paths[i], theme_cache.folder_icon_color));
|
|
|
}
|
|
|
|
|
|
if (modified) {
|