Page MenuHome

Node group inputs and outputs can have identical names
Closed, InvalidPublic

Description

Blender Version
Broken: Blender 2.62 or higher (probably earlier)

Short description of error
Node group input and output socket names are allowed to be identical. This is against the normal action of suffixing duplicate names with a numerical sequence.

Exact steps for others to reproduce the error
In python --

test_group = bpy.data.node_groups.new('testGroup', 'ShaderNodeTree')
test_group.inputs.new('NodeSocketFloat','test')
test_group.inputs.new('NodeSocketInt','test')

for node_in in test_group.inputs: print(node_in.name)

In gui -- create a node group and tab into group edit mode. In the Interface properties click the + button to add a new input or output several times - each will have the same name.

Details

Type
Bug

Event Timeline

Shane Ambler (sambler) updated the task description. (Show Details)
Shane Ambler (sambler) raised the priority of this task from to Needs Triage by Developer.
Shane Ambler (sambler) set Type to Bug.

Node names are indeed not required to be unique currently. This is not so convenient for python scripting and lookups by name, and I don't mind if the design changes, but this is not considered a bug.

Brecht Van Lommel (brecht) claimed this task.

Yes, this is a bit annoying. I had changed this when implementing python nodes so it would use the unique identifier string instead. These are an optional argument when creating a socket and readable as socket.identifier, they can be used to reliably identify a socket other than by index (used in node groups to replace the previous messy "own_index"/"to_index"). However, this caused old scripts to break and is yet another API change to infuriate users, so reverted the standard lookup key back to using the ambiguous names.

If needed you can just write your own search function based on identifiers instead:

def find_input(node, identifier):
  for socket in node.inputs:
    if socket.identifier == identifier:
      return socket