Bugfix for [#8962] Blender crashes on joining meshes with python

blenders screen needs initializing before running python scripts when not in background mode.
This commit is contained in:
Campbell Barton 2008-04-17 14:10:40 +00:00
parent 13b9b0ae03
commit da3c44958e

@ -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) */