Skip to content

Commit

Permalink
fix state effect
Browse files Browse the repository at this point in the history
  • Loading branch information
computergeek1507 committed Apr 12, 2024
1 parent 93cf9db commit 5e5c541
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions xLights/effects/StateEffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,14 @@ static const std::string &findKey(const std::map<std::string, std::string> &m, c
return v->second;
}

static std::list<int> const& findNodeKey(std::map<std::string, std::list<int>> 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) {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 5e5c541

Please sign in to comment.