forked from bartvdbraak/blender
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:
parent
13b9b0ae03
commit
da3c44958e
@ -256,9 +256,20 @@ static void print_help(void)
|
|||||||
double PIL_check_seconds_timer(void);
|
double PIL_check_seconds_timer(void);
|
||||||
extern void winlay_get_screensize(int *width_r, int *height_r);
|
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 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;
|
SYS_SystemHandle syshandle;
|
||||||
Scene *sce;
|
Scene *sce;
|
||||||
|
|
||||||
@ -649,7 +660,14 @@ int main(int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
case 'P':
|
case 'P':
|
||||||
a++;
|
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");
|
else printf("\nError: you must specify a Python script after '-P '.\n");
|
||||||
break;
|
break;
|
||||||
case 'o':
|
case 'o':
|
||||||
@ -794,16 +812,11 @@ int main(int argc, char **argv)
|
|||||||
/* actually incorrect, but works for now (ton) */
|
/* actually incorrect, but works for now (ton) */
|
||||||
exit_usiblender();
|
exit_usiblender();
|
||||||
}
|
}
|
||||||
|
|
||||||
setscreen(G.curscreen);
|
if (scr_init==0) {
|
||||||
|
main_init_screen();
|
||||||
if(G.main->scene.first==0) {
|
|
||||||
sce= add_scene("1");
|
|
||||||
set_scene(sce);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
screenmain();
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
} /* end of int main(argc,argv) */
|
} /* end of int main(argc,argv) */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user