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.
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user