void ezParticleAction::UpdateState() { if (m_Type == ActionType::PauseEffect) { SetCheckable(true); SetChecked(m_pEffectDocument->GetSimulationPaused()); } if (m_Type == ActionType::AutoRestart) { SetCheckable(true); SetChecked(m_pEffectDocument->GetAutoRestart()); } if (m_Type == ActionType::SimulationSpeed) { SetCheckable(true); SetChecked(m_pEffectDocument->GetSimulationSpeed() == m_fSimSpeed); } if (m_Type == ActionType::RenderVisualizers) { SetCheckable(true); SetChecked(m_pEffectDocument->GetRenderVisualizers()); } }
ezParticleAction::ezParticleAction(const ezActionContext& context, const char* szName, ezParticleAction::ActionType type, float fSimSpeed) : ezButtonAction(context, szName, false, "") { m_Type = type; m_fSimSpeed = fSimSpeed; m_pEffectDocument = const_cast<ezParticleEffectAssetDocument*>(static_cast<const ezParticleEffectAssetDocument*>(context.m_pDocument)); m_pEffectDocument->m_Events.AddEventHandler(ezMakeDelegate(&ezParticleAction::EffectEventHandler, this)); switch (m_Type) { case ActionType::PauseEffect: SetIconPath(":/EditorPluginParticle/Icons/Pause16.png"); break; case ActionType::RestartEffect: SetIconPath(":/EditorPluginParticle/Icons/Restart16.png"); break; case ActionType::AutoRestart: SetIconPath(":/EditorPluginParticle/Icons/Loop16.png"); break; case ActionType::RenderVisualizers: SetCheckable(true); SetIconPath(":/EditorFramework/Icons/Visualizers16.png"); SetChecked(m_pEffectDocument->GetRenderVisualizers()); break; } UpdateState(); }
TabButton::TabButton(const QString &text, QWidget *pParent) :Button(pParent), m_Text(text) { SetCheckable(true); setFixedSize(97, 25); // m_HoveringGradient = QLinearGradient(rect().topLeft(), rect().bottomLeft()); m_HoveringGradient.setColorAt(1.0, QColor(0, 200, 0, 10)); m_HoveringGradient.setColorAt(0, QColor(0, 200, 0, 120)); // m_PressingGradient = QLinearGradient(rect().topLeft(), rect().bottomLeft()); m_PressingGradient.setColorAt(1.0, QColor(10, 200, 10, 10)); m_PressingGradient.setColorAt(0, QColor(10, 200, 10, 120)); // m_CheckedGradient = QLinearGradient(rect().topLeft(), rect().bottomLeft()); m_CheckedGradient.setColorAt(1.0, QColor(200, 10, 10, 10)); m_CheckedGradient.setColorAt(0, QColor(200, 10, 10, 120)); }