diff options
author | Mai Lavelle <mai.lavelle@gmail.com> | 2018-02-13 10:26:07 +0300 |
---|---|---|
committer | Mai Lavelle <mai.lavelle@gmail.com> | 2018-02-15 11:26:59 +0300 |
commit | c1784824ffa2f816a763a2fa14f53043685d8804 (patch) | |
tree | 2fc204a326831f0728685a81e68c9f010968e971 | |
parent | 144a661152f1fbf41591d3b9aad679486207b5d7 (diff) |
Fix crash when rendering particles with cycles
view_layer is NULL when the render engine is created, this gets passed
around and ends up in this code causing a crash. This should be reverted
after the render engine api is updated to set view_layer.
-rw-r--r-- | source/blender/blenkernel/intern/effect.c | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/particle.c | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index 84f12c3a239..b54093555f5 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -221,7 +221,8 @@ ListBase *pdInitEffectors( if (weights->group) { view_layer = weights->group->view_layer; } - else if (eval_ctx) { + /* TODO(mai): the check for view_layer shouldnt be needed, remove when render engine api is updated for this */ + else if (eval_ctx && eval_ctx->view_layer) { view_layer = eval_ctx->view_layer; } else { diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 0bc5135c960..ef2ed9e2b65 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -290,9 +290,10 @@ void psys_enable_all(Object *ob) bool psys_in_edit_mode(const EvaluationContext *eval_ctx, ViewLayer *view_layer, ParticleSystem *psys) { - return (view_layer->basact && + /* TODO(mai): the check for view_layer shouldnt be needed, remove when render engine api is updated for this */ + return (view_layer && view_layer->basact && (eval_ctx->object_mode & OB_MODE_PARTICLE_EDIT) && - psys == psys_get_current((view_layer->basact)->object) && + psys == psys_get_current(view_layer->basact->object) && (psys->edit || psys->pointcache->edit) && !psys->renderdata); } |