Merge pull request #115111 from KoBeWi/icons_are_baaaaaaaaaaaaack

Restore context menu icons in EditorFileDialog
This commit is contained in:
Thaddeus Crews 2026-02-20 14:34:27 -06:00
commit 74ecf68e15
No known key found for this signature in database
GPG key ID: 8C6E5FEB5FC03CCC
5 changed files with 52 additions and 0 deletions

View file

@ -423,6 +423,24 @@
<theme_item name="list_mode" data_type="icon" type="Texture2D">
Icon for the button that enables list mode.
</theme_item>
<theme_item name="menu_copy_path" data_type="icon" type="Texture2D">
Icon for the "Copy Path" context menu option.
</theme_item>
<theme_item name="menu_delete" data_type="icon" type="Texture2D">
Icon for the "Delete" context menu option.
</theme_item>
<theme_item name="menu_new_folder" data_type="icon" type="Texture2D">
Icon for the "New Folder..." context menu option. Usually it should be the same as [theme_item create_folder]; leave it empty if you want the context menu to show no icons.
</theme_item>
<theme_item name="menu_open_bundle" data_type="icon" type="Texture2D">
Icon for the "Show Package Contents" context menu option. The option only appears for macOS bundles.
</theme_item>
<theme_item name="menu_refresh" data_type="icon" type="Texture2D">
Icon for the "Refresh" context menu option. Usually it should be the same as [theme_item reload]; leave it empty if you want the context menu to show no icons.
</theme_item>
<theme_item name="menu_show_in_file_manager" data_type="icon" type="Texture2D">
Icon for the "Show in File Manager" context menu option.
</theme_item>
<theme_item name="parent_folder" data_type="icon" type="Texture2D">
Custom icon for the parent folder arrow.
</theme_item>

View file

