Ejemplo n.º 1
0
void AssistPanel::SetEffectInfo(Effect* effect_, xLightsFrame* xlights_parent)
{
	if( mGridCanvas != nullptr )
    {
        mEffect = effect_;
        EffectLayer* layer = mEffect->GetParentEffectLayer();
        if (layer == nullptr) {
            static log4cpp::Category &logger_base = log4cpp::Category::getInstance(std::string("log_base"));
            logger_base.error("No layer found for effect %s", (const char *)mEffect->GetEffectName().c_str());
        }
        Element* elem = layer->GetParentElement();
        if (elem == nullptr) {
            static log4cpp::Category &logger_base = log4cpp::Category::getInstance(std::string("log_base"));
            logger_base.error("No element found for effect %s", (const char *)mEffect->GetEffectName().c_str());
        }
        std::string model_name = elem->GetModelName();
        mModel = xlights_parent->GetModel(model_name);
        if (mModel != nullptr && dynamic_cast<SubModelElement*>(elem) != nullptr) {
            Model *scls = mModel->GetSubModel(dynamic_cast<SubModelElement*>(elem)->GetName());
            if (scls != nullptr) {
                mModel = scls;
            }
        }
        if (mModel == nullptr) {
            static log4cpp::Category &logger_base = log4cpp::Category::getInstance(std::string("log_base"));
            logger_base.error("No model found for effect %s for model %s", (const char *)mEffect->GetEffectName().c_str(), (const char *)model_name.c_str());
        }
        RefreshEffect();
    }
}
Ejemplo n.º 2
0
void AssistPanel::SetEffectInfo(Effect* effect_, xLightsFrame* xlights_parent)
{
	if( mGridCanvas != nullptr )
    {
        mEffect = effect_;
        EffectLayer* layer = mEffect->GetParentEffectLayer();
        Element* elem = layer->GetParentElement();
        std::string model_name = elem->GetName();
        Model *cls = xlights_parent->GetModel(model_name);
        mGridCanvas->SetModel(cls);
        mGridCanvas->SetNumColumns(cls->BufferWi);
        mGridCanvas->SetNumRows(cls->BufferHt);
        mGridCanvas->SetEffect(mEffect);
    }
}