Hi !
As you can see in the previous articles, an other recent important point on the application is the creation, management and display of the connections between the nodes.
For a better understanding, here is a simplified diagram, limited to the connection mechanism :
You can see that a connection is defined by two “clips”, the name we gave to the input and output points of the nodes. Each clip is identified with :
- nodeName : the name (= identifier) of the node he belongs to
- port : it’s a string indicating if the clip is an “input” or an “output”
- clipNumber : the number of the clip, usefull for the nodes with several sources. For an output clip, this property is always equal to 1 because a node can have only one output.
In fact, there isn’t any direct link between the node object and the connection object, which just knows the identifier of the correspondind node, so the connection doesn’t have a direct access to the node’s coordinates for example. It’s why the clip object also supplies it’s coordinates, updated each time the node is moved. Then the connection is able to expose the right coordinates to the QML view.
Concerning the display of the connections, there isn’t any Line or Curve type in QML, so we had to create a custom line type. This is a QdeclarativeItem written in python and allowing to draw a line between two points by rewriting the method paint().
Here is the result :
Thanks to signals between the data core, the wrappers and the QML view, all connections are updated in real time when a node is moved.
In order to improve the connections’ appearance, we are planning to replace the line items by Bézier curves, maybe using the QML object Canvas. This is what we have now :
See you soon for an other article !