Python Nodes API: transferring data between nodes with sockets

I’m beginning development work on a scientific visualisation and analysis extension for Blender 2.70 using the PyNodes API (creating a custom NodeTree). I’m having trouble choosing the best way to transfer data between nodes, which I haven’t seen documented consistently anywhere.

I can think of two options, neither of which seem satisfactory:

  • Accessing input socket links from the node itself on each update, for which purpose I’d have to create a dummy “input socket” class with no associated properties which seems a little hacky (although I’ve seen dummy input sockets used in blendgraph)
  • Traversing the NodeTree links list, copying input socket data to their respective output sockets and updating nodes sequentially

Is there a specific method for data transfer between sockets that the API is intended for? I haven’t managed to find any definitive examples so far.

Cheers!
Varvara

The pynodes api is pure ui, you have to define everything else yourself. View is as source code that you compile into a program.

Aaahh, thanks, that makes a lot more sense. I was a little confused with the way it was used in some other sources. Should have suspected I was missing something obvious.

Aahh, thanks, that makes a lot more sense. I was a little confused by the way it was used in some other sources. Should have suspected I was missing something obvious.

Is there a specific method for data transfer between sockets that the API is intended for?

I took the polling approach. When a node is updated you need to examine the input sockets. If they are linked then you need to fetch the from_socket from the input link and grab the default_value from the linked node.

So I am never pushing data through the system, only pulling when updated.