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>2005-02-16 06:32:57 +0300
committerWillian Padovani Germano <wpgermano@gmail.com>2005-02-16 06:32:57 +0300
commitb7eaee3ad2dcd0fd845a9bd957306e4ed5fc0195 (patch)
tree3f9e78a65cab74eef69188b715fd3e06ec4bb9c4 /source/blender/python/api2_2x/Window.c
parent427ff274a281e3aac230446700093ebb1c4427d6 (diff)
BPython bug fixes:
-- Ton caught a redraw trying to free a busy slider button in a script. Made sure the redraws don't happen in the scripts win during slider updates, but the realtime slider (automatically updates the 3d view) isn't working yet as it probably shouldn't with the current code. There's a pre 2.25 comment in Draw.c about it being hackish and wrong; -- Melchior FRANZ reported a bug related to a script dict being freed too early (when two instances of the same script were on: one with a gui and the other with a file selector -- selecting the file triggered the problem); -- bug #2074 reported by Roland Hess: totally empty string button -- no prepended but->str (e.g. "OB:") neither but->poin (the actual string) -- crashing Blender. Crash happened on editscreen.c: screen_delayed_push_undo calls strncpy() without checking the passed string. Didn't mess with it, better let the coder in charge of undo (Ton, right?) choose a preferred way to deal with it (report error, simply use blank string). Staying on the python side at least for now, I just made but->str = " " (a space) when user doesn't define it, so the crash shouldn't happen anymore. http://projects.blender.org/tracker/?func=detail&atid=125&aid=2074&group_id=9 Thanks guys for reporting the problems.
Diffstat (limited to 'source/blender/python/api2_2x/Window.c')
-rw-r--r--source/blender/python/api2_2x/Window.c60
1 files changed, 33 insertions, 27 deletions
diff --git a/source/blender/python/api2_2x/Window.c b/source/blender/python/api2_2x/Window.c
index 750f7ef30b3..b8be06e4db2 100644
--- a/source/blender/python/api2_2x/Window.c
+++ b/source/blender/python/api2_2x/Window.c
@@ -376,33 +376,28 @@ PyObject *M_Window_Redraw( PyObject * self, PyObject * args )
if( wintype < 0 )
redraw_all = 1;
- if( !during_script( ) ) {
+ if( !during_script( ) ) {
tempsa = curarea;
sa = G.curscreen->areabase.first;
while( sa ) {
if( sa->spacetype == wintype || redraw_all ) {
- if( sa->spacetype == SPACE_TEXT ) {
- st = sa->spacedata.first;
- if( st->text ) {
- if( st->text->flags & TXT_FOLLOW ) /* follow cursor display */
- pop_space_text( st );
-
- // XXX making a test: Jul 07, 2004.
- // we don't need to prevent text win redraws anymore,
- // since now there's a scripts space instead.
- //if (EXPP_disable_force_draw) { /* defined in Draw.[ch] ... */
- // scrarea_queue_redraw(sa);
+ if (sa->spacetype == SPACE_SCRIPT && EXPP_disable_force_draw) {
+ scrarea_queue_redraw(sa);
+ }
+ else {
+ if( sa->spacetype == SPACE_TEXT ) {
+ st = sa->spacedata.first;
+ if( st->text ) {
+ if( st->text->flags & TXT_FOLLOW ) /* follow cursor display */
+ pop_space_text( st );
+ }
}
+ scrarea_do_windraw( sa );
+ if( sa->headwin ) scrarea_do_headdraw( sa );
}
- //} else {
- scrarea_do_windraw( sa );
- if( sa->headwin )
- scrarea_do_headdraw( sa );
- //}
}
-
sa = sa->next;
}
@@ -478,7 +473,7 @@ static PyObject *M_Window_FileSelector( PyObject * self, PyObject * args )
char *title = "SELECT FILE";
char *filename = G.sce;
SpaceScript *sc;
- Script *script = G.main->script.last;
+ Script *script = NULL;
int startspace = 0;
if( (!PyArg_ParseTuple( args, "O|ss", &EXPP_FS_PyCallback, &title, &filename ) )
@@ -499,8 +494,14 @@ static PyObject *M_Window_FileSelector( PyObject * self, PyObject * args )
sc = curarea->spacedata.first;
- /* did we get the right script? */
- if( !( script->flags & SCRIPT_RUNNING ) ) {
+ /* let's find the script that called us */
+ script = G.main->script.first;
+ while (script) {
+ if (script->flags & SCRIPT_RUNNING) break;
+ script = script->id.next;
+ }
+
+ if( !script ) {
/* if not running, then we were already on a SpaceScript space, executing
* a registered callback -- aka: this script has a gui */
script = sc->script; /* this is the right script */
@@ -522,7 +523,7 @@ static PyObject *M_Window_ImageSelector( PyObject * self, PyObject * args )
char *title = "SELECT IMAGE";
char *filename = G.sce;
SpaceScript *sc;
- Script *script = G.main->script.last;
+ Script *script = NULL;
int startspace = 0;
if( !PyArg_ParseTuple( args, "O|ss", &EXPP_FS_PyCallback, &title, &filename )
@@ -544,11 +545,16 @@ static PyObject *M_Window_ImageSelector( PyObject * self, PyObject * args )
sc = curarea->spacedata.first;
- /* did we get the right script? */
- if( !( script->flags & SCRIPT_RUNNING ) ) {
- /* if not running, then we're on a SpaceScript space, executing a
- * registered callback -- aka: this script has a gui */
- SpaceScript *sc = curarea->spacedata.first;
+ /* let's find the script that called us */
+ script = G.main->script.first;
+ while (script) {
+ if (script->flags & SCRIPT_RUNNING) break;
+ script = script->id.next;
+ }
+
+ if( !script ) {
+ /* if not running, then we were already on a SpaceScript space, executing
+ * a registered callback -- aka: this script has a gui */
script = sc->script; /* this is the right script */
} else { /* still running, use the trick */
script->lastspace = startspace;