diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2017-05-30 18:15:58 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2017-05-30 18:18:00 +0300 |
commit | 7b379313ded90b58422497bac5af5dfda440aeb8 (patch) | |
tree | 06840dc530e137e4c04739c3be10472c81f3ca8b /intern/cycles/blender/addon/ui.py | |
parent | 470d66397d579944d2cbc54e9596073015b4493e (diff) |
Bpy Extras: Port cycles node functions to new node_utils.py
Diffstat (limited to 'intern/cycles/blender/addon/ui.py')
-rw-r--r-- | intern/cycles/blender/addon/ui.py | 27 |
1 files changed, 2 insertions, 25 deletions
diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index c8d63daee5f..a8018e3824d 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -17,6 +17,7 @@ # <pep8 compliant> import bpy +from bpy_extras.node_utils import find_node_input, find_output_node from bpy.types import ( Panel, @@ -898,30 +899,6 @@ class CYCLES_OT_use_shading_nodes(Operator): return {'FINISHED'} -def find_node(material, nodetype): - if material and material.node_tree: - ntree = material.node_tree - - 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 - - return None - - -def find_node_input(node, name): - for input in node.inputs: - if input.name == name: - return input - - return None - - def panel_node_draw(layout, id_data, output_type, input_name): if not id_data.use_nodes: layout.operator("cycles.use_shading_nodes", icon='NODETREE') @@ -929,7 +906,7 @@ def panel_node_draw(layout, id_data, output_type, input_name): ntree = id_data.node_tree - node = find_node(id_data, output_type) + node = find_output_node(ntree, output_type) if not node: layout.label(text="No output node") else: |