A Collection is a function that starts multiple other functions simultaneously. Unlike Chasers which play functions sequentially, Collections run all member functions in parallel, making them perfect for creating complex lighting scenes from multiple components.
Collections maintain control over their member functions and can stop them when the collection stops, making them ideal for creating grouped presets.
// Add a function to the collectionbool addFunction(quint32 fid, int insertIndex = -1);// Remove a function from the collectionbool removeFunction(quint32 fid);// Get list of all functionsQList<quint32> functions() const;
A function cannot be added to a collection more than once. The collection also prevents adding itself to avoid circular references.
void postRun(MasterTimer* timer, QList<Universe*> universes) { // Stop only functions started by this collection foreach (quint32 fid, m_runningChildren) { Function *function = doc()->function(fid); function->stop(functionParent()); } m_runningChildren.clear(); m_intensityOverrideIds.clear();}
Collections only stop functions that they started. If a function was already running when the collection started, it will continue running after the collection stops.
Collections apply master intensity to all members:
int adjustAttribute(qreal fraction, int attributeId) { if (attributeId == Intensity) { // Update all running functions for (int i = 0; i < m_functions.count(); i++) { Function *function = doc()->function(m_functions.at(i)); function->adjustAttribute( getAttributeValue(Function::Intensity), m_intensityOverrideIds.at(i) ); } } return attributeId;}
The collection uses intensity overrides to control members without permanently changing their settings.
protected slots: // Called when a child function stops void slotChildStopped(quint32 fid) { m_runningChildren.remove(fid); } // Called when a child function starts void slotChildStarted(quint32 fid) { m_runningChildren << fid; }
The collection automatically stops when all children have stopped:
<Function Type="Collection" ID="15" Name="Main Scene"> <Step Number="0">1</Step> <!-- Scene ID 1 --> <Step Number="1">5</Step> <!-- EFX ID 5 --> <Step Number="2">10</Step> <!-- RGB Matrix ID 10 --> <Step Number="3">20</Step> <!-- Chaser ID 20 --></Function>
The “Step” tag name is misleading - these are not sequential steps but simultaneous functions. The Number attribute indicates order in the list, not execution order.
<Function Type="Collection" Name="Movement + Color"> <Step>10</Step> <!-- EFX for movement --> <Step>20</Step> <!-- Chaser for color --> <Step>30</Step> <!-- RGB Matrix for background --></Function>