Dragged over lltexlayer, lldriverparam, lllocaltextureobject, llwearabledata

This commit is contained in:
Shyotl
2013-01-04 20:50:35 -06:00
parent 5ada2d4b6f
commit 9596514c79
57 changed files with 3350 additions and 2819 deletions

View File

@@ -95,7 +95,7 @@ class LLWearAndEditCallback : public LLInventoryCallback
// wearable type stored in asset is some other value.
// Calling this function whenever a wearable is added to increase visibility if this problem
// turns up in other inventories.
void checkWearableAgainstInventory(LLWearable *wearable)
void checkWearableAgainstInventory(LLViewerWearable *wearable)
{
if (wearable->getItemID().isNull())
return;
@@ -132,7 +132,7 @@ void LLAgentWearables::dump()
llinfos << "Type: " << i << " count " << count << llendl;
for (U32 j=0; j<count; j++)
{
LLWearable* wearable = getWearable((LLWearableType::EType)i,j);
LLViewerWearable* wearable = getViewerWearable((LLWearableType::EType)i,j);
if (wearable == NULL)
{
llinfos << " " << j << " NULL wearable" << llendl;
@@ -172,6 +172,7 @@ struct LLAgentDumper
};
LLAgentWearables::LLAgentWearables() :
LLWearableData(),
mWearablesLoaded(FALSE)
, mCOFChangeInProgress(false)
{
@@ -196,10 +197,12 @@ void LLAgentWearables::initClass()
void LLAgentWearables::setAvatarObject(LLVOAvatarSelf *avatar)
{
llassert(avatar);
if (avatar)
{
avatar->outputRezTiming("Sending wearables request");
sendAgentWearablesRequest();
setAvatarAppearance(avatar);
}
}
@@ -226,7 +229,7 @@ LLAgentWearables::sendAgentWearablesUpdateCallback::~sendAgentWearablesUpdateCal
* @param todo Bitmask of actions to take on completion.
*/
LLAgentWearables::addWearableToAgentInventoryCallback::addWearableToAgentInventoryCallback(
LLPointer<LLRefCount> cb, LLWearableType::EType type, U32 index, LLWearable* wearable, U32 todo) :
LLPointer<LLRefCount> cb, LLWearableType::EType type, U32 index, LLViewerWearable* wearable, U32 todo) :
mType(type),
mIndex(index),
mWearable(wearable),
@@ -279,7 +282,7 @@ void LLAgentWearables::addWearableToAgentInventoryCallback::fire(const LLUUID& i
void LLAgentWearables::addWearabletoAgentInventoryDone(const LLWearableType::EType type,
const U32 index,
const LLUUID& item_id,
LLWearable* wearable)
LLViewerWearable* wearable)
{
llinfos << "type " << type << " index " << index << " item " << item_id.asString() << llendl;
@@ -326,7 +329,7 @@ void LLAgentWearables::sendAgentWearablesUpdate()
{
for (U32 index=0; index < getWearableCount((LLWearableType::EType)type); ++index)
{
LLWearable* wearable = getWearable((LLWearableType::EType)type,index);
LLViewerWearable* wearable = getViewerWearable((LLWearableType::EType)type,index);
if (wearable)
{
if (wearable->getItemID().isNull())
@@ -368,7 +371,7 @@ void LLAgentWearables::sendAgentWearablesUpdate()
U8 type_u8 = (U8)type;
gMessageSystem->addU8Fast(_PREHASH_WearableType, type_u8 );
LLWearable* wearable = getWearable((LLWearableType::EType)type, 0);
LLViewerWearable* wearable = getViewerWearable((LLWearableType::EType)type, 0);
if( wearable )
{
//llinfos << "Sending wearable " << wearable->getName() << llendl;
@@ -397,14 +400,14 @@ void LLAgentWearables::saveWearable(const LLWearableType::EType type, const U32
const std::string new_name)
{
//llassert_always(index == 0);
LLWearable* old_wearable = getWearable(type, index);
LLViewerWearable* old_wearable = getViewerWearable(type, index);
if(!old_wearable) return;
bool name_changed = !new_name.empty() && (new_name != old_wearable->getName());
if (name_changed || old_wearable->isDirty() || old_wearable->isOldVersion())
{
LLUUID old_item_id = old_wearable->getItemID();
LLWearable* new_wearable = LLWearableList::instance().createCopy(old_wearable);
new_wearable->setItemID(old_item_id); // should this be in LLWearable::copyDataFrom()?
LLViewerWearable* new_wearable = LLWearableList::instance().createCopy(old_wearable);
new_wearable->setItemID(old_item_id); // should this be in LLViewerWearable::copyDataFrom()?
setWearable(type,index,new_wearable);
// old_wearable may still be referred to by other inventory items. Revert
@@ -470,7 +473,7 @@ void LLAgentWearables::saveWearable(const LLWearableType::EType type, const U32
}
}
LLWearable* LLAgentWearables::saveWearableAs(const LLWearableType::EType type,
LLViewerWearable* LLAgentWearables::saveWearableAs(const LLWearableType::EType type,
const U32 index,
const std::string& new_name,
BOOL save_in_lost_and_found)
@@ -480,7 +483,7 @@ LLWearable* LLAgentWearables::saveWearableAs(const LLWearableType::EType type,
llwarns << "LLAgent::saveWearableAs() not copyable." << llendl;
return NULL;
}
LLWearable* old_wearable = getWearable(type, index);
LLViewerWearable* old_wearable = getViewerWearable(type, index);
if (!old_wearable)
{
llwarns << "LLAgent::saveWearableAs() no old wearable." << llendl;
@@ -495,7 +498,7 @@ LLWearable* LLAgentWearables::saveWearableAs(const LLWearableType::EType type,
}
std::string trunc_name(new_name);
LLStringUtil::truncate(trunc_name, DB_INV_ITEM_NAME_STR_LEN);
LLWearable* new_wearable = LLWearableList::instance().createCopy(
LLViewerWearable* new_wearable = LLWearableList::instance().createCopy(
old_wearable,
trunc_name);
LLPointer<LLInventoryCallback> cb =
@@ -534,7 +537,7 @@ LLWearable* LLAgentWearables::saveWearableAs(const LLWearableType::EType type,
void LLAgentWearables::revertWearable(const LLWearableType::EType type, const U32 index)
{
LLWearable* wearable = getWearable(type, index);
LLViewerWearable* wearable = getViewerWearable(type, index);
llassert(wearable);
if (wearable)
{
@@ -551,7 +554,7 @@ void LLAgentWearables::saveAllWearables()
// return;
//}
for( S32 i=0; i < LLWearableType::WT_COUNT; i++ )
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);
@@ -559,23 +562,23 @@ void LLAgentWearables::saveAllWearables()
sendAgentWearablesUpdate();
}
// Called when the user changes the name of a wearable inventory item that is currenlty being worn.
void LLAgentWearables::setWearableName( const LLUUID& item_id, const std::string& new_name )
// Called when the user changes the name of a wearable inventory item that is currently being worn.
void LLAgentWearables::setWearableName(const LLUUID& item_id, const std::string& new_name)
{
for( S32 i=0; i < LLWearableType::WT_COUNT; i++ )
for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
{
for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
{
LLUUID curr_item_id = getWearableItemID((LLWearableType::EType)i,j);
if (curr_item_id == item_id)
{
LLWearable* old_wearable = getWearable((LLWearableType::EType)i,j);
LLViewerWearable* old_wearable = getViewerWearable((LLWearableType::EType)i,j);
llassert(old_wearable);
if (!old_wearable) continue;
std::string old_name = old_wearable->getName();
old_wearable->setName(new_name);
LLWearable* new_wearable = LLWearableList::instance().createCopy(old_wearable);
LLViewerWearable* new_wearable = LLWearableList::instance().createCopy(old_wearable);
new_wearable->setItemID(item_id);
LLInventoryItem* item = gInventory.getItem(item_id);
if (item)
@@ -659,14 +662,14 @@ LLInventoryItem* LLAgentWearables::getWearableInventoryItem(LLWearableType::ETyp
return item;
}
const LLWearable* LLAgentWearables::getWearableFromItemID( const LLUUID& item_id ) const
const LLViewerWearable* LLAgentWearables::getWearableFromItemID( const LLUUID& item_id ) const
{
const LLUUID& base_item_id = gInventory.getLinkedItemID(item_id);
for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
{
for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
{
const LLWearable * curr_wearable = getWearable((LLWearableType::EType)i, j);
const LLViewerWearable * curr_wearable = getViewerWearable((LLWearableType::EType)i, j);
if (curr_wearable && (curr_wearable->getItemID() == base_item_id))
{
return curr_wearable;
@@ -676,14 +679,14 @@ const LLWearable* LLAgentWearables::getWearableFromItemID( const LLUUID& item_id
return NULL;
}
LLWearable* LLAgentWearables::getWearableFromItemID( const LLUUID& item_id )
LLViewerWearable* LLAgentWearables::getWearableFromItemID(const LLUUID& item_id)
{
const LLUUID& base_item_id = gInventory.getLinkedItemID(item_id);
for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
{
for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
{
LLWearable * curr_wearable = getWearable((LLWearableType::EType)i, j);
LLViewerWearable * curr_wearable = getViewerWearable((LLWearableType::EType)i, j);
if (curr_wearable && (curr_wearable->getItemID() == base_item_id))
{
return curr_wearable;
@@ -693,13 +696,13 @@ LLWearable* LLAgentWearables::getWearableFromItemID( const LLUUID& item_id )
return NULL;
}
LLWearable* LLAgentWearables::getWearableFromAssetID(const LLUUID& asset_id)
LLViewerWearable* LLAgentWearables::getWearableFromAssetID(const LLUUID& asset_id)
{
for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
{
for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
{
LLWearable * curr_wearable = getWearable((LLWearableType::EType)i, j);
LLViewerWearable * curr_wearable = getViewerWearable((LLWearableType::EType)i, j);
if (curr_wearable && (curr_wearable->getAssetID() == asset_id))
{
return curr_wearable;
@@ -718,240 +721,63 @@ void LLAgentWearables::sendAgentWearablesRequest()
gAgent.sendReliableMessage();
}
// Used to enable/disable menu items.
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));
}
// static
BOOL LLAgentWearables::selfHasWearable(LLWearableType::EType type)
{
return (gAgentWearables.getWearableCount(type) > 0);
}
LLWearable* LLAgentWearables::getWearable(const LLWearableType::EType type, U32 index)
// virtual
void LLAgentWearables::wearableUpdated(LLWearable *wearable, BOOL removed)
{
//llassert_always(index == 0);
wearableentry_map_t::iterator wearable_iter = mWearableDatas.find(type);
if (wearable_iter == mWearableDatas.end())
if (isAgentAvatarValid())
{
return NULL;
}
wearableentry_vec_t& wearable_vec = wearable_iter->second;
if (index>=wearable_vec.size())
{
return NULL;
}
else
{
return wearable_vec[index];
}
}
void LLAgentWearables::setWearable(const LLWearableType::EType type, U32 index, LLWearable *wearable)
{
//llassert_always(index == 0);
LLWearable *old_wearable = getWearable(type,index);
if (!old_wearable)
{
pushWearable(type,wearable);
return;
const BOOL upload_result = removed;
gAgentAvatarp->wearableUpdated(wearable->getType(), upload_result);
}
wearableentry_map_t::iterator wearable_iter = mWearableDatas.find(type);
if (wearable_iter == mWearableDatas.end())
{
llwarns << "invalid type, type " << type << " index " << index << llendl;
return;
}
wearableentry_vec_t& wearable_vec = wearable_iter->second;
if (index>=wearable_vec.size())
{
llwarns << "invalid index, type " << type << " index " << index << llendl;
}
else
{
wearable_vec[index] = wearable;
old_wearable->setLabelUpdated();
wearableUpdated(wearable);
checkWearableAgainstInventory(wearable);
}
}
LLWearableData::wearableUpdated(wearable, removed);
U32 LLAgentWearables::pushWearable(const LLWearableType::EType type, LLWearable *wearable)
{
if (wearable == NULL)
if (!removed)
{
// no null wearables please!
llwarns << "Null wearable sent for type " << type << llendl;
return MAX_CLOTHING_PER_TYPE;
}
// if (type < LLWearableType::WT_COUNT || mWearableDatas[type].size() < MAX_CLOTHING_PER_TYPE)
// {
// mWearableDatas[type].push_back(wearable);
// wearableUpdated(wearable);
// checkWearableAgainstInventory(wearable);
// return mWearableDatas[type].size()-1;
// }
// [RLVa:KB] - Checked: 2010-06-08 (RLVa-1.2.0g) | Added: RLVa-1.2.0g
if ( (type < LLWearableType::WT_COUNT) && (mWearableDatas[type].size() < MAX_CLOTHING_PER_TYPE) )
{
// Don't add the same wearable twice
U32 idxWearable = getWearableIndex(wearable);
RLV_ASSERT(MAX_CLOTHING_PER_TYPE == idxWearable); // pushWearable() on an already added wearable is a bug *somewhere*
if (MAX_CLOTHING_PER_TYPE == idxWearable)
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( viewer_wearable->getDefinitionVersion() == 24 )
{
mWearableDatas[type].push_back(wearable);
idxWearable = mWearableDatas[type].size() - 1;
viewer_wearable->setDefinitionVersion(22);
U32 index = getWearableIndex(wearable);
llinfos << "forcing wearable type " << wearable->getType() << " to version 22 from 24" << llendl;
saveWearable(wearable->getType(),index,TRUE);
}
wearableUpdated(wearable);
checkWearableAgainstInventory(wearable);
return idxWearable;
// [/RLVa:KB]
//Needed as wearable 'save' process is a mess and fires superfluous updateScrollingPanelList calls
//while the wearable being created has not yet been stuffed into the wearable list.
//This results in the param hints being buggered and screwing up the current wearable during LLVisualParamHint::preRender,
//thus making the wearable 'dirty'. The code below basically 'forces' a refresh of the panel to fix this.
if(gFloaterCustomize)
gFloaterCustomize->wearablesChanged(wearable->getType());
checkWearableAgainstInventory(viewer_wearable);
}
return MAX_CLOTHING_PER_TYPE;
}
void LLAgentWearables::wearableUpdated(LLWearable *wearable)
{
gAgentAvatarp->wearableUpdated(wearable->getType(), FALSE);
wearable->refreshName();
wearable->setLabelUpdated();
wearable->pullCrossWearableValues();
// 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 werable type " << wearable->getType() << " to version 22 from 24" << llendl;
saveWearable(wearable->getType(),index,TRUE);
}
//Needed as wearable 'save' process is a mess and fires superfluous updateScrollingPanelList calls
//while the wearable being created has not yet been stuffed into the wearable list.
//This results in the param hints being buggered and screwing up the current wearable during LLVisualParamHint::preRender,
//thus making the wearable 'dirty'. The code below basically 'forces' a refresh of the panel to fix this.
if(gFloaterCustomize)
gFloaterCustomize->wearablesChanged(wearable->getType());
}
void LLAgentWearables::popWearable(LLWearable *wearable)
{
if (wearable == NULL)
{
// nothing to do here. move along.
return;
}
U32 index = getWearableIndex(wearable);
LLWearableType::EType type = wearable->getType();
if (index < MAX_CLOTHING_PER_TYPE && index < getWearableCount(type))
{
popWearable(type, index);
}
}
void LLAgentWearables::popWearable(const LLWearableType::EType type, U32 index)
{
//llassert_always(index == 0);
LLWearable *wearable = getWearable(type, index);
if (wearable)
{
mWearableDatas[type].erase(mWearableDatas[type].begin() + index);
if (isAgentAvatarValid())
{
gAgentAvatarp->wearableUpdated(wearable->getType(), TRUE);
}
wearable->setLabelUpdated();
}
}
U32 LLAgentWearables::getWearableIndex(const LLWearable *wearable) const
{
if (wearable == NULL)
{
return MAX_CLOTHING_PER_TYPE;
}
const LLWearableType::EType type = wearable->getType();
wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type);
if (wearable_iter == mWearableDatas.end())
{
llwarns << "tried to get wearable index with an invalid type!" << llendl;
return MAX_CLOTHING_PER_TYPE;
}
const wearableentry_vec_t& wearable_vec = wearable_iter->second;
for(U32 index = 0; index < wearable_vec.size(); index++)
{
if (wearable_vec[index] == wearable)
{
return index;
}
}
return MAX_CLOTHING_PER_TYPE;
}
const LLWearable* LLAgentWearables::getWearable(const LLWearableType::EType type, U32 index) const
{
//llassert_always(index == 0);
wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type);
if (wearable_iter == mWearableDatas.end())
{
return NULL;
}
const wearableentry_vec_t& wearable_vec = wearable_iter->second;
if (index>=wearable_vec.size())
{
return NULL;
}
else
{
return wearable_vec[index];
}
}
LLWearable* LLAgentWearables::getTopWearable(const LLWearableType::EType type)
{
U32 count = getWearableCount(type);
if ( count == 0)
{
return NULL;
}
return getWearable(type, count-1);
}
LLWearable* LLAgentWearables::getBottomWearable(const LLWearableType::EType type)
{
if (getWearableCount(type) == 0)
{
return NULL;
}
return getWearable(type, 0);
}
U32 LLAgentWearables::getWearableCount(const LLWearableType::EType type) const
{
wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type);
if (wearable_iter == mWearableDatas.end())
{
return 0;
}
const wearableentry_vec_t& wearable_vec = wearable_iter->second;
return wearable_vec.size();
}
U32 LLAgentWearables::getWearableCount(const U32 tex_index) const
{
const LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getTEWearableType((LLAvatarAppearanceDefines::ETextureIndex)tex_index);
return getWearableCount(wearable_type);
}
BOOL LLAgentWearables::itemUpdatePending(const LLUUID& item_id) const
@@ -966,7 +792,7 @@ U32 LLAgentWearables::itemUpdatePendingCount() const
const LLUUID LLAgentWearables::getWearableItemID(LLWearableType::EType type, U32 index) const
{
const LLWearable *wearable = getWearable(type,index);
const LLViewerWearable *wearable = getViewerWearable(type,index);
if (wearable)
return wearable->getItemID();
else
@@ -991,7 +817,9 @@ void LLAgentWearables::getWearableItemIDs(LLWearableType::EType eType, uuid_vec_
for (wearableentry_vec_t::const_iterator itWearable = itWearableType->second.begin(), endWearable = itWearableType->second.end();
itWearable != endWearable; ++itWearable)
{
idItems.push_back((*itWearable)->getItemID());
LLViewerWearable* wearable = dynamic_cast<LLViewerWearable*>(*itWearable);
if(wearable)
idItems.push_back(wearable->getItemID());
}
}
}
@@ -999,7 +827,7 @@ void LLAgentWearables::getWearableItemIDs(LLWearableType::EType eType, uuid_vec_
const LLUUID LLAgentWearables::getWearableAssetID(LLWearableType::EType type, U32 index) const
{
const LLWearable *wearable = getWearable(type,index);
const LLViewerWearable *wearable = getViewerWearable(type,index);
if (wearable)
return wearable->getAssetID();
else
@@ -1080,7 +908,7 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs
gMessageSystem->getUUIDFast(_PREHASH_WearableData, _PREHASH_AssetID, asset_id, i );
if( asset_id.isNull() )
{
LLWearable::removeFromAvatar( type, FALSE );
LLViewerWearable::removeFromAvatar( type, FALSE );
}
else
{
@@ -1127,7 +955,7 @@ void LLAgentWearables::recoverMissingWearable(const LLWearableType::EType type,
// 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;
LLWearable* new_wearable = LLWearableList::instance().createNewWearable(type);
LLViewerWearable* new_wearable = LLWearableList::instance().createNewWearable(type, gAgentAvatarp);
setWearable(type,index,new_wearable);
//new_wearable->writeToAvatar( TRUE );
@@ -1164,7 +992,7 @@ void LLAgentWearables::recoverMissingWearableDone()
void LLAgentWearables::addLocalTextureObject(const LLWearableType::EType wearable_type, const LLAvatarAppearanceDefines::ETextureIndex texture_type, U32 wearable_index)
{
LLWearable* wearable = getWearable((LLWearableType::EType)wearable_type, 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;
@@ -1197,7 +1025,7 @@ public:
mItemsToLink,
link_waiter);
}
void addPendingWearable(LLWearable *wearable)
void addPendingWearable(LLViewerWearable *wearable)
{
if (!wearable)
{
@@ -1232,7 +1060,7 @@ public:
LLWearableType::EType type = item->getWearableType();
if (type < LLWearableType::WT_COUNT)
{
LLWearable *wearable = mWearablesAwaitingItems[type];
LLViewerWearable *wearable = mWearablesAwaitingItems[type];
if (wearable)
wearable->setItemID(inv_item);
}
@@ -1245,7 +1073,7 @@ public:
private:
LLInventoryModel::item_array_t mItemsToLink;
std::vector<LLWearable*> mWearablesAwaitingItems;
std::vector<LLViewerWearable*> mWearablesAwaitingItems;
};
void LLAgentWearables::createStandardWearables()
@@ -1258,20 +1086,20 @@ void LLAgentWearables::createStandardWearables()
{
TRUE, //LLWearableType::WT_SHAPE
TRUE, //LLWearableType::WT_SKIN
TRUE, //WT_HAIR
TRUE, //WT_EYES
TRUE, //WT_SHIRT
TRUE, //WT_PANTS
TRUE, //WT_SHOES
TRUE, //WT_SOCKS
FALSE, //WT_JACKET
FALSE, //WT_GLOVES
TRUE, //WT_UNDERSHIRT
TRUE, //WT_UNDERPANTS
FALSE, //WT_SKIRT
FALSE, //WT_ALPHA
FALSE, //WT_TATTOO
FALSE, //WT_PHYSICS
TRUE, //LLWearableType::WT_HAIR
TRUE, //LLWearableType::WT_EYES
TRUE, //LLWearableType::WT_SHIRT
TRUE, //LLWearableType::WT_PANTS
TRUE, //LLWearableType::WT_SHOES
TRUE, //LLWearableType::WT_SOCKS
FALSE, //LLWearableType::WT_JACKET
FALSE, //LLWearableType::WT_GLOVES
TRUE, //LLWearableType::WT_UNDERSHIRT
TRUE, //LLWearableType::WT_UNDERPANTS
FALSE, //LLWearableType::WT_SKIRT
FALSE, //LLWearableType::WT_ALPHA
FALSE, //LLWearableType::WT_TATTOO
FALSE //LLWearableType::WT_PHYSICS
};
LLPointer<LLInventoryCallback> cb = new OnWearableItemCreatedCB;
@@ -1280,7 +1108,7 @@ void LLAgentWearables::createStandardWearables()
if (create[i])
{
llassert(getWearableCount((LLWearableType::EType)i) == 0);
LLWearable* wearable = LLWearableList::instance().createNewWearable((LLWearableType::EType)i);
LLViewerWearable* wearable = LLWearableList::instance().createNewWearable((LLWearableType::EType)i, gAgentAvatarp);
((OnWearableItemCreatedCB*)(&(*cb)))->addPendingWearable(wearable);
// no need to update here...
LLUUID category_id = LLUUID::null;
@@ -1339,7 +1167,7 @@ void LLAgentWearables::makeNewOutfitDone(S32 type, U32 index)
void LLAgentWearables::addWearableToAgentInventory(LLPointer<LLInventoryCallback> cb,
LLWearable* wearable,
LLViewerWearable* wearable,
const LLUUID& category_id,
BOOL notify)
{
@@ -1377,7 +1205,7 @@ void LLAgentWearables::removeWearable(const LLWearableType::EType type, bool do_
}
else
{
LLWearable* old_wearable = getWearable(type,index);
LLViewerWearable* old_wearable = getViewerWearable(type,index);
// if (old_wearable)
// [RLVa:KB] - Checked: 2010-05-11 (RLVa-1.2.0c) | Modified: RLVa-1.2.0g
@@ -1436,10 +1264,10 @@ void LLAgentWearables::removeWearableFinal( LLWearableType::EType type, bool do_
//llassert_always(index == 0);
if (do_remove_all)
{
S32 max_entry = mWearableDatas[type].size()-1;
S32 max_entry = getWearableCount(type)-1;
for (S32 i=max_entry; i>=0; i--)
{
LLWearable* old_wearable = getWearable(type,i);
LLViewerWearable* old_wearable = getViewerWearable(type,i);
//queryWearableCache(); // moved below
// if (old_wearable)
// [RLVa:KB] - Checked: 2010-05-14 (RLVa-1.2.0g) | Added: RLVa-1.2.0g
@@ -1458,7 +1286,7 @@ void LLAgentWearables::removeWearableFinal( LLWearableType::EType type, bool do_
}
else
{
LLWearable* old_wearable = getWearable(type, index);
LLViewerWearable* old_wearable = getViewerWearable(type, index);
//queryWearableCache(); // moved below
// if (old_wearable)
@@ -1504,7 +1332,7 @@ void LLAgentWearables::removeWearableFinal( LLWearableType::EType type, bool do_
// Assumes existing wearables are not dirty.
void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& items,
const LLDynamicArray< LLWearable* >& wearables,
const LLDynamicArray< LLViewerWearable* >& wearables,
BOOL remove)
{
llinfos << "setWearableOutfit() start" << llendl;
@@ -1535,7 +1363,7 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
S32 i;
for (i = 0; i < count; i++)
{
LLWearable* new_wearable = wearables[i];
LLViewerWearable* new_wearable = wearables[i];
LLPointer<LLInventoryItem> new_item = items[i];
llassert(new_wearable);
@@ -1601,8 +1429,8 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
idxCurPerType[type]++;
// [/RLVa:KB]
wearableUpdated(new_wearable);
checkWearableAgainstInventory(new_wearable);
const BOOL removed = FALSE;
wearableUpdated(new_wearable, removed);
}
}
@@ -1645,7 +1473,7 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
// User has picked "wear on avatar" from a menu.
void LLAgentWearables::setWearableItem(LLInventoryItem* new_item, LLWearable* new_wearable, bool do_append)
void LLAgentWearables::setWearableItem(LLInventoryItem* new_item, LLViewerWearable* new_wearable, bool do_append)
{
//LLAgentDumper dumper("setWearableItem");
if (isWearingItem(new_item->getUUID()))
@@ -1670,7 +1498,7 @@ void LLAgentWearables::setWearableItem(LLInventoryItem* new_item, LLWearable* ne
{
// Remove old wearable, if any
// MULTI_WEARABLE: hardwired to 0
LLWearable* old_wearable = getWearable(type,0);
LLViewerWearable* old_wearable = getViewerWearable(type,0);
if( old_wearable )
{
const LLUUID& old_item_id = old_wearable->getItemID();
@@ -1696,7 +1524,7 @@ void LLAgentWearables::setWearableItem(LLInventoryItem* new_item, LLWearable* ne
}
// static
bool LLAgentWearables::onSetWearableDialog( const LLSD& notification, const LLSD& response, LLWearable* wearable )
bool LLAgentWearables::onSetWearableDialog(const LLSD& notification, const LLSD& response, LLViewerWearable* wearable)
{
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
LLInventoryItem* new_item = gInventory.getItem( notification["payload"]["item_id"].asUUID());
@@ -1732,7 +1560,7 @@ bool LLAgentWearables::onSetWearableDialog( const LLSD& notification, const LLSD
// Called from setWearableItem() and onSetWearableDialog() to actually set the wearable.
// MULTI_WEARABLE: unify code after null objects are gone.
void LLAgentWearables::setWearableFinal(LLInventoryItem* new_item, LLWearable* new_wearable, bool do_append)
void LLAgentWearables::setWearableFinal(LLInventoryItem* new_item, LLViewerWearable* new_wearable, bool do_append)
{
const LLWearableType::EType type = new_wearable->getType();
@@ -1750,7 +1578,7 @@ void LLAgentWearables::setWearableFinal(LLInventoryItem* new_item, LLWearable* n
// Replace the old wearable with a new one.
llassert(new_item->getAssetUUID() == new_wearable->getAssetID());
LLWearable *old_wearable = getWearable(type,0);
LLViewerWearable *old_wearable = getViewerWearable(type,0);
LLUUID old_item_id;
if (old_wearable)
{
@@ -1765,7 +1593,7 @@ void LLAgentWearables::setWearableFinal(LLInventoryItem* new_item, LLWearable* n
gInventory.notifyObservers();
}
llinfos << "Replaced current element 0 for type " << type
<< " size is now " << mWearableDatas[type].size() << llendl;
<< " size is now " << getWearableCount(type) << llendl;
}
//llinfos << "LLVOAvatar::setWearableItem()" << llendl;
@@ -1831,46 +1659,14 @@ void LLAgentWearables::queryWearableCache()
}
}
LLUUID LLAgentWearables::computeBakedTextureHash(LLAvatarAppearanceDefines::EBakedTextureIndex baked_index,
BOOL generate_valid_hash) // Set to false if you want to upload the baked texture w/o putting it in the cache
// virtual
void LLAgentWearables::invalidateBakedTextureHash(LLMD5& hash) const
{
LLUUID hash_id;
bool hash_computed = false;
LLMD5 hash;
const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture(baked_index);
for (U8 i=0; i < baked_dict->mWearables.size(); i++)
// Add some garbage into the hash so that it becomes invalid.
if (isAgentAvatarValid())
{
const LLWearableType::EType baked_type = baked_dict->mWearables[i];
const U32 num_wearables = getWearableCount(baked_type);
for (U32 index = 0; index < num_wearables; ++index)
{
const LLWearable* wearable = getWearable(baked_type,index);
if (wearable)
{
LLUUID asset_id = wearable->getAssetID();
hash.update((const unsigned char*)asset_id.mData, UUID_BYTES);
hash_computed = true;
}
}
hash.update((const unsigned char*)gAgentAvatarp->getID().mData, UUID_BYTES);
}
if (hash_computed)
{
hash.update((const unsigned char*)baked_dict->mWearablesHashID.mData, UUID_BYTES);
// Add some garbage into the hash so that it becomes invalid.
if (!generate_valid_hash)
{
if (isAgentAvatarValid())
{
hash.update((const unsigned char*)gAgentAvatarp->getID().mData, UUID_BYTES);
}
}
hash.finalize();
hash.raw_digest(hash_id.mData);
}
return hash_id;
}
// User has picked "remove from avatar" from a menu.
@@ -2146,7 +1942,7 @@ void LLAgentWearables::checkWearablesLoaded() const
// 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)
bool LLAgentWearables::canMoveWearable(const LLUUID& item_id, bool closer_to_body) const
{
const LLWearable* wearable = getWearableFromItemID(item_id);
if (!wearable) return false;
@@ -2174,7 +1970,7 @@ void LLAgentWearables::updateWearablesLoaded()
}
}
bool LLAgentWearables::canWearableBeRemoved(const LLWearable* wearable) const
bool LLAgentWearables::canWearableBeRemoved(const LLViewerWearable* wearable) const
{
if (!wearable) return false;
@@ -2189,7 +1985,7 @@ void LLAgentWearables::animateAllWearableParams(F32 delta, BOOL upload_bake)
{
for (S32 count = 0; count < (S32)getWearableCount((LLWearableType::EType)type); ++count)
{
LLWearable *wearable = getWearable((LLWearableType::EType)type,count);
LLViewerWearable *wearable = getViewerWearable((LLWearableType::EType)type,count);
llassert(wearable);
if (wearable)
{
@@ -2204,28 +2000,39 @@ bool LLAgentWearables::moveWearable(const LLViewerInventoryItem* item, bool clos
if (!item) return false;
if (!item->isWearableType()) return false;
wearableentry_map_t::iterator wearable_iter = mWearableDatas.find(item->getWearableType());
if (wearable_iter == mWearableDatas.end()) return false;
wearableentry_vec_t& wearable_vec = wearable_iter->second;
if (wearable_vec.empty()) return false;
LLWearableType::EType type = item->getWearableType();
U32 wearable_count = getWearableCount(type);
if (0 == wearable_count) return false;
const LLUUID& asset_id = item->getAssetUUID();
//nowhere to move if the wearable is already on any boundary (closest to the body/furthest from the body)
if (closer_to_body && asset_id == wearable_vec.front()->getAssetID()) return false;
if (!closer_to_body && asset_id == wearable_vec.back()->getAssetID()) return false;
for (U32 i = 0; i < wearable_vec.size(); ++i)
if (closer_to_body)
{
LLWearable* wearable = wearable_vec[i];
LLViewerWearable* bottom_wearable = dynamic_cast<LLViewerWearable*>( getBottomWearable(type) );
if (bottom_wearable->getAssetID() == asset_id)
{
return false;
}
}
else // !closer_to_body
{
LLViewerWearable* top_wearable = dynamic_cast<LLViewerWearable*>( getTopWearable(type) );
if (top_wearable->getAssetID() == asset_id)
{
return false;
}
}
for (U32 i = 0; i < wearable_count; ++i)
{
LLViewerWearable* wearable = getViewerWearable(type, i);
if (!wearable) continue;
if (wearable->getAssetID() != asset_id) continue;
//swapping wearables
U32 swap_i = closer_to_body ? i-1 : i+1;
wearable_vec[i] = wearable_vec[swap_i];
wearable_vec[swap_i] = wearable;
swapWearables(type, i, swap_i);
if(gFloaterCustomize)
{
@@ -2243,7 +2050,7 @@ void LLAgentWearables::createWearable(LLWearableType::EType type, bool wear, con
{
if (type == LLWearableType::WT_INVALID || type == LLWearableType::WT_NONE) return;
LLWearable* wearable = LLWearableList::instance().createNewWearable(type);
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 LLWearAndEditCallback : NULL;
@@ -2276,7 +2083,7 @@ void LLAgentWearables::editWearable(const LLUUID& item_id)
return;
}
LLWearable* wearable = gAgentWearables.getWearableFromItemID(item_id);
LLViewerWearable* wearable = gAgentWearables.getWearableFromItemID(item_id);
if (!wearable)
{
llwarns << "Cannot get wearable" << llendl;