@@ -191,6 +191,7 @@ void EditorFileDialog::_update_theme_item_cache() {
191191 theme_cache.favorites_up = get_editor_theme_icon (SNAME (" MoveUp" ));
192192 theme_cache.favorites_down = get_editor_theme_icon (SNAME (" MoveDown" ));
193193 theme_cache.create_folder = get_editor_theme_icon (SNAME (" FolderCreate" ));
194+ theme_cache.open_folder = get_editor_theme_icon (SNAME (" FolderBrowse" ));
194195
195196 theme_cache.filter_box = get_editor_theme_icon (SNAME (" Search" ));
196197 theme_cache.file_sort_button = get_editor_theme_icon (SNAME (" Sort" ));
@@ -541,7 +542,7 @@ void EditorFileDialog::_action_pressed() {
541542 String file_text = file->get_text ();
542543 String f = file_text.is_absolute_path () ? file_text : dir_access->get_current_dir ().path_join (file_text);
543544
544- if ((mode == FILE_MODE_OPEN_ANY || mode == FILE_MODE_OPEN_FILE) && dir_access->file_exists (f)) {
545+ if ((mode == FILE_MODE_OPEN_ANY || mode == FILE_MODE_OPEN_FILE) && ( dir_access->file_exists (f) || dir_access-> is_bundle (f) )) {
545546 _save_to_recent ();
546547 hide ();
547548 emit_signal (SNAME (" file_selected" ), f);
@@ -793,6 +794,12 @@ void EditorFileDialog::_item_list_item_rmb_clicked(int p_item, const Vector2 &p_
793794 item_menu->add_icon_item (theme_cache.filesystem , item_text, ITEM_MENU_SHOW_IN_EXPLORER);
794795 }
795796#endif
797+ if (single_item_selected) {
798+ Dictionary item_meta = item_list->get_item_metadata (p_item);
799+ if (item_meta[" bundle" ]) {
800+ item_menu->add_icon_item (theme_cache.open_folder , TTR (" Show Package Contents" ), ITEM_MENU_SHOW_BUNDLE_CONTENT);
801+ }
802+ }
796803
797804 if (item_menu->get_item_count () > 0 ) {
798805 item_menu->set_position (item_list->get_screen_position () + p_pos);
@@ -855,7 +862,7 @@ void EditorFileDialog::_item_menu_id_pressed(int p_option) {
855862 case ITEM_MENU_SHOW_IN_EXPLORER: {
856863 String path;
857864 int idx = item_list->get_current ();
858- if (idx == -1 || item_list->get_selected_items (). size () == 0 ) {
865+ if (idx == -1 || ! item_list->is_anything_selected () ) {
859866 // Folder background was clicked. Open this folder.
860867 path = ProjectSettings::get_singleton ()->globalize_path (dir_access->get_current_dir ());
861868 } else {
@@ -865,6 +872,20 @@ void EditorFileDialog::_item_menu_id_pressed(int p_option) {
865872 }
866873 OS::get_singleton ()->shell_show_in_file_manager (path, true );
867874 } break ;
875+
876+ case ITEM_MENU_SHOW_BUNDLE_CONTENT: {
877+ String path;
878+ int idx = item_list->get_current ();
879+ if (idx == -1 || !item_list->is_anything_selected ()) {
880+ return ;
881+ }
882+ Dictionary item_meta = item_list->get_item_metadata (idx);
883+ dir_access->change_dir (item_meta[" path" ]);
884+ callable_mp (this , &EditorFileDialog::update_file_list).call_deferred ();
885+ callable_mp (this , &EditorFileDialog::update_dir).call_deferred ();
886+
887+ _push_history ();
888+ } break ;
868889 }
869890}
870891
@@ -1032,28 +1053,6 @@ void EditorFileDialog::update_file_list() {
10321053 }
10331054 sort_file_info_list (file_infos, file_sort);
10341055
1035- while (!dirs.is_empty ()) {
1036- const String &dir_name = dirs.front ()->get ();
1037-
1038- item_list->add_item (dir_name);
1039-
1040- if (display_mode == DISPLAY_THUMBNAILS) {
1041- item_list->set_item_icon (-1 , folder_thumbnail);
1042- } else {
1043- item_list->set_item_icon (-1 , theme_cache.folder );
1044- }
1045-
1046- Dictionary d;
1047- d[" name" ] = dir_name;
1048- d[" path" ] = cdir.path_join (dir_name);
1049- d[" dir" ] = true ;
1050-
1051- item_list->set_item_metadata (-1 , d);
1052- item_list->set_item_icon_modulate (-1 , get_dir_icon_color (String (d[" path" ])));
1053-
1054- dirs.pop_front ();
1055- }
1056-
10571056 List<String> patterns;
10581057 // build filter
10591058 if (filter->get_selected () == filter->get_item_count () - 1 ) {
@@ -1080,6 +1079,44 @@ void EditorFileDialog::update_file_list() {
10801079 }
10811080 }
10821081
1082+ while (!dirs.is_empty ()) {
1083+ const String &dir_name = dirs.front ()->get ();
1084+
1085+ bool bundle = dir_access->is_bundle (dir_name);
1086+ bool found = true ;
1087+ if (bundle) {
1088+ bool match = patterns.is_empty ();
1089+ for (const String &E : patterns) {
1090+ if (dir_name.matchn (E)) {
1091+ match = true ;
1092+ break ;
1093+ }
1094+ }
1095+ found = match;
1096+ }
1097+
1098+ if (found) {
1099+ item_list->add_item (dir_name);
1100+
1101+ if (display_mode == DISPLAY_THUMBNAILS) {
1102+ item_list->set_item_icon (-1 , folder_thumbnail);
1103+ } else {
1104+ item_list->set_item_icon (-1 , theme_cache.folder );
1105+ }
1106+
1107+ Dictionary d;
1108+ d[" name" ] = dir_name;
1109+ d[" path" ] = cdir.path_join (dir_name);
1110+ d[" dir" ] = !bundle;
1111+ d[" bundle" ] = bundle;
1112+
1113+ item_list->set_item_metadata (-1 , d);
1114+ item_list->set_item_icon_modulate (-1 , get_dir_icon_color (String (d[" path" ])));
1115+ }
1116+
1117+ dirs.pop_front ();
1118+ }
1119+
10831120 while (!file_infos.is_empty ()) {
10841121 bool match = patterns.is_empty ();
10851122
@@ -1115,6 +1152,7 @@ void EditorFileDialog::update_file_list() {
11151152 Dictionary d;
11161153 d[" name" ] = file_info.name ;
11171154 d[" dir" ] = false ;
1155+ d[" bundle" ] = false ;
11181156 d[" path" ] = file_info.path ;
11191157 item_list->set_item_metadata (-1 , d);
11201158
0 commit comments