diff --git a/xLights/effects/StateEffect.cpp b/xLights/effects/StateEffect.cpp index ffacd5f589..5679fbe713 100644 --- a/xLights/effects/StateEffect.cpp +++ b/xLights/effects/StateEffect.cpp @@ -200,6 +200,14 @@ static const std::string &findKey(const std::map &m, c return v->second; } +static std::list const& findNodeKey(std::map> const& m, std::string const& k) { + const auto& v = m.find(k); + if (v == m.end()) { + return {}; + } + return v->second; +} + void StateEffect::RenderState(RenderBuffer& buffer, SequenceElements* elements, const std::string& faceDefinition, const std::string& Phoneme, const std::string& trackName, const std::string& mode, const std::string& colourmode) { @@ -460,9 +468,8 @@ void StateEffect::RenderState(RenderBuffer& buffer, color = xlColor(cname); } } - if (type == 1) { - for (const auto it : findKey(definitionSi, statename)) { + for (const auto it : findNodeKey(model_info->GetStateInfoNodes().at(definition), statename)) { buffer.SetNodePixel(it, color, true); } } else {