From 86c363a02706b1a5d3cb18d17b4b37bd78461ded Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 7 Aug 2018 10:57:09 +0200 Subject: 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. --- source/blender/editors/space_console/space_console.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'source/blender/editors/space_console') diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c index ce87ad3b177..3429d726349 100644 --- a/source/blender/editors/space_console/space_console.c +++ b/source/blender/editors/space_console/space_console.c @@ -172,29 +172,22 @@ static void console_cursor(wmWindow *win, ScrArea *sa, ARegion *ar) static bool id_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event), const char **UNUSED(tooltip)) { -// SpaceConsole *sc = CTX_wm_space_console(C); - if (drag->type == WM_DRAG_ID) - return 1; - return 0; + return WM_drag_ID(drag, 0) != NULL; } static void id_drop_copy(wmDrag *drag, wmDropBox *drop) { - char *text; - ID *id = drag->poin; + ID *id = WM_drag_ID(drag, 0); /* copy drag path to properties */ - text = RNA_path_full_ID_py(id); + char *text = RNA_path_full_ID_py(id); RNA_string_set(drop->ptr, "text", text); MEM_freeN(text); } static bool path_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event), const char **UNUSED(tooltip)) { - // SpaceConsole *sc = CTX_wm_space_console(C); - if (drag->type == WM_DRAG_PATH) - return 1; - return 0; + return (drag->type == WM_DRAG_PATH); } static void path_drop_copy(wmDrag *drag, wmDropBox *drop) -- cgit v1.2.3