bool EFX::copyFrom(const Function* function) { const EFX* efx = qobject_cast<const EFX*> (function); if (efx == NULL) return false; while (m_fixtures.isEmpty() == false) delete m_fixtures.takeFirst(); QListIterator <EFXFixture*> it(efx->m_fixtures); while (it.hasNext() == true) { EFXFixture* ef = new EFXFixture(this); ef->copyFrom(it.next()); m_fixtures.append(ef); } m_propagationMode = efx->m_propagationMode; for (int i = 0; i < efx->attributes().count(); i++) adjustAttribute(efx->attributes().at(i).m_value, i); m_isRelative = efx->m_isRelative; updateRotationCache(); m_xFrequency = efx->m_xFrequency; m_yFrequency = efx->m_yFrequency; m_xPhase = efx->m_xPhase; m_yPhase = efx->m_yPhase; m_algorithm = efx->m_algorithm; return Function::copyFrom(function); }
EFX::EFX(Doc* doc) : Function(doc, Function::EFX) { m_width = 127; m_height = 127; m_xOffset = 127; m_yOffset = 127; m_rotation = 0; m_startOffset = 0; updateRotationCache(); m_xFrequency = 2; m_yFrequency = 3; m_xPhase = M_PI / 2.0; m_yPhase = 0; m_propagationMode = Parallel; m_algorithm = EFX::Circle; setName(tr("New EFX")); m_fader = NULL; setDuration(20000); // 20s m_legacyHoldBus = Bus::invalid(); m_legacyFadeBus = Bus::invalid(); }
EFX::EFX(Doc* doc) : Function(doc, Function::EFXType) { m_isRelative = false; updateRotationCache(); m_xFrequency = 2; m_yFrequency = 3; m_xPhase = M_PI / 2.0; m_yPhase = 0; m_propagationMode = Parallel; m_algorithm = EFX::Circle; setName(tr("New EFX")); m_fader = NULL; setDuration(20000); // 20s m_legacyHoldBus = Bus::invalid(); m_legacyFadeBus = Bus::invalid(); registerAttribute(tr("Width"), Function::LastWins, 0.0, 127.0, 127.0); registerAttribute(tr("Height"), Function::LastWins, 0.0, 127.0, 127.0); registerAttribute(tr("Rotation"), Function::LastWins, 0.0, 359.0, 0.0); registerAttribute(tr("X Offset"), Function::LastWins, 0.0, 255.0, 127.0); registerAttribute(tr("Y Offset"), Function::LastWins, 0.0, 255.0, 127.0); registerAttribute(tr("Start Offset"), Function::LastWins, 0.0, 359.0, 0.0); }
void EFX::adjustAttribute(qreal fraction, int attributeIndex) { switch (attributeIndex) { case Intensity: { if (m_fader != NULL) m_fader->adjustIntensity(fraction); QListIterator <EFXFixture*> it(m_fixtures); while (it.hasNext() == true) { EFXFixture* ef = it.next(); ef->adjustIntensity(fraction); } } break; case Height: case Width: case XOffset: case YOffset: case Rotation: break; } Function::adjustAttribute(fraction, attributeIndex); if (attributeIndex == Rotation) updateRotationCache(); }
bool EFX::copyFrom(const Function* function) { const EFX* efx = qobject_cast<const EFX*> (function); if (efx == NULL) return false; while (m_fixtures.isEmpty() == false) delete m_fixtures.takeFirst(); QListIterator <EFXFixture*> it(efx->m_fixtures); while (it.hasNext() == true) { EFXFixture* ef = new EFXFixture(this); ef->copyFrom(it.next()); m_fixtures.append(ef); } m_propagationMode = efx->m_propagationMode; m_width = efx->m_width; m_height = efx->m_height; m_xOffset = efx->m_xOffset; m_yOffset = efx->m_yOffset; m_rotation = efx->m_rotation; m_startOffset = efx->m_startOffset; m_isRelative = efx->m_isRelative; updateRotationCache(); m_xFrequency = efx->m_xFrequency; m_yFrequency = efx->m_yFrequency; m_xPhase = efx->m_xPhase; m_yPhase = efx->m_yPhase; m_algorithm = efx->m_algorithm; return Function::copyFrom(function); }
EFX::EFX(Doc* doc) : Function(doc, Function::EFXType) , m_algorithm(EFX::Circle) , m_isRelative(false) , m_xFrequency(2) , m_yFrequency(3) , m_xPhase(M_PI / 2.0) , m_yPhase(0) , m_propagationMode(Parallel) , m_legacyFadeBus(Bus::invalid()) , m_legacyHoldBus(Bus::invalid()) { updateRotationCache(); setName(tr("New EFX")); setDuration(20000); // 20s registerAttribute(tr("Width"), Function::LastWins, 0.0, 127.0, 127.0); registerAttribute(tr("Height"), Function::LastWins, 0.0, 127.0, 127.0); registerAttribute(tr("Rotation"), Function::LastWins, 0.0, 359.0, 0.0); registerAttribute(tr("X Offset"), Function::LastWins, 0.0, 255.0, 127.0); registerAttribute(tr("Y Offset"), Function::LastWins, 0.0, 255.0, 127.0); registerAttribute(tr("Start Offset"), Function::LastWins, 0.0, 359.0, 0.0); }
void EFX::adjustAttribute(qreal fraction, int attributeIndex) { switch (attributeIndex) { case Intensity: { if (m_fader != NULL) m_fader->adjustIntensity(fraction); } break; case Height: case Width: case XOffset: case YOffset: case Rotation: break; } Function::adjustAttribute(fraction, attributeIndex); if (attributeIndex == Rotation) updateRotationCache(); }
void EFX::setRotation(int rot) { m_rotation = static_cast<int> (CLAMP(rot, 0, 359)); updateRotationCache(); emit changed(this->id()); }
void EFX::setRotation(int rot) { adjustAttribute(CLAMP(rot, 0, 359), Rotation); updateRotationCache(); emit changed(this->id()); }