Skip to content

Commit

Permalink
config: update animation even if disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
vaxerski committed Jan 7, 2025
1 parent 830350a commit c143907
Showing 1 changed file with 21 additions and 23 deletions.
44 changes: 21 additions & 23 deletions src/config/ConfigManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2053,37 +2053,35 @@ std::optional<std::string> CConfigManager::handleAnimation(const std::string& co
if (enabledInt != 0 && enabledInt != 1)
return "invalid animation on/off state";

if (enabledInt) {
int64_t speed = -1;
int64_t speed = -1;

// speed
if (isNumber(ARGS[2], true)) {
speed = std::stof(ARGS[2]);
// speed
if (isNumber(ARGS[2], true)) {
speed = std::stof(ARGS[2]);

if (speed <= 0) {
speed = 1.f;
return "invalid speed";
}
} else {
speed = 10.f;
if (speed <= 0) {
speed = 1.f;
return "invalid speed";
}
} else {
speed = 10.f;
return "invalid speed";
}

std::string bezierName = ARGS[3];
m_AnimationTree.setConfigForNode(ANIMNAME, enabledInt, speed, ARGS[3], ARGS[4]);
std::string bezierName = ARGS[3];
m_AnimationTree.setConfigForNode(ANIMNAME, enabledInt, speed, ARGS[3], ARGS[4]);

if (!g_pAnimationManager->bezierExists(bezierName)) {
const auto PANIMNODE = m_AnimationTree.getConfig(ANIMNAME);
PANIMNODE->internalBezier = "default";
return "no such bezier";
}
if (!g_pAnimationManager->bezierExists(bezierName)) {
const auto PANIMNODE = m_AnimationTree.getConfig(ANIMNAME);
PANIMNODE->internalBezier = "default";
return "no such bezier";
}

if (ARGS[4] != "") {
auto ERR = g_pAnimationManager->styleValidInConfigVar(ANIMNAME, ARGS[4]);
if (ARGS[4] != "") {
auto ERR = g_pAnimationManager->styleValidInConfigVar(ANIMNAME, ARGS[4]);

if (ERR != "")
return ERR;
}
if (ERR != "")
return ERR;
}

return {};
Expand Down

0 comments on commit c143907

Please sign in to comment.