UI: Draw loading label in File Browser when list is empty but loading

Show "Loading..." now when file list loading is unfinished, but no item is
visible yet.

Would show "No items" earlier which is misleading, because the file
loading job may simply not have started yet, or found no relevant files
yet.

Pull Request: https://projects.blender.org/blender/blender/pulls/123029
This commit is contained in:
Julian Eisel
2024-06-11 00:54:33 +02:00
committed by Julian Eisel
parent 4f36fb1afe
commit 7b1de7e9ba

View File

@@ -1393,8 +1393,15 @@ void file_draw_list(const bContext *C, ARegion *region)
text_col[3] /= 2;
}
const char *message = is_filtered ? IFACE_("No results match the search filter") :
IFACE_("No items");
const char *message = [&]() {
if (!filelist_is_ready(files)) {
return IFACE_("Loading...");
}
if (is_filtered) {
return IFACE_("No results match the search filter");
}
return IFACE_("No items");
}();
UI_fontstyle_draw_simple(&style->widget,
tile_draw_rect.xmin + UI_UNIT_X,