From 28c8e6b1fef6de535395cc8cbc7c66d5b0e32d79 Mon Sep 17 00:00:00 2001 From: Sam Hellawell Date: Fri, 5 Apr 2024 22:20:32 +0100 Subject: [PATCH] Cleanup loadRules method, smooth animation transitions game.rst docuemntation --- components/resource/animblendrulesmanager.cpp | 17 ++++++----------- docs/source/reference/modding/settings/game.rst | 11 +++++++++++ 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/components/resource/animblendrulesmanager.cpp b/components/resource/animblendrulesmanager.cpp index 7bfea70974..7f46079ea5 100644 --- a/components/resource/animblendrulesmanager.cpp +++ b/components/resource/animblendrulesmanager.cpp @@ -58,7 +58,7 @@ namespace Resource osg::ref_ptr AnimBlendRulesManager::loadRules(std::string_view path) { - const VFS::Path::Normalized normalizedPath = VFS::Path::Normalized(path); + const VFS::Path::Normalized normalizedPath(path); std::optional> obj = mCache->getRefFromObjectCacheOrNone(normalizedPath); if (obj.has_value()) { @@ -67,15 +67,7 @@ namespace Resource else { osg::ref_ptr blendRules = AnimBlendRules::fromFile(mVfs, normalizedPath); - if (blendRules == nullptr) - { - // No blend rules were found in VFS, cache a nullptr. - osg::ref_ptr nullRules = nullptr; - mCache->addEntryToObjectCache(normalizedPath, nullRules); - // To avoid confusion - never return blend rules with 0 rules - return nullRules; - } - else + if (blendRules) { // Blend rules were found in VFS, cache them. mCache->addEntryToObjectCache(normalizedPath, blendRules); @@ -83,7 +75,10 @@ namespace Resource } } - return nullptr; + // No blend rules were found in VFS, cache a nullptr. + osg::ref_ptr nullRules = nullptr; + mCache->addEntryToObjectCache(normalizedPath, nullRules); + return nullRules; } void AnimBlendRulesManager::reportStats(unsigned int frameNumber, osg::Stats* stats) const diff --git a/docs/source/reference/modding/settings/game.rst b/docs/source/reference/modding/settings/game.rst index 368401f5c5..a602fa99fe 100644 --- a/docs/source/reference/modding/settings/game.rst +++ b/docs/source/reference/modding/settings/game.rst @@ -541,3 +541,14 @@ In third person, the camera will sway along with the movement animations of the Enabling this option disables this swaying by having the player character move independently of its animation. This setting can be controlled in the Settings tab of the launcher. + +smooth animation transitions +--------------------------------- + +:Type: boolean +:Range: True/False +:Default: False + +Enabling this option uses smooth transitions between animations making them a lot less jarring. Also allows to load modded animation blending. + +This setting can be controlled in the Settings tab of the launcher.