From 5e5c54113a93d48e65fc0b9a5d62975298ecdddf Mon Sep 17 00:00:00 2001 From: Scott Hanson Date: Fri, 12 Apr 2024 18:40:11 -0400 Subject: [PATCH] fix state effect --- xLights/effects/StateEffect.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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 {