Connections

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 :

Connections Diagram

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 :

connections

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 :

ButtleOFX_003

See you soon for an other article !

Advertisements

One thought on “Connections

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s