IO: Add support for multiple drag-n-drop files #107230

Merged
Brecht Van Lommel merged 20 commits from guishe/blender:dragndrop-files into main 2023-12-12 18:46:22 +01:00
1 changed files with 9 additions and 9 deletions
Showing only changes of commit cb4e1bb231 - Show all commits

View File

@ -768,29 +768,29 @@ const ListBase *WM_drag_asset_list_get(const wmDrag *drag)
return &drag->asset_items;
}
wmDragPath *WM_drag_create_path_data(blender::Span<const char *> _paths)
wmDragPath *WM_drag_create_path_data(blender::Span<const char *> paths)
{
const char *extension = BLI_path_extension(_paths[0]);
blender::Vector<std::string> paths;
for (auto path : _paths) {
const char *extension = BLI_path_extension(paths[0]);
blender::Vector<std::string> filtered_paths;
for (auto path : paths) {
const char *test_ext = BLI_path_extension(path);
if (extension == test_ext || (extension && test_ext && STREQ(extension, test_ext))) {
guishe marked this conversation as resolved
Review

No final point in our UI strings: "Dragging {} files"

No final point in our UI strings: `"Dragging {} files"`
paths.append(path);
filtered_paths.append(path);
}
}
const char *tooltip = _paths[0];
const char *tooltip = paths[0];
char tooltip_buffer[256];
if (_paths.size() == 1) {
if (filtered_paths.size() > 1) {
BLI_snprintf(tooltip_buffer,
ARRAY_SIZE(tooltip_buffer),
TIP_("Dragging %d %s files."),
paths.size(),
filtered_paths.size(),
extension ? extension : TIP_("Folder"));
tooltip = tooltip_buffer;
}
wmDragPath *path_data = MEM_new<wmDragPath>(
"wmDragPath", paths, tooltip, ED_path_extension_type(_paths[0]));
"wmDragPath", filtered_paths, tooltip, ED_path_extension_type(paths[0]));
return path_data;
}