From c42c12939342bdccb98000c195503a78423ddc2c Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 1 Aug 2017 18:03:16 +0200 Subject: 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. --- release/scripts/modules/bpy_extras/node_utils.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'release/scripts/modules/bpy_extras/node_utils.py') 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 -- cgit v1.2.3