diff options
author | Willian Padovani Germano <wpgermano@gmail.com> | 2003-12-14 04:18:09 +0300 |
---|---|---|
committer | Willian Padovani Germano <wpgermano@gmail.com> | 2003-12-14 04:18:09 +0300 |
commit | 49021f7ec4bfc1313c6cdfeae1f9c32e98cc9cdc (patch) | |
tree | 44e7c4c38bc8c26b5efe0b52b846402589a4ca9a /source/blender/makesdna | |
parent | 6653af79142aa929eb3d131f8fced363b2c4b828 (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/makesdna')
-rw-r--r-- | source/blender/makesdna/DNA_ID.h | 1 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_screen_types.h | 3 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_script_types.h | 69 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_space_types.h | 18 |
4 files changed, 85 insertions, 6 deletions
diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index e653f896e36..3802a8ff37c 100644 --- a/source/blender/makesdna/DNA_ID.h +++ b/source/blender/makesdna/DNA_ID.h @@ -126,6 +126,7 @@ typedef struct Library { #define ID_SEQ MAKE_ID2('S', 'Q') #define ID_AR MAKE_ID2('A', 'R') #define ID_AC MAKE_ID2('A', 'C') +#define ID_SCRIPT MAKE_ID2('P', 'Y') #define IPO_CO MAKE_ID2('C', 'O') /* NOTE! This is not an ID, but is needed for g.sipo->blocktype */ diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h index 964a8033164..f11374dff99 100644 --- a/source/blender/makesdna/DNA_screen_types.h +++ b/source/blender/makesdna/DNA_screen_types.h @@ -161,7 +161,8 @@ enum { SPACE_IMASEL, SPACE_SOUND, SPACE_ACTION, - SPACE_NLA + SPACE_NLA, + SPACE_SCRIPT /* SPACE_LOGIC */ }; diff --git a/source/blender/makesdna/DNA_script_types.h b/source/blender/makesdna/DNA_script_types.h new file mode 100644 index 00000000000..a61dd21f969 --- /dev/null +++ b/source/blender/makesdna/DNA_script_types.h @@ -0,0 +1,69 @@ +/** + * blenlib/DNA_script_types.h (mar-2001 nzc) + * + * $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. + * + * This is a new part of Blender. + * + * Contributor(s): Willian P. Germano. + * + * ***** END GPL/BL DUAL LICENSE BLOCK ***** + */ + +#ifndef DNA_SCRIPT_TYPES_H +#define DNA_SCRIPT_TYPES_H + +#include "DNA_listBase.h" +#include "DNA_ID.h" + +typedef struct Script { + ID id; + + char *filename; /* NULL for Blender Text scripts */ + + void *py_draw; + void *py_event; + void *py_button; + void *py_globaldict; + + int flags, lastspace; + +} Script; + +/* Note: a script that registers callbacks in the script->py_* pointers + * above (or calls the file or image selectors) needs to keep its global + * dictionary until Draw.Exit() is called and the callbacks removed. + * Unsetting SCRIPT_RUNNING means the interpreter reached the end of the + * script and returned control to Blender, but we can't get rid of its + * namespace (global dictionary) while SCRIPT_GUI or SCRIPT_FILESEL is set, + * because of the callbacks. The flags and the script name are saved in + * each running script's global dictionary, under '__script__'. */ + +/* Flags */ +#define SCRIPT_RUNNING 0x01 +#define SCRIPT_GUI 0x02 +#define SCRIPT_FILESEL 0x04 + +#endif /* DNA_SCRIPT_TYPES_H */ diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index 8947c10b970..7b65a32a59f 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -42,6 +42,7 @@ struct Ipo; struct ID; struct Text; +struct Script; struct ImBuf; struct Image; struct SpaceIpo; @@ -250,13 +251,20 @@ typedef struct SpaceText { float pix_per_line; struct rcti txtscroll, txtbar; - - void *py_draw; - void *py_event; - void *py_button; - void *py_globaldict; + } SpaceText; +typedef struct SpaceScript { + SpaceLink *next, *prev; + int spacetype, pad1; + struct ScrArea *area; + struct Script *script; + + int pad2; + short flags, menunr; + +} SpaceScript; + # # typedef struct OneSelectableIma { |