summaryrefslogtreecommitdiff
path: root/indra/newview/llagentwearables.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llagentwearables.cpp')
-rwxr-xr-xindra/newview/llagentwearables.cpp819
1 files changed, 253 insertions, 566 deletions
diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index fa810aac76..890fc9a8d9 100755
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -30,7 +30,6 @@
#include "llaccordionctrltab.h"
#include "llagent.h"
#include "llagentcamera.h"
-#include "llagentwearablesfetch.h"
#include "llappearancemgr.h"
#include "llcallbacklist.h"
#include "llfloatersidepanelcontainer.h"
@@ -39,6 +38,7 @@
#include "llinventoryfunctions.h"
#include "llinventoryobserver.h"
#include "llinventorypanel.h"
+#include "lllocaltextureobject.h"
#include "llmd5.h"
#include "llnotificationsutil.h"
#include "lloutfitobserver.h"
@@ -49,6 +49,7 @@
#include "llvoavatarself.h"
#include "llviewerwearable.h"
#include "llwearablelist.h"
+#include "llfloaterperms.h"
#include <boost/scoped_ptr.hpp>
@@ -62,15 +63,48 @@ using namespace LLAvatarAppearanceDefines;
// Callback to wear and start editing an item that has just been created.
void wear_and_edit_cb(const LLUUID& inv_item)
- {
- if (inv_item.isNull()) return;
+{
+ if (inv_item.isNull()) return;
+
+ LLViewerInventoryItem* item = gInventory.getItem(inv_item);
+ if (!item) return;
- // Request editing the item after it gets worn.
- gAgentWearables.requestEditingWearable(inv_item);
+ LLPermissions perm = item->getPermissions();
+ perm.setMaskNext(LLFloaterPerms::getNextOwnerPerms("Wearables"));
+ perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Wearables"));
+ perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Wearables"));
+ item->setPermissions(perm);
+
+ item->updateServer(FALSE);
+ gInventory.updateItem(item);
+ gInventory.notifyObservers();
+
+ // Request editing the item after it gets worn.
+ gAgentWearables.requestEditingWearable(inv_item);
+
+ // Wear it.
+ LLAppearanceMgr::instance().wearItemOnAvatar(inv_item,true);
+}
- // Wear it.
- LLAppearanceMgr::instance().wearItemOnAvatar(inv_item);
+void wear_cb(const LLUUID& inv_item)
+{
+ if (!inv_item.isNull())
+ {
+ LLViewerInventoryItem* item = gInventory.getItem(inv_item);
+ if (item)
+ {
+ LLPermissions perm = item->getPermissions();
+ perm.setMaskNext(LLFloaterPerms::getNextOwnerPerms("Wearables"));
+ perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Wearables"));
+ perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Wearables"));
+ item->setPermissions(perm);
+
+ item->updateServer(FALSE);
+ gInventory.updateItem(item);
+ gInventory.notifyObservers();
+ }
}
+}
///////////////////////////////////////////////////////////////////////////////
@@ -90,49 +124,42 @@ void checkWearableAgainstInventory(LLViewerWearable *wearable)
{
if (!item->isWearableType())
{
- llwarns << "wearable associated with non-wearable item" << llendl;
+ LL_WARNS() << "wearable associated with non-wearable item" << LL_ENDL;
}
if (item->getWearableType() != wearable->getType())
{
- llwarns << "type mismatch: wearable " << wearable->getName()
+ LL_WARNS() << "type mismatch: wearable " << wearable->getName()
<< " has type " << wearable->getType()
<< " but inventory item " << item->getName()
- << " has type " << item->getWearableType() << llendl;
+ << " has type " << item->getWearableType() << LL_ENDL;
}
}
else
{
- llwarns << "wearable inventory item not found" << wearable->getName()
- << " itemID " << wearable->getItemID().asString() << llendl;
+ LL_WARNS() << "wearable inventory item not found" << wearable->getName()
+ << " itemID " << wearable->getItemID().asString() << LL_ENDL;
}
}
void LLAgentWearables::dump()
{
- llinfos << "LLAgentWearablesDump" << llendl;
+ LL_INFOS() << "LLAgentWearablesDump" << LL_ENDL;
for (S32 i = 0; i < LLWearableType::WT_COUNT; i++)
{
U32 count = getWearableCount((LLWearableType::EType)i);
- llinfos << "Type: " << i << " count " << count << llendl;
+ LL_INFOS() << "Type: " << i << " count " << count << LL_ENDL;
for (U32 j=0; j<count; j++)
{
LLViewerWearable* wearable = getViewerWearable((LLWearableType::EType)i,j);
if (wearable == NULL)
{
- llinfos << " " << j << " NULL wearable" << llendl;
+ LL_INFOS() << " " << j << " NULL wearable" << LL_ENDL;
}
- llinfos << " " << j << " Name " << wearable->getName()
- << " description " << wearable->getDescription() << llendl;
+ LL_INFOS() << " " << j << " Name " << wearable->getName()
+ << " description " << wearable->getDescription() << LL_ENDL;
}
}
- llinfos << "Total items awaiting wearable update " << mItemsAwaitingWearableUpdate.size() << llendl;
- for (std::set<LLUUID>::iterator it = mItemsAwaitingWearableUpdate.begin();
- it != mItemsAwaitingWearableUpdate.end();
- ++it)
- {
- llinfos << (*it).asString() << llendl;
- }
}
struct LLAgentDumper
@@ -140,15 +167,15 @@ struct LLAgentDumper
LLAgentDumper(std::string name):
mName(name)
{
- llinfos << llendl;
- llinfos << "LLAgentDumper " << mName << llendl;
+ LL_INFOS() << LL_ENDL;
+ LL_INFOS() << "LLAgentDumper " << mName << LL_ENDL;
gAgentWearables.dump();
}
~LLAgentDumper()
{
- llinfos << llendl;
- llinfos << "~LLAgentDumper " << mName << llendl;
+ LL_INFOS() << LL_ENDL;
+ LL_INFOS() << "~LLAgentDumper " << mName << LL_ENDL;
gAgentWearables.dump();
}
@@ -180,36 +207,22 @@ void LLAgentWearables::initClass()
}
void LLAgentWearables::setAvatarObject(LLVOAvatarSelf *avatar)
-{
+{
llassert(avatar);
- avatar->outputRezTiming("Sending wearables request");
- sendAgentWearablesRequest();
setAvatarAppearance(avatar);
}
-// wearables
-LLAgentWearables::createStandardWearablesAllDoneCallback::~createStandardWearablesAllDoneCallback()
-{
- llinfos << "destructor - all done?" << llendl;
- gAgentWearables.createStandardWearablesAllDone();
-}
-
-LLAgentWearables::sendAgentWearablesUpdateCallback::~sendAgentWearablesUpdateCallback()
-{
- gAgentWearables.sendAgentWearablesUpdate();
-}
-
/**
* @brief Construct a callback for dealing with the wearables.
*
* Would like to pass the agent in here, but we can't safely
* count on it being around later. Just use gAgent directly.
- * @param cb callback to execute on completion (??? unused ???)
+ * @param cb callback to execute on completion (? unused ?)
* @param type Type for the wearable in the agent
* @param wearable The wearable data.
* @param todo Bitmask of actions to take on completion.
*/
-LLAgentWearables::addWearableToAgentInventoryCallback::addWearableToAgentInventoryCallback(
+LLAgentWearables::AddWearableToAgentInventoryCallback::AddWearableToAgentInventoryCallback(
LLPointer<LLRefCount> cb, LLWearableType::EType type, U32 index, LLViewerWearable* wearable, U32 todo, const std::string description) :
mType(type),
mIndex(index),
@@ -218,45 +231,27 @@ LLAgentWearables::addWearableToAgentInventoryCallback::addWearableToAgentInvento
mCB(cb),
mDescription(description)
{
- llinfos << "constructor" << llendl;
+ LL_INFOS() << "constructor" << LL_ENDL;
}
-void LLAgentWearables::addWearableToAgentInventoryCallback::fire(const LLUUID& inv_item)
+void LLAgentWearables::AddWearableToAgentInventoryCallback::fire(const LLUUID& inv_item)
{
- if (mTodo & CALL_CREATESTANDARDDONE)
- {
- llinfos << "callback fired, inv_item " << inv_item.asString() << llendl;
- }
-
if (inv_item.isNull())
return;
gAgentWearables.addWearabletoAgentInventoryDone(mType, mIndex, inv_item, mWearable);
- if (mTodo & CALL_UPDATE)
- {
- gAgentWearables.sendAgentWearablesUpdate();
- }
- if (mTodo & CALL_RECOVERDONE)
- {
- LLAppearanceMgr::instance().addCOFItemLink(inv_item,false);
- gAgentWearables.recoverMissingWearableDone();
- }
/*
* Do this for every one in the loop
*/
- if (mTodo & CALL_CREATESTANDARDDONE)
- {
- LLAppearanceMgr::instance().addCOFItemLink(inv_item,false);
- gAgentWearables.createStandardWearablesDone(mType, mIndex);
- }
if (mTodo & CALL_MAKENEWOUTFITDONE)
{
gAgentWearables.makeNewOutfitDone(mType, mIndex);
}
if (mTodo & CALL_WEARITEM)
{
- LLAppearanceMgr::instance().addCOFItemLink(inv_item, true, NULL, mDescription);
+ LLAppearanceMgr::instance().addCOFItemLink(inv_item,
+ new LLUpdateAppearanceAndEditWearableOnDestroy(inv_item), mDescription);
}
}
@@ -265,7 +260,7 @@ void LLAgentWearables::addWearabletoAgentInventoryDone(const LLWearableType::ETy
const LLUUID& item_id,
LLViewerWearable* wearable)
{
- llinfos << "type " << type << " index " << index << " item " << item_id.asString() << llendl;
+ LL_INFOS() << "type " << type << " index " << index << " item " << item_id.asString() << LL_ENDL;
if (item_id.isNull())
return;
@@ -303,81 +298,7 @@ void LLAgentWearables::addWearabletoAgentInventoryDone(const LLWearableType::ETy
gInventory.notifyObservers();
}
-void LLAgentWearables::sendAgentWearablesUpdate()
-{
- // First make sure that we have inventory items for each wearable
- for (S32 type=0; type < LLWearableType::WT_COUNT; ++type)
- {
- for (U32 index=0; index < getWearableCount((LLWearableType::EType)type); ++index)
- {
- LLViewerWearable* wearable = getViewerWearable((LLWearableType::EType)type,index);
- if (wearable)
- {
- if (wearable->getItemID().isNull())
- {
- LLPointer<LLInventoryCallback> cb =
- new addWearableToAgentInventoryCallback(
- LLPointer<LLRefCount>(NULL),
- (LLWearableType::EType)type,
- index,
- wearable,
- addWearableToAgentInventoryCallback::CALL_NONE);
- addWearableToAgentInventory(cb, wearable);
- }
- else
- {
- gInventory.addChangedMask(LLInventoryObserver::LABEL,
- wearable->getItemID());
- }
- }
- }
- }
-
- // Then make sure the inventory is in sync with the avatar.
- gInventory.notifyObservers();
-
- // Send the AgentIsNowWearing
- gMessageSystem->newMessageFast(_PREHASH_AgentIsNowWearing);
-
- gMessageSystem->nextBlockFast(_PREHASH_AgentData);
- gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
-
- lldebugs << "sendAgentWearablesUpdate()" << llendl;
- // MULTI-WEARABLE: DEPRECATED: HACK: index to 0- server database tables don't support concept of multiwearables.
- for (S32 type=0; type < LLWearableType::WT_COUNT; ++type)
- {
- gMessageSystem->nextBlockFast(_PREHASH_WearableData);
-
- U8 type_u8 = (U8)type;
- gMessageSystem->addU8Fast(_PREHASH_WearableType, type_u8);
-
- LLViewerWearable* wearable = getViewerWearable((LLWearableType::EType)type, 0);
- if (wearable)
- {
- //llinfos << "Sending wearable " << wearable->getName() << llendl;
- LLUUID item_id = wearable->getItemID();
- const LLViewerInventoryItem *item = gInventory.getItem(item_id);
- if (item && item->getIsLinkType())
- {
- // Get the itemID that this item points to. i.e. make sure
- // we are storing baseitems, not their links, in the database.
- item_id = item->getLinkedUUID();
- }
- gMessageSystem->addUUIDFast(_PREHASH_ItemID, item_id);
- }
- else
- {
- //llinfos << "Not wearing wearable type " << LLWearableType::getTypeName((LLWearableType::EType)i) << llendl;
- gMessageSystem->addUUIDFast(_PREHASH_ItemID, LLUUID::null);
- }
-
- lldebugs << " " << LLWearableType::getTypeLabel((LLWearableType::EType)type) << ": " << (wearable ? wearable->getAssetID() : LLUUID::null) << llendl;
- }
- gAgent.sendReliableMessage();
-}
-
-void LLAgentWearables::saveWearable(const LLWearableType::EType type, const U32 index, BOOL send_update,
+void LLAgentWearables::saveWearable(const LLWearableType::EType type, const U32 index,
const std::string new_name)
{
LLViewerWearable* old_wearable = getViewerWearable(type, index);
@@ -401,7 +322,7 @@ void LLAgentWearables::saveWearable(const LLWearableType::EType type, const U32
std::string item_name = item->getName();
if (name_changed)
{
- llinfos << "saveWearable changing name from " << item->getName() << " to " << new_name << llendl;
+ LL_INFOS() << "saveWearable changing name from " << item->getName() << " to " << new_name << LL_ENDL;
item_name = new_name;
}
// Update existing inventory item
@@ -418,23 +339,14 @@ void LLAgentWearables::saveWearable(const LLWearableType::EType type, const U32
item->getFlags(),
item->getCreationDate());
template_item->setTransactionID(new_wearable->getTransactionID());
- template_item->updateServer(FALSE);
- gInventory.updateItem(template_item);
- if (name_changed)
- {
- gInventory.notifyObservers();
- }
+ update_inventory_item(template_item, gAgentAvatarp->mEndCustomizeCallback);
}
else
{
// Add a new inventory item (shouldn't ever happen here)
- U32 todo = addWearableToAgentInventoryCallback::CALL_NONE;
- if (send_update)
- {
- todo |= addWearableToAgentInventoryCallback::CALL_UPDATE;
- }
+ U32 todo = AddWearableToAgentInventoryCallback::CALL_NONE;
LLPointer<LLInventoryCallback> cb =
- new addWearableToAgentInventoryCallback(
+ new AddWearableToAgentInventoryCallback(
LLPointer<LLRefCount>(NULL),
type,
index,
@@ -444,12 +356,7 @@ void LLAgentWearables::saveWearable(const LLWearableType::EType type, const U32
return;
}
- gAgentAvatarp->wearableUpdated( type, TRUE );
-
- if (send_update)
- {
- sendAgentWearablesUpdate();
- }
+ gAgentAvatarp->wearableUpdated(type);
}
}
@@ -461,20 +368,20 @@ void LLAgentWearables::saveWearableAs(const LLWearableType::EType type,
{
if (!isWearableCopyable(type, index))
{
- llwarns << "LLAgent::saveWearableAs() not copyable." << llendl;
+ LL_WARNS() << "LLAgent::saveWearableAs() not copyable." << LL_ENDL;
return;
}
LLViewerWearable* old_wearable = getViewerWearable(type, index);
if (!old_wearable)
{
- llwarns << "LLAgent::saveWearableAs() no old wearable." << llendl;
+ LL_WARNS() << "LLAgent::saveWearableAs() no old wearable." << LL_ENDL;
return;
}
LLInventoryItem* item = gInventory.getItem(getWearableItemID(type,index));
if (!item)
{
- llwarns << "LLAgent::saveWearableAs() no inventory item." << llendl;
+ LL_WARNS() << "LLAgent::saveWearableAs() no inventory item." << LL_ENDL;
return;
}
std::string trunc_name(new_name);
@@ -482,13 +389,14 @@ void LLAgentWearables::saveWearableAs(const LLWearableType::EType type,
LLViewerWearable* new_wearable = LLWearableList::instance().createCopy(
old_wearable,
trunc_name);
+
LLPointer<LLInventoryCallback> cb =
- new addWearableToAgentInventoryCallback(
+ new AddWearableToAgentInventoryCallback(
LLPointer<LLRefCount>(NULL),
type,
index,
new_wearable,
- addWearableToAgentInventoryCallback::CALL_WEARITEM,
+ AddWearableToAgentInventoryCallback::CALL_WEARITEM,
description
);
LLUUID category_id;
@@ -525,8 +433,6 @@ void LLAgentWearables::revertWearable(const LLWearableType::EType type, const U3
{
wearable->revertValues();
}
-
- gAgent.sendAgentSetAppearance();
}
void LLAgentWearables::saveAllWearables()
@@ -539,9 +445,8 @@ void LLAgentWearables::saveAllWearables()
for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
{
for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
- saveWearable((LLWearableType::EType)i, j, FALSE);
+ saveWearable((LLWearableType::EType)i, j);
}
- sendAgentWearablesUpdate();
}
// Called when the user changes the name of a wearable inventory item that is currently being worn.
@@ -570,7 +475,6 @@ void LLAgentWearables::setWearableName(const LLUUID& item_id, const std::string&
old_wearable->setName(old_name);
setWearable((LLWearableType::EType)i,j,new_wearable);
- sendAgentWearablesUpdate();
break;
}
}
@@ -691,22 +595,13 @@ LLViewerWearable* LLAgentWearables::getWearableFromAssetID(const LLUUID& asset_i
return NULL;
}
-void LLAgentWearables::sendAgentWearablesRequest()
-{
- gMessageSystem->newMessageFast(_PREHASH_AgentWearablesRequest);
- gMessageSystem->nextBlockFast(_PREHASH_AgentData);
- gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- gAgent.sendReliableMessage();
-}
-
LLViewerWearable* LLAgentWearables::getViewerWearable(const LLWearableType::EType type, U32 index /*= 0*/)
{
return dynamic_cast<LLViewerWearable*> (getWearable(type, index));
}
const LLViewerWearable* LLAgentWearables::getViewerWearable(const LLWearableType::EType type, U32 index /*= 0*/) const
- {
+{
return dynamic_cast<const LLViewerWearable*> (getWearable(type, index));
}
@@ -714,49 +609,38 @@ const LLViewerWearable* LLAgentWearables::getViewerWearable(const LLWearableType
BOOL LLAgentWearables::selfHasWearable(LLWearableType::EType type)
{
return (gAgentWearables.getWearableCount(type) > 0);
- }
-
+}
+
// virtual
void LLAgentWearables::wearableUpdated(LLWearable *wearable, BOOL removed)
- {
+{
if (isAgentAvatarValid())
{
- const BOOL upload_result = removed;
- gAgentAvatarp->wearableUpdated(wearable->getType(), upload_result);
-}
+ gAgentAvatarp->wearableUpdated(wearable->getType());
+ }
LLWearableData::wearableUpdated(wearable, removed);
if (!removed)
-{
+ {
LLViewerWearable* viewer_wearable = dynamic_cast<LLViewerWearable*>(wearable);
viewer_wearable->refreshName();
- // Hack pt 2. If the wearable we just loaded has definition version 24,
- // then force a re-save of this wearable after slamming the version number to 22.
- // This number was incorrectly incremented for internal builds before release, and
- // this fix will ensure that the affected wearables are re-saved with the right version number.
- // the versions themselves are compatible. This code can be removed before release.
- if( wearable->getDefinitionVersion() == 24 )
- {
- wearable->setDefinitionVersion(22);
- U32 index = getWearableIndex(wearable);
- llinfos << "forcing wearable type " << wearable->getType() << " to version 22 from 24" << llendl;
- saveWearable(wearable->getType(),index,TRUE);
- }
+ // Hack pt 2. If the wearable we just loaded has definition version 24,
+ // then force a re-save of this wearable after slamming the version number to 22.
+ // This number was incorrectly incremented for internal builds before release, and
+ // this fix will ensure that the affected wearables are re-saved with the right version number.
+ // the versions themselves are compatible. This code can be removed before release.
+ if( wearable->getDefinitionVersion() == 24 )
+ {
+ wearable->setDefinitionVersion(22);
+ U32 index = getWearableIndex(wearable);
+ LL_INFOS() << "forcing wearable type " << wearable->getType() << " to version 22 from 24" << LL_ENDL;
+ saveWearable(wearable->getType(),index);
+ }
checkWearableAgainstInventory(viewer_wearable);
-}
-}
-
-BOOL LLAgentWearables::itemUpdatePending(const LLUUID& item_id) const
-{
- return mItemsAwaitingWearableUpdate.find(item_id) != mItemsAwaitingWearableUpdate.end();
-}
-
-U32 LLAgentWearables::itemUpdatePendingCount() const
-{
- return mItemsAwaitingWearableUpdate.size();
+ }
}
const LLUUID LLAgentWearables::getWearableItemID(LLWearableType::EType type, U32 index) const
@@ -782,163 +666,12 @@ BOOL LLAgentWearables::isWearingItem(const LLUUID& item_id) const
return getWearableFromItemID(item_id) != NULL;
}
-// MULTI-WEARABLE: DEPRECATED (see backwards compatibility)
-// static
-// ! BACKWARDS COMPATIBILITY ! When we stop supporting viewer1.23, we can assume
-// that viewers have a Current Outfit Folder and won't need this message, and thus
-// we can remove/ignore this whole function. EXCEPT gAgentWearables.notifyLoadingStarted
-void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgsys, void** user_data)
-{
- // We should only receive this message a single time. Ignore subsequent AgentWearablesUpdates
- // that may result from AgentWearablesRequest having been sent more than once.
- if (mInitialWearablesUpdateReceived)
- return;
-
- if (isAgentAvatarValid())
- {
- gAgentAvatarp->startPhase("process_initial_wearables_update");
- gAgentAvatarp->outputRezTiming("Received initial wearables update");
- }
-
- // notify subscribers that wearables started loading. See EXT-7777
- // *TODO: find more proper place to not be called from deprecated method.
- // Seems such place is found: LLInitialWearablesFetch::processContents()
- gAgentWearables.notifyLoadingStarted();
-
- mInitialWearablesUpdateReceived = true;
-
- LLUUID agent_id;
- gMessageSystem->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id);
-
- if (isAgentAvatarValid() && (agent_id == gAgentAvatarp->getID()))
- {
- gMessageSystem->getU32Fast(_PREHASH_AgentData, _PREHASH_SerialNum, gAgentQueryManager.mUpdateSerialNum);
-
- const S32 NUM_BODY_PARTS = 4;
- S32 num_wearables = gMessageSystem->getNumberOfBlocksFast(_PREHASH_WearableData);
- if (num_wearables < NUM_BODY_PARTS)
- {
- // Transitional state. Avatars should always have at least their body parts (hair, eyes, shape and skin).
- // The fact that they don't have any here (only a dummy is sent) implies that either:
- // 1. This account existed before we had wearables
- // 2. The database has gotten messed up
- // 3. This is the account's first login (i.e. the wearables haven't been generated yet).
- return;
- }
-
- // Get the UUID of the current outfit folder (will be created if it doesn't exist)
- const LLUUID current_outfit_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
- LLInitialWearablesFetch* outfit = new LLInitialWearablesFetch(current_outfit_id);
-
- //lldebugs << "processAgentInitialWearablesUpdate()" << llendl;
- // Add wearables
- // MULTI-WEARABLE: DEPRECATED: Message only supports one wearable per type, will be ignored in future.
- gAgentWearables.mItemsAwaitingWearableUpdate.clear();
- for (S32 i=0; i < num_wearables; i++)
- {
- // Parse initial wearables data from message system
- U8 type_u8 = 0;
- gMessageSystem->getU8Fast(_PREHASH_WearableData, _PREHASH_WearableType, type_u8, i);
- if (type_u8 >= LLWearableType::WT_COUNT)
- {
- continue;
- }
- const LLWearableType::EType type = (LLWearableType::EType) type_u8;
-
- LLUUID item_id;
- gMessageSystem->getUUIDFast(_PREHASH_WearableData, _PREHASH_ItemID, item_id, i);
-
- LLUUID asset_id;
- gMessageSystem->getUUIDFast(_PREHASH_WearableData, _PREHASH_AssetID, asset_id, i);
- if (asset_id.isNull())
- {
- LLViewerWearable::removeFromAvatar(type, FALSE);
- }
- else
- {
- LLAssetType::EType asset_type = LLWearableType::getAssetType(type);
- if (asset_type == LLAssetType::AT_NONE)
- {
- continue;
- }
-
- // MULTI-WEARABLE: DEPRECATED: this message only supports one wearable per type. Should be ignored in future versions
-
- // Store initial wearables data until we know whether we have the current outfit folder or need to use the data.
- LLInitialWearablesFetch::InitialWearableData wearable_data(type, item_id, asset_id);
- outfit->add(wearable_data);
- }
-
- lldebugs << " " << LLWearableType::getTypeLabel(type) << llendl;
- }
-
- // Get the complete information on the items in the inventory and set up an observer
- // that will trigger when the complete information is fetched.
- outfit->startFetch();
- if(outfit->isFinished())
- {
- // everything is already here - call done.
- outfit->done();
- }
- else
- {
- // it's all on it's way - add an observer, and the inventory
- // will call done for us when everything is here.
- gInventory.addObserver(outfit);
- }
-
- }
-}
-
-// Normally, all wearables referred to "AgentWearablesUpdate" will correspond to actual assets in the
-// database. If for some reason, we can't load one of those assets, we can try to reconstruct it so that
-// the user isn't left without a shape, for example. (We can do that only after the inventory has loaded.)
-void LLAgentWearables::recoverMissingWearable(const LLWearableType::EType type, U32 index)
-{
- // Try to recover by replacing missing wearable with a new one.
- LLNotificationsUtil::add("ReplacedMissingWearable");
- lldebugs << "Wearable " << LLWearableType::getTypeLabel(type) << " could not be downloaded. Replaced inventory item with default wearable." << llendl;
- LLViewerWearable* new_wearable = LLWearableList::instance().createNewWearable(type, gAgentAvatarp);
-
- setWearable(type,index,new_wearable);
- //new_wearable->writeToAvatar(TRUE);
-
- // Add a new one in the lost and found folder.
- // (We used to overwrite the "not found" one, but that could potentially
- // destory content.) JC
- const LLUUID lost_and_found_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND);
- LLPointer<LLInventoryCallback> cb =
- new addWearableToAgentInventoryCallback(
- LLPointer<LLRefCount>(NULL),
- type,
- index,
- new_wearable,
- addWearableToAgentInventoryCallback::CALL_RECOVERDONE);
- addWearableToAgentInventory(cb, new_wearable, lost_and_found_id, TRUE);
-}
-
-void LLAgentWearables::recoverMissingWearableDone()
-{
- // Have all the wearables that the avatar was wearing at log-in arrived or been fabricated?
- updateWearablesLoaded();
- if (areWearablesLoaded())
- {
- // Make sure that the server's idea of the avatar's wearables actually match the wearables.
- gAgent.sendAgentSetAppearance();
- }
- else
- {
- gInventory.addChangedMask(LLInventoryObserver::LABEL, LLUUID::null);
- gInventory.notifyObservers();
- }
-}
-
void LLAgentWearables::addLocalTextureObject(const LLWearableType::EType wearable_type, const LLAvatarAppearanceDefines::ETextureIndex texture_type, U32 wearable_index)
{
LLViewerWearable* wearable = getViewerWearable((LLWearableType::EType)wearable_type, wearable_index);
if (!wearable)
{
- llerrs << "Tried to add local texture object to invalid wearable with type " << wearable_type << " and index " << wearable_index << llendl;
+ LL_ERRS() << "Tried to add local texture object to invalid wearable with type " << wearable_type << " and index " << wearable_index << LL_ENDL;
return;
}
LLLocalTextureObject lto;
@@ -951,28 +684,28 @@ public:
OnWearableItemCreatedCB():
mWearablesAwaitingItems(LLWearableType::WT_COUNT,NULL)
{
- llinfos << "created callback" << llendl;
+ LL_INFOS() << "created callback" << LL_ENDL;
}
/* virtual */ void fire(const LLUUID& inv_item)
{
- llinfos << "One item created " << inv_item.asString() << llendl;
- LLViewerInventoryItem *item = gInventory.getItem(inv_item);
- mItemsToLink.put(item);
+ LL_INFOS() << "One item created " << inv_item.asString() << LL_ENDL;
+ LLConstPointer<LLInventoryObject> item = gInventory.getItem(inv_item);
+ mItemsToLink.push_back(item);
updatePendingWearable(inv_item);
}
~OnWearableItemCreatedCB()
{
- llinfos << "All items created" << llendl;
+ LL_INFOS() << "All items created" << LL_ENDL;
LLPointer<LLInventoryCallback> link_waiter = new LLUpdateAppearanceOnDestroy;
- LLAppearanceMgr::instance().linkAll(LLAppearanceMgr::instance().getCOF(),
- mItemsToLink,
- link_waiter);
+ link_inventory_array(LLAppearanceMgr::instance().getCOF(),
+ mItemsToLink,
+ link_waiter);
}
void addPendingWearable(LLViewerWearable *wearable)
{
if (!wearable)
{
- llwarns << "no wearable" << llendl;
+ LL_WARNS() << "no wearable" << LL_ENDL;
return;
}
LLWearableType::EType type = wearable->getType();
@@ -982,7 +715,7 @@ public:
}
else
{
- llwarns << "invalid type " << type << llendl;
+ LL_WARNS() << "invalid type " << type << LL_ENDL;
}
}
void updatePendingWearable(const LLUUID& inv_item)
@@ -990,12 +723,12 @@ public:
LLViewerInventoryItem *item = gInventory.getItem(inv_item);
if (!item)
{
- llwarns << "no item found" << llendl;
+ LL_WARNS() << "no item found" << LL_ENDL;
return;
}
if (!item->isWearableType())
{
- llwarns << "non-wearable item found" << llendl;
+ LL_WARNS() << "non-wearable item found" << LL_ENDL;
return;
}
if (item && item->isWearableType())
@@ -1009,19 +742,19 @@ public:
}
else
{
- llwarns << "invalid wearable type " << type << llendl;
+ LL_WARNS() << "invalid wearable type " << type << LL_ENDL;
}
}
}
private:
- LLInventoryModel::item_array_t mItemsToLink;
+ LLInventoryObject::const_object_list_t mItemsToLink;
std::vector<LLViewerWearable*> mWearablesAwaitingItems;
};
void LLAgentWearables::createStandardWearables()
{
- llwarns << "Creating standard wearables" << llendl;
+ LL_WARNS() << "Creating standard wearables" << LL_ENDL;
if (!isAgentAvatarValid()) return;
@@ -1067,28 +800,38 @@ void LLAgentWearables::createStandardWearables()
}
}
-void LLAgentWearables::createStandardWearablesDone(S32 type, U32 index)
+// We no longer need this message in the current viewer, but send
+// it for now to maintain compatibility with release viewers. Can
+// remove this function once the SH-3455 changesets are universally deployed.
+void LLAgentWearables::sendDummyAgentWearablesUpdate()
{
- llinfos << "type " << type << " index " << index << llendl;
+ LL_DEBUGS("Avatar") << "sendAgentWearablesUpdate()" << LL_ENDL;
- if (!isAgentAvatarValid()) return;
- gAgentAvatarp->updateVisualParams();
-}
+ // Send the AgentIsNowWearing
+ gMessageSystem->newMessageFast(_PREHASH_AgentIsNowWearing);
+
+ gMessageSystem->nextBlockFast(_PREHASH_AgentData);
+ gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
-void LLAgentWearables::createStandardWearablesAllDone()
-{
- // ... because sendAgentWearablesUpdate will notify inventory
- // observers.
- llinfos << "all done?" << llendl;
+ // Send 4 standardized nonsense item ids (same as returned by the modified sim, not that it especially matters).
+ gMessageSystem->nextBlockFast(_PREHASH_WearableData);
+ gMessageSystem->addU8Fast(_PREHASH_WearableType, U8(1));
+ gMessageSystem->addUUIDFast(_PREHASH_ItemID, LLUUID("db5a4e5f-9da3-44c8-992d-1181c5795498"));
- mWearablesLoaded = TRUE;
- checkWearablesLoaded();
- notifyLoadingFinished();
-
- updateServer();
+ gMessageSystem->nextBlockFast(_PREHASH_WearableData);
+ gMessageSystem->addU8Fast(_PREHASH_WearableType, U8(2));
+ gMessageSystem->addUUIDFast(_PREHASH_ItemID, LLUUID("6969c7cc-f72f-4a76-a19b-c293cce8ce4f"));
+
+ gMessageSystem->nextBlockFast(_PREHASH_WearableData);
+ gMessageSystem->addU8Fast(_PREHASH_WearableType, U8(3));
+ gMessageSystem->addUUIDFast(_PREHASH_ItemID, LLUUID("7999702b-b291-48f9-8903-c91dfb828408"));
- // Treat this as the first texture entry message, if none received yet
- gAgentAvatarp->onFirstTEMessageReceived();
+ gMessageSystem->nextBlockFast(_PREHASH_WearableData);
+ gMessageSystem->addU8Fast(_PREHASH_WearableType, U8(4));
+ gMessageSystem->addUUIDFast(_PREHASH_ItemID, LLUUID("566cb59e-ef60-41d7-bfa6-e0f293fbea40"));
+
+ gAgent.sendReliableMessage();
}
void LLAgentWearables::makeNewOutfitDone(S32 type, U32 index)
@@ -1204,11 +947,10 @@ void LLAgentWearables::removeWearableFinal(const LLWearableType::EType type, boo
for (S32 i=max_entry; i>=0; i--)
{
LLViewerWearable* old_wearable = getViewerWearable(type,i);
- //queryWearableCache(); // moved below
if (old_wearable)
{
popWearable(old_wearable);
- old_wearable->removeFromAvatar(TRUE);
+ old_wearable->removeFromAvatar();
}
}
clearWearableType(type);
@@ -1216,48 +958,99 @@ void LLAgentWearables::removeWearableFinal(const LLWearableType::EType type, boo
else
{
LLViewerWearable* old_wearable = getViewerWearable(type, index);
- //queryWearableCache(); // moved below
if (old_wearable)
{
popWearable(old_wearable);
- old_wearable->removeFromAvatar(TRUE);
+ old_wearable->removeFromAvatar();
}
}
- queryWearableCache();
-
- // Update the server
- updateServer();
gInventory.notifyObservers();
}
// Assumes existing wearables are not dirty.
void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& items,
- const LLDynamicArray< LLViewerWearable* >& wearables,
- BOOL remove)
+ const std::vector< LLViewerWearable* >& wearables)
{
- llinfos << "setWearableOutfit() start" << llendl;
+ LL_INFOS() << "setWearableOutfit() start" << LL_ENDL;
+
+ S32 count = wearables.size();
+ llassert(items.size() == count);
+ // Check for whether outfit already matches the one requested
+ S32 matched = 0, mismatched = 0;
+ const S32 arr_size = LLWearableType::WT_COUNT;
+ S32 type_counts[arr_size];
+ std::fill(type_counts,type_counts+arr_size,0);
+ for (S32 i = 0; i < count; i++)
+ {
+ LLViewerWearable* new_wearable = wearables[i];
+ LLPointer<LLInventoryItem> new_item = items[i];
+
+ const LLWearableType::EType type = new_wearable->getType();
+ if (type < 0 || type>=LLWearableType::WT_COUNT)
+ {
+ LL_WARNS() << "invalid type " << type << LL_ENDL;
+ mismatched++;
+ continue;
+ }
+ S32 index = type_counts[type];
+ type_counts[type]++;
+
+ LLViewerWearable *curr_wearable = dynamic_cast<LLViewerWearable*>(getWearable(type,index));
+ if (!new_wearable || !curr_wearable ||
+ new_wearable->getAssetID() != curr_wearable->getAssetID())
+ {
+ LL_DEBUGS("Avatar") << "mismatch, type " << type << " index " << index
+ << " names " << (curr_wearable ? curr_wearable->getName() : "NONE") << ","
+ << " names " << (new_wearable ? new_wearable->getName() : "NONE") << LL_ENDL;
+ mismatched++;
+ continue;
+ }
+
+ if (curr_wearable->getName() != new_item->getName() ||
+ curr_wearable->getItemID() != new_item->getUUID())
+ {
+ LL_DEBUGS("Avatar") << "mismatch on name or inventory id, names "
+ << curr_wearable->getName() << " vs " << new_item->getName()
+ << " item ids " << curr_wearable->getItemID() << " vs " << new_item->getUUID()
+ << LL_ENDL;
+ mismatched++;
+ continue;
+ }
+ // If we got here, everything matches.
+ matched++;
+ }
+ LL_DEBUGS("Avatar") << "matched " << matched << " mismatched " << mismatched << LL_ENDL;
+ for (S32 j=0; j<LLWearableType::WT_COUNT; j++)
+ {
+ LLWearableType::EType type = (LLWearableType::EType) j;
+ if (getWearableCount(type) != type_counts[j])
+ {
+ LL_DEBUGS("Avatar") << "count mismatch for type " << j << " current " << getWearableCount(j) << " requested " << type_counts[j] << LL_ENDL;
+ mismatched++;
+ }
+ }
+ if (mismatched == 0)
+ {
+ LL_DEBUGS("Avatar") << "no changes, bailing out" << LL_ENDL;
+ return;
+ }
+
+
// TODO: Removed check for ensuring that teens don't remove undershirt and underwear. Handle later
- if (remove)
+ // note: shirt is the first non-body part wearable item. Update if wearable order changes.
+ // This loop should remove all clothing, but not any body parts
+ for (S32 j = 0; j < (S32)LLWearableType::WT_COUNT; j++)
{
- // note: shirt is the first non-body part wearable item. Update if wearable order changes.
- // This loop should remove all clothing, but not any body parts
- for (S32 type = 0; type < (S32)LLWearableType::WT_COUNT; type++)
+ if (LLWearableType::getAssetType((LLWearableType::EType)j) == LLAssetType::AT_CLOTHING)
{
- if (LLWearableType::getAssetType((LLWearableType::EType)type) == LLAssetType::AT_CLOTHING)
- {
- removeWearable((LLWearableType::EType)type, true, 0);
- }
+ removeWearable((LLWearableType::EType)j, true, 0);
}
}
- S32 count = wearables.count();
- llassert(items.count() == count);
-
- S32 i;
- for (i = 0; i < count; i++)
+ for (S32 i = 0; i < count; i++)
{
LLViewerWearable* new_wearable = wearables[i];
LLPointer<LLInventoryItem> new_item = items[i];
@@ -1304,14 +1097,12 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
// Start rendering & update the server
mWearablesLoaded = TRUE;
- checkWearablesLoaded();
+
notifyLoadingFinished();
- queryWearableCache();
- updateServer();
gAgentAvatarp->dumpAvatarTEs("setWearableOutfit");
- lldebugs << "setWearableOutfit() end" << llendl;
+ LL_DEBUGS("Avatar") << "setWearableOutfit() end" << LL_ENDL;
}
@@ -1321,7 +1112,7 @@ void LLAgentWearables::setWearableItem(LLInventoryItem* new_item, LLViewerWearab
//LLAgentDumper dumper("setWearableItem");
if (isWearingItem(new_item->getUUID()))
{
- llwarns << "wearable " << new_item->getUUID() << " is already worn" << llendl;
+ LL_WARNS() << "wearable " << new_item->getUUID() << " is already worn" << LL_ENDL;
return;
}
@@ -1338,7 +1129,7 @@ void LLAgentWearables::setWearableItem(LLInventoryItem* new_item, LLViewerWearab
if ((old_wearable->getAssetID() == new_wearable->getAssetID()) &&
(old_item_id == new_item->getUUID()))
{
- lldebugs << "No change to wearable asset and item: " << LLWearableType::getTypeName(type) << llendl;
+ LL_DEBUGS() << "No change to wearable asset and item: " << LLWearableType::getTypeName(type) << LL_ENDL;
return;
}
@@ -1402,8 +1193,8 @@ void LLAgentWearables::setWearableFinal(LLInventoryItem* new_item, LLViewerWeara
new_wearable->setItemID(new_item->getUUID());
const bool trigger_updated = false;
pushWearable(type, new_wearable, trigger_updated);
- llinfos << "Added additional wearable for type " << type
- << " size is now " << getWearableCount(type) << llendl;
+ LL_INFOS() << "Added additional wearable for type " << type
+ << " size is now " << getWearableCount(type) << LL_ENDL;
checkWearableAgainstInventory(new_wearable);
}
else
@@ -1425,84 +1216,11 @@ void LLAgentWearables::setWearableFinal(LLInventoryItem* new_item, LLViewerWeara
gInventory.addChangedMask(LLInventoryObserver::LABEL, old_item_id);
gInventory.notifyObservers();
}
- llinfos << "Replaced current element 0 for type " << type
- << " size is now " << getWearableCount(type) << llendl;
- }
-
- //llinfos << "LLVOAvatar::setWearableItem()" << llendl;
- queryWearableCache();
- //new_wearable->writeToAvatar(TRUE);
-
- updateServer();
-}
-
-void LLAgentWearables::queryWearableCache()
-{
- if (!areWearablesLoaded() || (gAgent.getRegion() && gAgent.getRegion()->getCentralBakeVersion()))
- {
- return;
- }
-
- // Look up affected baked textures.
- // If they exist:
- // disallow updates for affected layersets (until dataserver responds with cache request.)
- // If cache miss, turn updates back on and invalidate composite.
- // If cache hit, modify baked texture entries.
- //
- // Cache requests contain list of hashes for each baked texture entry.
- // Response is list of valid baked texture assets. (same message)
-
- gMessageSystem->newMessageFast(_PREHASH_AgentCachedTexture);
- gMessageSystem->nextBlockFast(_PREHASH_AgentData);
- gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- gMessageSystem->addS32Fast(_PREHASH_SerialNum, gAgentQueryManager.mWearablesCacheQueryID);
-
- S32 num_queries = 0;
- for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++)
- {
- LLUUID hash_id = computeBakedTextureHash((EBakedTextureIndex) baked_index);
- if (hash_id.notNull())
- {
- num_queries++;
- // *NOTE: make sure at least one request gets packed
-
- ETextureIndex te_index = LLAvatarAppearanceDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)baked_index);
-
- //llinfos << "Requesting texture for hash " << hash << " in baked texture slot " << baked_index << llendl;
- gMessageSystem->nextBlockFast(_PREHASH_WearableData);
- gMessageSystem->addUUIDFast(_PREHASH_ID, hash_id);
- gMessageSystem->addU8Fast(_PREHASH_TextureIndex, (U8)te_index);
- }
-
- gAgentQueryManager.mActiveCacheQueries[baked_index] = gAgentQueryManager.mWearablesCacheQueryID;
- }
- //VWR-22113: gAgent.getRegion() can return null if invalid, seen here on logout
- if(gAgent.getRegion())
- {
- if (isAgentAvatarValid())
- {
- selfStartPhase("fetch_texture_cache_entries");
- gAgentAvatarp->outputRezTiming("Fetching textures from cache");
- }
-
- LL_DEBUGS("Avatar") << gAgentAvatarp->avString() << "Requesting texture cache entry for " << num_queries << " baked textures" << LL_ENDL;
- gMessageSystem->sendReliable(gAgent.getRegion()->getHost());
- gAgentQueryManager.mNumPendingQueries++;
- gAgentQueryManager.mWearablesCacheQueryID++;
+ LL_INFOS() << "Replaced current element 0 for type " << type
+ << " size is now " << getWearableCount(type) << LL_ENDL;
}
}
-// virtual
-void LLAgentWearables::invalidateBakedTextureHash(LLMD5& hash) const
-{
- // Add some garbage into the hash so that it becomes invalid.
- if (isAgentAvatarValid())
- {
- hash.update((const unsigned char*)gAgentAvatarp->getID().mData, UUID_BYTES);
- }
- }
-
// User has picked "remove from avatar" from a menu.
// static
void LLAgentWearables::userRemoveWearable(const LLWearableType::EType &type, const U32 &index)
@@ -1537,10 +1255,10 @@ void LLAgentWearables::userUpdateAttachments(LLInventoryModel::item_array_t& obj
std::set<LLUUID> requested_item_ids;
std::set<LLUUID> current_item_ids;
- for (S32 i=0; i<obj_item_array.count(); i++)
+ for (S32 i=0; i<obj_item_array.size(); i++)
{
const LLUUID & requested_id = obj_item_array[i].get()->getLinkedUUID();
- //llinfos << "Requested attachment id " << requested_id << llendl;
+ //LL_INFOS() << "Requested attachment id " << requested_id << LL_ENDL;
requested_item_ids.insert(requested_id);
}
@@ -1573,12 +1291,12 @@ void LLAgentWearables::userUpdateAttachments(LLInventoryModel::item_array_t& obj
if (remove_attachment)
{
- // llinfos << "found object to remove, id " << objectp->getID() << ", item " << objectp->getAttachmentItemID() << llendl;
+ // LL_INFOS() << "found object to remove, id " << objectp->getID() << ", item " << objectp->getAttachmentItemID() << LL_ENDL;
objects_to_remove.push_back(objectp);
}
else
{
- // llinfos << "found object to keep, id " << objectp->getID() << ", item " << objectp->getAttachmentItemID() << llendl;
+ // LL_INFOS() << "found object to keep, id " << objectp->getID() << ", item " << objectp->getAttachmentItemID() << LL_ENDL;
current_item_ids.insert(object_item_id);
}
}
@@ -1603,7 +1321,7 @@ void LLAgentWearables::userUpdateAttachments(LLInventoryModel::item_array_t& obj
}
// S32 remove_count = objects_to_remove.size();
// S32 add_count = items_to_add.size();
- // llinfos << "remove " << remove_count << " add " << add_count << llendl;
+ // LL_INFOS() << "remove " << remove_count << " add " << add_count << LL_ENDL;
// Remove everything in objects_to_remove
userRemoveMultipleAttachments(objects_to_remove);
@@ -1638,7 +1356,7 @@ void LLAgentWearables::userRemoveMultipleAttachments(llvo_vec_t& objects_to_remo
void LLAgentWearables::userAttachMultipleAttachments(LLInventoryModel::item_array_t& obj_item_array)
{
// Build a compound message to send all the objects that need to be rezzed.
- S32 obj_count = obj_item_array.count();
+ S32 obj_count = obj_item_array.size();
// Limit number of packets to send
const S32 MAX_PACKETS_TO_SEND = 10;
@@ -1669,7 +1387,7 @@ void LLAgentWearables::userAttachMultipleAttachments(LLInventoryModel::item_arra
msg->addBOOLFast(_PREHASH_FirstDetachAll, false );
}
- const LLInventoryItem* item = obj_item_array.get(i).get();
+ const LLInventoryItem* item = obj_item_array.at(i).get();
msg->nextBlockFast(_PREHASH_ObjectData );
msg->addUUIDFast(_PREHASH_ItemID, item->getLinkedUUID());
msg->addUUIDFast(_PREHASH_OwnerID, item->getPermissions().getOwner());
@@ -1686,17 +1404,6 @@ void LLAgentWearables::userAttachMultipleAttachments(LLInventoryModel::item_arra
}
}
-void LLAgentWearables::checkWearablesLoaded() const
-{
-#ifdef SHOW_ASSERT
- U32 item_pend_count = itemUpdatePendingCount();
- if (mWearablesLoaded)
- {
- llassert(item_pend_count==0);
- }
-#endif
-}
-
// Returns false if the given wearable is already topmost/bottommost
// (depending on closer_to_body parameter).
bool LLAgentWearables::canMoveWearable(const LLUUID& item_id, bool closer_to_body) const
@@ -1713,20 +1420,9 @@ bool LLAgentWearables::canMoveWearable(const LLUUID& item_id, bool closer_to_bod
BOOL LLAgentWearables::areWearablesLoaded() const
{
- checkWearablesLoaded();
return mWearablesLoaded;
}
-// MULTI-WEARABLE: DEPRECATED: item pending count relies on old messages that don't support multi-wearables. do not trust to be accurate
-void LLAgentWearables::updateWearablesLoaded()
-{
- mWearablesLoaded = (itemUpdatePendingCount()==0);
- if (mWearablesLoaded)
- {
- notifyLoadingFinished();
- }
-}
-
bool LLAgentWearables::canWearableBeRemoved(const LLViewerWearable* wearable) const
{
if (!wearable) return false;
@@ -1736,7 +1432,7 @@ bool LLAgentWearables::canWearableBeRemoved(const LLViewerWearable* wearable) co
return !(((type == LLWearableType::WT_SHAPE) || (type == LLWearableType::WT_SKIN) || (type == LLWearableType::WT_HAIR) || (type == LLWearableType::WT_EYES))
&& (getWearableCount(type) <= 1) );
}
-void LLAgentWearables::animateAllWearableParams(F32 delta, BOOL upload_bake)
+void LLAgentWearables::animateAllWearableParams(F32 delta)
{
for( S32 type = 0; type < LLWearableType::WT_COUNT; ++type )
{
@@ -1746,7 +1442,7 @@ void LLAgentWearables::animateAllWearableParams(F32 delta, BOOL upload_bake)
llassert(wearable);
if (wearable)
{
- wearable->animateParams(delta, upload_bake);
+ wearable->animateParams(delta);
}
}
}
@@ -1804,7 +1500,16 @@ void LLAgentWearables::createWearable(LLWearableType::EType type, bool wear, con
LLViewerWearable* wearable = LLWearableList::instance().createNewWearable(type, gAgentAvatarp);
LLAssetType::EType asset_type = wearable->getAssetType();
LLInventoryType::EType inv_type = LLInventoryType::IT_WEARABLE;
- LLPointer<LLInventoryCallback> cb = wear ? new LLBoostFuncInventoryCallback(wear_and_edit_cb) : NULL;
+ LLPointer<LLInventoryCallback> cb;
+ if(wear)
+ {
+ cb = new LLBoostFuncInventoryCallback(wear_and_edit_cb);
+ }
+ else
+ {
+ cb = new LLBoostFuncInventoryCallback(wear_cb);
+ }
+
LLUUID folder_id;
if (parent_id.notNull())
@@ -1817,10 +1522,15 @@ void LLAgentWearables::createWearable(LLWearableType::EType type, bool wear, con
folder_id = gInventory.findCategoryUUIDForType(folder_type);
}
- create_inventory_item(gAgent.getID(), gAgent.getSessionID(),
- folder_id, wearable->getTransactionID(), wearable->getName(),
- wearable->getDescription(), asset_type, inv_type, wearable->getType(),
- wearable->getPermissions().getMaskNextOwner(),
+ create_inventory_item(gAgent.getID(),
+ gAgent.getSessionID(),
+ folder_id,
+ wearable->getTransactionID(),
+ wearable->getName(),
+ wearable->getDescription(),
+ asset_type, inv_type,
+ wearable->getType(),
+ LLFloaterPerms::getNextOwnerPerms("Wearables"),
cb);
}
@@ -1830,20 +1540,20 @@ void LLAgentWearables::editWearable(const LLUUID& item_id)
LLViewerInventoryItem* item = gInventory.getLinkedItem(item_id);
if (!item)
{
- llwarns << "Failed to get linked item" << llendl;
+ LL_WARNS() << "Failed to get linked item" << LL_ENDL;
return;
}
LLViewerWearable* wearable = gAgentWearables.getWearableFromItemID(item_id);
if (!wearable)
{
- llwarns << "Cannot get wearable" << llendl;
+ LL_WARNS() << "Cannot get wearable" << LL_ENDL;
return;
}
if (!gAgentWearables.isWearableModifiable(item->getUUID()))
{
- llwarns << "Cannot modify wearable" << llendl;
+ LL_WARNS() << "Cannot modify wearable" << LL_ENDL;
return;
}
@@ -1869,30 +1579,6 @@ void LLAgentWearables::editWearableIfRequested(const LLUUID& item_id)
}
}
-void LLAgentWearables::updateServer()
-{
- sendAgentWearablesUpdate();
- gAgent.sendAgentSetAppearance();
-}
-
-void LLAgentWearables::populateMyOutfitsFolder(void)
-{
- llinfos << "starting outfit population" << llendl;
-
- const LLUUID& my_outfits_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
- LLLibraryOutfitsFetch* outfits = new LLLibraryOutfitsFetch(my_outfits_id);
- outfits->mMyOutfitsID = my_outfits_id;
-
- // Get the complete information on the items in the inventory and
- // setup an observer that will wait for that to happen.
- gInventory.addObserver(outfits);
- outfits->startFetch();
- if (outfits->isFinished())
- {
- outfits->done();
- }
-}
-
boost::signals2::connection LLAgentWearables::addLoadingStartedCallback(loading_started_callback_t cb)
{
return mLoadingStartedSignal.connect(cb);
@@ -1911,6 +1597,7 @@ bool LLAgentWearables::changeInProgress() const
void LLAgentWearables::notifyLoadingStarted()
{
mCOFChangeInProgress = true;
+ mCOFChangeTimer.reset();
mLoadingStartedSignal();
}