IO: Add support for multiple drag-n-drop files #107230
|
@ -1427,11 +1427,11 @@ const char *WM_drag_get_item_name(wmDrag *drag);
|
|||
*/
|
||||
wmDragPath *WM_drag_create_path_data(blender::Span<const char *> paths);
|
||||
const char *WM_drag_get_single_path(const wmDrag *drag);
|
||||
const blender::Span<std::string> WM_drag_get_paths(const wmDrag *drag);
|
||||
blender::Span<std::string> WM_drag_get_paths(const wmDrag *drag);
|
||||
/**
|
||||
* Note that even though the enum return type uses bit-flags, this should never have multiple
|
||||
* type-bits set, so `ELEM()` like comparison is possible. For internal use only, and only
|
||||
* indicates the file type of first path in `wmDragPath.paths`.
|
||||
* type-bits set, so `ELEM()` like comparison is possible. Only indicates the file type of first
|
||||
* path in `wmDragPath.paths`.
|
||||
*/
|
||||
int /* eFileSel_File_Types */ WM_drag_get_path_file_type(const wmDrag *drag);
|
||||
|
||||
|
|
|
@ -1175,8 +1175,8 @@ struct wmDragAssetListItem {
|
|||
struct wmDragPath {
|
||||
blender::Vector<std::string> paths;
|
||||
/* Note that even though the enum type uses bit-flags, this should never have multiple type-bits
|
||||
* set, so `ELEM()` like comparison is possible. For internal use only, and only indicates the
|
||||
* file type of first path in `wmDragPath.paths`. */
|
||||
* set, so `ELEM()` like comparison is possible. Only indicates the file type of first path in
|
||||
* `wmDragPath.paths`. */
|
||||
int file_type; /* eFileSel_File_Types */
|
||||
std::string tooltip;
|
||||
};
|
||||
|
|
|
@ -767,7 +767,7 @@ wmDragPath *WM_drag_create_path_data(blender::Span<const char *> paths)
|
|||
|
||||
path_data->file_type = ED_path_extension_type(paths[0]);
|
||||
|
||||
for (auto path : paths) {
|
||||
for (const char *path : paths) {
|
||||
path_data->paths.append(path);
|
||||
}
|
||||
|
||||
|
@ -797,7 +797,7 @@ const char *WM_drag_get_single_path(const wmDrag *drag)
|
|||
return path_data->paths[0].c_str();
|
||||
}
|
||||
|
||||
const blender::Span<std::string> WM_drag_get_paths(const wmDrag *drag)
|
||||
blender::Span<std::string> WM_drag_get_paths(const wmDrag *drag)
|
||||
{
|
||||
if (drag->type != WM_DRAG_PATH) {
|
||||
return blender::Span<std::string>();
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
namespace blender::tests {
|
||||
|
||||
TEST(wm_dragdrop, create)
|
||||
TEST(wm_drag, wmDragPath)
|
||||
{
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -65,8 +65,6 @@
|
|||
#include "ED_scene.hh"
|
||||
#include "ED_screen.hh"
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include "IMB_imbuf.h"
|
||||
#include "IMB_imbuf_types.h"
|
||||
|
||||
|
@ -1583,7 +1581,6 @@ static bool ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_pt
|
|||
blender::Span((char **)stra->strings, stra->count));
|
||||
WM_event_start_drag(C, icon, WM_DRAG_PATH, path_data, 0.0, WM_DRAG_NOP);
|
||||
/* Void pointer should point to string, it makes a copy. */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue