PanteraPolnocy 2023-12-02 13:33:11 +01:00
commit 6a0cd2397b
2 changed files with 55 additions and 9 deletions

View File

@ -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))
{

View File

@ -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
{