From 596982fe67a4cf284a92db2436251c6fd33420a2 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 18 Oct 2013 17:35:20 +0000 Subject: ID blocks can be pasted to text editor now with mouse drag and move --- source/blender/editors/space_text/space_text.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'source/blender/editors/space_text') diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c index bd85551f8b1..a0659d5ce62 100644 --- a/source/blender/editors/space_text/space_text.c +++ b/source/blender/editors/space_text/space_text.c @@ -472,13 +472,26 @@ static void text_drop_copy(wmDrag *drag, wmDropBox *drop) RNA_string_set(drop->ptr, "filepath", drag->path); } +static int text_drop_paste_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) +{ + if (drag->type == WM_DRAG_ID) + return TRUE; + + return FALSE; +} + +static void text_drop_paste(wmDrag *drag, wmDropBox *drop) +{ + RNA_string_set(drop->ptr, "text", ((ID*)drag->poin)->name + 2); +} + /* this region dropbox definition */ static void text_dropboxes(void) { ListBase *lb = WM_dropboxmap_find("Text", SPACE_TEXT, RGN_TYPE_WINDOW); WM_dropbox_add(lb, "TEXT_OT_open", text_drop_poll, text_drop_copy); - + WM_dropbox_add(lb, "TEXT_OT_insert", text_drop_paste_poll, text_drop_paste); } /* ************* end drop *********** */ -- cgit v1.2.3