|
Blender V4.3
|
#include <cstring>#include "AS_asset_representation.hh"#include "DNA_asset_types.h"#include "DNA_screen_types.h"#include "DNA_space_types.h"#include "DNA_windowmanager_types.h"#include "MEM_guardedalloc.h"#include "BLT_translation.hh"#include "BLI_bitmap.h"#include "BLI_blenlib.h"#include "BLI_math_color.h"#include "BIF_glutil.hh"#include "BKE_context.hh"#include "BKE_global.hh"#include "BKE_idprop.hh"#include "BKE_idtype.hh"#include "BKE_lib_id.hh"#include "BKE_main.hh"#include "BKE_screen.hh"#include "GHOST_C-api.h"#include "BLO_readfile.hh"#include "ED_asset.hh"#include "ED_fileselect.hh"#include "ED_screen.hh"#include "GPU_shader.hh"#include "GPU_state.hh"#include "GPU_viewport.hh"#include "IMB_imbuf_types.hh"#include "UI_interface.hh"#include "UI_interface_icons.hh"#include "UI_resources.hh"#include "RNA_access.hh"#include "WM_api.hh"#include "WM_types.hh"#include "wm_event_system.hh"#include "wm_window.hh"#include <fmt/format.h>Go to the source code of this file.
Classes | |
| struct | wmDropBoxMap |
Variables | |
| static ListBase | dropboxes = {nullptr, nullptr} |
Our own drag-and-drop, drag state and drop boxes.
Definition in file wm_dragdrop.cc.
|
static |
Definition at line 432 of file wm_dragdrop.cc.
References CTX_store_set(), CTX_wm_operator_poll_msg_get(), wmDragActiveDropState::disabled_info, wmDrag::drop_state, dropbox_tooltip(), wmEventHandler_Dropbox::dropboxes, wmDragActiveDropState::free_disabled_info, LISTBASE_FOREACH, MEM_SAFE_FREE, wmDropBox::ot, wmDropBox::poll, wmDragActiveDropState::tooltip, wmDragActiveDropState::ui_context, wm_drop_operator_context_get(), WM_HANDLER_TYPE_DROPBOX, WM_operator_poll_context(), and wmEvent::xy.
Referenced by wm_dropbox_active().
|
static |
Definition at line 421 of file wm_dragdrop.cc.
References wmDropBox::ot, wmDropBox::ptr, wmDropBox::tooltip, WM_operatortype_name(), and xy.
Referenced by dropbox_active().
| void WM_drag_add_asset_list_item | ( | wmDrag * | drag, |
| const blender::asset_system::AssetRepresentation * | asset ) |
Definition at line 814 of file wm_dragdrop.cc.
References wmDragAssetListItem::asset_data, ASSET_IMPORT_APPEND, wmDrag::asset_items, BLI_addtail(), BLI_assert, wmDragAssetListItem::external_info, wmDragAssetListItem::is_external, blender::asset_system::AssetRepresentation::local_id(), wmDragAssetListItem::local_id, wmDrag::type, WM_DRAG_ASSET_LIST, and WM_drag_create_asset_data().
Referenced by WM_drag_data_create().
Definition at line 596 of file wm_dragdrop.cc.
References BLI_addtail(), BLI_assert_msg, wmDragID::from_parent, GS, wmDragID::id, wmDrag::ids, and LISTBASE_FOREACH.
Referenced by blender::ed::outliner::outliner_item_drag_drop_invoke(), and WM_drag_data_create().
| ID * WM_drag_asset_id_import | ( | const bContext * | C, |
| wmDragAsset * | asset_drag, | ||
| int | flag_extra ) |
| flag_extra | Additional linking flags (from eFileSel_Params_Flag). |
Definition at line 694 of file wm_dragdrop.cc.
References wmDragAsset::asset, ASSET_IMPORT_APPEND, ASSET_IMPORT_APPEND_REUSE, ASSET_IMPORT_LINK, BLI_assert, BLI_assert_unreachable, BLO_LIBLINK_APPEND_ASSET_DATA_CLEAR, BLO_LIBLINK_APPEND_LOCAL_ID_REUSE, BLO_LIBLINK_APPEND_RECURSIVE, blender::StringRefNull::c_str(), CTX_data_main(), CTX_data_scene(), CTX_data_view_layer(), CTX_wm_view3d(), FILE_ACTIVE_COLLECTION, FILE_AUTOSELECT, FILE_RELPATH, flag, blender::asset_system::AssetRepresentation::full_library_path(), G_MAIN, blender::asset_system::AssetRepresentation::get_id_type(), blender::asset_system::AssetRepresentation::get_name(), blender::asset_system::AssetRepresentation::get_use_relative_path(), wmDragAsset::import_method, WM_file_append_datablock(), and WM_file_link_datablock().
Referenced by view3d_collection_drop_copy_external_asset(), view3d_ob_drop_copy_external_asset(), and WM_drag_get_local_ID_or_import_from_asset().
Definition at line 835 of file wm_dragdrop.cc.
References wmDrag::asset_items, wmDrag::type, and WM_DRAG_ASSET_LIST.
Referenced by blender::ed::asset_browser::AssetCatalogDropTarget::drop_assets_into_catalog(), and blender::ed::asset_browser::AssetCatalogDropTarget::has_droppable_asset().
| bool WM_drag_asset_will_import_linked | ( | const wmDrag * | drag | ) |
Definition at line 751 of file wm_dragdrop.cc.
References ASSET_IMPORT_LINK, wmDragAsset::import_method, wmDrag::type, WM_DRAG_ASSET, and WM_drag_get_asset_data().
Referenced by view3d_ob_drop_on_enter().
| wmDragAsset * WM_drag_create_asset_data | ( | const blender::asset_system::AssetRepresentation * | asset, |
| int | import_method ) |
Definition at line 649 of file wm_dragdrop.cc.
References wmDragAsset::asset, and wmDragAsset::import_method.
Referenced by blender::ed::asset::shelf::AssetDragController::create_drag_data(), UI_but_drag_set_asset(), and WM_drag_add_asset_list_item().
| wmDragPath * WM_drag_create_path_data | ( | blender::Span< const char * > | paths | ) |
| paths | The paths to drag. Values will be copied into the drag data so the passed strings may be destructed. |
Definition at line 844 of file wm_dragdrop.cc.
References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), BLI_assert, ED_path_extension_type(), wmDragPath::file_types, wmDragPath::file_types_bit_flag, wmDragPath::paths, blender::Vector< T, InlineBufferCapacity, Allocator >::size(), TIP_, and wmDragPath::tooltip.
Referenced by ghost_event_proc(), blender::tests::TEST(), and UI_but_drag_set_path().
| wmDrag * WM_drag_data_create | ( | bContext * | C, |
| int | icon, | ||
| eWM_DragDataType | type, | ||
| void * | poin, | ||
| unsigned int | flags ) |
Create and fill the dragging data, but don't start dragging just yet (unlike WM_event_start_drag()). Must be followed up by WM_event_start_prepared_drag(), otherwise the returned pointer will leak memory.
Note that poin should be valid allocated and not on stack.
Definition at line 261 of file wm_dragdrop.cc.
References CTX_data_collection_get(), PointerRNA::data, wmDrag::flags, wmDrag::icon, wmDrag::poin, ptr, wmDrag::type, WM_drag_add_asset_list_item(), WM_drag_add_local_ID(), WM_DRAG_ASSET, WM_DRAG_ASSET_CATALOG, WM_DRAG_ASSET_LIST, WM_DRAG_FREE_DATA, WM_DRAG_GREASE_PENCIL_LAYER, WM_DRAG_ID, and WM_DRAG_PATH.
Referenced by blender::ed::outliner::outliner_item_drag_drop_invoke(), ui_but_drag_start(), and WM_event_start_drag().
| void WM_drag_data_free | ( | eWM_DragDataType | dragtype, |
| void * | poin ) |
Definition at line 362 of file wm_dragdrop.cc.
References MEM_freeN(), str, WM_DRAG_ASSET, wm_drag_free_asset_data(), wm_drag_free_path_data(), WM_DRAG_PATH, and WM_DRAG_STRING.
Referenced by ui_but_drag_free(), UI_but_drag_set_asset(), UI_but_drag_set_id(), UI_but_drag_set_name(), UI_but_drag_set_path(), UI_but_drag_set_rna(), and WM_drag_free().
|
static |
Definition at line 1125 of file wm_dragdrop.cc.
References wmDrag::imb, UI_ICON_SIZE, UI_SCALE_FAC, UNPACK2, wm_drag_draw_icon(), wm_drag_draw_item_name(), wm_drag_draw_tooltip(), wm_drag_imbuf_icon_height_get(), wm_drag_imbuf_icon_width_get(), and xy.
Referenced by WM_drag_draw_default_fn(), and wm_drags_draw().
Definition at line 1148 of file wm_dragdrop.cc.
References wm_drag_draw_default(), and xy.
Definition at line 1019 of file wm_dragdrop.cc.
References ImBuf::byte_buffer, col, ImBufByteBuffer::data, GPU_RGBA8, GPU_SHADER_3D_IMAGE_COLOR, wmDrag::icon, wmDrag::imb, wmDrag::imbuf_scale, immDrawPixelsTexSetup(), immDrawPixelsTexTiled_scaling(), padding(), state, UI_icon_draw_ex(), UI_INV_SCALE_FAC, UI_NO_ICON_OVERLAY_TEXT, UI_SCALE_FAC, wm_drag_imbuf_icon_height_get(), wm_drag_imbuf_icon_width_get(), ImBuf::x, x, xy, ImBuf::y, and y.
Referenced by wm_drag_draw_default().
Definition at line 1059 of file wm_dragdrop.cc.
References UI_fontstyle_draw_simple(), UI_FSTYLE_WIDGET, and WM_drag_get_item_name().
Referenced by wm_drag_draw_default(), and WM_drag_draw_item_name_fn().
Definition at line 1066 of file wm_dragdrop.cc.
References UI_SCALE_FAC, wm_drag_draw_item_name(), wmWindowViewport_ex(), and xy.
Referenced by view3d_dropboxes().
|
static |
Definition at line 1076 of file wm_dragdrop.cc.
References CTX_wm_region(), wmDragActiveDropState::disabled_info, wmDrag::drop_state, wmDrag::imb, blender::StringRefBase::is_empty(), padding(), wmDragActiveDropState::tooltip, UI_ICON_SIZE, UI_SCALE_FAC, wm_drag_imbuf_icon_height_get(), wm_drag_imbuf_icon_width_get(), wm_drop_operator_draw(), wm_drop_redalert_draw(), WM_window_native_pixel_y(), x, xy, and y.
Referenced by wm_drag_draw_default().
| void WM_drag_free | ( | wmDrag * | drag | ) |
Definition at line 392 of file wm_dragdrop.cc.
References wmDragActiveDropState::active_dropbox, wmDrag::asset_items, BLI_freelinkN(), BLI_freelistN(), wmDragActiveDropState::disabled_info, wmDrag::drop_state, wmDrag::flags, wmDragActiveDropState::free_disabled_info, wmDrag::ids, LISTBASE_FOREACH_MUTABLE, MEM_SAFE_FREE, wmDropBox::on_exit, wmDrag::poin, wmDrag::type, wmDragActiveDropState::ui_context, WM_drag_data_free(), wm_drag_free_asset_data(), and WM_DRAG_FREE_DATA.
Referenced by WM_drag_free_list().
|
static |
Definition at line 660 of file wm_dragdrop.cc.
Referenced by WM_drag_data_free(), and WM_drag_free().
Free asset ID imported for canceled 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 780 of file wm_dragdrop.cc.
References wmDragAsset::asset, BKE_id_free_us(), blender::asset_system::AssetRepresentation::get_id_type(), id_us_plus(), wmDropBox::ptr, wmDrag::type, WM_DRAG_ASSET, WM_drag_get_asset_data(), and WM_operator_properties_id_lookup_from_name_or_session_uid().
Referenced by ED_dropboxes_ui(), blender::ed::space_node::node_dropboxes(), and view3d_dropboxes().
| void WM_drag_free_list | ( | ListBase * | lb | ) |
Definition at line 414 of file wm_dragdrop.cc.
References BLI_pophead(), and WM_drag_free().
Referenced by wm_close_and_free(), wm_event_custom_free(), wm_event_drag_and_drop_test(), and wm_handlers_do_intern().
|
static |
Definition at line 865 of file wm_dragdrop.cc.
Referenced by WM_drag_data_free().
| wmDragAssetCatalog * WM_drag_get_asset_catalog_data | ( | const wmDrag * | drag | ) |
Definition at line 805 of file wm_dragdrop.cc.
References wmDrag::poin, wmDrag::type, and WM_DRAG_ASSET_CATALOG.
Referenced by blender::ed::asset_browser::AssetCatalogDropTarget::drop_asset_catalog_into_catalog(), and blender::ed::asset_browser::AssetCatalogDropTarget::get_drag_catalog().
| wmDragAsset * WM_drag_get_asset_data | ( | const wmDrag * | drag, |
| int | idcode ) |
Definition at line 668 of file wm_dragdrop.cc.
References wmDragAsset::asset, ELEM, blender::asset_system::AssetRepresentation::get_id_type(), wmDrag::poin, wmDrag::type, and WM_DRAG_ASSET.
Referenced by blender::ed::space_node::node_group_drop_poll(), view3d_collection_drop_copy_external_asset(), view3d_drop_id_in_main_region_poll_get_id_type(), view3d_geometry_nodes_drop_poll(), view3d_ob_drop_copy_external_asset(), WM_drag_asset_will_import_linked(), WM_drag_free_imported_drag_ID(), WM_drag_get_asset_meta_data(), WM_drag_get_item_name(), WM_drag_get_local_ID_or_import_from_asset(), and WM_drag_is_ID_type().
| AssetMetaData * WM_drag_get_asset_meta_data | ( | const wmDrag * | drag, |
| int | idcode ) |
Definition at line 679 of file wm_dragdrop.cc.
References wmDragAsset::asset, ID::asset_data, blender::asset_system::AssetRepresentation::get_metadata(), WM_drag_get_asset_data(), and WM_drag_get_local_ID().
Referenced by view3d_ob_drop_on_enter().
| const char * WM_drag_get_item_name | ( | wmDrag * | drag | ) |
Definition at line 978 of file wm_dragdrop.cc.
References wmDragAsset::asset, BKE_idtype_idcode_to_name_plural(), BLI_listbase_is_single(), blender::StringRefNull::c_str(), blender::asset_system::AssetRepresentation::get_name(), GS, wmDrag::ids, wmDrag::poin, wmDragPath::tooltip, 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 ui_drop_material_tooltip(), view3d_mat_drop_tooltip(), and wm_drag_draw_item_name().
Definition at line 619 of file wm_dragdrop.cc.
References ListBase::first, GS, wmDragID::id, wmDrag::ids, wmDrag::type, and WM_DRAG_ID.
Referenced by console_drop_id_copy(), console_drop_id_poll(), blender::ed::outliner::material_drop_poll(), blender::ed::space_node::node_group_drop_poll(), blender::ed::outliner::parent_clear_poll(), blender::ed::outliner::parent_drop_poll(), blender::ed::outliner::scene_drop_poll(), text_drop_id_copy(), ui_drop_name_copy(), view3d_collection_drop_copy_local_id(), view3d_drop_id_in_main_region_poll_get_id_type(), view3d_geometry_nodes_drop_poll(), view3d_ob_drop_copy_local_id(), view3d_ob_drop_on_enter(), WM_drag_get_asset_meta_data(), WM_drag_get_item_name(), WM_drag_get_local_ID_from_event(), WM_drag_get_local_ID_or_import_from_asset(), and WM_drag_is_ID_type().
Definition at line 634 of file wm_dragdrop.cc.
References wmEvent::custom, EVT_DATA_DRAGDROP, ListBase::first, and WM_drag_get_local_ID().
Referenced by blender::ed::outliner::material_drop_invoke(), blender::ed::outliner::parent_drop_invoke(), and blender::ed::outliner::scene_drop_invoke().
| ID * WM_drag_get_local_ID_or_import_from_asset | ( | const bContext * | C, |
| const wmDrag * | drag, | ||
| int | idcode ) |
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 761 of file wm_dragdrop.cc.
References ELEM, 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 get_drag_path(), blender::ed::space_node::node_group_drop_copy(), blender::ed::space_node::node_id_drop_copy(), blender::ed::space_node::node_id_im_drop_copy(), sequencer_drop_copy(), ui_drop_material_copy(), view3d_id_drop_copy(), view3d_id_drop_copy_with_type(), and view3d_id_path_drop_copy().
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. To check all paths or to do a bit-flag check use WM_drag_has_path_file_type(drag, file_type) instead.
Definition at line 920 of file wm_dragdrop.cc.
References wmDragPath::file_types, wmDrag::poin, wmDrag::type, and WM_DRAG_PATH.
Referenced by blend_file_drop_poll(), clip_drop_poll(), image_drop_poll(), image_drop_preview_poll(), is_movie(), is_sound(), movie_drop_preview_poll(), sound_drop_preview_poll(), blender::tests::TEST(), and text_drop_path_poll().
| blender::Span< std::string > WM_drag_get_paths | ( | const wmDrag * | drag | ) |
Definition at line 910 of file wm_dragdrop.cc.
References blender::Vector< T, InlineBufferCapacity, Allocator >::as_span(), wmDragPath::paths, wmDrag::poin, wmDrag::type, and WM_DRAG_PATH.
Referenced by drop_import_file_copy(), drop_import_file_poll(), drop_import_file_tooltip(), blender::tests::TEST(), and test_single_file_handler_poll().
| const char * WM_drag_get_single_path | ( | const wmDrag * | drag | ) |
If drag contains path data, returns the first path int he path list.
Definition at line 871 of file wm_dragdrop.cc.
References wmDragPath::paths, wmDrag::poin, wmDrag::type, and WM_DRAG_PATH.
Referenced by blend_file_drop_copy(), clip_drop_copy(), console_drop_path_copy(), drop_extension_path_copy(), drop_extension_path_poll(), filepath_drop_copy(), get_drag_path(), sequencer_drop_copy(), blender::tests::TEST(), and text_drop_path_copy().
If drag contains path data, returns the first path in the path list that matches a a file_type.
| drag | The drag that could contain drag path data. |
| file_type | eFileSel_File_Types bit flag. |
Definition at line 881 of file wm_dragdrop.cc.
References blender::Span< T >::begin(), blender::Span< T >::end(), wmDragPath::file_types, wmDragPath::paths, wmDrag::poin, wmDrag::type, and WM_DRAG_PATH.
| const std::string & WM_drag_get_string | ( | const wmDrag * | drag | ) |
Definition at line 930 of file wm_dragdrop.cc.
References BLI_assert, wmDrag::poin, str, wmDrag::type, and WM_DRAG_STRING.
Referenced by drop_extension_url_copy(), drop_extension_url_poll(), and text_drop_string_copy().
| std::string WM_drag_get_string_firstline | ( | const wmDrag * | drag | ) |
Definition at line 937 of file wm_dragdrop.cc.
References BLI_assert, wmDrag::poin, str, wmDrag::type, and WM_DRAG_STRING.
Referenced by console_drop_string_copy().
If drag contains path data, returns if any file path match a file_type.
| drag | The drag that could contain drag path data. |
| file_type | eFileSel_File_Types bit flag. |
Definition at line 901 of file wm_dragdrop.cc.
References wmDragPath::file_types_bit_flag, wmDrag::poin, wmDrag::type, and WM_DRAG_PATH.
Referenced by blender::tests::TEST().
Definition at line 1014 of file wm_dragdrop.cc.
References wmDrag::imb, wmDrag::imbuf_scale, round_fl_to_int(), and ImBuf::y.
Referenced by wm_drag_draw_default(), wm_drag_draw_icon(), and wm_drag_draw_tooltip().
Definition at line 1009 of file wm_dragdrop.cc.
References wmDrag::imb, wmDrag::imbuf_scale, round_fl_to_int(), and ImBuf::x.
Referenced by wm_drag_draw_default(), wm_drag_draw_icon(), and wm_drag_draw_tooltip().
Check if the drag data is either a local ID or an external ID asset of type idcode.
Definition at line 644 of file wm_dragdrop.cc.
References WM_drag_get_asset_data(), and WM_drag_get_local_ID().
Referenced by image_drop_poll(), image_drop_preview_poll(), is_movie(), is_sound(), movie_drop_preview_poll(), blender::ed::space_node::node_collection_drop_poll(), blender::ed::space_node::node_group_drop_poll(), blender::ed::space_node::node_id_im_drop_poll(), blender::ed::space_node::node_mask_drop_poll(), blender::ed::space_node::node_material_drop_poll(), blender::ed::space_node::node_object_drop_poll(), sound_drop_preview_poll(), ui_drop_material_poll(), view3d_drop_id_in_main_region_poll(), and view3d_ima_drop_poll().
Called in inner handler loop, region context.
Definition at line 569 of file wm_dragdrop.cc.
References wmDragActiveDropState::active_dropbox, BLI_listbase_is_empty(), CTX_wm_manager(), CTX_wm_window(), wmWindowManager::drags, wmDrag::drop_state, LISTBASE_FOREACH, WM_CURSOR_DEFAULT, WM_cursor_modal_set(), WM_CURSOR_STOP, and wm_drop_update_active().
Referenced by wm_event_do_region_handlers().
Called in wm_draw_window_onscreen.
Definition at line 1153 of file wm_dragdrop.cc.
References wmDragActiveDropState::active_dropbox, wmDragActiveDropState::area_from, BKE_screen_find_area_xy(), BLI_assert, CTX_store_set(), CTX_wm_area(), CTX_wm_area_set(), CTX_wm_manager(), CTX_wm_region(), CTX_wm_region_set(), CTX_wm_screen(), wmWindowManager::drags, wmDropBox::draw_droptip, wmDropBox::draw_in_view, wmDrag::drop_state, ED_area_find_region_xy_visual(), ELEM, wmWindow::eventstate, GHOST_kGrabHide, GHOST_kGrabWrap, GPU_blend(), GPU_BLEND_ALPHA, GPU_BLEND_NONE, wmWindow::grabcursor, LISTBASE_FOREACH, wmDragActiveDropState::region_from, RGN_TYPE_ANY, SPACE_TYPE_ANY, wmDragActiveDropState::ui_context, wm_cursor_position_get(), wm_drag_draw_default(), wmViewport(), wmWindowViewport(), wmWindowViewport_ex(), wmEvent::xy, and xy.
Referenced by wm_draw_window_onscreen().
| void wm_drags_exit | ( | wmWindowManager * | wm, |
| wmWindow * | win ) |
Additional work to cleanly end dragging. Additional because this doesn't actually remove the drag items. Should be called whenever dragging is stopped (successful or not, also when canceled).
Definition at line 321 of file wm_dragdrop.cc.
References ED_region_tag_redraw_no_rebuild(), wmWindow::eventstate, LISTBASE_FOREACH, wmWindow::tag_cursor_refresh, wmWindowManager::windows, WM_cursor_modal_restore(), WM_event_add_mousemove(), WM_window_find_under_cursor(), WM_window_get_active_screen(), and wmEvent::xy.
Referenced by wm_drop_prepare(), wm_event_drag_and_drop_test(), and wm_handlers_do_intern().
Definition at line 564 of file wm_dragdrop.cc.
References CTX_store_set().
Referenced by wm_handlers_do_intern().
|
static |
Definition at line 197 of file wm_dragdrop.cc.
References PointerRNA::data, wmDropBox::properties, wmDropBox::ptr, and wm_drop_item_free_data().
Referenced by wm_dropbox_item_update_ot().
|
static |
Definition at line 183 of file wm_dragdrop.cc.
References IDP_FreeProperty(), wmDropBox::properties, wmDropBox::ptr, and WM_operator_properties_free().
Referenced by wm_drop_item_clear_runtime(), and wm_dropbox_free().
| wmOperatorCallContext wm_drop_operator_context_get | ( | const wmDropBox * | drop | ) |
The operator of a dropbox should always be executed in the context determined by the mouse coordinates. The dropbox poll should check the context area and region as needed. So this always returns WM_OP_INVOKE_DEFAULT.
Definition at line 589 of file wm_dragdrop.cc.
References WM_OP_INVOKE_DEFAULT.
Referenced by dropbox_active(), wm_drop_prepare(), and wm_handlers_do_intern().
|
static |
Definition at line 950 of file wm_dragdrop.cc.
References uiWidgetColors::inner, rgba_uchar_to_float(), uiWidgetColors::text, bTheme::tui, UI_fontstyle_draw_simple_backdrop(), UI_FSTYLE_WIDGET, UI_GetTheme(), and ThemeUI::wcol_tooltip.
Referenced by wm_drag_draw_tooltip().
Definition at line 546 of file wm_dragdrop.cc.
References wmDropBox::copy, CTX_store_set(), CTX_wm_manager(), CTX_wm_window(), wmDrag::drop_state, wmDropBox::ot, wmDragActiveDropState::ui_context, wm_drags_exit(), wm_drop_operator_context_get(), and WM_operator_poll_context().
Referenced by wm_handlers_do_intern().
|
static |
Definition at line 965 of file wm_dragdrop.cc.
References uiWidgetColors::inner, rgba_uchar_to_float(), TH_REDALERT, bTheme::tui, UI_fontstyle_draw_simple_backdrop(), UI_FSTYLE_WIDGET, UI_GetTheme(), UI_GetThemeColor4fv(), and ThemeUI::wcol_tooltip.
Referenced by wm_drag_draw_tooltip().
|
static |
Definition at line 341 of file wm_dragdrop.cc.
References CTX_wm_region(), UI_but_context_get(), and UI_region_active_but_get().
Referenced by wm_drop_update_active().
Update dropping information for the current mouse position in event.
Definition at line 509 of file wm_dragdrop.cc.
References wmDragActiveDropState::active_dropbox, wmDragActiveDropState::area_from, BLI_assert, CTX_wm_area(), CTX_wm_region(), CTX_wm_window(), wmDropBox::draw_data, wmDrag::drop_state, wmDropBox::on_enter, wmDropBox::on_exit, wmDragActiveDropState::region_from, wmDragActiveDropState::tooltip, wmDragActiveDropState::ui_context, wm_drop_ui_context_create(), wm_dropbox_active(), WM_window_native_pixel_size(), and wmEvent::xy.
Referenced by wm_drags_check_ops().
Definition at line 483 of file wm_dragdrop.cc.
References BKE_area_find_region_xy(), BKE_screen_find_area_xy(), CTX_wm_window(), dropbox_active(), wmWindow::handlers, RGN_TYPE_ANY, SPACE_TYPE_ANY, WM_window_get_active_screen(), and wmEvent::xy.
Referenced by wm_drop_update_active().
| wmDropBox * WM_dropbox_add | ( | ListBase * | 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 ) |
Definition at line 108 of file wm_dragdrop.cc.
References BLI_addtail(), wmDropBox::cancel, copy(), wmDropBox::copy, wmDropBox::opname, ot, wmDropBox::ot, PointerRNA::owner_id, wmDropBox::poll, printf, wmDropBox::properties, wmDropBox::ptr, STRNCPY, wmDropBox::tooltip, WM_operator_properties_alloc(), WM_operator_properties_sanitize(), and WM_operatortype_find().
Referenced by clip_dropboxes(), console_dropboxes(), ED_dropbox_drop_extension(), ED_dropbox_drop_import_file(), ED_dropboxes_ui(), ED_keymap_screen(), file_dropboxes(), blender::ed::space_node::node_dropboxes(), blender::ed::outliner::outliner_dropboxes(), sequencer_dropboxes_add_to_lb(), sequencer_preview_dropboxes_add_to_lb(), text_dropboxes(), and view3d_dropboxes().
| void wm_dropbox_free | ( | ) |
Definition at line 208 of file wm_dragdrop.cc.
References BLI_freelistN(), dropboxes, LISTBASE_FOREACH, and wm_drop_item_free_data().
Referenced by WM_exit_ex().
Definition at line 223 of file wm_dragdrop.cc.
References BLI_assert, CTX_store_set(), CTX_wm_manager(), wmDrag::drop_state, dropboxes, ED_screen_areas_iter, LISTBASE_FOREACH, wmDropBox::on_drag_start, RGN_TYPE_NUM, SPACE_TYPE_NUM, wmDragActiveDropState::ui_context, wmWindowManager::windows, and WM_window_get_active_screen().
Referenced by WM_event_start_prepared_drag().
|
static |
Definition at line 140 of file wm_dragdrop.cc.
References PointerRNA::data, wmDropBox::opname, ot, wmDropBox::ot, PointerRNA::owner_id, wmDropBox::properties, wmDropBox::ptr, wmOperatorType::srna, PointerRNA::type, wm_drop_item_clear_runtime(), WM_operator_properties_alloc(), WM_operator_properties_create_ptr(), WM_operator_properties_sanitize(), and WM_operatortype_find().
Referenced by WM_dropbox_update_ot().
| void WM_dropbox_update_ot | ( | ) |
Ensure operator pointers & properties are valid after operators have been added/removed.
Definition at line 174 of file wm_dragdrop.cc.
References dropboxes, LISTBASE_FOREACH, and wm_dropbox_item_update_ot().
Referenced by WM_keyconfig_update_ex().
spaceid / regionid are zero for window drop maps.
Definition at line 89 of file wm_dragdrop.cc.
References BLI_addtail(), dropboxes, wmDropBoxMap::dropboxes, wmDropBoxMap::idname, KMAP_MAX_NAME, LISTBASE_FOREACH, wmDropBoxMap::regionid, wmDropBoxMap::spaceid, STREQLEN, and STRNCPY_UTF8.
Referenced by clip_dropboxes(), clip_init(), console_dropboxes(), console_main_region_init(), ed_default_handlers(), ED_dropbox_drop_extension(), ED_dropbox_drop_import_file(), ED_dropboxes_ui(), ED_keymap_screen(), file_dropboxes(), image_init(), blender::ed::space_node::node_dropboxes(), blender::ed::space_node::node_main_region_init(), blender::ed::outliner::outliner_dropboxes(), blender::ed::outliner::outliner_main_region_init(), sequencer_dropboxes(), sequencer_main_region_init(), sequencer_preview_region_init(), text_dropboxes(), text_main_region_init(), view3d_dropboxes(), view3d_main_region_init(), and wm_window_ghostwindow_ensure().
Definition at line 356 of file wm_dragdrop.cc.
References wmDrag::imb, and wmDrag::imbuf_scale.
Referenced by ui_but_drag_start().
| void WM_event_start_drag | ( | bContext * | C, |
| int | icon, | ||
| eWM_DragDataType | type, | ||
| void * | poin, | ||
| unsigned int | flags ) |
Start dragging immediately with the given data. Note that poin should be valid allocated and not on stack.
Definition at line 315 of file wm_dragdrop.cc.
References WM_drag_data_create(), and WM_event_start_prepared_drag().
Referenced by ghost_event_proc(), ui_but_drag_init(), ui_but_drag_start(), and UI_view_item_drag_start().
Invoke dragging using the given drag data.
Definition at line 307 of file wm_dragdrop.cc.
References BLI_addtail(), CTX_wm_manager(), wmWindowManager::drags, and wm_dropbox_invoke().
Referenced by blender::ed::outliner::outliner_item_drag_drop_invoke(), ui_but_drag_start(), and WM_event_start_drag().
|
static |
Definition at line 66 of file wm_dragdrop.cc.
Referenced by ed_default_handlers(), wm_dropbox_free(), wm_dropbox_invoke(), WM_dropbox_update_ot(), WM_dropboxmap_find(), and WM_event_add_dropbox_handler().