config: update animation even if disabled

This commit is contained in:
Vaxry 2025-01-07 20:27:07 +01:00
parent 830350a1f7
commit c143907857

View file

@ -2053,37 +2053,35 @@ std::optional<std::string> CConfigManager::handleAnimation(const std::string& co
if (enabledInt != 0 && enabledInt != 1) if (enabledInt != 0 && enabledInt != 1)
return "invalid animation on/off state"; return "invalid animation on/off state";
if (enabledInt) { int64_t speed = -1;
int64_t speed = -1;
// speed // speed
if (isNumber(ARGS[2], true)) { if (isNumber(ARGS[2], true)) {
speed = std::stof(ARGS[2]); speed = std::stof(ARGS[2]);
if (speed <= 0) { if (speed <= 0) {
speed = 1.f; speed = 1.f;
return "invalid speed";
}
} else {
speed = 10.f;
return "invalid speed"; return "invalid speed";
} }
} else {
speed = 10.f;
return "invalid speed";
}
std::string bezierName = ARGS[3]; std::string bezierName = ARGS[3];
m_AnimationTree.setConfigForNode(ANIMNAME, enabledInt, speed, ARGS[3], ARGS[4]); m_AnimationTree.setConfigForNode(ANIMNAME, enabledInt, speed, ARGS[3], ARGS[4]);
if (!g_pAnimationManager->bezierExists(bezierName)) { if (!g_pAnimationManager->bezierExists(bezierName)) {
const auto PANIMNODE = m_AnimationTree.getConfig(ANIMNAME); const auto PANIMNODE = m_AnimationTree.getConfig(ANIMNAME);
PANIMNODE->internalBezier = "default"; PANIMNODE->internalBezier = "default";
return "no such bezier"; return "no such bezier";
} }
if (ARGS[4] != "") { if (ARGS[4] != "") {
auto ERR = g_pAnimationManager->styleValidInConfigVar(ANIMNAME, ARGS[4]); auto ERR = g_pAnimationManager->styleValidInConfigVar(ANIMNAME, ARGS[4]);
if (ERR != "") if (ERR != "")
return ERR; return ERR;
}
} }
return {}; return {};