Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWillian Padovani Germano <wpgermano@gmail.com>2003-12-14 04:18:09 +0300
committerWillian Padovani Germano <wpgermano@gmail.com>2003-12-14 04:18:09 +0300
commit49021f7ec4bfc1313c6cdfeae1f9c32e98cc9cdc (patch)
tree44e7c4c38bc8c26b5efe0b52b846402589a4ca9a /source/blender/src
parent6653af79142aa929eb3d131f8fced363b2c4b828 (diff)
BPython - first step for better integration of Python in Blender:
- add a new space: Space Script - add a new dna struct: Script - add these two properly everywhere they are meant to It's not a tiny commit, but most of it is ground work for what is still to be done. Right now the benefits should be: freeing the Text Editor to be used in a window even while a script w/ gui in "on" and letting more than one currently running script w/ gui be accessible from each window Some files are added, so some build systems (not autotools) will need updates
Diffstat (limited to 'source/blender/src')
-rw-r--r--source/blender/src/drawscript.c155
-rw-r--r--source/blender/src/drawtext.c10
-rw-r--r--source/blender/src/editscreen.c5
-rw-r--r--source/blender/src/eventdebug.c1
-rw-r--r--source/blender/src/filesel.c7
-rw-r--r--source/blender/src/header_script.c162
-rw-r--r--source/blender/src/header_text.c40
-rw-r--r--source/blender/src/headerbuttons.c18
-rw-r--r--source/blender/src/space.c39
-rw-r--r--source/blender/src/spacetypes.c1
-rw-r--r--source/blender/src/toets.c3
11 files changed, 404 insertions, 37 deletions
diff --git a/source/blender/src/drawscript.c b/source/blender/src/drawscript.c
new file mode 100644
index 00000000000..c633d0528eb
--- /dev/null
+++ b/source/blender/src/drawscript.c
@@ -0,0 +1,155 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: drawtext.c.
+ *
+ * Contributor(s): Willian Padovani Germano.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#include <stdlib.h>
+#include <math.h>
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifndef _WIN32
+#include <unistd.h>
+#else
+#include <io.h>
+#include "BLI_winstuff.h"
+#endif
+#include "MEM_guardedalloc.h"
+#include "PIL_time.h"
+
+#include "BMF_Api.h"
+
+#include "BLI_blenlib.h"
+
+#include "DNA_script_types.h"
+#include "DNA_space_types.h"
+#include "DNA_screen_types.h"
+#include "DNA_userdef_types.h"
+
+#include "BKE_utildefines.h"
+#include "BKE_text.h"
+#include "BKE_global.h"
+#include "BKE_main.h"
+
+#include "BPY_extern.h"
+
+#include "BIF_gl.h"
+#include "BIF_keyval.h"
+#include "BIF_interface.h"
+#include "BIF_drawscript.h"
+#include "BIF_editfont.h"
+#include "BIF_spacetypes.h"
+#include "BIF_usiblender.h"
+#include "BIF_screen.h"
+#include "BIF_toolbox.h"
+#include "BIF_space.h"
+#include "BIF_mywindow.h"
+
+#include "BSE_filesel.h"
+
+#include "mydevice.h"
+#include "blendef.h"
+#include "interface.h"
+
+void drawscriptspace(ScrArea *sa, void *spacedata);
+void winqreadscriptspace(struct ScrArea *sa, void *spacedata, struct BWinEvent *evt);
+
+void drawscriptspace(ScrArea *sa, void *spacedata)
+{
+ SpaceScript *sc = curarea->spacedata.first;
+
+ glClearColor(0.6, 0.6, 0.6, 1.0);
+ glClear(GL_COLOR_BUFFER_BIT);
+ myortho2(-0.5, curarea->winrct.xmax-curarea->winrct.xmin-0.5, -0.5, curarea->winrct.ymax-curarea->winrct.ymin-0.5);
+
+ if(!sc->script) {
+ if (G.main->script.first)
+ sc->script = G.main->script.first;
+ else
+ return;
+ }
+
+ BPY_spacescript_do_pywin_draw(sc);
+}
+
+void winqreadscriptspace(struct ScrArea *sa, void *spacedata, struct BWinEvent *evt)
+{
+ unsigned short event = evt->event;
+ short val = evt->val;
+ SpaceScript *sc = curarea->spacedata.first;
+ Script *script = sc->script;
+
+ if (script) {
+ BPY_spacescript_do_pywin_event(sc, event, val);
+
+ if (!script->flags) /* finished with this script, let's free it */
+ BPY_free_finished_script(script);
+ }
+ else {
+ if (event == QKEY)
+ if (val && okee("QUIT BLENDER")) exit_usiblender();
+ }
+
+ return;
+}
+
+void free_scriptspace (SpaceScript *sc)
+{
+ if (!sc) return;
+
+ sc->script = NULL;
+}
+
+void unlink_script(Script *script)
+{ /* copied from unlink_text in drawtext.c */
+ bScreen *scr;
+ ScrArea *area;
+ SpaceLink *sl;
+
+ for (scr= G.main->screen.first; scr; scr= scr->id.next) {
+ for (area= scr->areabase.first; area; area= area->next) {
+ for (sl= area->spacedata.first; sl; sl= sl->next) {
+ if (sl->spacetype==SPACE_SCRIPT) {
+ SpaceScript *sc= (SpaceScript*) sl;
+
+ if (sc->script==script) {
+ sc->script= NULL;
+
+ if (sc==area->spacedata.first) {
+ scrarea_queue_redraw(area);
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/source/blender/src/drawtext.c b/source/blender/src/drawtext.c
index cc4e11d3495..20a0b62eefb 100644
--- a/source/blender/src/drawtext.c
+++ b/source/blender/src/drawtext.c
@@ -543,11 +543,6 @@ void drawtextspace(ScrArea *sa, void *spacedata)
float col[3];
int linecount = 0;
- if (BPY_spacetext_is_pywin(st)) {
- BPY_spacetext_do_pywin_draw(st);
- return;
- }
-
BIF_GetThemeColor3fv(TH_BACK, col);
glClearColor(col[0], col[1], col[2], 0.0);
glClear(GL_COLOR_BUFFER_BIT);
@@ -984,11 +979,6 @@ void winqreadtextspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
Text *text= st->text;
int do_draw=0, p;
- if (BPY_spacetext_is_pywin(st)) {
- BPY_spacetext_do_pywin_event(st, event, val);
- return;
- }
-
/* smartass code to prevent the events below from not working! */
if (!isprint(ascii) || (G.qual & ~LR_SHIFTKEY)) ascii= 0;
diff --git a/source/blender/src/editscreen.c b/source/blender/src/editscreen.c
index 0c9469d9282..53db6ff62ad 100644
--- a/source/blender/src/editscreen.c
+++ b/source/blender/src/editscreen.c
@@ -352,6 +352,7 @@ void scrarea_do_headdraw(ScrArea *area)
case SPACE_IMASEL: imasel_buttons(); break;
case SPACE_OOPS: oops_buttons(); break;
case SPACE_TEXT: text_buttons(); break;
+ case SPACE_SCRIPT:script_buttons(); break;
case SPACE_SOUND: sound_buttons(); break;
case SPACE_ACTION: action_buttons(); break;
case SPACE_NLA: nla_buttons(); break;
@@ -1055,7 +1056,7 @@ void screenmain(void)
towin= 0;
}
else if (event==QKEY) {
- if((G.obedit && G.obedit->type==OB_FONT && g_activearea->spacetype==SPACE_VIEW3D)||g_activearea->spacetype==SPACE_TEXT);
+ if((G.obedit && G.obedit->type==OB_FONT && g_activearea->spacetype==SPACE_VIEW3D)||g_activearea->spacetype==SPACE_TEXT||g_activearea->spacetype==SPACE_SCRIPT);
else {
if(val && okee("QUIT BLENDER")) exit_usiblender();
towin= 0;
@@ -1084,7 +1085,7 @@ void screenmain(void)
}
}
else if (event==SPACEKEY) {
- if((G.obedit && G.obedit->type==OB_FONT && g_activearea->spacetype==SPACE_VIEW3D)||g_activearea->spacetype==SPACE_TEXT);
+ if((G.obedit && G.obedit->type==OB_FONT && g_activearea->spacetype==SPACE_VIEW3D)||g_activearea->spacetype==SPACE_TEXT||g_activearea->spacetype==SPACE_SCRIPT);
else {
if(val) toolbox_n();
towin= 0;
diff --git a/source/blender/src/eventdebug.c b/source/blender/src/eventdebug.c
index dd12215c727..0f9c425ded7 100644
--- a/source/blender/src/eventdebug.c
+++ b/source/blender/src/eventdebug.c
@@ -66,6 +66,7 @@ char *event_to_string(short evt) {
smap(IMALEFTMOUSE);
smap(AFTERPIBREAD);
smap(REDRAWTEXT);
+ smap(REDRAWSCRIPT);
smap(REDRAWACTION);
smap(LEFTMOUSE);
smap(MIDDLEMOUSE);
diff --git a/source/blender/src/filesel.c b/source/blender/src/filesel.c
index 1f5a212dec4..f84ddc78fe8 100644
--- a/source/blender/src/filesel.c
+++ b/source/blender/src/filesel.c
@@ -71,6 +71,7 @@
#include "DNA_space_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
+#include "DNA_script_types.h"
#include "DNA_view3d_types.h"
#include "DNA_userdef_types.h"
@@ -1410,6 +1411,12 @@ void filesel_prevspace()
BLI_addtail(&curarea->spacedata, sfile);
sfile= curarea->spacedata.first;
+
+ if (sfile->spacetype == SPACE_SCRIPT) {
+ SpaceScript *sc = (SpaceScript *)sfile;
+ if (sc->script) sc->script->flags &=~SCRIPT_FILESEL;
+ }
+
newspace(curarea, sfile->spacetype);
}
else newspace(curarea, SPACE_INFO);
diff --git a/source/blender/src/header_script.c b/source/blender/src/header_script.c
new file mode 100644
index 00000000000..e66fea68cf4
--- /dev/null
+++ b/source/blender/src/header_script.c
@@ -0,0 +1,162 @@
+/**
+ * header_script.c nov-2003
+ *
+ * Functions to draw the "Script Window" window header
+ * and handle user events sent to it.
+ *
+ * $Id$
+ *
+ * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * Contributor(s): Willian P. Germano.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#include <stdlib.h>
+#include <string.h>
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef WIN32
+#include "BLI_winstuff.h"
+#endif
+
+#include "BMF_Api.h"
+#include "BIF_language.h"
+#ifdef INTERNATIONAL
+#include "FTF_Api.h"
+#endif
+
+#include "BSE_headerbuttons.h"
+
+#include "DNA_ID.h"
+#include "DNA_screen_types.h"
+#include "DNA_space_types.h"
+#include "DNA_script_types.h"
+
+#include "BIF_interface.h"
+#include "BIF_resources.h"
+#include "BIF_screen.h"
+#include "BIF_space.h"
+#include "BIF_toolbox.h"
+#include "BKE_global.h"
+#include "BKE_library.h"
+#include "BKE_main.h"
+#include "BKE_sca.h"
+#include "BPY_extern.h"
+#include "BSE_filesel.h"
+
+#include "blendef.h"
+#include "mydevice.h"
+
+/* ********************** SCRIPT ****************************** */
+void do_script_buttons(unsigned short event)
+{
+ SpaceScript *sc= curarea->spacedata.first;
+ ID *id, *idtest;
+ int nr= 1;
+ Script *script;
+
+ if (!sc) return;
+ if (sc->spacetype != SPACE_SCRIPT) return;
+
+ switch (event) {
+ case B_SCRIPTBROWSE:
+ if (sc->menunr==-2) {
+ activate_databrowse((ID *)sc->script, ID_SCR, 0, B_SCRIPTBROWSE,
+ &sc->menunr, do_script_buttons);
+ break;
+ }
+ if(sc->menunr < 0) break;
+
+ script = sc->script;
+
+ nr = 1;
+ id = (ID *)script;
+
+ idtest= G.main->script.first;
+ while(idtest) {
+ if(nr==sc->menunr) {
+ break;
+ }
+ nr++;
+ idtest= idtest->next;
+ }
+ if(idtest!=id) {
+ sc->script= (Script *)idtest;
+
+ allqueue(REDRAWSCRIPT, 0);
+ allqueue(REDRAWHEADERS, 0);
+ }
+ break;
+ }
+
+ return;
+}
+
+void script_buttons(void)
+{
+ uiBlock *block;
+ SpaceScript *sc= curarea->spacedata.first;
+ short xco = 8;
+ char naam[256];
+
+ if (!sc || sc->spacetype != SPACE_SCRIPT) return;
+
+ sprintf(naam, "header %d", curarea->headwin);
+ block= uiNewBlock(&curarea->uiblocks, naam, UI_EMBOSSX, UI_HELV, curarea->headwin);
+
+ if(area_is_active_area(curarea)) uiBlockSetCol(block, TH_HEADER);
+ else uiBlockSetCol(block, TH_HEADERDESEL);
+
+ curarea->butspacetype= SPACE_SCRIPT;
+
+ uiDefIconTextButC(block, ICONTEXTROW,B_NEWSPACE, ICON_VIEW3D,
+ windowtype_pup(), xco,0,XIC+10,YIC, &(curarea->butspacetype), 1.0,
+ SPACEICONMAX, 0, 0, "Displays Current Window Type. Click for menu"
+ " of available types.");
+
+ /* FULL WINDOW */
+ xco= 25;
+ if(curarea->full)
+ uiDefIconBut(block, BUT,B_FULL, ICON_SPLITSCREEN, xco+=XIC,0,XIC,YIC, 0, 0,
+ 0, 0, 0, "Returns to multiple views window (CTRL+Up arrow)");
+ else
+ uiDefIconBut(block, BUT,B_FULL, ICON_FULLSCREEN, xco+=XIC,0,XIC,YIC, 0, 0,
+ 0, 0, 0, "Makes current window full screen (CTRL+Down arrow)");
+
+ /* STD SCRIPT BUTTONS */
+ xco+= 2*XIC;
+ xco= std_libbuttons(block, xco, 0, 0, NULL, B_SCRIPTBROWSE, (ID*)sc->script, 0, &(sc->menunr), 0, 0, 0, 0, 0);
+
+ /* always as last */
+ curarea->headbutlen= xco+2*XIC;
+
+ uiDrawBlock(block);
+}
+
+/* ********************** SCRIPT ****************************** */
+
diff --git a/source/blender/src/header_text.c b/source/blender/src/header_text.c
index f897d01b66a..0af4a9527ea 100644
--- a/source/blender/src/header_text.c
+++ b/source/blender/src/header_text.c
@@ -508,28 +508,26 @@ void text_buttons(void)
/* STD TEXT BUTTONS */
- if (!BPY_spacetext_is_pywin(st)) {
- xco+= 2*XIC;
- xco= std_libbuttons(block, xco, 0, 0, NULL, B_TEXTBROWSE, (ID*)st->text, 0, &(st->menunr), 0, 0, B_TEXTDELETE, 0, 0);
-
- /*
- if (st->text) {
- if (st->text->flags & TXT_ISDIRTY && (st->text->flags & TXT_ISEXT || !(st->text->flags & TXT_ISMEM)))
- uiDefIconBut(block, BUT,0, ICON_ERROR, xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "The text has been changed");
- if (st->text->flags & TXT_ISEXT)
- uiDefBut(block, BUT,B_TEXTSTORE, ICON(), xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "Stores text in project file");
- else
- uiDefBut(block, BUT,B_TEXTSTORE, ICON(), xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "Disables storing of text in project file");
- xco+=10;
- }
- */
-
- xco+=XIC;
- if(st->font_id>1) st->font_id= 0;
- uiDefButI(block, MENU, B_TEXTFONT, "Screen 12 %x0|Screen 15%x1", xco,0,100,YIC, &st->font_id, 0, 0, 0, 0, "Displays available fonts");
- xco+=100;
+ xco+= 2*XIC;
+ xco= std_libbuttons(block, xco, 0, 0, NULL, B_TEXTBROWSE, (ID*)st->text, 0, &(st->menunr), 0, 0, B_TEXTDELETE, 0, 0);
+
+ /*
+ if (st->text) {
+ if (st->text->flags & TXT_ISDIRTY && (st->text->flags & TXT_ISEXT || !(st->text->flags & TXT_ISMEM)))
+ uiDefIconBut(block, BUT,0, ICON_ERROR, xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "The text has been changed");
+ if (st->text->flags & TXT_ISEXT)
+ uiDefBut(block, BUT,B_TEXTSTORE, ICON(), xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "Stores text in project file");
+ else
+ uiDefBut(block, BUT,B_TEXTSTORE, ICON(), xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "Disables storing of text in project file");
+ xco+=10;
}
-
+ */
+
+ xco+=XIC;
+ if(st->font_id>1) st->font_id= 0;
+ uiDefButI(block, MENU, B_TEXTFONT, "Screen 12 %x0|Screen 15%x1", xco,0,100,YIC, &st->font_id, 0, 0, 0, 0, "Displays available fonts");
+ xco+=100;
+
/* always as last */
curarea->headbutlen= xco+2*XIC;
diff --git a/source/blender/src/headerbuttons.c b/source/blender/src/headerbuttons.c
index 020cbe9ed1c..03bbbb97fa9 100644
--- a/source/blender/src/headerbuttons.c
+++ b/source/blender/src/headerbuttons.c
@@ -78,6 +78,7 @@
#include "DNA_packedFile_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
+#include "DNA_script_types.h"
#include "DNA_sequence_types.h"
#include "DNA_sound_types.h"
#include "DNA_space_types.h"
@@ -216,8 +217,12 @@ char *windowtype_pup(void)
strcat(string, "|%l"); //254
- strcat(string, "|Image Browser %x10");
- strcat(string, "|File Browser %x5");
+ strcat(string, "|Image Browser %x10"); //273
+ strcat(string, "|File Browser %x5"); //290
+
+ strcat(string, "|%l"); //293
+
+ strcat(string, "|Scripts Window %x14"); //313
return (string);
}
@@ -302,6 +307,9 @@ int std_libbuttons(uiBlock *block, short xco, short yco,
else if(curarea->spacetype==SPACE_TEXT) {
id= G.main->text.first;
}
+ else if(curarea->spacetype==SPACE_SCRIPT) {
+ id= G.main->script.first;
+ }
}
if(id) {
char *extrastr= NULL;
@@ -356,6 +364,9 @@ int std_libbuttons(uiBlock *block, short xco, short yco,
else if(curarea->spacetype==SPACE_TEXT) {
uiDefButS(block, MENU, browse, "OPEN NEW %x 32766 | ADD NEW %x 32767", xco,yco,XIC,YIC, menupoin, 0, 0, 0, 0, "Browses Datablock");
}
+ else if(curarea->spacetype==SPACE_SCRIPT) {
+ uiDefButS(block, MENU, browse, "No running scripts", xco, yco, XIC, YIC, menupoin, 0, 0, 0, 0, "Browses Datablock");
+ }
else if(curarea->spacetype==SPACE_SOUND) {
uiDefButS(block, MENU, browse, "OPEN NEW %x 32766",xco,yco,XIC,YIC, menupoin, 0, 0, 0, 0, "Browses Datablock");
}
@@ -2000,7 +2011,8 @@ void do_headerbuttons(short event)
else if(event<400) do_image_buttons(event);
else if(event<450) do_buts_buttons(event);
else if(event<500) do_imasel_buttons(event);
- else if(event<550) do_text_buttons(event);
+ else if(event<525) do_text_buttons(event);
+ else if(event<550) do_script_buttons(event);
else if(event<600) do_file_buttons(event);
else if(event<650) do_seq_buttons(event);
else if(event<700) do_sound_buttons(event);
diff --git a/source/blender/src/space.c b/source/blender/src/space.c
index e600cb6d99d..0bb5d16fafc 100644
--- a/source/blender/src/space.c
+++ b/source/blender/src/space.c
@@ -3070,6 +3070,19 @@ void init_textspace(ScrArea *sa)
st->top= 0;
}
+void init_scriptspace(ScrArea *sa)
+{
+ SpaceScript *sc;
+
+ sc = MEM_callocN(sizeof(SpaceScript), "initscriptspace");
+ BLI_addhead(&sa->spacedata, sc);
+
+ sc->spacetype = SPACE_SCRIPT;
+
+ sc->script = NULL;
+ sc->flags = 0;
+}
+
void init_imaselspace(ScrArea *sa)
{
SpaceImaSel *simasel;
@@ -3477,6 +3490,11 @@ void init_oopsspace(ScrArea *sa)
extern void drawtextspace(ScrArea *sa, void *spacedata);
extern void winqreadtextspace(struct ScrArea *sa, void *spacedata, struct BWinEvent *evt);
+/* ******************** SPACE: Script ********************** */
+
+extern void drawscriptspace(ScrArea *sa, void *spacedata);
+extern void winqreadscriptspace(struct ScrArea *sa, void *spacedata, struct BWinEvent *evt);
+
/* ******************** SPACE: ALGEMEEN ********************** */
void newspace(ScrArea *sa, int type)
@@ -3531,6 +3549,8 @@ void newspace(ScrArea *sa, int type)
init_actionspace(sa);
else if(type==SPACE_TEXT)
init_textspace(sa);
+ else if(type==SPACE_SCRIPT)
+ init_scriptspace(sa);
else if(type==SPACE_SOUND)
init_soundspace(sa);
else if(type==SPACE_NLA)
@@ -3611,6 +3631,9 @@ void freespacelist(ListBase *lb)
else if(sl->spacetype==SPACE_TEXT) {
free_textspace((SpaceText *)sl);
}
+ else if(sl->spacetype==SPACE_SCRIPT) {
+ free_scriptspace((SpaceScript *)sl);
+ }
else if(sl->spacetype==SPACE_SOUND) {
free_soundspace((SpaceSound *)sl);
}
@@ -3878,6 +3901,11 @@ void allqueue(unsigned short event, short val)
scrarea_queue_winredraw(sa);
}
break;
+ case REDRAWSCRIPT:
+ if (sa->spacetype==SPACE_SCRIPT) {
+ scrarea_queue_winredraw(sa);
+ }
+ break;
case REDRAWSOUND:
if(sa->spacetype==SPACE_SOUND) {
scrarea_queue_headredraw(sa);
@@ -4162,6 +4190,17 @@ SpaceType *spacetext_get_type(void)
return st;
}
+SpaceType *spacescript_get_type(void)
+{
+ static SpaceType *st = NULL;
+
+ if (!st) {
+ st = spacetype_new("Script");
+ spacetype_set_winfuncs(st, drawscriptspace, NULL, winqreadscriptspace);
+ }
+
+ return st;
+}
SpaceType *spaceview3d_get_type(void)
{
static SpaceType *st= NULL;
diff --git a/source/blender/src/spacetypes.c b/source/blender/src/spacetypes.c
index 060f00d64a7..1b1f87f6d1b 100644
--- a/source/blender/src/spacetypes.c
+++ b/source/blender/src/spacetypes.c
@@ -92,6 +92,7 @@ SpaceType *spacetype_from_code(int spacecode)
case SPACE_SEQ: return spaceseq_get_type();
case SPACE_SOUND: return spacesound_get_type();
case SPACE_TEXT: return spacetext_get_type();
+ case SPACE_SCRIPT:return spacescript_get_type();
case SPACE_VIEW3D: return spaceview3d_get_type();
default:
return NULL;
diff --git a/source/blender/src/toets.c b/source/blender/src/toets.c
index cf68fbe25eb..a88c6ca7a0e 100644
--- a/source/blender/src/toets.c
+++ b/source/blender/src/toets.c
@@ -521,6 +521,7 @@ int blenderqread(unsigned short event, short val)
if (G.flags & G_FLAGS_AUTOPLAY) return 1;
if (curarea && curarea->spacetype==SPACE_TEXT) textspace= 1;
+ else if (curarea && curarea->spacetype==SPACE_SCRIPT) textspace= 1;
switch(event) {
@@ -798,7 +799,7 @@ int blenderqread(unsigned short event, short val)
break;
case NKEY:
- if(textediting==0 && textspace==0 ) {
+ if(textediting==0 && textspace==0) {
if(G.qual & LR_CTRLKEY);
else if(G.qual==0 || (G.qual & LR_SHIFTKEY)) {
if(curarea->spacetype==SPACE_VIEW3D); // is new panel, in view3d queue