22#include "RNA_prototypes.hh"
75 props,
"files", RNA_OperatorFileListElement);
78 for (
const auto &
index : supported_paths) {
89 const bool has_any_filepath_prop = filepath_prop || directory_prop || files_prop;
90 if (!has_any_filepath_prop) {
92 "The '%s' file handler import operator ('%s') is missing the required operator "
97 if (directory_prop && !files_prop) {
100 "The '%s' file handler import operator ('%s') is missing the 'files' operator property.",
104 if (!directory_prop && files_prop) {
106 "The '%s' file handler import operator ('%s') is missing the 'directory' operator "
116 if (paths.is_empty()) {
139 if (paths.is_empty()) {
166 popup_menu_end(
C, pup);
172 ot->
name =
"Drop to Import File";
173 ot->
description =
"Operator that allows file handlers to receive file drops";
174 ot->
idname =
"WM_OT_drop_import_file";
182 ot->
srna,
"directory",
nullptr,
FILE_MAX,
"Directory",
"Directory of the file");
215 return TIP_(
"Multiple file handlers can be used, drop to pick which to use");
222 "WM_OT_drop_import_file",
#define CTX_TIP_(context, msgid)
#define CLOG_WARN(clg_ref,...)
#define BLI_assert_msg(a, msg)
Vector< FileHandlerType * > file_handlers_poll_file_drop(const bContext *C, const Span< std::string > paths)
Span< std::unique_ptr< FileHandlerType > > file_handlers()
Vector< std::string > paths_from_operator_properties(PointerRNA *ptr)
void paths_to_operator_properties(PointerRNA *ptr, const Span< std::string > paths)
PopupMenu * popup_menu_begin(bContext *C, const char *title, int icon) ATTR_NONNULL()
wmDropBox * WM_dropbox_add(ListBaseT< wmDropBox > *lb, const char *idname, bool(*poll)(bContext *C, wmDrag *drag, const wmEvent *event), void(*copy)(bContext *C, wmDrag *drag, wmDropBox *drop), void(*cancel)(Main *bmain, wmDrag *drag, wmDropBox *drop), WMDropboxTooltipFunc tooltip)
char * STRNCPY(char(&dst)[N], const char *src)
void WM_operator_properties_free(PointerRNA *ptr)
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
PointerRNA WM_operator_properties_create_ptr(wmOperatorType *ot)
void ED_dropbox_drop_import_file()
PropertyRNA * RNA_struct_find_property_check(PointerRNA &props, const char *name, const PropertyType property_type_check)
PropertyRNA * RNA_def_string_dir_path(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, const int maxlen, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_collection_runtime(StructOrFunctionRNA *cont, const char *identifier, StructRNA *type, const char *ui_name, const char *ui_description)
void RNA_property_collection_add(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *r_ptr)
static wmOperatorStatus wm_drop_import_file_exec(bContext *C, wmOperator *op)
void void BLI_path_split_dir_part(const char *filepath, char *dir, size_t dir_maxncpy) ATTR_NONNULL(1
void RNA_property_string_set(PointerRNA *ptr, PropertyRNA *prop, const char *value)
static void file_handler_import_operator_write_ptr(const bke::FileHandlerType *file_handler, PointerRNA &props, const Span< std::string > paths)
static std::string drop_import_file_tooltip(bContext *C, wmDrag *drag, const int[2], wmDropBox *)
static wmOperatorStatus wm_drop_import_file_invoke(bContext *C, wmOperator *op, const wmEvent *)
bool void BLI_path_rel(char path[FILE_MAX], const char *basepath) ATTR_NONNULL(1)
void WM_OT_drop_import_file(wmOperatorType *ot)
wmOperatorType * WM_operatortype_find(const char *idname, bool quiet)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
bool BLI_path_is_rel(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
void RNA_property_collection_clear(PointerRNA *ptr, PropertyRNA *prop)
wmOperatorStatus WM_operator_name_call_ptr(bContext *C, wmOperatorType *ot, wm::OpCallContext context, PointerRNA *properties, const wmEvent *event)
Span< std::string > WM_drag_get_paths(const wmDrag *drag)
static void drop_import_file_copy(bContext *, wmDrag *drag, wmDropBox *drop)
static Vector< bke::FileHandlerType * > drop_import_file_poll_file_handlers(const bContext *C, const Span< std::string > paths, const bool quiet=true)
ListBaseT< wmDropBox > * WM_dropboxmap_find(const char *idname, int spaceid, int regionid)
PropertyRNA * RNA_struct_find_collection_property_check(PointerRNA &props, const char *name, const StructRNA *struct_type_check)
static bool drop_import_file_poll(bContext *C, wmDrag *drag, const wmEvent *)
Vector< int64_t > filter_supported_paths(const Span< std::string > paths) const
char idname[OP_MAX_TYPENAME]
char import_operator[OP_MAX_TYPENAME]
void operator_context_set(wm::OpCallContext opcontext)
PointerRNA op(wmOperatorType *ot, std::optional< StringRef > name, int icon, wm::OpCallContext context, eUI_Item_Flag flag)
wmOperatorStatus(*) exec(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
const char * translation_context
wmOperatorStatus(*) invoke(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT