diff options
author | Campbell Barton <ideasman42@gmail.com> | 2008-04-17 18:10:40 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2008-04-17 18:10:40 +0400 |
commit | da3c44958e7264d2cb7cd98615b4d1d05cc02a96 (patch) | |
tree | c56c01e467e1eccc609e6c62626fb707156141e8 | |
parent | 13b9b0ae033830996b48f2934f11acc56cb2ddf6 (diff) |
Bugfix for [#8962] Blender crashes on joining meshes with python
blenders screen needs initializing before running python scripts when not in background mode.
-rw-r--r-- | source/creator/creator.c | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/source/creator/creator.c b/source/creator/creator.c index 7607d1026f8..24cdfe88940 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -256,9 +256,20 @@ static void print_help(void) double PIL_check_seconds_timer(void); extern void winlay_get_screensize(int *width_r, int *height_r); +static void main_init_screen( void ) +{ + setscreen(G.curscreen); + + if(G.main->scene.first==0) { + set_scene( add_scene("1") ); + } + + screenmain(); +} + int main(int argc, char **argv) { - int a, i, stax=0, stay=0, sizx, sizy; + int a, i, stax=0, stay=0, sizx, sizy, scr_init = 0; SYS_SystemHandle syshandle; Scene *sce; @@ -649,7 +660,14 @@ int main(int argc, char **argv) break; case 'P': a++; - if (a < argc) BPY_run_python_script (argv[a]); + if (a < argc) { + /* If we're not running in background mode, then give python a valid screen */ + if ((G.background==0) && (scr_init==0)) { + main_init_screen(); + scr_init = 1; + } + BPY_run_python_script (argv[a]); + } else printf("\nError: you must specify a Python script after '-P '.\n"); break; case 'o': @@ -794,16 +812,11 @@ int main(int argc, char **argv) /* actually incorrect, but works for now (ton) */ exit_usiblender(); } - - setscreen(G.curscreen); - - if(G.main->scene.first==0) { - sce= add_scene("1"); - set_scene(sce); + + if (scr_init==0) { + main_init_screen(); } - screenmain(); - return 0; } /* end of int main(argc,argv) */ |