Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <julian@blender.org>2022-07-14 20:21:56 +0300
committerJulian Eisel <julian@blender.org>2022-07-14 20:21:56 +0300
commitbdd0ac5bcebd6deb3d590ada9a3f25c6ddd58ea4 (patch)
treeb60a608dc46c970e71eba27b8f753c60e9a030fd /source/blender/editors/interface/interface_drag.cc
parent1ef686bd26cc3c89849f41770ce76d7b94f169db (diff)
Fix `on_drag_start` handler not getting ID when dragging from Outliner
We would first invoke the dragging, and then set the drag data (like the ID or the dragged modifier), so the `wmDropBox.on_drag_start()` handler wouldn't be able to access this. This broke dragging some IDs from the Outliner, noticed in D15333. It's now possible to first create/request drag data, extend it, and then invoke the actual dragging. The normal function to start dragging returns `void` now instead of `wmDrag *`, so the drag data can't easily be modified after starting anymore.
Diffstat (limited to 'source/blender/editors/interface/interface_drag.cc')
-rw-r--r--source/blender/editors/interface/interface_drag.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/source/blender/editors/interface/interface_drag.cc b/source/blender/editors/interface/interface_drag.cc
index 4c68870b2c7..1db3db32411 100644
--- a/source/blender/editors/interface/interface_drag.cc
+++ b/source/blender/editors/interface/interface_drag.cc
@@ -122,7 +122,7 @@ bool ui_but_drag_is_draggable(const uiBut *but)
void ui_but_drag_start(bContext *C, uiBut *but)
{
- wmDrag *drag = WM_event_start_drag(C,
+ wmDrag *drag = WM_drag_data_create(C,
but->icon,
but->dragtype,
but->dragpoin,
@@ -136,6 +136,8 @@ void ui_but_drag_start(bContext *C, uiBut *but)
WM_event_drag_image(drag, but->imb, but->imb_scale);
}
+ WM_event_start_prepared_drag(C, drag);
+
/* Special feature for assets: We add another drag item that supports multiple assets. It
* gets the assets from context. */
if (ELEM(but->dragtype, WM_DRAG_ASSET, WM_DRAG_ID)) {