@ -1058,6 +1058,13 @@ void ThemeClassic::populate_standard_styles(const Ref<EditorTheme> &p_theme, Edi
p_theme->set_icon("favorite_up", "FileDialog", p_theme->get_icon("MoveUp", EditorStringName(EditorIcons)));
p_theme->set_icon("favorite_down", "FileDialog", p_theme->get_icon("MoveDown", EditorStringName(EditorIcons)));
p_theme->set_icon("create_folder", "FileDialog", p_theme->get_icon("FolderCreate", EditorStringName(EditorIcons)));
p_theme->set_icon("menu_copy_path", "FileDialog", p_theme->get_icon("ActionCopy", EditorStringName(EditorIcons)));
p_theme->set_icon("menu_delete", "FileDialog", p_theme->get_icon("Remove", EditorStringName(EditorIcons)));
p_theme->set_icon("menu_refresh", "FileDialog", p_theme->get_icon("Reload", EditorStringName(EditorIcons)));
p_theme->set_icon("menu_new_folder", "FileDialog", p_theme->get_icon("Folder", EditorStringName(EditorIcons)));
p_theme->set_icon("menu_show_in_file_manager", "FileDialog", p_theme->get_icon("Filesystem", EditorStringName(EditorIcons)));
p_theme->set_icon("menu_open_bundle", "FileDialog", p_theme->get_icon("FolderBrowse", EditorStringName(EditorIcons)));
// Use a different color for folder icons to make them easier to distinguish from files.
// On a light theme, the icon will be dark, so we need to lighten it before blending it with the accent color.
p_theme->set_color("folder_icon_color", "FileDialog", (p_config.dark_icon_and_font ? Color(1, 1, 1) : Color(4.25, 4.25, 4.25)).lerp(p_config.accent_color, 0.7));

View file

@ -1044,6 +1044,13 @@ void ThemeModern::populate_standard_styles(const Ref<EditorTheme> &p_theme, Edit
p_theme->set_icon("favorite_up", "FileDialog", p_theme->get_icon("MoveUp", EditorStringName(EditorIcons)));
p_theme->set_icon("favorite_down", "FileDialog", p_theme->get_icon("MoveDown", EditorStringName(EditorIcons)));
p_theme->set_icon("create_folder", "FileDialog", p_theme->get_icon("FolderCreate", EditorStringName(EditorIcons)));
p_theme->set_icon("menu_copy_path", "FileDialog", p_theme->get_icon("ActionCopy", EditorStringName(EditorIcons)));
p_theme->set_icon("menu_delete", "FileDialog", p_theme->get_icon("Remove", EditorStringName(EditorIcons)));
p_theme->set_icon("menu_refresh", "FileDialog", p_theme->get_icon("Reload", EditorStringName(EditorIcons)));
p_theme->set_icon("menu_new_folder", "FileDialog", p_theme->get_icon("Folder", EditorStringName(EditorIcons)));
p_theme->set_icon("menu_show_in_file_manager", "FileDialog", p_theme->get_icon("Filesystem", EditorStringName(EditorIcons)));
p_theme->set_icon("menu_open_bundle", "FileDialog", p_theme->get_icon("FolderBrowse", EditorStringName(EditorIcons)));
// Use a different color for folder icons to make them easier to distinguish from files.
// On a light theme, the icon will be dark, so we need to lighten it before blending it with the accent color.
p_theme->set_color("folder_icon_color", "FileDialog", (p_config.dark_icon_and_font ? Color(1, 1, 1) : Color(4.25, 4.25, 4.25)).lerp(p_config.accent_color, 0.7));

View file

@ -774,15 +774,19 @@ void FileDialog::_popup_menu(const Vector2 &p_pos, int p_for_item) {
if (p_for_item > -1) {
item_menu->add_item(ETR("Copy Path"), ITEM_MENU_COPY_PATH);
item_menu->set_item_icon(-1, theme_cache.menu_copy_path);
if (customization_flags[CUSTOMIZATION_DELETE]) {
item_menu->add_item(ETR("Delete"), ITEM_MENU_DELETE);
item_menu->set_item_icon(-1, theme_cache.menu_delete);
item_menu->set_item_shortcut(-1, action_shortcuts[ITEM_MENU_DELETE]);
}
} else {
if (can_create_folders) {
item_menu->add_item(ETR("New Folder..."), ITEM_MENU_NEW_FOLDER);
item_menu->set_item_icon(-1, theme_cache.menu_new_folder);
}
item_menu->add_item(ETR("Refresh"), ITEM_MENU_REFRESH);
item_menu->set_item_icon(-1, theme_cache.menu_refresh);
item_menu->set_item_shortcut(-1, action_shortcuts[ITEM_MENU_REFRESH]);
}
@ -796,8 +800,10 @@ void FileDialog::_popup_menu(const Vector2 &p_pos, int p_for_item) {
}
item_menu->add_item((p_for_item == -1 || meta["dir"]) ? ETR("Open in File Manager") : ETR("Show in File Manager"), ITEM_MENU_SHOW_IN_EXPLORER);
item_menu->set_item_icon(-1, theme_cache.menu_show_in_file_manager);
if (meta["bundle"]) {
item_menu->add_item(ETR("Show Package Contents"), ITEM_MENU_SHOW_BUNDLE_CONTENT);
item_menu->set_item_icon(-1, theme_cache.menu_open_bundle);
}
#endif
@ -2184,6 +2190,13 @@ void FileDialog::_bind_methods() {
BIND_THEME_ITEM(Theme::DATA_TYPE_ICON, FileDialog, file_thumbnail);
BIND_THEME_ITEM(Theme::DATA_TYPE_ICON, FileDialog, folder_thumbnail);
BIND_THEME_ITEM(Theme::DATA_TYPE_ICON, FileDialog, menu_copy_path);
BIND_THEME_ITEM(Theme::DATA_TYPE_ICON, FileDialog, menu_delete);
BIND_THEME_ITEM(Theme::DATA_TYPE_ICON, FileDialog, menu_refresh);
BIND_THEME_ITEM(Theme::DATA_TYPE_ICON, FileDialog, menu_new_folder);
BIND_THEME_ITEM(Theme::DATA_TYPE_ICON, FileDialog, menu_show_in_file_manager);
BIND_THEME_ITEM(Theme::DATA_TYPE_ICON, FileDialog, menu_open_bundle);
BIND_THEME_ITEM(Theme::DATA_TYPE_COLOR, FileDialog, folder_icon_color);
BIND_THEME_ITEM(Theme::DATA_TYPE_COLOR, FileDialog, file_icon_color);
BIND_THEME_ITEM(Theme::DATA_TYPE_COLOR, FileDialog, file_disabled_color);

View file

@ -280,6 +280,13 @@ private:
Ref<Texture2D> file_thumbnail;
Ref<Texture2D> folder_thumbnail;
Ref<Texture2D> menu_copy_path;
Ref<Texture2D> menu_delete;
Ref<Texture2D> menu_refresh;
Ref<Texture2D> menu_new_folder;
Ref<Texture2D> menu_show_in_file_manager;
Ref<Texture2D> menu_open_bundle;
Color folder_icon_color;
Color file_icon_color;
Color file_disabled_color;