[Bf-blender-cvs] [8427e02abc5] master: Fix T81589: Correct drag type handling in outliner
Robert Guetzkow
noreply at git.blender.org
Tue Oct 13 01:19:28 CEST 2020
Commit: 8427e02abc5e7963cee14e15bc9a1c78c95d28e6
Author: Robert Guetzkow
Date: Mon Oct 12 23:55:40 2020 +0200
Branches: master
https://developer.blender.org/rB8427e02abc5e7963cee14e15bc9a1c78c95d28e6
Fix T81589: Correct drag type handling in outliner
Blender crashed when dragging and dropping color into the outliner.
This issue was cause by a missing check for the correct drag type
in `datastack_drop_poll`. The check is added in this commit.
Additionally, a new drag type is introduced for the "data stack"
drag option, that was introduced in commit 1572da858df4, to
differentiate it from the existing WM_DRAG_ID type.
Reviewed By: Severin
Differential Revision: https://developer.blender.org/D9169
===================================================================
M source/blender/editors/space_outliner/outliner_dragdrop.c
M source/blender/windowmanager/WM_types.h
===================================================================
diff --git a/source/blender/editors/space_outliner/outliner_dragdrop.c b/source/blender/editors/space_outliner/outliner_dragdrop.c
index cbe6887f66e..6c0975498e0 100644
--- a/source/blender/editors/space_outliner/outliner_dragdrop.c
+++ b/source/blender/editors/space_outliner/outliner_dragdrop.c
@@ -847,6 +847,10 @@ static bool datastack_drop_poll(bContext *C,
const wmEvent *event,
const char **r_tooltip)
{
+ if (drag->type != WM_DRAG_DATASTACK) {
+ return false;
+ }
+
SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
ARegion *region = CTX_wm_region(C);
bool changed = outliner_flag_set(&space_outliner->tree, TSE_HIGHLIGHTED | TSE_DRAG_ANY, false);
@@ -1363,16 +1367,18 @@ static int outliner_item_drag_drop_invoke(bContext *C,
WM_operator_properties_free(&op_ptr);
}
- wmDrag *drag = WM_event_start_drag(C, data.icon, WM_DRAG_ID, NULL, 0.0, WM_DRAG_NOP);
+ const bool use_datastack_drag = ELEM(tselem->type,
+ TSE_MODIFIER,
+ TSE_MODIFIER_BASE,
+ TSE_CONSTRAINT,
+ TSE_CONSTRAINT_BASE,
+ TSE_GPENCIL_EFFECT,
+ TSE_GPENCIL_EFFECT_BASE);
- if (ELEM(tselem->type,
- TSE_MODIFIER,
- TSE_MODIFIER_BASE,
- TSE_CONSTRAINT,
- TSE_CONSTRAINT_BASE,
- TSE_GPENCIL_EFFECT,
- TSE_GPENCIL_EFFECT_BASE)) {
+ const int wm_drag_type = use_datastack_drag ? WM_DRAG_DATASTACK : WM_DRAG_ID;
+ wmDrag *drag = WM_event_start_drag(C, data.icon, wm_drag_type, NULL, 0.0, WM_DRAG_NOP);
+ if (use_datastack_drag) {
TreeElement *te_bone = NULL;
bPoseChannel *pchan = outliner_find_parent_bone(te, &te_bone);
datastack_drop_data_init(drag, (Object *)tselem->id, pchan, te, tselem, te->directdata);
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index 82d6e93dd87..acd72a4b1fd 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -822,6 +822,7 @@ typedef void (*wmPaintCursorDraw)(struct bContext *C, int, int, void *customdata
#define WM_DRAG_NAME 3
#define WM_DRAG_VALUE 4
#define WM_DRAG_COLOR 5
+#define WM_DRAG_DATASTACK 6
typedef enum wmDragFlags {
WM_DRAG_NOP = 0,
More information about the Bf-blender-cvs
mailing list