forked from bartvdbraak/blender
fix [#27174] World Starfield Generation causes crash
allow escaping from render if generating stars takes too long.
This commit is contained in:
parent
7a44c65ce3
commit
bc6828426d
@ -170,6 +170,7 @@ void RE_make_stars(Render *re, Scene *scenev3d, void (*initfunc)(void),
|
|||||||
float fac, starmindist, clipend;
|
float fac, starmindist, clipend;
|
||||||
float mat[4][4], stargrid, maxrand, maxjit, force, alpha;
|
float mat[4][4], stargrid, maxrand, maxjit, force, alpha;
|
||||||
int x, y, z, sx, sy, sz, ex, ey, ez, done = 0;
|
int x, y, z, sx, sy, sz, ex, ey, ez, done = 0;
|
||||||
|
unsigned int totstar= 0;
|
||||||
|
|
||||||
if(initfunc) {
|
if(initfunc) {
|
||||||
scene= scenev3d;
|
scene= scenev3d;
|
||||||
@ -294,6 +295,17 @@ void RE_make_stars(Render *re, Scene *scenev3d, void (*initfunc)(void),
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 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 */
|
/* 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) */
|
/* main cause is G.afbreek of course, a global again... (ton) */
|
||||||
@ -5045,9 +5057,13 @@ void RE_Database_FromScene(Render *re, Main *bmain, Scene *scene, unsigned int l
|
|||||||
|
|
||||||
/* don't sort stars */
|
/* don't sort stars */
|
||||||
tothalo= re->tothalo;
|
tothalo= re->tothalo;
|
||||||
if(!re->test_break(re->tbh))
|
if(!re->test_break(re->tbh)) {
|
||||||
if(re->wrld.mode & WO_STARS)
|
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);
|
RE_make_stars(re, NULL, NULL, NULL, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
sort_halos(re, tothalo);
|
sort_halos(re, tothalo);
|
||||||
|
|
||||||
init_camera_inside_volumes(re);
|
init_camera_inside_volumes(re);
|
||||||
|
Loading…
Reference in New Issue
Block a user