I would like to implement a nodal-interface, basically a DAG where each node performs an operation on it's input connections, and outputs something (which you can connect to another node)
Some example applications:
- Apples "Shake" - screenshot
- The Foundrys "Nuke" - screenshot
- MindNode - screenshot
- vvvv - screenshots
- Quartz Composer - screenshot
As a first goal, I would like to have an graphical application with only 2 nodes. A "number" which simply outputs a fixed number, and an "Add" node, which takes two inputs and outputs the sum of the two.
As people have answered so-far, I have a rough idea of how to represent the data in code, for example in Python'y looking pseudo-code:
class Number:
def __init__(self, value):
self.value = value
def eval(self):
return self.value
class Add:
def __init__(self, input1, input2):
self.input1 = input1
self.input2 = input2
def eval(self):
return self.input1.eval() + self.input2.eval()
a = Number(20)
b = Number(72)
adder = Add(a, b)
print adder.eval()
How would I got about wrapping a custom GUI around this? Something like the following, but slightly less hand-drawn!
Where would I begin? I currently plan to write it in Objective-C/Cocoa, although I'm more than open to suggestions for other languages.