Fix T39941: Freestyle: Rendered preview crashes when non-primary render layer is selected and disabled.

Freestyle relies on render layer name (RenderLayer::name) to find the render layer that
corresponds to a scene render layer being rendered.

When the active render layer is disabled during preview rendering, the function
render_result_new() populates the list of render layers (RenderResult::layers) with an
unnamed render layer while setting the active scene render layer index to zero.

This commit fixes the missing initialization of the render layer name by referring to that of
the first in the list of scene render layers.
This commit is contained in:
Tamito Kajiyama 2014-04-29 20:39:25 +09:00
parent 437bb528bd
commit 182e97a2cd
Notes: blender-bot 2023-02-14 10:43:46 +01:00
Referenced by issue #39941, Freestyle: Rendered preview crashes when non-primary render layer is selected and disabled.
1 changed files with 2 additions and 0 deletions

View File

@ -604,6 +604,8 @@ RenderResult *render_result_new(Render *re, rcti *partrct, int crop, int savebuf
rl->passflag = SCE_PASS_COMBINED;
re->r.actlay = 0;
srl = BLI_findlink(&re->r.layers, re->r.actlay);
BLI_strncpy(rl->name, srl->name, sizeof(rl->name));
}
/* border render; calculate offset for use in compositor. compo is centralized coords */