[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14450] trunk/blender/source/creator/ creator.c: Bugfix for [#8962] Blender crashes on joining meshes with python
Campbell Barton
ideasman42 at gmail.com
Thu Apr 17 16:11:24 CEST 2008
Revision: 14450
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14450
Author: campbellbarton
Date: 2008-04-17 16:10:40 +0200 (Thu, 17 Apr 2008)
Log Message:
-----------
Bugfix for [#8962] Blender crashes on joining meshes with python
blenders screen needs initializing before running python scripts when not in background mode.
Modified Paths:
--------------
trunk/blender/source/creator/creator.c
Modified: trunk/blender/source/creator/creator.c
===================================================================
--- trunk/blender/source/creator/creator.c 2008-04-17 12:51:22 UTC (rev 14449)
+++ trunk/blender/source/creator/creator.c 2008-04-17 14:10:40 UTC (rev 14450)
@@ -256,9 +256,20 @@
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 @@
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 @@
/* 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) */
More information about the Bf-blender-cvs
mailing list