WIP: Experiment: Drop import operator helper and file drop type #111242
|
@ -588,7 +588,7 @@ static void ui_alembic_import_settings(uiLayout *layout, PointerRNA *imfptr)
|
|||
|
||||
static void wm_alembic_import_draw(bContext *C, wmOperator *op)
|
||||
{
|
||||
files_drop_label_draw(C, op, ICON_FILE_3D, ".abc");
|
||||
io_util_drop_file_label_draw(C, op, ICON_FILE_3D, ".abc");
|
||||
ui_alembic_import_settings(op->layout, op->ptr);
|
||||
}
|
||||
|
||||
|
@ -598,7 +598,7 @@ static int wm_alembic_import_invoke(bContext *C, wmOperator *op, const wmEvent *
|
|||
if (!RNA_struct_property_is_set(op->ptr, "as_background_job")) {
|
||||
RNA_boolean_set(op->ptr, "as_background_job", true);
|
||||
}
|
||||
return wm_io_import_invoke(C, op, event);
|
||||
return io_util_import_invoke(C, op, event);
|
||||
}
|
||||
|
||||
static int wm_alembic_import_exec(bContext *C, wmOperator *op)
|
||||
|
@ -668,7 +668,7 @@ void WM_OT_alembic_import(wmOperatorType *ot)
|
|||
WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH | WM_FILESEL_SHOW_PROPS,
|
||||
FILE_DEFAULTDISPLAY,
|
||||
FILE_SORT_DEFAULT);
|
||||
skip_filesel_props(ot, WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH);
|
||||
io_util_skip_save_filesel_props(ot, WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH);
|
||||
|
||||
PropertyRNA *prop = RNA_def_string(ot->srna, "filter_glob", "*.abc", 0, "", "");
|
||||
RNA_def_property_flag(prop, PROP_HIDDEN);
|
||||
|
|
|
@ -791,7 +791,7 @@ static void uiCollada_importSettings(uiLayout *layout, PointerRNA *imfptr)
|
|||
|
||||
static void wm_collada_import_draw(bContext *C, wmOperator *op)
|
||||
{
|
||||
files_drop_label_draw(C, op, ICON_FILE_3D, "dae");
|
||||
io_util_drop_file_label_draw(C, op, ICON_FILE_3D, "dae");
|
||||
uiCollada_importSettings(op->layout, op->ptr);
|
||||
}
|
||||
|
||||
|
@ -802,7 +802,7 @@ void WM_OT_collada_import(wmOperatorType *ot)
|
|||
ot->idname = "WM_OT_collada_import";
|
||||
ot->flag = OPTYPE_UNDO | OPTYPE_PRESET;
|
||||
|
||||
ot->invoke = wm_io_import_invoke;
|
||||
ot->invoke = io_util_import_invoke;
|
||||
ot->exec = wm_collada_import_exec;
|
||||
ot->poll = WM_operator_winactive;
|
||||
|
||||
|
@ -815,7 +815,7 @@ void WM_OT_collada_import(wmOperatorType *ot)
|
|||
WM_FILESEL_FILEPATH | WM_FILESEL_SHOW_PROPS,
|
||||
FILE_DEFAULTDISPLAY,
|
||||
FILE_SORT_DEFAULT);
|
||||
skip_filesel_props(ot, WM_FILESEL_FILEPATH);
|
||||
io_util_skip_save_filesel_props(ot, WM_FILESEL_FILEPATH);
|
||||
|
||||
PropertyRNA *prop = RNA_def_string(ot->srna, "filter_glob", "*.dae", 0, "", "");
|
||||
RNA_def_property_flag(prop, PROP_HIDDEN);
|
||||
|
|
|
@ -138,7 +138,7 @@ static void ui_gpencil_import_svg_settings(uiLayout *layout, PointerRNA *imfptr)
|
|||
|
||||
static void wm_gpencil_import_svg_draw(bContext *C, wmOperator *op)
|
||||
{
|
||||
files_drop_label_draw(C, op, ICON_FILE_3D, ".svg");
|
||||
io_util_drop_file_label_draw(C, op, ICON_FILE_3D, ".svg");
|
||||
ui_gpencil_import_svg_settings(op->layout, op->ptr);
|
||||
}
|
||||
|
||||
|
@ -157,7 +157,7 @@ void WM_OT_gpencil_import_svg(wmOperatorType *ot)
|
|||
ot->description = "Import SVG into grease pencil";
|
||||
ot->idname = "WM_OT_gpencil_import_svg";
|
||||
|
||||
ot->invoke = wm_io_import_invoke;
|
||||
ot->invoke = io_util_import_invoke;
|
||||
ot->exec = wm_gpencil_import_svg_exec;
|
||||
ot->poll = wm_gpencil_import_svg_poll;
|
||||
ot->ui = wm_gpencil_import_svg_draw;
|
||||
|
@ -171,7 +171,7 @@ void WM_OT_gpencil_import_svg(wmOperatorType *ot)
|
|||
WM_FILESEL_DIRECTORY | WM_FILESEL_FILES,
|
||||
FILE_DEFAULTDISPLAY,
|
||||
FILE_SORT_DEFAULT);
|
||||
skip_filesel_props(
|
||||
io_util_skip_save_filesel_props(
|
||||
ot, WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH | WM_FILESEL_DIRECTORY | WM_FILESEL_FILES);
|
||||
|
||||
RNA_def_int(ot->srna,
|
||||
|
|
|
@ -478,7 +478,7 @@ void WM_OT_obj_import(wmOperatorType *ot)
|
|||
ot->idname = "WM_OT_obj_import";
|
||||
ot->flag = OPTYPE_UNDO | OPTYPE_PRESET;
|
||||
|
||||
ot->invoke = wm_io_import_invoke;
|
||||
ot->invoke = io_util_import_invoke;
|
||||
ot->exec = wm_obj_import_exec;
|
||||
ot->poll = WM_operator_winactive;
|
||||
ot->ui = wm_obj_import_draw;
|
||||
|
@ -492,7 +492,8 @@ void WM_OT_obj_import(wmOperatorType *ot)
|
|||
FILE_DEFAULTDISPLAY,
|
||||
FILE_SORT_DEFAULT);
|
||||
|
||||
skip_filesel_props(ot, WM_FILESEL_FILEPATH | WM_FILESEL_DIRECTORY | WM_FILESEL_FILES);
|
||||
io_util_skip_save_filesel_props(ot,
|
||||
WM_FILESEL_FILEPATH | WM_FILESEL_DIRECTORY | WM_FILESEL_FILES);
|
||||
|
||||
RNA_def_float(
|
||||
ot->srna,
|
||||
|
|
|
@ -294,7 +294,7 @@ static void wm_ply_import_draw(bContext *C, wmOperator *op)
|
|||
{
|
||||
wmWindowManager *wm = CTX_wm_manager(C);
|
||||
PointerRNA ptr = RNA_pointer_create(&wm->id, op->type->srna, op->properties);
|
||||
files_drop_label_draw(C, op, ICON_FILE_3D, ".ply");
|
||||
io_util_drop_file_label_draw(C, op, ICON_FILE_3D, ".ply");
|
||||
ui_ply_import_settings(op->layout, &ptr);
|
||||
}
|
||||
|
||||
|
@ -306,7 +306,7 @@ void WM_OT_ply_import(wmOperatorType *ot)
|
|||
ot->description = "Import an PLY file as an object";
|
||||
ot->idname = "WM_OT_ply_import";
|
||||
|
||||
ot->invoke = wm_io_import_invoke;
|
||||
ot->invoke = io_util_import_invoke;
|
||||
ot->exec = wm_ply_import_exec;
|
||||
ot->poll = WM_operator_winactive;
|
||||
ot->ui = wm_ply_import_draw;
|
||||
|
@ -320,7 +320,8 @@ void WM_OT_ply_import(wmOperatorType *ot)
|
|||
WM_FILESEL_SHOW_PROPS,
|
||||
FILE_DEFAULTDISPLAY,
|
||||
FILE_SORT_DEFAULT);
|
||||
skip_filesel_props(ot, WM_FILESEL_FILEPATH | WM_FILESEL_FILES | WM_FILESEL_DIRECTORY);
|
||||
io_util_skip_save_filesel_props(ot,
|
||||
WM_FILESEL_FILEPATH | WM_FILESEL_FILES | WM_FILESEL_DIRECTORY);
|
||||
|
||||
RNA_def_float(ot->srna, "global_scale", 1.0f, 1e-6f, 1e6f, "Scale", "", 0.001f, 1000.0f);
|
||||
RNA_def_boolean(ot->srna,
|
||||
|
|
|
@ -111,7 +111,7 @@ static void wm_stl_import_draw(bContext *C, wmOperator *op)
|
|||
{
|
||||
wmWindowManager *wm = CTX_wm_manager(C);
|
||||
PointerRNA ptr = RNA_pointer_create(&wm->id, op->type->srna, op->properties);
|
||||
files_drop_label_draw(C, op, ICON_FILE_3D, ".stl");
|
||||
io_util_drop_file_label_draw(C, op, ICON_FILE_3D, ".stl");
|
||||
ui_stl_import_settings(op->layout, &ptr);
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@ void WM_OT_stl_import(wmOperatorType *ot)
|
|||
ot->description = "Import an STL file as an object";
|
||||
ot->idname = "WM_OT_stl_import";
|
||||
|
||||
ot->invoke = wm_io_import_invoke;
|
||||
ot->invoke = io_util_import_invoke;
|
||||
ot->exec = wm_stl_import_exec;
|
||||
ot->poll = WM_operator_winactive;
|
||||
ot->check = wm_stl_import_check;
|
||||
|
@ -138,7 +138,8 @@ void WM_OT_stl_import(wmOperatorType *ot)
|
|||
WM_FILESEL_SHOW_PROPS,
|
||||
FILE_DEFAULTDISPLAY,
|
||||
FILE_SORT_DEFAULT);
|
||||
skip_filesel_props(ot, WM_FILESEL_FILEPATH | WM_FILESEL_FILES | WM_FILESEL_DIRECTORY);
|
||||
io_util_skip_save_filesel_props(ot,
|
||||
WM_FILESEL_FILEPATH | WM_FILESEL_FILES | WM_FILESEL_DIRECTORY);
|
||||
|
||||
RNA_def_float(ot->srna, "global_scale", 1.0f, 1e-6f, 1e6f, "Scale", "", 0.001f, 1000.0f);
|
||||
RNA_def_boolean(ot->srna,
|
||||
|
|
|
@ -394,7 +394,7 @@ static int wm_usd_import_invoke(bContext *C, wmOperator *op, const wmEvent *even
|
|||
options->as_background_job = true;
|
||||
op->customdata = options;
|
||||
|
||||
return wm_io_import_invoke(C, op, event);
|
||||
return io_util_import_invoke(C, op, event);
|
||||
}
|
||||
|
||||
static int wm_usd_import_exec(bContext *C, wmOperator *op)
|
||||
|
@ -538,7 +538,7 @@ static void wm_usd_import_draw(bContext *C, wmOperator *op)
|
|||
uiLayout *layout = op->layout;
|
||||
PointerRNA *ptr = op->ptr;
|
||||
|
||||
files_drop_label_draw(C, op, ICON_FILE_3D, ".usd");
|
||||
io_util_drop_file_label_draw(C, op, ICON_FILE_3D, ".usd");
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
uiLayoutSetPropDecorate(layout, false);
|
||||
|
@ -620,7 +620,7 @@ void WM_OT_usd_import(wmOperatorType *ot)
|
|||
WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH | WM_FILESEL_SHOW_PROPS,
|
||||
FILE_DEFAULTDISPLAY,
|
||||
FILE_SORT_DEFAULT);
|
||||
skip_filesel_props(ot, WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH);
|
||||
io_util_skip_save_filesel_props(ot, WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH);
|
||||
|
||||
PropertyRNA *prop = RNA_def_string(ot->srna, "filter_glob", "*.usd", 0, "", "");
|
||||
RNA_def_property_flag(prop, PROP_HIDDEN);
|
||||
|
|
|
@ -1,35 +1,34 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#if defined(WITH_COLLADA) || defined(WITH_IO_GPENCIL) || defined(WITH_IO_WAVEFRONT_OBJ) || \
|
||||
defined(WITH_IO_PLY) || defined(WITH_IO_STL) || defined(WITH_USD)
|
||||
#include "BKE_context.h"
|
||||
|
||||
guishe marked this conversation as resolved
|
||||
# include "BKE_context.h"
|
||||
#include "BLI_path_util.h"
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
# include "BLI_path_util.h"
|
||||
# include "BLI_string.h"
|
||||
# include "BLI_utildefines.h"
|
||||
#include "BLT_translation.h"
|
||||
|
||||
# include "BLT_translation.h"
|
||||
#include "DNA_space_types.h"
|
||||
|
||||
# include "DNA_space_types.h"
|
||||
#include "ED_fileselect.hh"
|
||||
|
||||
# include "ED_fileselect.hh"
|
||||
#include "RNA_access.hh"
|
||||
#include "RNA_define.hh"
|
||||
|
||||
# include "RNA_access.hh"
|
||||
# include "RNA_define.hh"
|
||||
#include "UI_interface.hh"
|
||||
|
||||
# include "UI_interface.hh"
|
||||
#include "WM_api.hh"
|
||||
|
||||
# include "WM_api.hh"
|
||||
#include "io_utils.hh"
|
||||
|
||||
# include "io_utils.hh"
|
||||
|
||||
int wm_io_import_invoke(bContext *C, wmOperator *op, const wmEvent * /* event */)
|
||||
int io_util_import_invoke(bContext *C, wmOperator *op, const wmEvent * /* event */)
|
||||
{
|
||||
char filepath[FILE_MAX];
|
||||
RNA_string_get(op->ptr, "filepath", filepath);
|
||||
|
||||
if (filepath[0]) {
|
||||
PropertyRNA *filepath_prop = RNA_struct_find_property(op->ptr, "filepath");
|
||||
PropertyRNA *directory_prop = RNA_struct_find_property(op->ptr, "directory");
|
||||
if ((filepath_prop && RNA_property_is_set(op->ptr, filepath_prop)) ||
|
||||
(directory_prop && RNA_property_is_set(op->ptr, directory_prop)))
|
||||
{
|
||||
return WM_operator_props_dialog_popup(C, op, 300);
|
||||
}
|
||||
|
||||
|
@ -37,7 +36,7 @@ int wm_io_import_invoke(bContext *C, wmOperator *op, const wmEvent * /* event */
|
|||
return OPERATOR_RUNNING_MODAL;
|
||||
}
|
||||
|
||||
void skip_filesel_props(wmOperatorType *ot, const eFileSel_Flag flag)
|
||||
void io_util_skip_save_filesel_props(wmOperatorType *ot, const eFileSel_Flag flag)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
if (flag & WM_FILESEL_FILEPATH) {
|
||||
|
@ -62,7 +61,7 @@ void skip_filesel_props(wmOperatorType *ot, const eFileSel_Flag flag)
|
|||
}
|
||||
}
|
||||
|
||||
void files_drop_label_draw(bContext *C, wmOperator *op, int icon, const char *extension)
|
||||
void io_util_drop_file_label_draw(bContext *C, wmOperator *op, int icon, const char *extension)
|
||||
{
|
||||
ScrArea *area = CTX_wm_area(C);
|
||||
|
||||
|
@ -81,5 +80,3 @@ void files_drop_label_draw(bContext *C, wmOperator *op, int icon, const char *ex
|
|||
uiLayout *box = uiLayoutBox(op->layout);
|
||||
uiItemL(box, label, icon);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -2,18 +2,13 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#if defined(WITH_COLLADA) || defined(WITH_IO_GPENCIL) || defined(WITH_IO_WAVEFRONT_OBJ) || \
|
||||
defined(WITH_IO_PLY) || defined(WITH_IO_STL) || defined(WITH_USD)
|
||||
|
||||
# include "WM_types.hh"
|
||||
#include "WM_types.hh"
|
||||
|
||||
struct wmOperator;
|
||||
struct wmOperatorType;
|
||||
struct wmDrag;
|
||||
struct wmDropBox;
|
||||
|
||||
int wm_io_import_invoke(bContext *C, wmOperator *op, const wmEvent *event);
|
||||
void skip_filesel_props(wmOperatorType *ot, const eFileSel_Flag flag);
|
||||
void files_drop_label_draw(bContext *C, wmOperator *op, int icon, const char *extension);
|
||||
|
||||
#endif
|
||||
int io_util_import_invoke(bContext *C, wmOperator *op, const wmEvent *event);
|
||||
void io_util_skip_save_filesel_props(wmOperatorType *ot, const eFileSel_Flag flag);
|
||||
void io_util_drop_file_label_draw(bContext *C, wmOperator *op, int icon, const char *extension);
|
||||
|
|
|
@ -5941,7 +5941,7 @@ static bool blend_file_drop_poll(bContext * /*C*/, wmDrag *drag, const wmEvent *
|
|||
static void blend_file_drop_copy(bContext * /*C*/, wmDrag *drag, wmDropBox *drop)
|
||||
{
|
||||
/* copy drag path to properties */
|
||||
RNA_string_set(drop->ptr, "filepath", WM_drag_get_paths(drag)[0].c_str());
|
||||
RNA_string_set(drop->ptr, "filepath", WM_drag_get_single_path(drag));
|
||||
}
|
||||
|
||||
void ED_keymap_screen(wmKeyConfig *keyconf)
|
||||
|
|
|
@ -536,8 +536,7 @@ static void clip_drop_copy(bContext * /*C*/, wmDrag *drag, wmDropBox *drop)
|
|||
PointerRNA itemptr;
|
||||
char dir[FILE_MAX], file[FILE_MAX];
|
||||
|
||||
BLI_path_split_dir_file(
|
||||
WM_drag_get_paths(drag)[0].c_str(), dir, sizeof(dir), file, sizeof(file));
|
||||
BLI_path_split_dir_file(WM_drag_get_single_path(drag), dir, sizeof(dir), file, sizeof(file));
|
||||
|
||||
RNA_string_set(drop->ptr, "directory", dir);
|
||||
|
||||
|
|
|
@ -174,7 +174,7 @@ static bool path_drop_poll(bContext * /*C*/, wmDrag *drag, const wmEvent * /*eve
|
|||
static void path_drop_copy(bContext * /*C*/, wmDrag *drag, wmDropBox *drop)
|
||||
{
|
||||
char pathname[FILE_MAX + 2];
|
||||
SNPRINTF(pathname, "\"%s\"", WM_drag_get_paths(drag)[0].c_str());
|
||||
SNPRINTF(pathname, "\"%s\"", WM_drag_get_single_path(drag));
|
||||
RNA_string_set(drop->ptr, "text", pathname);
|
||||
}
|
||||
|
||||
|
|
|
@ -797,7 +797,7 @@ static bool filepath_drop_poll(bContext *C, wmDrag *drag, const wmEvent * /*even
|
|||
|
||||
static void filepath_drop_copy(bContext * /*C*/, wmDrag *drag, wmDropBox *drop)
|
||||
{
|
||||
RNA_string_set(drop->ptr, "filepath", WM_drag_get_paths(drag)[0].c_str());
|
||||
RNA_string_set(drop->ptr, "filepath", WM_drag_get_single_path(drag));
|
||||
}
|
||||
|
||||
/* region dropbox definition */
|
||||
|
|
|
@ -268,7 +268,7 @@ static bool image_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
|
|||
static void image_drop_copy(bContext * /*C*/, wmDrag *drag, wmDropBox *drop)
|
||||
{
|
||||
/* copy drag path to properties */
|
||||
RNA_string_set(drop->ptr, "filepath", WM_drag_get_paths(drag)[0].c_str());
|
||||
RNA_string_set(drop->ptr, "filepath", WM_drag_get_single_path(drag));
|
||||
}
|
||||
|
||||
/* area+region dropbox definition */
|
||||
|
|
|
@ -898,9 +898,9 @@ static void node_id_path_drop_copy(bContext *C, wmDrag *drag, wmDropBox *drop)
|
|||
return;
|
||||
}
|
||||
|
||||
const auto paths = WM_drag_get_paths(drag);
|
||||
if (paths.begin()) {
|
||||
RNA_string_set(drop->ptr, "filepath", paths[0].c_str());
|
||||
const char *path = WM_drag_get_single_path(drag);
|
||||
if (path) {
|
||||
RNA_string_set(drop->ptr, "filepath", path);
|
||||
RNA_struct_property_unset(drop->ptr, "name");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -249,17 +249,17 @@ static void sequencer_drop_copy(bContext *C, wmDrag *drag, wmDropBox *drop)
|
|||
return;
|
||||
}
|
||||
|
||||
const auto paths = WM_drag_get_paths(drag);
|
||||
const char *path = WM_drag_get_single_path(drag);
|
||||
/* Path dropped. */
|
||||
if (paths.begin()) {
|
||||
if (path) {
|
||||
if (RNA_struct_find_property(drop->ptr, "filepath")) {
|
||||
RNA_string_set(drop->ptr, "filepath", paths[0].c_str());
|
||||
RNA_string_set(drop->ptr, "filepath", path);
|
||||
}
|
||||
if (RNA_struct_find_property(drop->ptr, "directory")) {
|
||||
PointerRNA itemptr;
|
||||
char dir[FILE_MAX], file[FILE_MAX];
|
||||
|
||||
BLI_path_split_dir_file(paths[0].c_str(), dir, sizeof(dir), file, sizeof(file));
|
||||
BLI_path_split_dir_file(path, dir, sizeof(dir), file, sizeof(file));
|
||||
|
||||
RNA_string_set(drop->ptr, "directory", dir);
|
||||
|
||||
|
@ -337,7 +337,7 @@ static void get_drag_path(const bContext *C, wmDrag *drag, char r_path[FILE_MAX]
|
|||
BLI_path_abs(r_path, BKE_main_blendfile_path_from_global());
|
||||
}
|
||||
else {
|
||||
BLI_strncpy(r_path, WM_drag_get_paths(drag)[0].c_str(), FILE_MAX);
|
||||
BLI_strncpy(r_path, WM_drag_get_single_path(drag), FILE_MAX);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -316,7 +316,7 @@ static bool text_drop_poll(bContext * /*C*/, wmDrag *drag, const wmEvent * /*eve
|
|||
static void text_drop_copy(bContext * /*C*/, wmDrag *drag, wmDropBox *drop)
|
||||
{
|
||||
/* copy drag path to properties */
|
||||
RNA_string_set(drop->ptr, "filepath", WM_drag_get_paths(drag)[0].c_str());
|
||||
RNA_string_set(drop->ptr, "filepath", WM_drag_get_single_path(drag));
|
||||
}
|
||||
|
||||
static bool text_drop_paste_poll(bContext * /*C*/, wmDrag *drag, const wmEvent * /*event*/)
|
||||
|
|
|
@ -891,9 +891,9 @@ static void view3d_id_path_drop_copy(bContext *C, wmDrag *drag, wmDropBox *drop)
|
|||
RNA_struct_property_unset(drop->ptr, "filepath");
|
||||
return;
|
||||
}
|
||||
const auto paths = WM_drag_get_paths(drag);
|
||||
if (paths.begin()) {
|
||||
RNA_string_set(drop->ptr, "filepath", paths[0].c_str());
|
||||
const char *path = WM_drag_get_single_path(drag);
|
||||
if (path) {
|
||||
RNA_string_set(drop->ptr, "filepath", path);
|
||||
RNA_struct_property_unset(drop->ptr, "image");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1426,6 +1426,7 @@ const char *WM_drag_get_item_name(wmDrag *drag);
|
|||
* may be destructed. Only paths that share the same extension of the first file will be copied.
|
||||
*/
|
||||
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);
|
||||
/**
|
||||
* Note that even though the enum return type uses bit-flags, this should never have multiple
|
||||
|
|
|
@ -792,6 +792,16 @@ static void wm_drag_free_path_data(wmDragPath **path_data)
|
|||
*path_data = nullptr;
|
||||
}
|
||||
|
||||
const char *WM_drag_get_single_path(const wmDrag *drag)
|
||||
{
|
||||
if (drag->type != WM_DRAG_PATH) {
|
||||
nullptr;
|
||||
}
|
||||
|
||||
const wmDragPath *path_data = static_cast<const wmDragPath *>(drag->poin);
|
||||
return path_data->paths[0].c_str();
|
||||
}
|
||||
|
||||
const blender::Span<std::string> WM_drag_get_paths(const wmDrag *drag)
|
||||
{
|
||||
if (drag->type != WM_DRAG_PATH) {
|
||||
|
|
Loading…
Reference in New Issue
Remove these tests. The code may not be used if none of these are defined, but that's not a problem.