[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [60846] trunk/blender/source/blender/ editors/space_text/space_text.c: ID blocks can be pasted to text editor now with mouse drag and move

Sergey Sharybin sergey.vfx at gmail.com
Fri Oct 18 19:35:21 CEST 2013


Revision: 60846
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=60846
Author:   nazgul
Date:     2013-10-18 17:35:20 +0000 (Fri, 18 Oct 2013)
Log Message:
-----------
ID blocks can be pasted to text editor now with mouse drag and move

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_text/space_text.c

Modified: trunk/blender/source/blender/editors/space_text/space_text.c
===================================================================
--- trunk/blender/source/blender/editors/space_text/space_text.c	2013-10-18 16:10:34 UTC (rev 60845)
+++ trunk/blender/source/blender/editors/space_text/space_text.c	2013-10-18 17:35:20 UTC (rev 60846)
@@ -472,13 +472,26 @@
 	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 *********** */




More information about the Bf-blender-cvs mailing list