[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36349] trunk/blender/source/blender/ render/intern/source/convertblender.c: fix [#27174] World Starfield Generation causes crash

Campbell Barton ideasman42 at gmail.com
Wed Apr 27 10:32:21 CEST 2011


Revision: 36349
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36349
Author:   campbellbarton
Date:     2011-04-27 08:32:20 +0000 (Wed, 27 Apr 2011)
Log Message:
-----------
fix [#27174] World Starfield Generation causes crash
allow escaping from render if generating stars takes too long.

Modified Paths:
--------------
    trunk/blender/source/blender/render/intern/source/convertblender.c

Modified: trunk/blender/source/blender/render/intern/source/convertblender.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/convertblender.c	2011-04-27 07:36:34 UTC (rev 36348)
+++ trunk/blender/source/blender/render/intern/source/convertblender.c	2011-04-27 08:32:20 UTC (rev 36349)
@@ -170,6 +170,7 @@
 	float fac, starmindist, clipend;
 	float mat[4][4], stargrid, maxrand, maxjit, force, alpha;
 	int x, y, z, sx, sy, sz, ex, ey, ez, done = 0;
+	unsigned int totstar= 0;
 	
 	if(initfunc) {
 		scene= scenev3d;
@@ -294,6 +295,17 @@
 						}
 					}
 				}
+
+				/* break out of the loop if generating stars takes too long */
+				if(re && !(totstar % 1000000)) {
+					if(re->test_break(re->tbh)) {
+						x= ex + 1;
+						y= ey + 1;
+						z= ez + 1;
+					}
+				}
+				
+				totstar++;
 			}
 			/* do not call blender_test_break() here, since it is used in UI as well, confusing the callback system */
 			/* main cause is G.afbreek of course, a global again... (ton) */
@@ -5045,9 +5057,13 @@
 		
 		/* don't sort stars */
 		tothalo= re->tothalo;
-		if(!re->test_break(re->tbh))
-			if(re->wrld.mode & WO_STARS)
+		if(!re->test_break(re->tbh)) {
+			if(re->wrld.mode & WO_STARS) {
+				re->i.infostr= "Creating Starfield";
+				re->stats_draw(re->sdh, &re->i);
 				RE_make_stars(re, NULL, NULL, NULL, NULL);
+			}
+		}
 		sort_halos(re, tothalo);
 		
 		init_camera_inside_volumes(re);




More information about the Bf-blender-cvs mailing list