From c14390785745972903865c824fd324aa708f296a Mon Sep 17 00:00:00 2001 From: vaxerski Date: Tue, 7 Jan 2025 20:27:07 +0100 Subject: [PATCH] config: update animation even if disabled --- src/config/ConfigManager.cpp | 44 +++++++++++++++++------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index bbb3e68f..5839204f 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -2053,37 +2053,35 @@ std::optional 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 {};