Page MenuHome

Render Result showing the wrong renderlayer in image editor
Closed, ResolvedPublic

Description

Blender Version
Broken: 2.79 official, also tested on latest master.

Short description of error
When rendering with 'Only render active layer' enabled in the renderlayer panel, the image editor switches to a seemingly random renderlayer when rendering is finished, instead of showing the active renderlayer.

Exact steps for others to reproduce the error

  1. Open Blend file attached and hit F12
  2. Select another render and render again.
  3. Repeat #2 a few times and notice that the image editor starts to show you a random renderlayer in the stack, instead of the one you are rendering.

Event Timeline

ronan ducluzeau (zeauro) triaged this task as Confirmed, Medium priority.

confirmed on 2.79 and master under ubuntu 16.04

Problem seems to occur for both render engines BI and Cycles.

Hi there, I'm new to this, but I've been poking around with this bug to find my way around. From what I gather, the displayed render-layer is affected by the value of ‘iuser->layer’ in ‘uiblock_layer_pass_buttons’, which displays the rendered layer corresponding to the index of ‘iuser->layer’. It's set to 1 initially, so when multiple layers are rendered consecutively, it keeps displaying the second layer in the rendered stack. (If there isn't a layer at that index, it'll just display the closest one.) If you select a different layer to be displayed in the image editor, ‘iuser->layer’ is properly updated to that layer's index, and then it'll keep displaying the render layer at that index until you set another layer.

I think the issue is that ‘iuser->layer’ is only directly affected by the selected layer in the image editor, but not the layer that is being rendered. A possible fix could be to update ‘iuser->layer’ to the selected render layer, particularly when ‘Only render active layer' is enabled? Or maybe have the displayed layer be directly affected by the layer that was last rendered…Anyway, I’ll poke around a bit more and see if I can find a work-around.

A possible fix could be to update ‘iuser->layer’ to the selected render layer, particularly when ‘Only render active layer' is enabled?

Yes, I think iuser->layer should be automatically set to the active render layer when "Only render active layer" is enabled. This means changing render_image_restore_layer() behavior.

Yes, I think iuser->layer should be automatically set to the active render layer when "Only render active layer" is enabled. This means changing render_image_restore_layer() behavior.

Thanks for the tip! I've got a working implementation now, but I'm not sure if it's the most efficient. I couldn't use render_get_active_layer(), since it seemed to be using the layer index corresponding to the full layer list on the list of only the rendered layers, which seems a bit strange? So it sometimes returns the wrong layer if not all layers are rendered yet. Right now, I'm getting the layer name from the list of all render layers, and then using that to find the string index in the rendered layer list, but that requires looping through both lists...
I'm also not sure how to check whether "Only render active layer" is used or not. I'm looking at RenderSettings_use_single_layer_get(), but it takes in a PointerRNA. Is there anything in RenderJob that holds that pointer? Thanks!