From 7266a60c16dd801fe6d2cf1988edab08e580e3f9 Mon Sep 17 00:00:00 2001 From: vinymayan Date: Sat, 30 Aug 2025 19:22:49 -0300 Subject: [PATCH 1/2] Added reload animations Add an api call to reload animations mod config --- src/API/OpenAnimationReplacerAPI-Animations.h | 6 ++++++ src/Jobs.cpp | 4 ++++ src/Jobs.h | 5 +++++ src/ModAPI.cpp | 4 ++++ src/ModAPI.h | 1 + src/OpenAnimationReplacer.cpp | 17 +++++++++++++++++ src/OpenAnimationReplacer.h | 1 + src/UI/UIMain.cpp | 8 ++++++++ 8 files changed, 46 insertions(+) diff --git a/src/API/OpenAnimationReplacerAPI-Animations.h b/src/API/OpenAnimationReplacerAPI-Animations.h index 53dde72..c5e1af4 100644 --- a/src/API/OpenAnimationReplacerAPI-Animations.h +++ b/src/API/OpenAnimationReplacerAPI-Animations.h @@ -43,6 +43,12 @@ namespace OAR_API::Animations /// /// The refr to clear related condition state data for. virtual void ClearConditionStateData(RE::TESObjectREFR* a_refr) noexcept = 0; + + /// + /// Reloads all animations and mod configurations. + /// + virtual void ReloadAnimations() noexcept = 0; + }; using IAnimationsInterface = IAnimationsInterface1; diff --git a/src/Jobs.cpp b/src/Jobs.cpp index 1b5bf86..31ed661 100644 --- a/src/Jobs.cpp +++ b/src/Jobs.cpp @@ -27,4 +27,8 @@ namespace Jobs } } } + void ReloadAnimationsJob::Run() + { + OpenAnimationReplacer::GetSingleton().ReloadAnimations(); + } } diff --git a/src/Jobs.h b/src/Jobs.h index dc711a7..7b5454c 100644 --- a/src/Jobs.h +++ b/src/Jobs.h @@ -201,4 +201,9 @@ namespace Jobs replacerMod->RemoveConditionPreset(conditionPresetName); } }; + + struct ReloadAnimationsJob : GenericJob + { + void Run() override; + }; } diff --git a/src/ModAPI.cpp b/src/ModAPI.cpp index 0044520..cc20b5c 100644 --- a/src/ModAPI.cpp +++ b/src/ModAPI.cpp @@ -47,6 +47,10 @@ namespace OAR_API { OpenAnimationReplacer::GetSingleton().ClearConditionStateDataForRefr(a_refr); } + void AnimationsInterface::ReloadAnimations() noexcept + { + OpenAnimationReplacer::GetSingleton().QueueJob(); + } } namespace Conditions diff --git a/src/ModAPI.h b/src/ModAPI.h index 7fa2457..ea07481 100644 --- a/src/ModAPI.h +++ b/src/ModAPI.h @@ -21,6 +21,7 @@ namespace OAR_API [[nodiscard]] ReplacementAnimationInfo GetCurrentReplacementAnimationInfo(RE::hkbClipGenerator* a_clipGenerator) noexcept override; void ClearConditionStateData(RE::hkbClipGenerator* a_clipGenerator) noexcept override; void ClearConditionStateData(RE::TESObjectREFR* a_refr) noexcept override; + void ReloadAnimations() noexcept override; private: AnimationsInterface() = default; diff --git a/src/OpenAnimationReplacer.cpp b/src/OpenAnimationReplacer.cpp index cde03e0..33dbd9a 100644 --- a/src/OpenAnimationReplacer.cpp +++ b/src/OpenAnimationReplacer.cpp @@ -691,6 +691,23 @@ void OpenAnimationReplacer::ForEachSortedReplacerMod(const std::function& a_func) const; void ForEachReplacerMod(const std::function& a_func) const; void ForEachSortedReplacerMod(const std::function& a_func) const; + void ReloadAnimations(); void SetSynchronizedClipsIDOffset(RE::hkbCharacterStringData* a_stringData, uint16_t a_offset); [[nodiscard]] uint16_t GetSynchronizedClipsIDOffset(RE::hkbCharacterStringData* a_stringData) const; diff --git a/src/UI/UIMain.cpp b/src/UI/UIMain.cpp index 844ea94..265a826 100644 --- a/src/UI/UIMain.cpp +++ b/src/UI/UIMain.cpp @@ -596,6 +596,14 @@ namespace UI } ImGui::SameLine(); UICommon::HelpMarker("Enable to increase the animation limit to double the default value. Should generally work fine, but I might have missed some places to patch in the game code so this is still considered to be experimental. There's no benefit in enabling this if you're not going over the limit."); + ImGui::Spacing(); + ImGui::Separator(); + + if (ImGui::Button("Reload animations")) { + OpenAnimationReplacer::GetSingleton().QueueJob(); + } + ImGui::SameLine(); + UICommon::HelpMarker("Reload all animations mod config"); } ImGui::End(); From 7d346ebbcc1405773e896e9116e6c093fc154e64 Mon Sep 17 00:00:00 2001 From: vinymayan Date: Sat, 30 Aug 2025 22:24:39 +0000 Subject: [PATCH 2/2] =?UTF-8?q?style:=20=F0=9F=8E=A8=20apply=20clang-forma?= =?UTF-8?q?t=20changes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/API/OpenAnimationReplacerAPI-Animations.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/API/OpenAnimationReplacerAPI-Animations.h b/src/API/OpenAnimationReplacerAPI-Animations.h index c5e1af4..1d57960 100644 --- a/src/API/OpenAnimationReplacerAPI-Animations.h +++ b/src/API/OpenAnimationReplacerAPI-Animations.h @@ -48,7 +48,6 @@ namespace OAR_API::Animations /// Reloads all animations and mod configurations. /// virtual void ReloadAnimations() noexcept = 0; - }; using IAnimationsInterface = IAnimationsInterface1;