Blender V5.3
blender::wmDropBox Struct Reference

#include <WM_types.hh>

Public Attributes

wmDropBox * next
wmDropBox * prev
bool(*) poll (bContext *C, wmDrag *drag, const wmEvent *event)
void(*) on_drag_start (bContext *C, wmDrag *drag)
void(*) on_enter (wmDropBox *drop, wmDrag *drag)
void(*) on_exit (wmDropBox *drop, wmDrag *drag)
void(*) copy (bContext *C, wmDrag *drag, wmDropBox *drop)
void(*) cancel (Main *bmain, wmDrag *drag, wmDropBox *drop)
void(*) draw_droptip (bContext *C, wmWindow *win, wmDrag *drag, const int xy[2])
void(*) draw_in_view (bContext *C, wmWindow *win, wmDrag *drag, const int xy[2])
void(*) on_event_while_hover (bContext *C, wmDropBox &dropbox, const wmEvent *event)
void * draw_data
WMDropboxTooltipFunc tooltip
wmOperatorType * ot
char opname [64]
IDProperty * properties
PointerRNA * ptr
wmTimer * timer

Detailed Description

Drop-boxes are like key-maps, part of the screen/area/region definition. Allocation and free is on startup and exit.

The operator is polled and invoked with the current context (#wm::OpCallContext::InvokeDefault), there is no way to override that (by design, since drop-boxes should act on the exact mouse position). So the drop-boxes are supposed to check the required area and region context in their poll.

Definition at line 1452 of file WM_types.hh.

Member Data Documentation

◆ cancel

void(*) blender::wmDropBox::cancel(Main *bmain, wmDrag *drag, wmDropBox *drop)

If the operator is canceled (returns OPERATOR_CANCELLED), this can be used for cleanup of copy() resources.

Definition at line 1481 of file WM_types.hh.

Referenced by blender::WM_dropbox_add(), and blender::wm_handlers_do_intern().

◆ copy

void(*) blender::wmDropBox::copy(bContext *C, wmDrag *drag, wmDropBox *drop)

Before exec, this copies drag info to #wmDrop properties.

Definition at line 1475 of file WM_types.hh.

Referenced by blender::wm_drop_prepare(), and blender::WM_dropbox_add().

◆ draw_data

◆ draw_droptip

void(*) blender::wmDropBox::draw_droptip(bContext *C, wmWindow *win, wmDrag *drag, const int xy[2])

Override the default cursor overlay drawing function. Can be used to draw text or thumbnails. IE a tool-tip for drag and drop.

Parameters
xyCursor location in window coordinates (#wmEvent.xy compatible).

Definition at line 1488 of file WM_types.hh.

Referenced by blender::ed::vse::sequencer_dropboxes_add_to_lb(), blender::view3d_dropboxes(), and blender::wm_drags_draw().

◆ draw_in_view

void(*) blender::wmDropBox::draw_in_view(bContext *C, wmWindow *win, wmDrag *drag, const int xy[2])

Called with the draw buffer (GPUViewport) set up for drawing into the region's view.

Note
Only setups the drawing buffer for drawing in view, not the GPU transform matrices. The callback has to do that itself, with for example #view2d_view_ortho.
Parameters
xyCursor location in window coordinates (#wmEvent.xy compatible).

Definition at line 1496 of file WM_types.hh.

Referenced by blender::ed::vse::sequencer_dropboxes_add_to_lb(), and blender::wm_drags_draw().

◆ next

wmDropBox* blender::wmDropBox::next

Definition at line 1453 of file WM_types.hh.

◆ on_drag_start

void(*) blender::wmDropBox::on_drag_start(bContext *C, wmDrag *drag)

Called when the drag action starts. Can be used to prefetch data for previews.

Note
The dropbox that will be called eventually is not known yet when starting the drag. So this callback is called on every dropbox that is registered in the current screen.

Definition at line 1463 of file WM_types.hh.

Referenced by blender::ed::vse::sequencer_dropboxes_add_to_lb(), and blender::wm_dropbox_invoke().

◆ on_enter

void(*) blender::wmDropBox::on_enter(wmDropBox *drop, wmDrag *drag)

Called when poll returns true the first time. Typically used to setup some drawing data.

Definition at line 1466 of file WM_types.hh.

Referenced by blender::ed::vse::sequencer_dropboxes_add_to_lb(), blender::view3d_dropboxes(), and blender::wm_drop_update_active().

◆ on_event_while_hover

void(*) blender::wmDropBox::on_event_while_hover(bContext *C, wmDropBox &dropbox, const wmEvent *event)

Used by tree views to scroll when the mouse is near the edge. Called for every event while the dropbox is active (hovered and poll succeeds). For #wmEventType::TIMER events, only the ones created from this #wmDropBox.timer are passed to it.

Definition at line 1504 of file WM_types.hh.

Referenced by blender::ui::dropboxes_ui().

◆ on_exit

void(*) blender::wmDropBox::on_exit(wmDropBox *drop, wmDrag *drag)

Called when poll returns false the first time or when the drag event ends (successful drop or canceled). Typically used to cleanup resources or end drawing.

Definition at line 1472 of file WM_types.hh.

Referenced by blender::ed::vse::sequencer_dropboxes_add_to_lb(), blender::view3d_dropboxes(), blender::WM_drag_free(), and blender::wm_drop_update_active().

◆ opname

char blender::wmDropBox::opname[64]

#wmOperatorType::idname, needed for re-registration.

Definition at line 1519 of file WM_types.hh.

Referenced by blender::WM_dropbox_add(), and blender::wm_dropbox_item_update_ot().

◆ ot

wmOperatorType* blender::wmDropBox::ot

If poll succeeds, operator is called. Not saved in file, so can be pointer. This may be null when the operator has been unregistered, where opname can be used to re-initialize it.

Definition at line 1517 of file WM_types.hh.

Referenced by blender::dropbox_active(), blender::dropbox_tooltip(), blender::wm_drop_prepare(), blender::WM_dropbox_add(), blender::wm_dropbox_item_update_ot(), and blender::wm_handlers_do_intern().

◆ poll

bool(*) blender::wmDropBox::poll(bContext *C, wmDrag *drag, const wmEvent *event)

Test if the dropbox is active.

Definition at line 1456 of file WM_types.hh.

Referenced by blender::dropbox_active(), blender::WM_dropbox_add(), and blender::wm_handlers_do_intern().

◆ prev

wmDropBox * blender::wmDropBox::prev

Definition at line 1453 of file WM_types.hh.

◆ properties

IDProperty* blender::wmDropBox::properties

Operator properties, assigned to ptr->data and can be written to a file.

Definition at line 1522 of file WM_types.hh.

Referenced by blender::wm_drop_item_clear_runtime(), blender::wm_drop_item_free_data(), blender::WM_dropbox_add(), and blender::wm_dropbox_item_update_ot().

◆ ptr

PointerRNA* blender::wmDropBox::ptr

RNA pointer to access properties.

Definition at line 1524 of file WM_types.hh.

Referenced by blender::blend_file_drop_copy(), blender::clip_drop_copy(), blender::console_drop_id_copy(), blender::console_drop_path_copy(), blender::console_drop_string_copy(), blender::ui::drop_color_copy(), blender::drop_extension_path_copy(), blender::drop_extension_url_copy(), blender::drop_import_file_copy(), blender::ui::drop_material_copy(), blender::ui::drop_name_copy(), blender::dropbox_tooltip(), blender::filepath_drop_copy(), 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(), blender::ed::space_node::node_import_file_drop_copy(), blender::ed::space_node::node_interface_item_drop_copy_all(), blender::ed::space_node::node_interface_item_drop_copy_single(), blender::screen_drop_scene_copy(), blender::ed::vse::sequencer_drop_copy(), blender::text_drop_id_copy(), blender::text_drop_path_copy(), blender::text_drop_string_copy(), blender::view3d_collection_drop_copy_external_asset(), blender::view3d_collection_drop_copy_local_id(), blender::view3d_geometry_nodes_drop_copy(), blender::view3d_geometry_nodes_drop_tooltip(), blender::view3d_id_drop_copy(), blender::view3d_id_drop_copy_with_type(), blender::view3d_id_path_drop_copy(), blender::view3d_ob_drop_copy_external_asset(), blender::view3d_ob_drop_copy_local_id(), blender::WM_drag_free_imported_drag_ID(), blender::wm_drop_item_clear_runtime(), blender::wm_drop_item_free_data(), blender::WM_dropbox_add(), blender::wm_dropbox_item_update_ot(), and blender::wm_handlers_do_intern().

◆ timer

◆ tooltip

WMDropboxTooltipFunc blender::wmDropBox::tooltip

Custom tool-tip shown during dragging.

Definition at line 1509 of file WM_types.hh.

Referenced by blender::dropbox_tooltip(), and blender::WM_dropbox_add().


The documentation for this struct was generated from the following file: