diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-08-07 11:57:09 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-08-10 18:53:00 +0300 |
commit | 86c363a02706b1a5d3cb18d17b4b37bd78461ded (patch) | |
tree | 3e10c488d7a10d2e84fa4a647ee7a211ff883427 /source/blender/editors/space_node | |
parent | 74016d73dbebd8c8a0e1aed70295d1a09037d7eb (diff) |
WM: pass on wmDrag to drop operators, so they can get the data directly.
Currently drop operators work mostly by specifying the name of the datablock.
However there can be datablocks with the same name in different libraries, so
this gives wrong results in some cases.
Currently only outliner drop operators have been updated to use this mechanism.
Diffstat (limited to 'source/blender/editors/space_node')
-rw-r--r-- | source/blender/editors/space_node/space_node.c | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c index 74c036883e6..2b2e659d151 100644 --- a/source/blender/editors/space_node/space_node.c +++ b/source/blender/editors/space_node/space_node.c @@ -677,26 +677,17 @@ static void node_main_region_draw(const bContext *C, ARegion *ar) static bool node_ima_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event), const char **UNUSED(tooltip)) { - if (drag->type == WM_DRAG_ID) { - ID *id = drag->poin; - if (GS(id->name) == ID_IM) - return 1; + if (drag->type == WM_DRAG_PATH) { + return (ELEM(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_MOVIE)); /* rule might not work? */ } - else if (drag->type == WM_DRAG_PATH) { - if (ELEM(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_MOVIE)) /* rule might not work? */ - return 1; + else { + return WM_drag_ID(drag, ID_IM) != NULL; } - return 0; } static bool node_mask_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event), const char **UNUSED(tooltip)) { - if (drag->type == WM_DRAG_ID) { - ID *id = drag->poin; - if (GS(id->name) == ID_MSK) - return 1; - } - return 0; + return WM_drag_ID(drag, ID_MSK) != NULL; } static void node_id_drop_copy(wmDrag *drag, wmDropBox *drop) |