Initial AISv3 merge. New HTTP messages not plugged in yet.
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
#include "llinventoryfunctions.h"
|
||||
#include "llinventoryobserver.h"
|
||||
#include "llinventorypanel.h"
|
||||
#include "lllocaltextureobject.h"
|
||||
#include "llpanelmaininventory.h"
|
||||
#include "llmd5.h"
|
||||
#include "llnotificationsutil.h"
|
||||
@@ -97,7 +98,7 @@ void wear_and_edit_cb(const LLUUID& inv_item)
|
||||
gAgentWearables.requestEditingWearable(inv_item);
|
||||
|
||||
// Wear it.
|
||||
LLAppearanceMgr::instance().wearItemOnAvatar(inv_item);
|
||||
LLAppearanceMgr::instance().wearItemOnAvatar(inv_item,true);
|
||||
}
|
||||
|
||||
void wear_cb(const LLUUID& inv_item)
|
||||
@@ -232,8 +233,11 @@ void LLAgentWearables::setAvatarObject(LLVOAvatarSelf *avatar)
|
||||
llassert(avatar);
|
||||
if (avatar)
|
||||
{
|
||||
avatar->outputRezTiming("Sending wearables request");
|
||||
sendAgentWearablesRequest();
|
||||
if(!gHippoGridManager->getConnectedGrid()->isSecondLife())
|
||||
{
|
||||
avatar->outputRezTiming("Sending wearables request");
|
||||
sendAgentWearablesRequest();
|
||||
}
|
||||
setAvatarAppearance(avatar);
|
||||
}
|
||||
}
|
||||
@@ -260,7 +264,7 @@ LLAgentWearables::sendAgentWearablesUpdateCallback::~sendAgentWearablesUpdateCal
|
||||
* @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),
|
||||
@@ -272,7 +276,7 @@ LLAgentWearables::addWearableToAgentInventoryCallback::addWearableToAgentInvento
|
||||
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)
|
||||
{
|
||||
@@ -307,7 +311,8 @@ void LLAgentWearables::addWearableToAgentInventoryCallback::fire(const LLUUID& i
|
||||
}
|
||||
if (mTodo & CALL_WEARITEM)
|
||||
{
|
||||
LLAppearanceMgr::instance().addCOFItemLink(inv_item, true, NULL, mDescription);
|
||||
LLAppearanceMgr::instance().addCOFItemLink(inv_item,
|
||||
new LLUpdateAppearanceAndEditWearableOnDestroy(inv_item), mDescription);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -320,7 +325,7 @@ void LLAgentWearables::addWearabletoAgentInventoryDone(const LLWearableType::ETy
|
||||
|
||||
if (item_id.isNull())
|
||||
return;
|
||||
|
||||
|
||||
LLUUID old_item_id = getWearableItemID(type,index);
|
||||
|
||||
if (wearable)
|
||||
@@ -328,7 +333,7 @@ void LLAgentWearables::addWearabletoAgentInventoryDone(const LLWearableType::ETy
|
||||
wearable->setItemID(item_id);
|
||||
|
||||
if (old_item_id.notNull())
|
||||
{
|
||||
{
|
||||
gInventory.addChangedMask(LLInventoryObserver::LABEL, old_item_id);
|
||||
setWearable(type,index,wearable);
|
||||
}
|
||||
@@ -341,7 +346,7 @@ void LLAgentWearables::addWearabletoAgentInventoryDone(const LLWearableType::ETy
|
||||
gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);
|
||||
|
||||
LLViewerInventoryItem* item = gInventory.getItem(item_id);
|
||||
if(item && wearable)
|
||||
if (item && wearable)
|
||||
{
|
||||
// We're changing the asset id, so we both need to set it
|
||||
// locally via setAssetUUID() and via setTransactionID() which
|
||||
@@ -367,12 +372,12 @@ void LLAgentWearables::sendAgentWearablesUpdate()
|
||||
if (wearable->getItemID().isNull())
|
||||
{
|
||||
LLPointer<LLInventoryCallback> cb =
|
||||
new addWearableToAgentInventoryCallback(
|
||||
new AddWearableToAgentInventoryCallback(
|
||||
LLPointer<LLRefCount>(NULL),
|
||||
(LLWearableType::EType)type,
|
||||
index,
|
||||
wearable,
|
||||
addWearableToAgentInventoryCallback::CALL_NONE);
|
||||
AddWearableToAgentInventoryCallback::CALL_NONE);
|
||||
addWearableToAgentInventory(cb, wearable);
|
||||
}
|
||||
else
|
||||
@@ -470,23 +475,18 @@ 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;
|
||||
U32 todo = AddWearableToAgentInventoryCallback::CALL_NONE;
|
||||
if (send_update)
|
||||
{
|
||||
todo |= addWearableToAgentInventoryCallback::CALL_UPDATE;
|
||||
todo |= AddWearableToAgentInventoryCallback::CALL_UPDATE;
|
||||
}
|
||||
LLPointer<LLInventoryCallback> cb =
|
||||
new addWearableToAgentInventoryCallback(
|
||||
new AddWearableToAgentInventoryCallback(
|
||||
LLPointer<LLRefCount>(NULL),
|
||||
type,
|
||||
index,
|
||||
@@ -539,12 +539,12 @@ LLViewerWearable* LLAgentWearables::saveWearableAs(const LLWearableType::EType t
|
||||
trunc_description);
|
||||
|
||||
LLPointer<LLInventoryCallback> cb =
|
||||
new addWearableToAgentInventoryCallback(
|
||||
new AddWearableToAgentInventoryCallback(
|
||||
LLPointer<LLRefCount>(NULL),
|
||||
type,
|
||||
index,
|
||||
new_wearable,
|
||||
addWearableToAgentInventoryCallback::CALL_WEARITEM,
|
||||
AddWearableToAgentInventoryCallback::CALL_WEARITEM,
|
||||
trunc_description
|
||||
);
|
||||
LLUUID category_id;
|
||||
@@ -826,10 +826,13 @@ void LLAgentWearables::wearableUpdated(LLWearable *wearable, BOOL removed)
|
||||
// the versions themselves are compatible. This code can be removed before release.
|
||||
if( wearable->getDefinitionVersion() == 24 )
|
||||
{
|
||||
wearable->setDefinitionVersion(22);
|
||||
U32 index = getWearableIndex(wearable);
|
||||
saveWearable(wearable->getType(),index,TRUE);
|
||||
U32 index;
|
||||
if (getWearableIndex(wearable,index))
|
||||
{
|
||||
LL_INFOS() << "forcing wearable type " << wearable->getType() << " to version 22 from 24" << LL_ENDL;
|
||||
wearable->setDefinitionVersion(22);
|
||||
saveWearable(wearable->getType(),index,TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
//Needed as wearable 'save' process is a mess and fires superfluous updateScrollingPanelList calls
|
||||
@@ -881,11 +884,13 @@ void LLAgentWearables::getWearableItemIDs(LLWearableType::EType eType, uuid_vec_
|
||||
if (mWearableDatas.end() != itWearableType)
|
||||
{
|
||||
for (wearableentry_vec_t::const_iterator itWearable = itWearableType->second.begin();
|
||||
itWearable != itWearableType->second.end(); ++itWearable)
|
||||
itWearable != itWearableType->second.end(); ++itWearable)
|
||||
{
|
||||
LLViewerWearable* wearable = dynamic_cast<LLViewerWearable*>(*itWearable);
|
||||
if(wearable)
|
||||
idItems.push_back(wearable->getItemID());
|
||||
const LLViewerWearable* pWearable = dynamic_cast<LLViewerWearable*>(*itWearable);
|
||||
if (pWearable)
|
||||
{
|
||||
idItems.push_back(pWearable->getItemID());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1033,12 +1038,12 @@ void LLAgentWearables::recoverMissingWearable(const LLWearableType::EType type,
|
||||
// destory content.) JC
|
||||
const LLUUID lost_and_found_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND);
|
||||
LLPointer<LLInventoryCallback> cb =
|
||||
new addWearableToAgentInventoryCallback(
|
||||
new AddWearableToAgentInventoryCallback(
|
||||
LLPointer<LLRefCount>(NULL),
|
||||
type,
|
||||
index,
|
||||
new_wearable,
|
||||
addWearableToAgentInventoryCallback::CALL_RECOVERDONE);
|
||||
AddWearableToAgentInventoryCallback::CALL_RECOVERDONE);
|
||||
addWearableToAgentInventory( cb, new_wearable, lost_and_found_id, TRUE);
|
||||
}
|
||||
|
||||
@@ -1081,7 +1086,7 @@ public:
|
||||
/* virtual */ void fire(const LLUUID& inv_item)
|
||||
{
|
||||
LL_INFOS() << "One item created " << inv_item.asString() << LL_ENDL;
|
||||
LLViewerInventoryItem *item = gInventory.getItem(inv_item);
|
||||
LLConstPointer<LLInventoryObject> item = gInventory.getItem(inv_item);
|
||||
mItemsToLink.push_back(item);
|
||||
updatePendingWearable(inv_item);
|
||||
}
|
||||
@@ -1089,9 +1094,9 @@ public:
|
||||
{
|
||||
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)
|
||||
{
|
||||
@@ -1140,7 +1145,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
LLInventoryModel::item_array_t mItemsToLink;
|
||||
LLInventoryObject::const_object_list_t mItemsToLink;
|
||||
std::vector<LLViewerWearable*> mWearablesAwaitingItems;
|
||||
};
|
||||
|
||||
@@ -1195,6 +1200,39 @@ void LLAgentWearables::createStandardWearables()
|
||||
}
|
||||
}
|
||||
|
||||
// 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()
|
||||
{
|
||||
LL_DEBUGS("Avatar") << "sendAgentWearablesUpdate()" << LL_ENDL;
|
||||
|
||||
// Send the AgentIsNowWearing
|
||||
gMessageSystem->newMessageFast(_PREHASH_AgentIsNowWearing);
|
||||
|
||||
gMessageSystem->nextBlockFast(_PREHASH_AgentData);
|
||||
gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
|
||||
gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
|
||||
|
||||
// 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"));
|
||||
|
||||
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"));
|
||||
|
||||
gMessageSystem->nextBlockFast(_PREHASH_WearableData);
|
||||
gMessageSystem->addU8Fast(_PREHASH_WearableType, U8(4));
|
||||
gMessageSystem->addUUIDFast(_PREHASH_ItemID, LLUUID("566cb59e-ef60-41d7-bfa6-e0f293fbea40"));
|
||||
|
||||
gAgent.sendReliableMessage();
|
||||
}
|
||||
void LLAgentWearables::createStandardWearablesDone(S32 type, U32 index)
|
||||
{
|
||||
LL_INFOS() << "type " << type << " index " << index << LL_ENDL;
|
||||
@@ -1335,7 +1373,7 @@ void LLAgentWearables::removeWearableFinal( LLWearableType::EType type, bool do_
|
||||
//queryWearableCache(); // moved below
|
||||
if (old_wearable)
|
||||
{
|
||||
popWearable(old_wearable);
|
||||
eraseWearable(old_wearable);
|
||||
old_wearable->removeFromAvatar(TRUE);
|
||||
}
|
||||
}
|
||||
@@ -1352,7 +1390,7 @@ void LLAgentWearables::removeWearableFinal( LLWearableType::EType type, bool do_
|
||||
|
||||
if (old_wearable)
|
||||
{
|
||||
popWearable(old_wearable);
|
||||
eraseWearable(old_wearable);
|
||||
old_wearable->removeFromAvatar(TRUE);
|
||||
}
|
||||
}
|
||||
@@ -1366,30 +1404,92 @@ void LLAgentWearables::removeWearableFinal( LLWearableType::EType type, bool do_
|
||||
|
||||
// Assumes existing wearables are not dirty.
|
||||
void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& items,
|
||||
const std::vector< LLViewerWearable* >& wearables,
|
||||
BOOL remove)
|
||||
const std::vector< LLViewerWearable* >& wearables)
|
||||
{
|
||||
LL_INFOS() << "setWearableOutfit() start" << LL_ENDL;
|
||||
|
||||
// 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 type = 0; type < (S32)LLWearableType::WT_COUNT; type++)
|
||||
{
|
||||
if (LLWearableType::getAssetType((LLWearableType::EType)type) == LLAssetType::AT_CLOTHING)
|
||||
{
|
||||
removeWearable((LLWearableType::EType)type, true, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
S32 count = wearables.size();
|
||||
llassert(items.size() == count);
|
||||
|
||||
S32 i;
|
||||
for (i = 0; i < count; i++)
|
||||
// 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;
|
||||
}
|
||||
|
||||
// Don't care about this case - ordering of wearables with the same asset id has no effect.
|
||||
// Causes the two-alphas error case in MAINT-4158.
|
||||
// We should actually disallow wearing two wearables with the same asset id.
|
||||
#if 0
|
||||
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;
|
||||
}
|
||||
#endif
|
||||
// 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;
|
||||
mCOFChangeInProgress = false;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// TODO: Removed check for ensuring that teens don't remove undershirt and underwear. Handle later
|
||||
// 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++)
|
||||
{
|
||||
if (LLWearableType::getAssetType((LLWearableType::EType)j) == LLAssetType::AT_CLOTHING)
|
||||
{
|
||||
removeWearable((LLWearableType::EType)j, true, 0);
|
||||
}
|
||||
}
|
||||
|
||||
for (S32 i = 0; i < count; i++)
|
||||
{
|
||||
LLViewerWearable* new_wearable = wearables[i];
|
||||
LLPointer<LLInventoryItem> new_item = items[i];
|
||||
@@ -1422,6 +1522,7 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
gAgentAvatarp->setCompositeUpdatesEnabled(TRUE);
|
||||
gAgentAvatarp->writeWearablesToAvatar();
|
||||
gAgentAvatarp->updateVisualParams();
|
||||
|
||||
// If we have not yet declouded, we may want to use
|
||||
@@ -1442,7 +1543,6 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
|
||||
if (!mInitialWearablesLoaded)
|
||||
{
|
||||
mInitialWearablesLoaded = true;
|
||||
mInitialWearablesLoadedSignal();
|
||||
}
|
||||
// [/SL:KB]
|
||||
notifyLoadingFinished();
|
||||
@@ -1511,7 +1611,13 @@ bool LLAgentWearables::onSetWearableDialog(const LLSD& notification, const LLSD&
|
||||
{
|
||||
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
|
||||
LLInventoryItem* new_item = gInventory.getItem( notification["payload"]["item_id"].asUUID());
|
||||
U32 index = gAgentWearables.getWearableIndex(wearable);
|
||||
U32 index;
|
||||
if (!gAgentWearables.getWearableIndex(wearable,index))
|
||||
{
|
||||
LL_WARNS() << "Wearable not found" << LL_ENDL;
|
||||
delete wearable;
|
||||
return false;
|
||||
}
|
||||
if( !new_item )
|
||||
{
|
||||
delete wearable;
|
||||
@@ -1550,11 +1656,11 @@ void LLAgentWearables::setWearableFinal(LLInventoryItem* new_item, LLViewerWeara
|
||||
if (do_append && getWearableItemID(type,0).notNull())
|
||||
{
|
||||
new_wearable->setItemID(new_item->getUUID());
|
||||
/*mWearableDatas[type].push_back(new_wearable);
|
||||
checkWearableAgainstInventory(new_wearable);*/
|
||||
pushWearable(type,new_wearable); //To call LLAgentWearables::wearableUpdated
|
||||
const bool trigger_updated = false;
|
||||
pushWearable(type, new_wearable, trigger_updated);
|
||||
LL_INFOS() << "Added additional wearable for type " << type
|
||||
<< " size is now " << getWearableCount(type) << LL_ENDL;
|
||||
checkWearableAgainstInventory(new_wearable);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1653,33 +1759,12 @@ void LLAgentWearables::invalidateBakedTextureHash(LLMD5& hash) const
|
||||
}
|
||||
}
|
||||
|
||||
// User has picked "remove from avatar" from a menu.
|
||||
// static
|
||||
//void LLAgentWearables::userRemoveWearable(const LLWearableType::EType &type, const U32 &index)
|
||||
//{
|
||||
// if (!(type==LLWearableType::WT_SHAPE || type==LLWearableType::WT_SKIN || type==LLWearableType::WT_HAIR || type==LLWearableType::WT_EYES)) //&&
|
||||
// //!((!gAgent.isTeen()) && (type==LLWearableType::WT_UNDERPANTS || type==LLWearableType::WT_UNDERSHIRT)))
|
||||
// {
|
||||
// gAgentWearables.removeWearable(type,false,index);
|
||||
// }
|
||||
//}
|
||||
|
||||
//static
|
||||
//void LLAgentWearables::userRemoveWearablesOfType(const LLWearableType::EType &type)
|
||||
//{
|
||||
// if (!(type==LLWearableType::WT_SHAPE || type==LLWearableType::WT_SKIN || type==LLWearableType::WT_HAIR || type==LLWearableType::WT_EYES)) //&&
|
||||
// //!((!gAgent.isTeen()) && (type==LLWearableType::WT_UNDERPANTS || type==LLWearableType::WT_UNDERSHIRT)))
|
||||
// {
|
||||
// gAgentWearables.removeWearable(type,true,0);
|
||||
// }
|
||||
//}
|
||||
|
||||
// Combines userRemoveAllAttachments() and userAttachMultipleAttachments() logic to
|
||||
// get attachments into desired state with minimal number of adds/removes.
|
||||
//void LLAgentWearables::userUpdateAttachments(LLInventoryModel::item_array_t& obj_item_array)
|
||||
// [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2010-09-22 (Catznip-2.2)
|
||||
void LLAgentWearables::userUpdateAttachments(LLInventoryModel::item_array_t& obj_item_array, bool attach_only)
|
||||
// [/SL:KB]
|
||||
/// Given a desired set of attachments, find what objects need to be
|
||||
// removed, and what additional inventory items need to be added.
|
||||
void LLAgentWearables::findAttachmentsAddRemoveInfo(LLInventoryModel::item_array_t& obj_item_array,
|
||||
llvo_vec_t& objects_to_remove,
|
||||
llvo_vec_t& objects_to_retain,
|
||||
LLInventoryModel::item_array_t& items_to_add)
|
||||
{
|
||||
// Possible cases:
|
||||
// already wearing but not in request set -> take off.
|
||||
@@ -1691,10 +1776,12 @@ 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.size(); i++)
|
||||
requested_item_ids.insert(obj_item_array[i].get()->getLinkedUUID());
|
||||
|
||||
{
|
||||
const LLUUID & requested_id = obj_item_array[i].get()->getLinkedUUID();
|
||||
//LL_INFOS() << "Requested attachment id " << requested_id << LL_ENDL;
|
||||
requested_item_ids.insert(requested_id);
|
||||
}
|
||||
// Build up list of objects to be removed and items currently attached.
|
||||
llvo_vec_t objects_to_remove;
|
||||
for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
|
||||
iter != gAgentAvatarp->mAttachmentPoints.end();)
|
||||
{
|
||||
@@ -1708,22 +1795,33 @@ void LLAgentWearables::userUpdateAttachments(LLInventoryModel::item_array_t& obj
|
||||
if (objectp)
|
||||
{
|
||||
LLUUID object_item_id = objectp->getAttachmentItemID();
|
||||
|
||||
bool remove_attachment = true;
|
||||
if (requested_item_ids.find(object_item_id) != requested_item_ids.end())
|
||||
{
|
||||
// Object currently worn, was requested.
|
||||
{ // Object currently worn, was requested to keep it
|
||||
// Flag as currently worn so we won't have to add it again.
|
||||
current_item_ids.insert(object_item_id);
|
||||
remove_attachment = false;
|
||||
}
|
||||
else if (objectp->isTempAttachment())
|
||||
{ // Check if we should keep this temp attachment
|
||||
remove_attachment = LLAppearanceMgr::instance().shouldRemoveTempAttachment(objectp->getID());
|
||||
}
|
||||
|
||||
if (remove_attachment)
|
||||
{
|
||||
// LL_INFOS() << "found object to remove, id " << objectp->getID() << ", item " << objectp->getAttachmentItemID() << LL_ENDL;
|
||||
objects_to_remove.push_back(objectp);
|
||||
}
|
||||
else
|
||||
{
|
||||
// object currently worn, not requested.
|
||||
objects_to_remove.push_back(objectp);
|
||||
// LL_INFOS() << "found object to keep, id " << objectp->getID() << ", item " << objectp->getAttachmentItemID() << LL_ENDL;
|
||||
current_item_ids.insert(object_item_id);
|
||||
objects_to_retain.push_back(objectp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LLInventoryModel::item_array_t items_to_add;
|
||||
for (LLInventoryModel::item_array_t::iterator it = obj_item_array.begin();
|
||||
it != obj_item_array.end();
|
||||
++it)
|
||||
@@ -1742,18 +1840,6 @@ void LLAgentWearables::userUpdateAttachments(LLInventoryModel::item_array_t& obj
|
||||
// S32 remove_count = objects_to_remove.size();
|
||||
// S32 add_count = items_to_add.size();
|
||||
// LL_INFOS() << "remove " << remove_count << " add " << add_count << LL_ENDL;
|
||||
|
||||
// Remove everything in objects_to_remove
|
||||
// userRemoveMultipleAttachments(objects_to_remove);
|
||||
// [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2010-09-22 (Catznip-2.2)
|
||||
if (!attach_only)
|
||||
{
|
||||
userRemoveMultipleAttachments(objects_to_remove);
|
||||
}
|
||||
// [/SL:KB]
|
||||
|
||||
// Add everything in items_to_add
|
||||
userAttachMultipleAttachments(items_to_add);
|
||||
}
|
||||
|
||||
void LLAgentWearables::userRemoveMultipleAttachments(llvo_vec_t& objects_to_remove)
|
||||
@@ -1821,7 +1907,7 @@ void LLAgentWearables::userAttachMultipleAttachments(LLInventoryModel::item_arra
|
||||
const LLInventoryItem* pItem = obj_item_array.at(idxItem).get();
|
||||
if (!gRlvAttachmentLocks.canAttach(pItem))
|
||||
{
|
||||
obj_item_array.erase(obj_item_array.begin() + idxItem);
|
||||
obj_item_array.erase( obj_item_array.begin() + idxItem );
|
||||
RLV_ASSERT(false);
|
||||
}
|
||||
}
|
||||
@@ -1938,7 +2024,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, bool upload_bake)
|
||||
{
|
||||
for( S32 type = 0; type < LLWearableType::WT_COUNT; ++type )
|
||||
{
|
||||
@@ -2012,7 +2098,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 = new LLBoostFuncInventoryCallback(wear ? wear_and_edit_cb : wear_cb);
|
||||
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())
|
||||
@@ -2031,8 +2126,7 @@ void LLAgentWearables::createWearable(LLWearableType::EType type, bool wear, con
|
||||
wearable->getTransactionID(),
|
||||
wearable->getName(),
|
||||
wearable->getDescription(),
|
||||
asset_type,
|
||||
inv_type,
|
||||
asset_type, inv_type,
|
||||
wearable->getType(),
|
||||
LLFloaterPerms::getNextOwnerPerms("Wearables"),
|
||||
cb);
|
||||
@@ -2118,13 +2212,6 @@ boost::signals2::connection LLAgentWearables::addLoadedCallback(loaded_callback_
|
||||
return mLoadedSignal.connect(cb);
|
||||
}
|
||||
|
||||
// [SL:KB] - Patch: Appearance-InitialWearablesLoadedCallback | Checked: 2010-08-14 (Catznip-2.1)
|
||||
boost::signals2::connection LLAgentWearables::addInitialWearablesLoadedCallback(loaded_callback_t cb)
|
||||
{
|
||||
return mInitialWearablesLoadedSignal.connect(cb);
|
||||
}
|
||||
// [/SL:KB]
|
||||
|
||||
bool LLAgentWearables::changeInProgress() const
|
||||
{
|
||||
return mCOFChangeInProgress;
|
||||
@@ -2133,6 +2220,7 @@ bool LLAgentWearables::changeInProgress() const
|
||||
void LLAgentWearables::notifyLoadingStarted()
|
||||
{
|
||||
mCOFChangeInProgress = true;
|
||||
mCOFChangeTimer.reset();
|
||||
mLoadingStartedSignal();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user