Ansariel 2023-11-30 18:34:56 +01:00
commit d5431cb570
4 changed files with 50 additions and 16 deletions

View File

@ -891,14 +891,12 @@ BOOL FloaterAO::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDr
*accept = ACCEPT_YES_MULTI;
if (item && drop)
{
if (AOEngine::instance().addAnimation(mSelectedSet, mSelectedState, item))
{
addAnimation(item->getName());
AOEngine::instance().addAnimation(mSelectedSet, mSelectedState, item);
addAnimation(item->getName());
// TODO: this would be the right thing to do, but it blocks multi drop
// before final release this must be resolved
reloading(true);
}
// TODO: this would be the right thing to do, but it blocks multi drop
// before final release this must be resolved
reloading(true);
}
}
else

View File

@ -1000,7 +1000,7 @@ void AOEngine::addSet(const std::string& name, inventory_func_type callback, boo
}
}
bool AOEngine::createAnimationLink(const AOSet* set, AOSet::AOState* state, const LLInventoryItem* item)
bool AOEngine::createAnimationLink(AOSet::AOState* state, const LLInventoryItem* item)
{
LL_DEBUGS("AOEngine") << "Asset ID " << item->getAssetUUID() << " inventory id " << item->getUUID() << " category id " << state->mInventoryUUID << LL_ENDL;
LL_DEBUGS("AOEngine") << "state " << state->mName << " item " << item->getName() << LL_ENDL;
@ -1019,7 +1019,7 @@ bool AOEngine::createAnimationLink(const AOSet* set, AOSet::AOState* state, cons
return true;
}
bool AOEngine::addAnimation(const AOSet* set, AOSet::AOState* state, const LLInventoryItem* item, bool reload)
void AOEngine::addAnimation(const AOSet* set, AOSet::AOState* state, const LLInventoryItem* item, bool reload)
{
AOSet::AOAnimation anim;
anim.mAssetUUID = item->getAssetUUID();
@ -1030,14 +1030,47 @@ bool AOEngine::addAnimation(const AOSet* set, AOSet::AOState* state, const LLInv
BOOL wasProtected = gSavedPerAccountSettings.getBOOL("LockAOFolders");
gSavedPerAccountSettings.setBOOL("LockAOFolders", FALSE);
createAnimationLink(set, state, item);
bool success = createAnimationLink(state, item);
gSavedPerAccountSettings.setBOOL("LockAOFolders", wasProtected);
if (reload)
if(success)
{
mTimerCollection.enableReloadTimer(true);
if (reload)
{
mTimerCollection.enableReloadTimer(true);
}
return;
}
// creating the animation link failed, so we need to create a new folder for this state -
// add the animation asset to the queue of animations to insert into the state - this takes
// care of multi animation drag & drop that come in faster than the viewer can create a new
// inventory folder
state->mAddQueue.push_back(item);
// if this is the first queued animation for this state, create the folder asyncronously
if(state->mAddQueue.size() == 1)
{
gInventory.createNewCategory(set->getInventoryUUID(), LLFolderType::FT_NONE, state->mName, [this, state, reload, wasProtected](const LLUUID &new_cat_id)
{
state->mInventoryUUID = new_cat_id;
gSavedPerAccountSettings.setBOOL("LockAOFolders", FALSE);
// add all queued animations to this state's folder and then clear the queue
for (const auto item : state->mAddQueue)
{
createAnimationLink(state, item);
}
state->mAddQueue.clear();
gSavedPerAccountSettings.setBOOL("LockAOFolders", wasProtected);
if (reload)
{
mTimerCollection.enableReloadTimer(true);
}
});
}
return true;
}
bool AOEngine::findForeignItems(const LLUUID& uuid) const
@ -2203,7 +2236,7 @@ void AOEngine::processImport(bool from_timer)
while (!state->mAnimations.empty())
{
LL_DEBUGS("AOEngine") << "linking animation " << state->mAnimations[animationIndex].mName << LL_ENDL;
if (createAnimationLink(mImportSet, state, gInventory.getItem(state->mAnimations[animationIndex].mInventoryUUID)))
if (createAnimationLink(state, gInventory.getItem(state->mAnimations[animationIndex].mInventoryUUID)))
{
LL_DEBUGS("AOEngine") << "link success, size " << state->mAnimations.size() << ", removing animation "
<< state->mAnimations[animationIndex].mName << " from import state" << LL_ENDL;

View File

@ -109,7 +109,7 @@ class AOEngine
void addSet(const std::string& name, inventory_func_type callback, bool reload = true);
bool removeSet(AOSet* set);
bool addAnimation(const AOSet* set, AOSet::AOState* state, const LLInventoryItem* item, bool reload = true);
void addAnimation(const AOSet* set, AOSet::AOState* state, const LLInventoryItem* item, bool reload = true);
bool removeAnimation(const AOSet* set, AOSet::AOState* state, S32 index);
void checkSitCancel();
void checkBelowWater(bool check_underwater);
@ -176,7 +176,7 @@ class AOEngine
void saveSet(const AOSet* set);
void saveState(const AOSet::AOState* state);
bool createAnimationLink(const AOSet* set, AOSet::AOState* state, const LLInventoryItem* item);
bool createAnimationLink(AOSet::AOState* state, const LLInventoryItem* item);
bool findForeignItems(const LLUUID& uuid) const;
void purgeFolder(const LLUUID& uuid) const;

View File

@ -27,6 +27,8 @@
#include "lleventtimer.h"
class LLInventoryItem;
class AOSet
: public LLEventTimer
{
@ -78,6 +80,7 @@ class AOSet
{
std::string mName;
std::vector<std::string> mAlternateNames;
std::vector<const LLInventoryItem*> mAddQueue;
LLUUID mRemapID;
bool mCycle;
bool mRandom;