diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2017-08-01 19:03:16 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2017-08-01 20:13:41 +0300 |
commit | c42c12939342bdccb98000c195503a78423ddc2c (patch) | |
tree | a60e272cbe1f4805e34e39f8f5118ec0fb743c77 /release/scripts/modules/bpy_extras | |
parent | 110d6832a88a3ebca0b0d4c3d996e545c2f5e1f1 (diff) |
Render: make Cycles and Evee support each other's output material nodes.
This changes the Cycles exporting and Cycles/Eevee UI code to support both
output material nodes, giving priority to the renderer native one. Still
missing is Eevee code to prefer the Eevee output node.
Diffstat (limited to 'release/scripts/modules/bpy_extras')
-rw-r--r-- | release/scripts/modules/bpy_extras/node_utils.py | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/release/scripts/modules/bpy_extras/node_utils.py b/release/scripts/modules/bpy_extras/node_utils.py index 3b8d4ad7c2a..9a2be5b9f68 100644 --- a/release/scripts/modules/bpy_extras/node_utils.py +++ b/release/scripts/modules/bpy_extras/node_utils.py @@ -32,16 +32,19 @@ def find_node_input(node, name): return None -# Return the output node to display in the UI -def find_output_node(ntree, nodetype): +# Return the output node to display in the UI. In case multiple node types are +# specified, node types earlier in the list get priority. +def find_output_node(ntree, nodetypes): if ntree: - active_output_node = None - for node in ntree.nodes: - if getattr(node, "type", None) == nodetype: - if getattr(node, "is_active_output", True): - return node - if not active_output_node: - active_output_node = node - return active_output_node + output_node = None + for nodetype in nodetypes: + for node in ntree.nodes: + if getattr(node, "type", None) == nodetype: + if getattr(node, "is_active_output", True): + return node + if not output_node: + output_node = node + if output_node: + return output_node return None |