I'm trying to get a list of currently activated render passes for a view layer.

For a scene 'Scene' and a view layer labelled 'my_vl', I can query individual pass status by returning True or False (e.g. the normal pass) like this:




But is there a way to return a list of activated passes?

(I assume the Render Layers compositing node queries the passes to activate its outputs, but I can't figure out how.)

I found this update_render_passes method, but I'm not familiar with its purpose or useage:


..and I get nothing in the console after running it as above.


I am not sure if there is a better method to do this but....

You can test all of the "use_pass_****" attribute in view-layer (and also eevee, cycles):

    for attr in dir(C.view_layer)
    if attr.startswith("use_pass") and getattr(C.view_layer, attr) == True
]  # -> ['use_pass_combined', 'use_pass_mist', 'use_pass_normal', 'use_pass_z']

And eevee-only pass:

    for attr in dir(C.view_layer.eevee)
    if attr.startswith("use_pass") and getattr(C.view_layer.eevee, attr) == True
]  # -> ['use_pass_volume_scatter', 'use_pass_volume_transmittance']

After seeking in Render Layer node, there is a outputs attribute contain different outputs that a node can potentially have. And each output can be enabled by attribute enable:

enter image description here

    for key, output
    in C.scene.node_tree.nodes["Render Layers"].outputs.items()
    if getattr(output, 'enabled', False)
]  # -> ['Image', 'Alpha', 'Depth', 'Mist', 'Normal']
  • 1
    $\begingroup$ Thanks for the suggestions. Your use of list comprehension is elegant, and will improve what I have currently. However, passes like the denoise passes aren't caught by the 'use_pass' or other common term. I am curious if there is a more direct method to query the activated passes (as labeled on the Render Layer node outputs). $\endgroup$ – nodster Sep 4 '20 at 20:30
  • $\begingroup$ I update the method and it should find every node output inside render layer. But it's kind of unlink between two object from UI properties panel and the node tree. Not sure if there is a linked bl_id for it. $\endgroup$ – HikariTW Sep 5 '20 at 1:12
  • $\begingroup$ This works perfectly! Thank you! One question: for the getattr arguments, what is the 'False' component doing? (This method seems to work with just the 'output' and 'enabled' arguments - omitting 'False'.) $\endgroup$ – nodster Sep 6 '20 at 1:14
  • $\begingroup$ @nodster It should work but due to the complexity of Blender implementation, using a explicit default value is convenient. getattr — Python 3.8.5 documentation $\endgroup$ – HikariTW Sep 6 '20 at 5:47
  • $\begingroup$ Ah! Thanks for the explanation and the link. Your help is greatly appreciated! $\endgroup$ – nodster Sep 6 '20 at 7:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.