diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-05-28 13:28:52 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-05-28 13:28:52 +0400 |
commit | 6bb459f6d7574d5cbe1ed9ad3470b5a802c3f843 (patch) | |
tree | 55ae5aac89aebf46c070d65b40d18405e50b9599 | |
parent | 5a7b049a940bc120c5e9734f3ae2545c8ccc93f0 (diff) |
Fix T40403: Particles disappear after rendering
Read the comment in ensure_curve_cache, it tells it all.
-rw-r--r-- | source/blender/editors/space_view3d/drawobject.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 6df5fd80029..7e44a8185f3 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -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: |