Fix T40403: Particles disappear after rendering

Read the comment in ensure_curve_cache, it tells it all.
This commit is contained in:
Sergey Sharybin 2014-05-28 15:28:52 +06:00
parent 5a7b049a94
commit 6bb459f6d7

@ -1942,7 +1942,29 @@ static void drawlattice__point(Lattice *lt, DispList *dl, int u, int v, int w, i
#ifdef SEQUENCER_DAG_WORKAROUND
static void ensure_curve_cache(Scene *scene, Object *object)
{
if (object->curve_cache == NULL) {
bool need_recalc = object->curve_cache == NULL;
/* Render thread might have freed the curve cache if the
* object is not visible. If the object is also used for
* particles duplication, then render thread might have
* also created curve_cache with only bevel and path
* filled in.
*
* So check for curve_cache != NULL is not fully correct
* here, we also need to check whether display list is
* empty or not.
*
* The trick below tries to optimie calls to displist
* creation for cases curve is empty. Meaning, if the curve
* is empty (without splies) bevel list would also be empty.
* And the thing is, render thread always leaves bevel list
* in a proper state. So if bevel list is here and display
* list is not we need to make display list.
*/
if (need_recalc == false) {
need_recalc = object->curve_cache->disp.first == NULL &&
object->curve_cache->bev.first != NULL;
}
if (need_recalc) {
switch (object->type) {
case OB_CURVE:
case OB_SURF: