|
Blender
V2.93
|
#include <string.h>#include "DNA_screen_types.h"#include "DNA_windowmanager_types.h"#include "MEM_guardedalloc.h"#include "BLT_translation.h"#include "BLI_blenlib.h"#include "BIF_glutil.h"#include "BKE_context.h"#include "BKE_global.h"#include "BKE_idtype.h"#include "BKE_lib_id.h"#include "GPU_shader.h"#include "GPU_state.h"#include "GPU_viewport.h"#include "IMB_imbuf_types.h"#include "UI_interface.h"#include "UI_interface_icons.h"#include "RNA_access.h"#include "WM_api.h"#include "WM_types.h"#include "wm_event_system.h"Go to the source code of this file.
Classes | |
| struct | wmDropBoxMap |
Typedefs | |
| typedef struct wmDropBoxMap | wmDropBoxMap |
Functions | |
| ListBase * | WM_dropboxmap_find (const char *idname, int spaceid, int regionid) |
| wmDropBox * | WM_dropbox_add (ListBase *lb, const char *idname, bool(*poll)(bContext *, wmDrag *, const wmEvent *, const char **), void(*copy)(wmDrag *, wmDropBox *), void(*cancel)(struct Main *, wmDrag *, wmDropBox *)) |
| void | wm_dropbox_free (void) |
| wmDrag * | WM_event_start_drag (struct bContext *C, int icon, int type, void *poin, double value, unsigned int flags) |
| void | WM_event_drag_image (wmDrag *drag, ImBuf *imb, float scale, int sx, int sy) |
| void | WM_drag_data_free (int dragtype, void *poin) |
| void | WM_drag_free (wmDrag *drag) |
| void | WM_drag_free_list (struct ListBase *lb) |
| static const char * | dropbox_active (bContext *C, ListBase *handlers, wmDrag *drag, const wmEvent *event) |
| static const char * | wm_dropbox_active (bContext *C, wmDrag *drag, const wmEvent *event) |
| static void | wm_drop_operator_options (bContext *C, wmDrag *drag, const wmEvent *event) |
| void | wm_drags_check_ops (bContext *C, const wmEvent *event) |
| void | WM_drag_add_local_ID (wmDrag *drag, ID *id, ID *from_parent) |
| ID * | WM_drag_get_local_ID (const wmDrag *drag, short idcode) |
| ID * | WM_drag_get_local_ID_from_event (const wmEvent *event, short idcode) |
| bool | WM_drag_is_ID_type (const wmDrag *drag, int idcode) |
| wmDragAsset * | WM_drag_get_asset_data (const wmDrag *drag, int idcode) |
| static ID * | wm_drag_asset_id_import (wmDragAsset *asset_drag) |
| ID * | WM_drag_get_local_ID_or_import_from_asset (const wmDrag *drag, int idcode) |
| void | WM_drag_free_imported_drag_ID (struct Main *bmain, wmDrag *drag, wmDropBox *drop) |
| Free asset ID imported for cancelled drop. More... | |
| static void | wm_drop_operator_draw (const char *name, int x, int y) |
| static const char * | wm_drag_name (wmDrag *drag) |
| static void | drag_rect_minmax (rcti *rect, int x1, int y1, int x2, int y2) |
| void | wm_drags_draw (bContext *C, wmWindow *win, rcti *rect) |
Variables | |
| static ListBase | dropboxes = {NULL, NULL} |
Our own drag-and-drop, drag state and drop boxes.
Definition in file wm_dragdrop.c.
| typedef struct wmDropBoxMap wmDropBoxMap |
|
static |
Definition at line 481 of file wm_dragdrop.c.
References x2, rcti::xmax, rcti::xmin, y1, rcti::ymax, and rcti::ymin.
Referenced by wm_drags_draw().
|
static |
Definition at line 220 of file wm_dragdrop.c.
References C, wmEventHandler_Dropbox::dropboxes, LISTBASE_FOREACH, NULL, WM_HANDLER_TYPE_DROPBOX, WM_operator_poll_context(), and WM_operatortype_name().
Referenced by wm_dropbox_active().
Definition at line 312 of file wm_dragdrop.c.
References BLI_addtail(), BLI_assert, wmDragID::from_parent, GS, id, wmDragID::id, wmDrag::ids, LISTBASE_FOREACH, MEM_callocN, ID::name, and NULL.
Referenced by outliner_item_drag_drop_invoke(), and WM_event_start_drag().
|
static |
Definition at line 378 of file wm_dragdrop.c.
References G_MAIN, wmDragAsset::id_type, wmDragAsset::name, NULL, wmDragAsset::path, and WM_file_append_datablock().
Referenced by WM_drag_get_local_ID_or_import_from_asset().
| void WM_drag_data_free | ( | int | dragtype, |
| void * | poin | ||
| ) |
Definition at line 188 of file wm_dragdrop.c.
References MEM_freeN, wmDragAsset::path, and WM_DRAG_ASSET.
Referenced by UI_but_drag_set_asset(), UI_but_drag_set_id(), UI_but_drag_set_image(), UI_but_drag_set_name(), UI_but_drag_set_path(), UI_but_drag_set_rna(), ui_but_free(), and WM_drag_free().
| void WM_drag_free | ( | wmDrag * | drag | ) |
Definition at line 203 of file wm_dragdrop.c.
References BLI_freelistN(), wmDrag::flags, wmDrag::ids, MEM_freeN, wmDrag::poin, wmDrag::type, WM_drag_data_free(), and WM_DRAG_FREE_DATA.
Referenced by WM_drag_free_list().
Free asset ID imported for cancelled drop.
If the asset was imported (linked/appended) using WM_drag_get_local_ID_or_import_from_asset()` (typically via a wmDropBox.copy() callback), we want the ID to be removed again if the drop operator cancels. This is for use as wmDropBox.cancel() callback.
Definition at line 419 of file wm_dragdrop.c.
References BKE_id_delete(), BKE_libblock_find_name(), wmDragAsset::id_type, MAX_ID_NAME, wmDropBox::ptr, RNA_string_get(), wmDrag::type, WM_DRAG_ASSET, and WM_drag_get_asset_data().
Referenced by node_dropboxes(), and view3d_dropboxes().
| void WM_drag_free_list | ( | struct ListBase * | lb | ) |
Definition at line 212 of file wm_dragdrop.c.
References BLI_pophead(), and WM_drag_free().
Referenced by wm_close_and_free(), wm_event_drag_and_drop_test(), wm_event_free(), and wm_handlers_do_intern().
| wmDragAsset* WM_drag_get_asset_data | ( | const wmDrag * | drag, |
| int | idcode | ||
| ) |
Definition at line 368 of file wm_dragdrop.c.
References ELEM, wmDragAsset::id_type, NULL, wmDrag::poin, wmDrag::type, and WM_DRAG_ASSET.
Referenced by view3d_drop_id_in_main_region_poll_get_id_type(), WM_drag_free_imported_drag_ID(), WM_drag_get_local_ID_or_import_from_asset(), WM_drag_is_ID_type(), and wm_drag_name().
Definition at line 335 of file wm_dragdrop.c.
References ListBase::first, GS, id, wmDragID::id, wmDrag::ids, ID::name, NULL, wmDrag::type, and WM_DRAG_ID.
Referenced by id_drop_copy(), id_drop_poll(), material_drop_poll(), parent_clear_poll(), parent_drop_poll(), scene_drop_poll(), text_drop_paste(), ui_but_drop(), view3d_drop_id_in_main_region_poll_get_id_type(), WM_drag_get_local_ID_from_event(), WM_drag_get_local_ID_or_import_from_asset(), WM_drag_is_ID_type(), and wm_drag_name().
Definition at line 350 of file wm_dragdrop.c.
References wmEvent::custom, EVT_DATA_DRAGDROP, ListBase::first, NULL, and WM_drag_get_local_ID().
Referenced by material_drop_invoke(), parent_drop_invoke(), and scene_drop_invoke().
When dragging a local ID, return that. Otherwise, if dragging an asset-handle, link or append that depending on what was chosen by the drag-box (currently append only in fact).
Use WM_drag_free_imported_drag_ID() as cancel callback of the drop-box, so that the asset import is rolled back if the drop operator fails.
Definition at line 392 of file wm_dragdrop.c.
References ELEM, NULL, wmDrag::type, WM_DRAG_ASSET, wm_drag_asset_id_import(), WM_drag_get_asset_data(), WM_drag_get_local_ID(), and WM_DRAG_ID.
Referenced by node_group_drop_copy(), node_id_drop_copy(), node_id_path_drop_copy(), view3d_collection_drop_copy(), view3d_id_drop_copy(), view3d_id_drop_copy_with_type(), view3d_id_path_drop_copy(), and view3d_ob_drop_copy().
| bool WM_drag_is_ID_type | ( | const wmDrag * | drag, |
| int | idcode | ||
| ) |
Check if the drag data is either a local ID or an external ID asset of type idcode.
Definition at line 363 of file wm_dragdrop.c.
References WM_drag_get_asset_data(), and WM_drag_get_local_ID().
Referenced by node_collection_drop_poll(), node_group_drop_poll(), node_ima_drop_poll(), node_mask_drop_poll(), node_object_drop_poll(), node_texture_drop_poll(), view3d_drop_id_in_main_region_poll(), and view3d_ima_drop_poll().
|
static |
Definition at line 455 of file wm_dragdrop.c.
References BKE_idtype_idcode_to_name_plural(), BLI_listbase_count_at_most(), GS, id, wmDrag::ids, wmDragAsset::name, ID::name, wmDrag::path, wmDrag::type, WM_DRAG_ASSET, WM_drag_get_asset_data(), WM_drag_get_local_ID(), WM_DRAG_ID, WM_DRAG_NAME, and WM_DRAG_PATH.
Referenced by wm_drags_draw().
Definition at line 301 of file wm_dragdrop.c.
References C, CTX_wm_manager(), wmWindowManager::drags, LISTBASE_FOREACH, and wm_drop_operator_options().
Referenced by wm_event_do_handlers().
Definition at line 499 of file wm_dragdrop.c.
References C, col, CTX_wm_manager(), drag_rect_minmax(), wmWindowManager::drags, wmWindow::eventstate, GPU_blend(), GPU_BLEND_ALPHA, GPU_BLEND_NONE, GPU_RGBA8, GPU_SHADER_2D_IMAGE_COLOR, immDrawPixelsTexScaled(), immDrawPixelsTexSetup(), LISTBASE_FOREACH, padding(), state, UI_DPI_FAC, UI_DPI_ICON_SIZE, UI_fontstyle_draw_simple(), UI_fontstyle_string_width(), UI_FSTYLE_WIDGET, UI_icon_draw_ex(), w(), wm_drag_name(), wm_drop_operator_draw(), WM_window_pixels_y(), x, wmEvent::x, rcti::xmax, rcti::xmin, y, wmEvent::y, rcti::ymax, and rcti::ymin.
Referenced by wm_draw_window_onscreen().
|
static |
Definition at line 446 of file wm_dragdrop.c.
References UI_fontstyle_draw_simple_backdrop(), UI_FSTYLE_WIDGET, x, and y.
Referenced by wm_drags_draw().
Definition at line 270 of file wm_dragdrop.c.
References BLI_strncpy(), C, CTX_wm_window(), IFACE_, wmDrag::opname, UI_but_active_drop_name(), wm_dropbox_active(), WM_window_pixels_x(), WM_window_pixels_y(), wmEvent::x, and wmEvent::y.
Referenced by wm_drags_check_ops().
Definition at line 245 of file wm_dragdrop.c.
References blender::compositor::area(), C, CTX_wm_area(), CTX_wm_region(), CTX_wm_window(), dropbox_active(), ARegion::handlers, wmWindow::handlers, and NULL.
Referenced by wm_drop_operator_options().
| wmDropBox* WM_dropbox_add | ( | ListBase * | lb, |
| const char * | idname, | ||
| bool(*)(bContext *, wmDrag *, const wmEvent *, const char **) | poll, | ||
| void(*)(wmDrag *, wmDropBox *) | copy, | ||
| void(*)(struct Main *, wmDrag *, wmDropBox *) | cancel | ||
| ) |
Definition at line 96 of file wm_dragdrop.c.
References BLI_addtail(), wmDropBox::cancel, copy(), wmDropBox::copy, wmDropBoxMap::idname, MEM_callocN, MEM_freeN, NULL, wmDropBox::opcontext, wmDropBox::ot, wmDropBox::poll, wmDropBox::properties, wmDropBox::ptr, WM_OP_INVOKE_DEFAULT, WM_operator_properties_alloc(), and WM_operatortype_find().
Referenced by clip_dropboxes(), console_dropboxes(), ED_keymap_screen(), file_dropboxes(), image_dropboxes(), node_dropboxes(), outliner_dropboxes(), sequencer_dropboxes(), text_dropboxes(), and view3d_dropboxes().
| void wm_dropbox_free | ( | void | ) |
Definition at line 121 of file wm_dragdrop.c.
References BLI_freelistN(), dropboxes, LISTBASE_FOREACH, MEM_freeN, and WM_operator_properties_free().
Referenced by WM_exit_ex().
| ListBase* WM_dropboxmap_find | ( | const char * | idname, |
| int | spaceid, | ||
| int | regionid | ||
| ) |
Definition at line 77 of file wm_dragdrop.c.
References BLI_addtail(), BLI_strncpy(), dropboxes, wmDropBoxMap::dropboxes, wmDropBoxMap::idname, KMAP_MAX_NAME, LISTBASE_FOREACH, MEM_callocN, wmDropBoxMap::regionid, wmDropBoxMap::spaceid, and STREQLEN.
Referenced by clip_dropboxes(), clip_init(), console_dropboxes(), console_main_region_init(), ED_keymap_screen(), file_dropboxes(), image_dropboxes(), image_init(), node_dropboxes(), node_main_region_init(), outliner_dropboxes(), outliner_main_region_init(), sequencer_dropboxes(), sequencer_main_region_init(), text_dropboxes(), text_main_region_init(), view3d_dropboxes(), view3d_main_region_init(), and wm_window_ghostwindow_ensure().
Definition at line 180 of file wm_dragdrop.c.
References wmDrag::imb, wmDrag::scale, wmDrag::sx, and wmDrag::sy.
Referenced by ui_but_drag_init().
| wmDrag* WM_event_start_drag | ( | struct bContext * | C, |
| int | icon, | ||
| int | type, | ||
| void * | poin, | ||
| double | value, | ||
| unsigned int | flags | ||
| ) |
Definition at line 140 of file wm_dragdrop.c.
References BLI_addtail(), BLI_strncpy(), C, CTX_wm_manager(), wmWindowManager::drags, FILE_MAX, wmDrag::flags, wmDrag::icon, MEM_callocN, MEM_freeN, NULL, wmDrag::path, wmDrag::poin, type, wmDrag::type, wmDrag::value, WM_drag_add_local_ID(), WM_DRAG_ASSET, WM_DRAG_FREE_DATA, WM_DRAG_ID, and WM_DRAG_PATH.
Referenced by ghost_event_proc(), outliner_item_drag_drop_invoke(), and ui_but_drag_init().
Definition at line 61 of file wm_dragdrop.c.
Referenced by wm_dropbox_free(), WM_dropboxmap_find(), and WM_event_add_dropbox_handler().