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>2004-01-21 07:38:03 +0300
committerWillian Padovani Germano <wpgermano@gmail.com>2004-01-21 07:38:03 +0300
commit1652884463afa64ec000462e7a23d3267f980b25 (patch)
treeb9c6bb55ea9c56256c9eb4c42787bacb602e22bd
parent24bb131b7cd987018077418141e566c957f96527 (diff)
BPython:
-- removed struct Script (DNA_script_types.h) from makesdna to blender/include/BPI_script.h (BPI meaning Blender Python-related external Include file). Had agreed with Ton that makesdna was not the proper place for it. -- fixed two small warnings in Ipo.c (variables might be used uninitialized) -- fixed a bug reported on blender.org's python forum by Wim Van Hoydonck (aka tuinbels): Blender would hang if a script failed. My fault, accidentally put a node=node->next type call outside the while loop check, so it never ended. With makesdna/DNA_script_types.h removed and include/BPI_script.h added, msvc projectfiles will need to be updated. Sorry to do it now, but I promissed I'd fix this before next release.
-rw-r--r--source/blender/blenkernel/bad_level_call_stubs/stubs.c4
-rw-r--r--source/blender/blenkernel/intern/library.c2
-rw-r--r--source/blender/blenkernel/intern/script.c11
-rw-r--r--source/blender/include/BPI_script.h (renamed from source/blender/makesdna/DNA_script_types.h)17
-rw-r--r--source/blender/python/BPY_extern.h2
-rw-r--r--source/blender/python/BPY_interface.c8
-rw-r--r--source/blender/python/api2_2x/Draw.c8
-rw-r--r--source/blender/python/api2_2x/Draw.h3
-rw-r--r--source/blender/python/api2_2x/EXPP_interface.c3
-rw-r--r--source/blender/python/api2_2x/Ipo.c4
-rw-r--r--source/blender/python/api2_2x/gen_utils.h3
-rw-r--r--source/blender/src/drawscript.c8
-rw-r--r--source/blender/src/filesel.c2
-rw-r--r--source/blender/src/header_script.c2
-rw-r--r--source/blender/src/headerbuttons.c3
15 files changed, 44 insertions, 36 deletions
diff --git a/source/blender/blenkernel/bad_level_call_stubs/stubs.c b/source/blender/blenkernel/bad_level_call_stubs/stubs.c
index 532c4243844..e4560982184 100644
--- a/source/blender/blenkernel/bad_level_call_stubs/stubs.c
+++ b/source/blender/blenkernel/bad_level_call_stubs/stubs.c
@@ -32,10 +32,10 @@
*/
+#include "BKE_bad_level_calls.h"
#include "BLI_blenlib.h"
+#include "BPI_script.h"
#include "DNA_material_types.h"
-#include "DNA_script_types.h"
-#include "BKE_bad_level_calls.h"
#ifdef HAVE_CONFIG_H
#include <config.h>
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 51d22b2802d..3d9c6560cb4 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -71,7 +71,6 @@
#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"
@@ -105,6 +104,7 @@
#include "BKE_lattice.h"
#include "BKE_armature.h"
#include "BKE_action.h"
+#include "BPI_script.h"
#define MAX_IDPUP 30 /* was 24 */
#define MAX_LIBARRAY 100 /* was 30 */
diff --git a/source/blender/blenkernel/intern/script.c b/source/blender/blenkernel/intern/script.c
index 78a9b511538..45072513591 100644
--- a/source/blender/blenkernel/intern/script.c
+++ b/source/blender/blenkernel/intern/script.c
@@ -1,8 +1,10 @@
-/* script.c
+/* blenkernel/script.c
*
*
* $Id$
*
+ * Function(s) related to struct script management.
+ *
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
@@ -32,11 +34,10 @@
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
-#include "MEM_guardedalloc.h"
-
-#include "DNA_script_types.h"
-
#include "BKE_script.h"
+#include "BPI_script.h"
+
+#include "MEM_guardedalloc.h"
/*
#include "BLI_blenlib.h"
diff --git a/source/blender/makesdna/DNA_script_types.h b/source/blender/include/BPI_script.h
index a61dd21f969..243e50ecfa4 100644
--- a/source/blender/makesdna/DNA_script_types.h
+++ b/source/blender/include/BPI_script.h
@@ -1,7 +1,10 @@
/**
- * blenlib/DNA_script_types.h (mar-2001 nzc)
+ * include/BPI_script.h (jan-2004 ianwill)
*
- * $Id$
+ * $Id$
+ *
+ * Header for BPython's script structure. BPI: Blender Python external include
+ * file.
*
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
@@ -32,17 +35,15 @@
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
-#ifndef DNA_SCRIPT_TYPES_H
-#define DNA_SCRIPT_TYPES_H
+#ifndef BPI_SCRIPT_H
+#define BPI_SCRIPT_H
-#include "DNA_listBase.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;
@@ -66,4 +67,4 @@ typedef struct Script {
#define SCRIPT_GUI 0x02
#define SCRIPT_FILESEL 0x04
-#endif /* DNA_SCRIPT_TYPES_H */
+#endif /* BPI_SCRIPT_H */
diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h
index 3feb5606059..b55d55b0ffe 100644
--- a/source/blender/python/BPY_extern.h
+++ b/source/blender/python/BPY_extern.h
@@ -42,7 +42,7 @@ struct ScriptLink; /* defined in DNA_scriptlink_types.h */
struct ListBase; /* defined in DNA_listBase.h */
struct SpaceText; /* defined in DNA_space_types.h */
struct SpaceScript;/* defined in DNA_space_types.h */
-struct Script; /* defined in DNA_script_types.h */
+struct Script; /* defined in BPI_script.h */
/*
struct _object; // forward declaration for PyObject !
*/
diff --git a/source/blender/python/BPY_interface.c b/source/blender/python/BPY_interface.c
index e1320bb6b30..3a1fd5c26a0 100644
--- a/source/blender/python/BPY_interface.c
+++ b/source/blender/python/BPY_interface.c
@@ -50,6 +50,8 @@
#include <BKE_main.h>
#include <BKE_text.h>
#include <BKE_utildefines.h>
+#include <BPI_script.h>
+
#include <DNA_camera_types.h>
#include <DNA_ID.h>
#include <DNA_lamp_types.h>
@@ -57,7 +59,6 @@
#include <DNA_object_types.h>
#include <DNA_scene_types.h>
#include <DNA_screen_types.h>
-#include <DNA_script_types.h>
#include <DNA_scriptlink_types.h>
#include <DNA_space_types.h>
#include <DNA_text_types.h>
@@ -419,7 +420,6 @@ int BPY_txt_do_python(struct SpaceText* st)
}
script->id.us = 1;
- script->filename = NULL; /* it's a Blender Text script */
script->flags = SCRIPT_RUNNING;
script->py_draw = NULL;
script->py_event = NULL;
@@ -549,7 +549,6 @@ int BPY_menu_do_python(short menutype, int event)
}
script->id.us = 1;
- script->filename = NULL; /* it's a Blender Text script */
script->flags = SCRIPT_RUNNING;
script->py_draw = NULL;
script->py_event = NULL;
@@ -636,9 +635,6 @@ void BPY_free_finished_script(Script *script)
{
if (!script) return;
- if (script->lastspace != SPACE_SCRIPT)
- newspace (curarea, script->lastspace);
-
free_libblock(&G.main->script, script);
return;
}
diff --git a/source/blender/python/api2_2x/Draw.c b/source/blender/python/api2_2x/Draw.c
index a7a45db64d7..19f2d2f8807 100644
--- a/source/blender/python/api2_2x/Draw.c
+++ b/source/blender/python/api2_2x/Draw.c
@@ -132,13 +132,15 @@ static void exec_callback(SpaceScript *sc, PyObject *callback, PyObject *args)
PyObject *result = PyObject_CallObject (callback, args);
if (result == NULL && sc->script) { /* errors in the script */
- if (sc->script->filename == NULL) { /* if it's a Blender Text script */
+ if (sc->script->lastspace == SPACE_TEXT) {/*if it can be an ALT+P script*/
Text *text = G.main->text.first;
while (text) { /* find it and free its compiled code */
- if (!strcmp(text->id.name+2, sc->script->id.name+2))
+ if (!strcmp(text->id.name+2, sc->script->id.name+2)) {
BPY_free_compiled_text(text);
+ break;
+ }
+ text = text->id.next;
}
- text = text->id.next;
}
exit_pydraw(sc, 1);
}
diff --git a/source/blender/python/api2_2x/Draw.h b/source/blender/python/api2_2x/Draw.h
index 3681e4a5fe9..04169e6d215 100644
--- a/source/blender/python/api2_2x/Draw.h
+++ b/source/blender/python/api2_2x/Draw.h
@@ -46,7 +46,6 @@
#include "BMF_Api.h"
#include "DNA_screen_types.h"
-#include "DNA_script_types.h"
#include "DNA_space_types.h"
#include "DNA_text_types.h"
@@ -59,6 +58,8 @@
#include "BIF_interface.h"
#include "BIF_mywindow.h"
+#include "BPI_script.h" /* script struct */
+
#include "interface.h"
#include "mydevice.h" /*@ for all the event constants */
diff --git a/source/blender/python/api2_2x/EXPP_interface.c b/source/blender/python/api2_2x/EXPP_interface.c
index 351ff3e5ec4..472ded82688 100644
--- a/source/blender/python/api2_2x/EXPP_interface.c
+++ b/source/blender/python/api2_2x/EXPP_interface.c
@@ -36,6 +36,8 @@
#include <BKE_global.h>
#include <BKE_library.h>
#include <BKE_main.h>
+#include <BPI_script.h>
+
#include <DNA_ID.h>
#include <DNA_camera_types.h>
#include <DNA_lamp_types.h>
@@ -43,7 +45,6 @@
#include <DNA_object_types.h>
#include <DNA_scene_types.h>
#include <DNA_screen_types.h>
-#include <DNA_script_types.h>
#include <DNA_scriptlink_types.h>
#include <DNA_space_types.h>
#include <DNA_world_types.h>
diff --git a/source/blender/python/api2_2x/Ipo.c b/source/blender/python/api2_2x/Ipo.c
index 63c2e81f04c..7ad07561079 100644
--- a/source/blender/python/api2_2x/Ipo.c
+++ b/source/blender/python/api2_2x/Ipo.c
@@ -279,11 +279,11 @@ static PyObject *Ipo_addCurve(BPy_Ipo *self, PyObject *args)
IpoCurve *get_ipocurve(ID *from, short type, int adrcode, Ipo *useipo);
void allspace(unsigned short event, short val) ;
void allqueue(unsigned short event, short val);
- int param,ok = 0;
+ int param = 0,ok = 0;
char*s = 0;
IpoCurve*icu;
Link * link;
- struct Object * object;
+ struct Object * object = NULL;
if (!PyArg_ParseTuple(args, "s",&s))
return (EXPP_ReturnPyObjError (PyExc_TypeError, "expected string argument"));
diff --git a/source/blender/python/api2_2x/gen_utils.h b/source/blender/python/api2_2x/gen_utils.h
index 161eea4de9c..6418c9638a3 100644
--- a/source/blender/python/api2_2x/gen_utils.h
+++ b/source/blender/python/api2_2x/gen_utils.h
@@ -40,10 +40,11 @@
#include <BKE_global.h>
#include <BKE_main.h>
+#include <BPI_script.h>
+
#include <DNA_ID.h>
#include <DNA_object_types.h>
#include <DNA_material_types.h>
-#include <DNA_script_types.h>
#include <DNA_scriptlink_types.h>
#include <DNA_listBase.h>
diff --git a/source/blender/src/drawscript.c b/source/blender/src/drawscript.c
index 950bd4f2989..e94834f5c7b 100644
--- a/source/blender/src/drawscript.c
+++ b/source/blender/src/drawscript.c
@@ -50,7 +50,6 @@
#include "BLI_blenlib.h"
-#include "DNA_script_types.h"
#include "DNA_space_types.h"
#include "DNA_screen_types.h"
#include "DNA_userdef_types.h"
@@ -60,6 +59,7 @@
#include "BKE_global.h"
#include "BKE_main.h"
+#include "BPI_script.h"
#include "BPY_extern.h"
#include "BIF_gl.h"
@@ -111,8 +111,12 @@ void winqreadscriptspace(struct ScrArea *sa, void *spacedata, struct BWinEvent *
if (script) {
BPY_spacescript_do_pywin_event(sc, event, val);
- if (!script->flags) /* finished with this script, let's free it */
+ if (!script->flags) {/* finished with this script, let's free it */
+ if (script->lastspace != SPACE_SCRIPT)
+ newspace (curarea, script->lastspace);
BPY_free_finished_script(script);
+ sc->script = NULL;
+ }
}
else {
if (event == QKEY)
diff --git a/source/blender/src/filesel.c b/source/blender/src/filesel.c
index ba75cc34e89..78f7f58faaf 100644
--- a/source/blender/src/filesel.c
+++ b/source/blender/src/filesel.c
@@ -71,7 +71,6 @@
#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"
@@ -96,6 +95,7 @@
#include "BLO_readfile.h"
#include "BDR_editcurve.h"
+#include "BPI_script.h"
#include "BSE_filesel.h"
#include "BSE_view.h"
diff --git a/source/blender/src/header_script.c b/source/blender/src/header_script.c
index 3c97575e528..491ca6ac8b9 100644
--- a/source/blender/src/header_script.c
+++ b/source/blender/src/header_script.c
@@ -55,7 +55,6 @@
#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"
@@ -68,6 +67,7 @@
#include "BKE_sca.h"
#include "BSE_filesel.h"
+#include "BPI_script.h"
#include "BPY_extern.h"
#include "BPY_menus.h"
diff --git a/source/blender/src/headerbuttons.c b/source/blender/src/headerbuttons.c
index ef3d78deab9..7f023f37916 100644
--- a/source/blender/src/headerbuttons.c
+++ b/source/blender/src/headerbuttons.c
@@ -78,7 +78,6 @@
#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"
@@ -150,6 +149,8 @@
#include "BIF_writeimage.h"
#include "BIF_butspace.h"
+#include "BPI_script.h"
+
#include "BSE_edit.h"
#include "BSE_filesel.h"
#include "BSE_headerbuttons.h"