Page MenuHome

Unable to create group input/output sockets with python
Closed, ArchivedPublic


System Information
FreeBSD 9.2 amd64 Nvidia gt520

Blender Version
Broken: Blender 2.69
Worked: Blender 2.66

Short description of error
Using python I can create a group and add group input and output nodes but I can't add sockets to these nodes to connect anything to. I can create and connect other nodes within the group.

Exact steps for others to reproduce the error
In 2.66 the following script works, it creates a group, adds a node and connects the node to the group in/out sockets.

test_group ='testGroup', 'SHADER')'in_to_nodes','VALUE')'out_result','VALUE')

node_add ='MATH')[0], node_add.inputs[0])[0], test_group.outputs[0])

From 2.67 node groups started to be edited over the top of the nodes display, this introduced group input and output nodes. This would mean the script would be changed to

test_group ='testGroup', 'ShaderNodeTree')

group_inputs ='NodeGroupInput')

group_outputs ='NodeGroupOutput')

node_add ='ShaderNodeMath')
node_add.operation = 'ADD'

While that much works in python I can't get a new input or output socket created to make connections.

I expect to be the way to do this but it fails without error. does create sockets but on the wrong side showing an error - Undefined Socket Type

Manually created sockets appear to be available in test_group.inputs but also fails without error.

There is an operator bpy.ops.node.tree_socket_add() that will create sockets but it is only available when a node editor is in context.

Event Timeline

Shane Ambler (sambler) raised the priority of this task from to 90.
Shane Ambler (sambler) updated the task description. (Show Details)
Shane Ambler (sambler) edited a custom field.
Shane Ambler (sambler) changed the task status from Unknown Status to Archived.Dec 11 2013, 11:55 AM
Shane Ambler (sambler) claimed this task.

We found the missing link, use NodeSocketFloat instead of VALUE for'NodeSocketFloat','grpInput')'NodeSocketFloat','grpOutput')

Though it would be helpful if'VALUE','grpInput') provided some sort of error.