[Bf-extensions-cvs] [3687f02a] master: Node Wrangler: correct handling of disabled sockets

Omar Ahmad noreply at git.blender.org
Thu Jun 27 17:24:44 CEST 2019


Commit: 3687f02a662d6c258cb72e36127cff1fb7fe3236
Author: Omar Ahmad
Date:   Thu Jun 27 17:22:48 2019 +0200
Branches: master
https://developer.blender.org/rBA3687f02a662d6c258cb72e36127cff1fb7fe3236

Node Wrangler: correct handling of disabled sockets

Differential Revision: https://developer.blender.org/D5123

===================================================================

M	node_wrangler.py

===================================================================

diff --git a/node_wrangler.py b/node_wrangler.py
index f82c1528..c3fbc507 100644
--- a/node_wrangler.py
+++ b/node_wrangler.py
@@ -547,6 +547,8 @@ draw_color_sets = {
 def is_cycles_or_eevee(context):
     return context.scene.render.engine in {'CYCLES', 'BLENDER_EEVEE'}
 
+def is_visible_socket(socket):
+    return not socket.hide and socket.enabled
 
 def nice_hotkey_name(punc):
     # convert the ugly string name into the actual character
@@ -1622,7 +1624,7 @@ class NWEmissionViewer(Operator, NWBase):
             if active:
                 if (active.name != "Emission Viewer") and (active.type not in output_types) and not in_group:
                     for out in active.outputs:
-                        if not out.hide:
+                        if is_visible_socket(out):
                             valid = True
                             break
             if valid:
@@ -1658,7 +1660,7 @@ class NWEmissionViewer(Operator, NWBase):
                 out_i = None
                 valid_outputs = []
                 for i, out in enumerate(active.outputs):
-                    if not out.hide:
+                    if is_visible_socket(out):
                         valid_outputs.append(i)
                 if valid_outputs:
                     out_i = valid_outputs[0]  # Start index of node's outputs
@@ -3211,7 +3213,7 @@ class NWLinkToOutputNode(Operator, NWBase):
         if nw_check(context):
             if context.active_node is not None:
                 for out in context.active_node.outputs:
-                    if not out.hide:
+                    if is_visible_socket(out):
                         valid = True
                         break
         return valid
@@ -3246,11 +3248,11 @@ class NWLinkToOutputNode(Operator, NWBase):
             output_node.location.y = active.location.y
         if (output_node and active.outputs):
             for i, output in enumerate(active.outputs):
-                if not output.hide:
+                if is_visible_socket(output):
                     output_index = i
                     break
             for i, output in enumerate(active.outputs):
-                if output.type == output_node.inputs[0].type and not output.hide:
+                if output.type == output_node.inputs[0].type and is_visible_socket(output):
                     output_index = i
                     break



More information about the Bf-extensions-cvs mailing list