From a08e50354f51173a209ca89a1ab0d2a085ed924c Mon Sep 17 00:00:00 2001 From: Zi Ree Date: Sat, 2 Dec 2023 07:54:55 +0100 Subject: [PATCH] FIRE-33300 - FS AO doesn't load animations on login --- indra/newview/aoengine.cpp | 43 +++++++++++++++++++++++++++++++------- indra/newview/aoset.cpp | 21 ++++++++++++++++++- 2 files changed, 55 insertions(+), 9 deletions(-) diff --git a/indra/newview/aoengine.cpp b/indra/newview/aoengine.cpp index 9373ed525a..f128cabe7d 100644 --- a/indra/newview/aoengine.cpp +++ b/indra/newview/aoengine.cpp @@ -911,7 +911,25 @@ void AOEngine::cycle(eCycleMode cycleMode) state->mCurrentAnimation = 0; } } - animation = state->mAnimations[state->mCurrentAnimation].mAssetUUID; + + AOSet::AOAnimation& anim = state->mAnimations[state->mCurrentAnimation]; + + if (anim.mAssetUUID.isNull()) + { + LL_DEBUGS("AOEngine") << "Asset UUID for cycled animation " << anim.mName << " not yet known, try to find it." << LL_ENDL; + + if(LLViewerInventoryItem* item = gInventory.getItem(anim.mInventoryUUID) ; item) + { + LL_DEBUGS("AOEngine") << "Found asset UUID for cycled animation: " << item->getAssetUUID() << " - Updating AOAnimation.mAssetUUID" << LL_ENDL; + anim.mAssetUUID = item->getAssetUUID(); + } + else + { + LL_DEBUGS("AOEngine") << "Inventory UUID " << anim.mInventoryUUID << " for cycled animation " << anim.mName << " still returns no asset." << LL_ENDL; + } + } + + animation = anim.mAssetUUID; } // don't do anything if the animation didn't change @@ -1308,15 +1326,17 @@ void AOEngine::reloadStateAnimations(AOSet::AOState* state) << " asset " << item->getAssetUUID() << LL_ENDL; AOSet::AOAnimation anim; - anim.mAssetUUID = item->getAssetUUID(); - LLViewerInventoryItem* linkedItem = item->getLinkedItem(); - if (!linkedItem) + anim.mName = item->LLInventoryItem::getName(); + anim.mInventoryUUID = item->getLinkedUUID(); + + anim.mAssetUUID = LLUUID::null; + + // if we can find the original animation already right here, save its asset ID, otherwise this will + // be tried again in AOSet::getAnimationForState() and/or AOEngine::cycle() + if (item->getLinkedItem()) { - LL_WARNS("AOEngine") << "linked item for link " << item->LLInventoryItem::getName() << " not found (broken link). Skipping." << LL_ENDL; - continue; + anim.mAssetUUID = item->getAssetUUID(); } - anim.mName = linkedItem->LLInventoryItem::getName(); - anim.mInventoryUUID = item->getUUID(); S32 sortOrder; if (!LLStringUtil::convertToS32(item->LLInventoryItem::getDescription(), sortOrder)) @@ -1365,6 +1385,13 @@ void AOEngine::update() return; } + if (!gInventory.isCategoryComplete(mAOFolder)) + { + LL_DEBUGS("AOEngine") << "#AO folder hasn't fully fetched yet, try again next timer tick." << LL_ENDL; + gInventory.fetchDescendentsOf(mAOFolder); + return; + } + // move everything that's not an animation link to "lost and found" if (findForeignItems(mAOFolder)) { diff --git a/indra/newview/aoset.cpp b/indra/newview/aoset.cpp index e08a8ffe69..52ab2a07de 100644 --- a/indra/newview/aoset.cpp +++ b/indra/newview/aoset.cpp @@ -27,6 +27,7 @@ #include "aoengine.h" #include "aoset.h" #include "llanimationstates.h" +#include "llinventorymodel.h" AOSet::AOSet(const LLUUID inventoryID) : LLEventTimer(10000.0f), @@ -190,7 +191,25 @@ const LLUUID& AOSet::getAnimationForState(AOState* state) const LL_DEBUGS("AOEngine") << "cycle " << state->mCurrentAnimation << " of " << numOfAnimations << LL_ENDL; } } - return state->mAnimations[state->mCurrentAnimation].mAssetUUID; + + AOAnimation& anim = state->mAnimations[state->mCurrentAnimation]; + + if (anim.mAssetUUID.isNull()) + { + LL_DEBUGS("AOEngine") << "Asset UUID for chosen animation " << anim.mName << " not yet known, try to find it." << LL_ENDL; + + if(LLViewerInventoryItem* item = gInventory.getItem(anim.mInventoryUUID) ; item) + { + LL_DEBUGS("AOEngine") << "Found asset UUID for chosen animation: " << item->getAssetUUID() << " - Updating AOAnimation.mAssetUUID" << LL_ENDL; + anim.mAssetUUID = item->getAssetUUID(); + } + else + { + LL_DEBUGS("AOEngine") << "Inventory UUID " << anim.mInventoryUUID << " for chosen animation " << anim.mName << " still returns no asset." << LL_ENDL; + } + } + + return anim.mAssetUUID; } else {