diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2017-05-19 20:33:52 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2017-05-19 20:40:22 +0300 |
commit | b6f5e8d9a1aa29720167cf1b1700f76b3e5950a1 (patch) | |
tree | f389c54eba9d0678d898adb239145995403e7715 /source/blender | |
parent | 8d4aff31cea22203244a933ddd494ac57b7943b2 (diff) |
Fix T51524: Instantiated Hair Object which has dupligroup children and hidden orig objects of group crash at render.
Note that this is speculative fix, actually precisely understanding what
happens in this code is... not easy.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/render/intern/source/convertblender.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 263ea3d4ef2..41ff8e046e7 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -4701,6 +4701,12 @@ static void add_render_object(Render *re, Object *ob, Object *par, DupliObject * if (ob->particlesystem.first) { psysindex= 1; for (psys=ob->particlesystem.first; psys; psys=psys->next, psysindex++) { + /* It seems that we may generate psys->renderdata recursively in some nasty intricated cases of + * several levels of bupliobject (see T51524). + * For now, basic rule is, do not restore psys if it was already in 'render state'. + * Another, more robust solution could be to add some reference counting to that renderdata... */ + const bool psys_has_renderdata = (psys->renderdata != NULL); + if (!psys_check_enabled(ob, psys, G.is_rendering)) continue; @@ -4712,8 +4718,9 @@ static void add_render_object(Render *re, Object *ob, Object *par, DupliObject * if (dob) psys->flag |= PSYS_USE_IMAT; init_render_object_data(re, obr, timeoffset); - if (!(re->r.scemode & R_VIEWPORT_PREVIEW)) + if (!(re->r.scemode & R_VIEWPORT_PREVIEW) && !psys_has_renderdata) { psys_render_restore(ob, psys); + } psys->flag &= ~PSYS_USE_IMAT; /* only add instance for objects that have not been used for dupli */ |