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/blenkernel
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/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_main.h1
-rw-r--r--source/blender/blenkernel/BKE_script.h49
-rw-r--r--source/blender/blenkernel/intern/library.c19
-rw-r--r--source/blender/blenkernel/intern/script.c70
-rw-r--r--source/blender/blenkernel/intern/text.c1
5 files changed, 136 insertions, 4 deletions
diff --git a/source/blender/blenkernel/BKE_main.h b/source/blender/blenkernel/BKE_main.h
index 9afe75898c7..058ac3f0a28 100644
--- a/source/blender/blenkernel/BKE_main.h
+++ b/source/blender/blenkernel/BKE_main.h
@@ -68,6 +68,7 @@ typedef struct Main {
ListBase key;
ListBase world;
ListBase screen;
+ ListBase script;
ListBase vfont;
ListBase text;
ListBase sound;
diff --git a/source/blender/blenkernel/BKE_script.h b/source/blender/blenkernel/BKE_script.h
new file mode 100644
index 00000000000..70f3d58fcae
--- /dev/null
+++ b/source/blender/blenkernel/BKE_script.h
@@ -0,0 +1,49 @@
+/**
+ * blenlib/BKE_script.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 BKE_SCRIPT_H
+#define BKE_SCRIPT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct Script;
+
+void free_script (struct Script *script);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BKE_SCRIPT_H */
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index fb7e6ba8fed..d693148fe94 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -71,6 +71,7 @@
#include "DNA_screen_types.h"
#include "DNA_vfont_types.h"
#include "DNA_text_types.h"
+#include "DNA_script_types.h"
#include "DNA_sound_types.h"
#include "DNA_group_types.h"
#include "DNA_armature_types.h"
@@ -86,11 +87,12 @@
#include "BKE_sound.h"
#include "BKE_object.h"
#include "BKE_screen.h"
+#include "BKE_script.h"
#include "BKE_mesh.h"
#include "BKE_material.h"
#include "BKE_curve.h"
#include "BKE_mball.h"
- #include "BKE_text.h"
+#include "BKE_text.h"
#include "BKE_texture.h"
#include "BKE_scene.h"
#include "BKE_image.h"
@@ -173,6 +175,8 @@ ListBase *wich_libbase(Main *mainlib, short type)
return &(mainlib->vfont);
case ID_TXT:
return &(mainlib->text);
+ case ID_SCRIPT:
+ return &(mainlib->script);
case ID_SO:
return &(mainlib->sound);
case ID_SAMPLE:
@@ -225,9 +229,10 @@ int set_listbasepointers(Main *main, ListBase **lb)
lb[23]= &(main->group);
lb[24]= samples;
- lb[25]= 0;
-
- return 25;
+ lb[25]= &(main->script);
+ lb[26]=0;
+
+ return 26;
}
/* *********** ALLOC AND FREE *****************
@@ -305,6 +310,9 @@ static ID *alloc_libblock_notest(short type)
case ID_TXT:
id= MEM_callocN(sizeof(Text), "text");
break;
+ case ID_SCRIPT:
+ id= MEM_callocN(sizeof(Script), "script");
+ break;
case ID_SO:
id= MEM_callocN(sizeof(bSound), "sound");
break;
@@ -450,6 +458,9 @@ void free_libblock(ListBase *lb, void *idv)
case ID_TXT:
free_text((Text *)id);
break;
+ case ID_SCRIPT:
+ free_script((Script *)id);
+ break;
case ID_SO:
sound_free_sound((bSound *)id);
break;
diff --git a/source/blender/blenkernel/intern/script.c b/source/blender/blenkernel/intern/script.c
new file mode 100644
index 00000000000..13b7473b9d8
--- /dev/null
+++ b/source/blender/blenkernel/intern/script.c
@@ -0,0 +1,70 @@
+/* script.c
+ *
+ *
+ * $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 *****
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "DNA_script_types.h"
+
+#include "BKE_script.h"
+#include "BIF_drawscript.h" /* for unlink_script */
+
+/*
+#include "BLI_blenlib.h"
+#include "BKE_bad_level_calls.h"
+#include "BKE_utildefines.h"
+#include "BKE_library.h"
+#include "BKE_global.h"
+#include "BKE_main.h"
+
+#include "BPY_extern.h" // Blender Python library
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+*/
+
+void free_script (Script *script)
+{
+ if (!script) return;
+
+ if (script->py_globaldict || script->py_button ||
+ script->py_event || script->py_draw)
+ {
+ BPY_clear_script(script);
+ }
+
+ unlink_script (script); /* unlink from all visible SPACE_SCRIPTS */
+
+ return;
+}
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index b45efdc819e..4ad4ac648f2 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -147,6 +147,7 @@ void free_text(Text *text)
if(text->name) MEM_freeN(text->name);
MEM_freeN(text->undo_buf);
+ if (text->compiled) BPY_free_compiled_text(text);
}
Text *add_empty_text(void)