Page MenuHome

Changing Renderlayer Compositor node Layer does not update enabled outputs until script is finished
Closed, ResolvedPublic

Description

System Information
GNU/Linux 64 bit (Fedora 23), Intel CPU, Nvidia GPU

Blender Version
Broken: 2.77.1 2af4c80
Worked: maybe never

Short description of error
If you add change a renderlayer node's scene layer, the enabled output sockets change to reflect the scene layer's enabled passes. But if you do this within a python script or function, this does not happen until *after* the script has finished running, making it extremely cumbersome to use this node in your script (scene layer passes are not 1 to 1 the same as node layer output names, e.g. Combined -> Image, Alpha, Object Index ->IndexOB etc.)

Exact steps for others to reproduce the error

  1. First download the included .blend
  2. Start Blender from a terminal so you can see the script output
  3. Now run the included test.py and look at the output.
  4. Note that both print_enabled_sockets() commands give the same enabled sockets, even though the layer has changed
  5. Note that the two renderlayers in the scene (A and B) have different passes

What I Expect to Happen

At least with some type of refreshing (note the overkill_update() function in the script) I would expect the output to change on the second print_enabled_sockets() command to reflect the renderlayer change.

Event Timeline

bassam kurdali (bassamk) set Type to Bug.
bassam kurdali (bassamk) created this task.
bassam kurdali (bassamk) raised the priority of this task from to Needs Triage by Developer.


I added a bpy.context.scene.node_tree.update_tag()
bpy.context.scene.update()
just in case, to the overkill_update() function. Same result.

Bastien Montagne (mont29) triaged this task as Confirmed, Medium priority.

Can confirm the issue, it comes from the fact that your newly added node has no output (ED_node_tag_update_nodetree is called from RNA update callback, but does nothing in case node is not connected somehow to output - i.e. node has no effect on result). And RenderLayer node has no update() callback registered either, afaict.

Not sure how to handle this, @Jeroen Bakker (jbakker), @Monique Dewanchand (mdewanchand), @Sergey Sharybin (sergey)?

@Bastien Montagne (mont29), ED_node_tag_update_nodetree updates nodetree itself (aka, executes the tree to get new result).

The actual issue here is that currently sockets gets hidden on _every_ _redraw_ of compositor. This is weak, but it is how it is. Tweaking render passes forces updates of hidden sockets, so guess it'll be fine to do same for layer in Image and Scene compositor nodes.

wow! thanks sergey and mont, that was an interesting/ difficult case!