You are here:

Layer layouts consists of nodes connected into chains. There are 2 types of chains: a lifeline chain and a sub-chain. A lifeline chain consists of nodes connected with a lifeline connection. It is shown with a lime green color and has square pins. Sub-chains, on the other hand, consist of all the nodes that are connected with other connection types, but if they are to be executed, their sub-chain needs to be connected to the main chain. In other words, if a sub-chain is to be executed, it needs to be connected to a node that has an active Lifeline input.

Let’s consider the layout below:

Execution flow simple

It consists of a Render to canvas node, a Run node and a Color to texture node. When the transport is on the layer and the layer is active, Lightact will fire Run node every frame. When this happens it will look for the next node that’s connected to the lifeline pin of the Run node. Obviously, it will find Render to canvas node. But before it will execute it, it will look for all the nodes that are connected to its inputs. It will find Color to texture node, so it will look if there are any nodes connected to its Resolution and Color inputs as well. Only after discovering that there aren’t any nodes connected to Color to texture’s inputs, it will execute it. The output of Color to texture node is a texture and this texture is grabbed by Render to canvas node and rendered to a canvas that’s selected in the node’s properties. So the order of node execution is:

Execution flow simple and enumerated

  1. Run node
  2. Color to texture node
  3. Render to canvas node

Now let’s add another node, for example a Random color node and connect it to the Color input of Color to texture node. Now, the order of execution is:

Execution flow intermediate and enumerated

  1. Run node
  2. Random color node
  3. Color to texture node
  4. Render to canvas node

So, if we assume, the connections are not making any u-turns, the execution flow can be explained with the following instructions:

  1. Find Lifeline origin: usually it’s a Run node, but there are other lifeline generator nodes too. More about this in the following chapters.
  2. Find the next node in the lifeline chain.
  3. Execute its subchain from left-to right.
  4. Execute the node and go back to step 2.

Let’s make another modification to our layout. Let’s add an If node and connect it between the Run node and Render to canvas node as shown below:

Execution flow with an if node

Similarly to before, Lightact will start the execution with Run node and look for the node that’s next in the lifeline chain. It will find an If node and because the Bool input is false it will look for the node that’s connected to its False output. As it won’t find any, it will stop with the execution. This layout doesn’t really do much, so let’s change this by checking the Bool input.

Execution flow with a chacked if node

Now, instead of looking for a node that’s connected to the False output of the If node, Lightact will look for the node that’s connected to its True output. It will find Render to canvas node, execute its subchain (Random color and Color to texture nodes) and then execute the Render to canvas node itself.

Previous Node connections
Next Flow control