diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-10-18 21:35:20 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-10-18 21:35:20 +0400 |
commit | 596982fe67a4cf284a92db2436251c6fd33420a2 (patch) | |
tree | 245315a010d84be74ad5a7d65439e389f49d11d8 /source/blender | |
parent | 598239eb51445d198047cc0bad57fb930aa87928 (diff) |
ID blocks can be pasted to text editor now with mouse drag and move
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/space_text/space_text.c | 15 |
1 files changed, 14 insertions, 1 deletions
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 *********** */ |