diff options
author | Campbell Barton <ideasman42@gmail.com> | 2008-04-29 01:54:03 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2008-04-29 01:54:03 +0400 |
commit | 723397bb91d00aeb625769084cef159ba7794048 (patch) | |
tree | f04fdc05d86e2b40508a1652e8ea6636c8529ca6 /source | |
parent | 96cec2e99bc4d09f368b3737b8e2161ff5345fa9 (diff) |
running scripts in background mode would crash blender when checking a scriptspace areas
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/python/BPY_interface.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/source/blender/python/BPY_interface.c b/source/blender/python/BPY_interface.c index 5858b933562..86bcd51e914 100644 --- a/source/blender/python/BPY_interface.c +++ b/source/blender/python/BPY_interface.c @@ -639,11 +639,13 @@ int BPY_txt_do_python_Text( struct Text *text ) if( !strcmp( script->id.name + 2, text->id.name + 2 ) ) { /* if this text is already a running script, * just move to it: */ - SpaceScript *sc; - newspace( curarea, SPACE_SCRIPT ); - sc = curarea->spacedata.first; - sc->script = script; - return 1; + if (!G.background) { + SpaceScript *sc; + newspace( curarea, SPACE_SCRIPT ); + sc = curarea->spacedata.first; + sc->script = script; + return 1; + } } script = script->id.next; } @@ -943,10 +945,12 @@ int BPY_run_script(Script *script) /* special case: called from the menu in the Scripts window * we have to change sc->script pointer, since it'll be freed here.*/ - if( curarea->spacetype == SPACE_SCRIPT ) { - SpaceScript *sc = curarea->spacedata.first; - sc->script = G.main->script.first; /* can be null, which is ok ... */ - /* ... meaning no other script is running right now. */ + if (!G.background) { + if( curarea->spacetype == SPACE_SCRIPT ) { + SpaceScript *sc = curarea->spacedata.first; + sc->script = G.main->script.first; /* can be null, which is ok ... */ + /* ... meaning no other script is running right now. */ + } } } |