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>2021-10-26 19:48:24 +0300
committerJulian Eisel <julian@blender.org>2021-10-26 19:55:27 +0300
commit11e8a2ec5fc95524a59a7422d2715ef1116dbef4 (patch)
tree709a06d470a2810d140a72599624a7f46a3e6f50 /source/blender/editors/interface/interface_dropboxes.cc
parent03c0581c6ed6eb98c4c4c7bf42c92d623880dfac (diff)
UI: Support disabled-hint for dropping in the tree-view API
A tree-view item's drop controller can now return a message for the user explaining why dropping isn't possible with the dropped data. This is then displayed in red text next to the cursor. This isn't actually used yet, the follow up commit will do that.
Diffstat (limited to 'source/blender/editors/interface/interface_dropboxes.cc')
-rw-r--r--source/blender/editors/interface/interface_dropboxes.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/editors/interface/interface_dropboxes.cc b/source/blender/editors/interface/interface_dropboxes.cc
index 1cc06db3a8c..ab0c7e088e2 100644
--- a/source/blender/editors/interface/interface_dropboxes.cc
+++ b/source/blender/editors/interface/interface_dropboxes.cc
@@ -22,6 +22,8 @@
#include "DNA_space_types.h"
+#include "MEM_guardedalloc.h"
+
#include "WM_api.h"
#include "UI_interface.h"
@@ -35,7 +37,12 @@ static bool ui_tree_view_drop_poll(bContext *C, wmDrag *drag, const wmEvent *eve
return false;
}
- return UI_tree_view_item_can_drop(hovered_tree_item, drag);
+ if (drag->free_disabled_info) {
+ MEM_SAFE_FREE(drag->disabled_info);
+ }
+
+ drag->free_disabled_info = false;
+ return UI_tree_view_item_can_drop(hovered_tree_item, drag, &drag->disabled_info);
}
static char *ui_tree_view_drop_tooltip(bContext *C,