Added wearable index handling to LLAgentWearables to scope out further changes. Index is still always zero for now, so behavior should not have changed. (marked with // TODO: MULTI-WEARABLE)
This commit is contained in:
@@ -84,7 +84,7 @@ public:
|
||||
// Add all currently worn wearables
|
||||
for (S32 idxType = 0; idxType < LLWearableType::WT_COUNT; idxType++)
|
||||
{
|
||||
const LLUUID& idItem = gAgentWearables.getWearableItemID((LLWearableType::EType)idxType);
|
||||
const LLUUID& idItem = gAgentWearables.getWearableItemID((LLWearableType::EType)idxType,0); // TODO: MULTI-WEARABLE
|
||||
if (idItem.isNull())
|
||||
continue;
|
||||
idItems.push_back(idItem);
|
||||
@@ -486,7 +486,7 @@ void LLCOFMgr::synchWearables()
|
||||
uuid_vec_t newItems;
|
||||
for (S32 idxType = 0; idxType < LLWearableType::WT_COUNT; idxType++)
|
||||
{
|
||||
const LLUUID& idItem = gAgentWearables.getWearableItemID((LLWearableType::EType)idxType);
|
||||
const LLUUID& idItem = gAgentWearables.getWearableItemID((LLWearableType::EType)idxType, 0); // TODO: MULTI-WEARABLE
|
||||
if (idItem.isNull())
|
||||
continue;
|
||||
newItems.push_back(idItem);
|
||||
|
||||
@@ -3950,7 +3950,7 @@ void LLAgent::sendAgentSetAppearance()
|
||||
|
||||
|
||||
static bool send_physics_params = false;
|
||||
send_physics_params |= !!gAgentWearables.getWearable(LLWearableType::WT_PHYSICS);
|
||||
send_physics_params |= !!gAgentWearables.selfHasWearable(LLWearableType::WT_PHYSICS);
|
||||
S32 transmitted_params = 0;
|
||||
for (LLViewerVisualParam* param = (LLViewerVisualParam*)gAgentAvatarp->getFirstVisualParam();
|
||||
param;
|
||||
|
||||
@@ -105,22 +105,39 @@ LLAgentWearables::sendAgentWearablesUpdateCallback::~sendAgentWearablesUpdateCal
|
||||
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 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(
|
||||
LLPointer<LLRefCount> cb, LLWearableType::EType type, LLWearable* wearable, U32 todo) :
|
||||
LLPointer<LLRefCount> cb, LLWearableType::EType type, U32 index, LLWearable* wearable, U32 todo) :
|
||||
mType(type),
|
||||
mIndex(index),
|
||||
mWearable(wearable),
|
||||
mTodo(todo),
|
||||
mCB(cb)
|
||||
{
|
||||
llassert_always(index == 0);
|
||||
llinfos << "constructor" << llendl;
|
||||
}
|
||||
|
||||
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, inv_item, mWearable);
|
||||
gAgentWearables.addWearabletoAgentInventoryDone(mType, mIndex, inv_item, mWearable);
|
||||
|
||||
if (mTodo & CALL_UPDATE)
|
||||
{
|
||||
@@ -135,24 +152,28 @@ void LLAgentWearables::addWearableToAgentInventoryCallback::fire(const LLUUID& i
|
||||
*/
|
||||
if (mTodo & CALL_CREATESTANDARDDONE)
|
||||
{
|
||||
gAgentWearables.createStandardWearablesDone(mType);
|
||||
gAgentWearables.createStandardWearablesDone(mType, mIndex);
|
||||
}
|
||||
if (mTodo & CALL_MAKENEWOUTFITDONE)
|
||||
{
|
||||
gAgentWearables.makeNewOutfitDone(mType);
|
||||
gAgentWearables.makeNewOutfitDone(mType, mIndex);
|
||||
}
|
||||
}
|
||||
|
||||
void LLAgentWearables::addWearabletoAgentInventoryDone(const LLWearableType::EType type,
|
||||
const LLUUID& item_id,
|
||||
LLWearable* wearable)
|
||||
const U32 index,
|
||||
const LLUUID& item_id,
|
||||
LLWearable* wearable)
|
||||
{
|
||||
llinfos << "type " << type << " item " << item_id.asString() << llendl;
|
||||
llassert_always(index == 0);
|
||||
|
||||
llinfos << "type " << type << " index " << index << " item " << item_id.asString() << llendl;
|
||||
|
||||
if (item_id.isNull())
|
||||
return;
|
||||
|
||||
LLUUID old_item_id = getWearableItemID(type,index);
|
||||
|
||||
LLUUID old_item_id = getWearableItemID(type);
|
||||
if (wearable)
|
||||
{
|
||||
wearable->setItemID(item_id);
|
||||
@@ -160,7 +181,7 @@ void LLAgentWearables::addWearabletoAgentInventoryDone(const LLWearableType::ETy
|
||||
if (old_item_id.notNull())
|
||||
{
|
||||
gInventory.addChangedMask(LLInventoryObserver::LABEL, old_item_id);
|
||||
setWearable(type,wearable);
|
||||
setWearable(type,index,wearable);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -189,8 +210,9 @@ 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)
|
||||
{
|
||||
LLWearable* wearable = getWearable((LLWearableType::EType)type);
|
||||
LLWearable* wearable = getWearable((LLWearableType::EType)type,index);
|
||||
if (wearable)
|
||||
{
|
||||
if (wearable->getItemID().isNull())
|
||||
@@ -199,6 +221,7 @@ void LLAgentWearables::sendAgentWearablesUpdate()
|
||||
new addWearableToAgentInventoryCallback(
|
||||
LLPointer<LLRefCount>(NULL),
|
||||
(LLWearableType::EType)type,
|
||||
index,
|
||||
wearable,
|
||||
addWearableToAgentInventoryCallback::CALL_NONE);
|
||||
addWearableToAgentInventory(cb, wearable);
|
||||
@@ -226,18 +249,19 @@ void LLAgentWearables::sendAgentWearablesUpdate()
|
||||
gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
|
||||
|
||||
lldebugs << "sendAgentWearablesUpdate()" << llendl;
|
||||
for (S32 type=0; type < LLWearableType::WT_COUNT; ++type)
|
||||
// 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 );
|
||||
|
||||
LLWearable* wearable = getWearable((LLWearableType::EType)type);
|
||||
LLWearable* wearable = getWearable((LLWearableType::EType)type, 0);
|
||||
if( wearable )
|
||||
{
|
||||
//llinfos << "Sending wearable " << wearable->getName() << llendl;
|
||||
LLUUID item_id = wearable->getItemID();
|
||||
LL_DEBUGS("Wearables") << "Sending wearable " << wearable->getName() << " mItemID = " << item_id << LL_ENDL;
|
||||
const LLViewerInventoryItem *item = gInventory.getItem(item_id);
|
||||
if (item && item->getIsLinkType())
|
||||
{
|
||||
@@ -249,8 +273,8 @@ void LLAgentWearables::sendAgentWearablesUpdate()
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_DEBUGS("Wearables") << "Not wearing wearable type " << LLWearableType::getTypeName((LLWearableType::EType)type) << LL_ENDL;
|
||||
gMessageSystem->addUUIDFast(_PREHASH_ItemID, LLUUID::null );
|
||||
//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;
|
||||
@@ -258,10 +282,11 @@ void LLAgentWearables::sendAgentWearablesUpdate()
|
||||
gAgent.sendReliableMessage();
|
||||
}
|
||||
|
||||
void LLAgentWearables::saveWearable(const LLWearableType::EType type, BOOL send_update,
|
||||
void LLAgentWearables::saveWearable(const LLWearableType::EType type, const U32 index, BOOL send_update,
|
||||
const std::string new_name)
|
||||
{
|
||||
LLWearable* old_wearable = getWearable(type);
|
||||
llassert_always(index == 0);
|
||||
LLWearable* old_wearable = getWearable(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())
|
||||
@@ -269,7 +294,7 @@ void LLAgentWearables::saveWearable(const LLWearableType::EType type, BOOL send_
|
||||
LLUUID old_item_id = old_wearable->getItemID();
|
||||
LLWearable* new_wearable = LLWearableList::instance().createCopyFromAvatar( old_wearable );
|
||||
new_wearable->setItemID(old_item_id); // should this be in LLWearable::copyDataFrom()?
|
||||
setWearable(type,new_wearable);
|
||||
setWearable(type,index,new_wearable);
|
||||
|
||||
LLInventoryItem* item = gInventory.getItem(old_item_id);
|
||||
if( item )
|
||||
@@ -313,6 +338,7 @@ void LLAgentWearables::saveWearable(const LLWearableType::EType type, BOOL send_
|
||||
new addWearableToAgentInventoryCallback(
|
||||
LLPointer<LLRefCount>(NULL),
|
||||
type,
|
||||
index,
|
||||
new_wearable,
|
||||
todo);
|
||||
addWearableToAgentInventory(cb, new_wearable);
|
||||
@@ -329,23 +355,25 @@ void LLAgentWearables::saveWearable(const LLWearableType::EType type, BOOL send_
|
||||
}
|
||||
|
||||
void LLAgentWearables::saveWearableAs(const LLWearableType::EType type,
|
||||
const U32 index,
|
||||
const std::string& new_name,
|
||||
BOOL save_in_lost_and_found)
|
||||
{
|
||||
if(!isWearableCopyable(type))
|
||||
llassert_always(index == 0);
|
||||
if (!isWearableCopyable(type, index))
|
||||
{
|
||||
llwarns << "LLAgent::saveWearableAs() not copyable." << llendl;
|
||||
return;
|
||||
}
|
||||
LLWearable* old_wearable = getWearable(type);
|
||||
if(!old_wearable)
|
||||
LLWearable* old_wearable = getWearable(type, index);
|
||||
if (!old_wearable)
|
||||
{
|
||||
llwarns << "LLAgent::saveWearableAs() no old wearable." << llendl;
|
||||
return;
|
||||
}
|
||||
|
||||
LLInventoryItem* item = gInventory.getItem(getWearableItemID(type));
|
||||
if(!item)
|
||||
LLInventoryItem* item = gInventory.getItem(getWearableItemID(type,index));
|
||||
if (!item)
|
||||
{
|
||||
llwarns << "LLAgent::saveWearableAs() no inventory item." << llendl;
|
||||
return;
|
||||
@@ -359,6 +387,7 @@ void LLAgentWearables::saveWearableAs(const LLWearableType::EType type,
|
||||
new addWearableToAgentInventoryCallback(
|
||||
LLPointer<LLRefCount>(NULL),
|
||||
type,
|
||||
index,
|
||||
new_wearable,
|
||||
addWearableToAgentInventoryCallback::CALL_UPDATE);
|
||||
LLUUID category_id;
|
||||
@@ -422,9 +451,10 @@ void LLAgentWearables::saveWearableAs(const LLWearableType::EType type,
|
||||
*/
|
||||
}
|
||||
|
||||
void LLAgentWearables::revertWearable( LLWearableType::EType type )
|
||||
void LLAgentWearables::revertWearable(const LLWearableType::EType type, const U32 index)
|
||||
{
|
||||
LLWearable* wearable = getWearable(type);
|
||||
llassert_always(index == 0);
|
||||
LLWearable* wearable = getWearable(type, index);
|
||||
llassert(wearable);
|
||||
if( wearable )
|
||||
{
|
||||
@@ -438,7 +468,8 @@ void LLAgentWearables::revertAllWearables()
|
||||
{
|
||||
for( S32 i=0; i < LLWearableType::WT_COUNT; i++ )
|
||||
{
|
||||
revertWearable( (LLWearableType::EType)i );
|
||||
for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
|
||||
revertWearable( (LLWearableType::EType)i, j);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -451,7 +482,8 @@ void LLAgentWearables::saveAllWearables()
|
||||
|
||||
for( S32 i=0; i < LLWearableType::WT_COUNT; i++ )
|
||||
{
|
||||
saveWearable( (LLWearableType::EType)i, FALSE );
|
||||
for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
|
||||
saveWearable((LLWearableType::EType)i, j, FALSE);
|
||||
}
|
||||
sendAgentWearablesUpdate();
|
||||
}
|
||||
@@ -461,35 +493,39 @@ void LLAgentWearables::setWearableName( const LLUUID& item_id, const std::string
|
||||
{
|
||||
for( S32 i=0; i < LLWearableType::WT_COUNT; i++ )
|
||||
{
|
||||
LLUUID curr_item_id = getWearableItemID((LLWearableType::EType)i);
|
||||
if( curr_item_id == item_id )
|
||||
for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
|
||||
{
|
||||
LLWearable* old_wearable = getWearable((LLWearableType::EType)i);
|
||||
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);
|
||||
new_wearable->setItemID(item_id);
|
||||
LLInventoryItem* item = gInventory.getItem(item_id);
|
||||
if(item)
|
||||
LLUUID curr_item_id = getWearableItemID((LLWearableType::EType)i,j);
|
||||
if (curr_item_id == item_id)
|
||||
{
|
||||
new_wearable->setPermissions(item->getPermissions());
|
||||
}
|
||||
old_wearable->setName( old_name );
|
||||
LLWearable* old_wearable = getWearable((LLWearableType::EType)i,j);
|
||||
llassert(old_wearable);
|
||||
if (!old_wearable) continue;
|
||||
|
||||
setWearable((LLWearableType::EType)i,new_wearable);
|
||||
sendAgentWearablesUpdate();
|
||||
break;
|
||||
std::string old_name = old_wearable->getName();
|
||||
old_wearable->setName(new_name);
|
||||
LLWearable* new_wearable = LLWearableList::instance().createCopy(old_wearable);
|
||||
new_wearable->setItemID(item_id);
|
||||
LLInventoryItem* item = gInventory.getItem(item_id);
|
||||
if (item)
|
||||
{
|
||||
new_wearable->setPermissions(item->getPermissions());
|
||||
}
|
||||
old_wearable->setName(old_name);
|
||||
|
||||
setWearable((LLWearableType::EType)i,j,new_wearable);
|
||||
sendAgentWearablesUpdate();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BOOL LLAgentWearables::isWearableModifiable(LLWearableType::EType type) const
|
||||
BOOL LLAgentWearables::isWearableModifiable(LLWearableType::EType type, U32 index) const
|
||||
{
|
||||
LLUUID item_id = getWearableItemID(type);
|
||||
llassert_always(index == 0);
|
||||
LLUUID item_id = getWearableItemID(type, index);
|
||||
return item_id.notNull() ? isWearableModifiable(item_id) : FALSE;
|
||||
}
|
||||
|
||||
@@ -508,10 +544,11 @@ BOOL LLAgentWearables::isWearableModifiable(const LLUUID& item_id) const
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL LLAgentWearables::isWearableCopyable(LLWearableType::EType type) const
|
||||
BOOL LLAgentWearables::isWearableCopyable(LLWearableType::EType type, U32 index) const
|
||||
{
|
||||
LLUUID item_id = getWearableItemID(type);
|
||||
if(!item_id.isNull())
|
||||
llassert_always(index == 0);
|
||||
LLUUID item_id = getWearableItemID(type, index);
|
||||
if (!item_id.isNull())
|
||||
{
|
||||
LLInventoryItem* item = gInventory.getItem(item_id);
|
||||
if(item && item->getPermissions().allowCopyBy(gAgent.getID(),
|
||||
@@ -530,7 +567,7 @@ BOOL LLAgentWearables::areWearablesLoaded() const
|
||||
return mWearablesLoaded;
|
||||
}
|
||||
|
||||
U32 LLAgentWearables::getWearablePermMask(LLWearableType::EType type) const
|
||||
/*U32 LLAgentWearables::getWearablePermMask(LLWearableType::EType type) const
|
||||
{
|
||||
LLUUID item_id = getWearableItemID(type);
|
||||
if(!item_id.isNull())
|
||||
@@ -543,10 +580,12 @@ U32 LLAgentWearables::getWearablePermMask(LLWearableType::EType type) const
|
||||
}
|
||||
return PERM_NONE;
|
||||
}
|
||||
*/
|
||||
|
||||
LLInventoryItem* LLAgentWearables::getWearableInventoryItem(LLWearableType::EType type)
|
||||
LLInventoryItem* LLAgentWearables::getWearableInventoryItem(LLWearableType::EType type, U32 index)
|
||||
{
|
||||
LLUUID item_id = getWearableItemID(type);
|
||||
llassert_always(index == 0);
|
||||
LLUUID item_id = getWearableItemID(type,index);
|
||||
LLInventoryItem* item = NULL;
|
||||
if(item_id.notNull())
|
||||
{
|
||||
@@ -558,12 +597,15 @@ LLInventoryItem* LLAgentWearables::getWearableInventoryItem(LLWearableType::ETyp
|
||||
const LLWearable* 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 (S32 i=0; i < LLWearableType::WT_COUNT; i++)
|
||||
{
|
||||
const LLWearable * curr_wearable = getWearable((LLWearableType::EType)i);
|
||||
if (curr_wearable && (curr_wearable->getItemID() == base_item_id))
|
||||
for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
|
||||
{
|
||||
return curr_wearable;
|
||||
const LLWearable * curr_wearable = getWearable((LLWearableType::EType)i, j);
|
||||
if (curr_wearable && (curr_wearable->getItemID() == base_item_id))
|
||||
{
|
||||
return curr_wearable;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
@@ -572,12 +614,15 @@ const LLWearable* LLAgentWearables::getWearableFromItemID( const LLUUID& item_id
|
||||
LLWearable* 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 (S32 i=0; i < LLWearableType::WT_COUNT; i++)
|
||||
{
|
||||
LLWearable * curr_wearable = getWearable((LLWearableType::EType)i);
|
||||
if (curr_wearable && (curr_wearable->getItemID() == base_item_id))
|
||||
for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
|
||||
{
|
||||
return curr_wearable;
|
||||
LLWearable * curr_wearable = getWearable((LLWearableType::EType)i, j);
|
||||
if (curr_wearable && (curr_wearable->getItemID() == base_item_id))
|
||||
{
|
||||
return curr_wearable;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
@@ -587,10 +632,13 @@ LLWearable* LLAgentWearables::getWearableFromAssetID(const LLUUID& asset_id)
|
||||
{
|
||||
for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
|
||||
{
|
||||
LLWearable * curr_wearable = getWearable((LLWearableType::EType)i);
|
||||
if (curr_wearable && (curr_wearable->getAssetID() == asset_id))
|
||||
for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
|
||||
{
|
||||
return curr_wearable;
|
||||
LLWearable * curr_wearable = getWearable((LLWearableType::EType)i, j);
|
||||
if (curr_wearable && (curr_wearable->getAssetID() == asset_id))
|
||||
{
|
||||
return curr_wearable;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
@@ -612,14 +660,14 @@ BOOL LLAgentWearables::selfHasWearable(LLWearableType::EType type)
|
||||
return (gAgentWearables.getWearableCount(type) > 0);
|
||||
}
|
||||
|
||||
LLWearable* LLAgentWearables::getWearable(const LLWearableType::EType type)
|
||||
LLWearable* LLAgentWearables::getWearable(const LLWearableType::EType type, U32 index)
|
||||
{
|
||||
llassert_always(index == 0);
|
||||
wearableentry_map_t::iterator wearable_iter = mWearableDatas.find(type);
|
||||
if (wearable_iter == mWearableDatas.end())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
U32 index = 0; //Remove when multi-wearables are implemented.
|
||||
wearableentry_vec_t& wearable_vec = wearable_iter->second;
|
||||
if (index>=wearable_vec.size())
|
||||
{
|
||||
@@ -631,17 +679,16 @@ LLWearable* LLAgentWearables::getWearable(const LLWearableType::EType type)
|
||||
}
|
||||
}
|
||||
|
||||
void LLAgentWearables::setWearable(const LLWearableType::EType type, LLWearable *wearable)
|
||||
void LLAgentWearables::setWearable(const LLWearableType::EType type, U32 index, LLWearable *wearable)
|
||||
{
|
||||
|
||||
LLWearable *old_wearable = getWearable(type);
|
||||
llassert_always(index == 0);
|
||||
LLWearable *old_wearable = getWearable(type,index);
|
||||
if (!old_wearable)
|
||||
{
|
||||
pushWearable(type,wearable);
|
||||
return;
|
||||
}
|
||||
|
||||
U32 index = 0; //Remove when multi-wearables are implemented.
|
||||
wearableentry_map_t::iterator wearable_iter = mWearableDatas.find(type);
|
||||
if (wearable_iter == mWearableDatas.end())
|
||||
{
|
||||
@@ -692,22 +739,23 @@ void LLAgentWearables::popWearable(LLWearable *wearable)
|
||||
// nothing to do here. move along.
|
||||
return;
|
||||
}
|
||||
|
||||
U32 index = 0; //Remove when multi-wearables are implemented.
|
||||
|
||||
U32 index = getWearableIndex(wearable);
|
||||
LLWearableType::EType type = wearable->getType();
|
||||
|
||||
if (index < MAX_CLOTHING_PER_TYPE && index < getWearableCount(type))
|
||||
{
|
||||
popWearable(type);
|
||||
popWearable(type, index);
|
||||
}
|
||||
}
|
||||
|
||||
void LLAgentWearables::popWearable(const LLWearableType::EType type)
|
||||
void LLAgentWearables::popWearable(const LLWearableType::EType type, U32 index)
|
||||
{
|
||||
LLWearable *wearable = getWearable(type);
|
||||
llassert_always(index == 0);
|
||||
LLWearable *wearable = getWearable(type, index);
|
||||
if (wearable)
|
||||
{
|
||||
mWearableDatas[type].erase(mWearableDatas[type].begin());
|
||||
mWearableDatas[type].erase(mWearableDatas[type].begin() + index);
|
||||
gAgentAvatarp->wearableUpdated(wearable->getType(), TRUE);
|
||||
wearable->setLabelUpdated();
|
||||
}
|
||||
@@ -739,15 +787,14 @@ U32 LLAgentWearables::getWearableIndex(const LLWearable *wearable) const
|
||||
return MAX_CLOTHING_PER_TYPE;
|
||||
}
|
||||
|
||||
|
||||
const LLWearable* LLAgentWearables::getWearable(const LLWearableType::EType type) const
|
||||
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;
|
||||
}
|
||||
U32 index = 0; //Remove when multi-wearables are implemented.
|
||||
const wearableentry_vec_t& wearable_vec = wearable_iter->second;
|
||||
if (index>=wearable_vec.size())
|
||||
{
|
||||
@@ -767,7 +814,7 @@ LLWearable* LLAgentWearables::getTopWearable(const LLWearableType::EType type)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return getWearable(type);
|
||||
return getWearable(type, count-1);
|
||||
}
|
||||
|
||||
LLWearable* LLAgentWearables::getBottomWearable(const LLWearableType::EType type)
|
||||
@@ -777,7 +824,7 @@ LLWearable* LLAgentWearables::getBottomWearable(const LLWearableType::EType type
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return getWearable(type);
|
||||
return getWearable(type, 0);
|
||||
}
|
||||
|
||||
U32 LLAgentWearables::getWearableCount(const LLWearableType::EType type) const
|
||||
@@ -798,18 +845,20 @@ U32 LLAgentWearables::getWearableCount(const U32 tex_index) const
|
||||
}
|
||||
|
||||
|
||||
const LLUUID LLAgentWearables::getWearableItemID(LLWearableType::EType type) const
|
||||
const LLUUID LLAgentWearables::getWearableItemID(LLWearableType::EType type, U32 index) const
|
||||
{
|
||||
const LLWearable *wearable = getWearable(type);
|
||||
llassert_always(index == 0);
|
||||
const LLWearable *wearable = getWearable(type,index);
|
||||
if (wearable)
|
||||
return wearable->getItemID();
|
||||
else
|
||||
return LLUUID();
|
||||
}
|
||||
|
||||
const LLUUID LLAgentWearables::getWearableAssetID(LLWearableType::EType type) const
|
||||
const LLUUID LLAgentWearables::getWearableAssetID(LLWearableType::EType type, U32 index) const
|
||||
{
|
||||
const LLWearable *wearable = getWearable(type);
|
||||
llassert_always(index == 0);
|
||||
const LLWearable *wearable = getWearable(type,index);
|
||||
if (wearable)
|
||||
return wearable->getAssetID();
|
||||
else
|
||||
@@ -822,8 +871,12 @@ BOOL LLAgentWearables::isWearingItem( const LLUUID& item_id ) const
|
||||
return (getWearableFromItemID(base_item_id) != NULL);
|
||||
}
|
||||
|
||||
// MULTI-WEARABLE: DEPRECATED (see backwards compatibility)
|
||||
// static
|
||||
void LLAgentWearables::processAgentInitialWearablesUpdate( LLMessageSystem* mesgsys, void** user_data )
|
||||
// ! 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.
|
||||
@@ -881,7 +934,7 @@ void LLAgentWearables::processAgentInitialWearablesUpdate( LLMessageSystem* mesg
|
||||
asset_id_array[type] = std::pair<LLUUID, LLUUID>(asset_id,item_id);
|
||||
}
|
||||
|
||||
LL_DEBUGS("Wearables") << " " << LLWearableType::getTypeLabel(type) << " " << asset_id << " item id " << gAgentWearables.getWearableItemID(type).asString() << LL_ENDL;
|
||||
LL_DEBUGS("Wearables") << " " << LLWearableType::getTypeLabel(type) << " " << asset_id << " item id " << gAgentWearables.getWearableItemID(type, 0).asString() << LL_ENDL;
|
||||
}
|
||||
|
||||
LLCOFMgr::instance().fetchCOF();
|
||||
@@ -928,7 +981,7 @@ void LLAgentWearables::onInitialWearableAssetArrived( LLWearable* wearable, void
|
||||
{
|
||||
llassert( type == wearable->getType() );
|
||||
wearable->setItemID(item_id);
|
||||
gAgentWearables.setWearable(type,wearable);
|
||||
gAgentWearables.setWearable(type,0,wearable);
|
||||
|
||||
// disable composites if initial textures are baked
|
||||
avatar->setupComposites();
|
||||
@@ -941,7 +994,7 @@ void LLAgentWearables::onInitialWearableAssetArrived( LLWearable* wearable, void
|
||||
else
|
||||
{
|
||||
// Somehow the asset doesn't exist in the database.
|
||||
gAgentWearables.recoverMissingWearable( type );
|
||||
gAgentWearables.recoverMissingWearable( type, 0 );
|
||||
}
|
||||
|
||||
gInventory.notifyObservers();
|
||||
@@ -952,7 +1005,7 @@ void LLAgentWearables::onInitialWearableAssetArrived( LLWearable* wearable, void
|
||||
gAgentWearables.mWearablesLoaded = TRUE;
|
||||
for( S32 i = 0; i < LLWearableType::WT_COUNT; i++ )
|
||||
{
|
||||
if( !gAgentWearables.getWearableItemID((LLWearableType::EType)i).isNull() && !gAgentWearables.getWearable((LLWearableType::EType)i) )
|
||||
if( !gAgentWearables.getWearableItemID((LLWearableType::EType)i, 0).isNull() && !gAgentWearables.getWearable((LLWearableType::EType)i, 0) )
|
||||
{
|
||||
gAgentWearables.mWearablesLoaded = FALSE;
|
||||
break;
|
||||
@@ -977,14 +1030,15 @@ void LLAgentWearables::onInitialWearableAssetArrived( LLWearable* wearable, void
|
||||
// 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( LLWearableType::EType type )
|
||||
void LLAgentWearables::recoverMissingWearable(const LLWearableType::EType type, U32 index)
|
||||
{
|
||||
llassert_always(index == 0);
|
||||
// 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);
|
||||
|
||||
setWearable(type,new_wearable);
|
||||
setWearable(type,index,new_wearable);
|
||||
new_wearable->writeToAvatar( TRUE );
|
||||
|
||||
// Add a new one in the lost and found folder.
|
||||
@@ -995,6 +1049,7 @@ void LLAgentWearables::recoverMissingWearable( LLWearableType::EType type )
|
||||
new addWearableToAgentInventoryCallback(
|
||||
LLPointer<LLRefCount>(NULL),
|
||||
type,
|
||||
index,
|
||||
new_wearable,
|
||||
addWearableToAgentInventoryCallback::CALL_RECOVERDONE);
|
||||
addWearableToAgentInventory( cb, new_wearable, lost_and_found_id, TRUE);
|
||||
@@ -1063,15 +1118,16 @@ void LLAgentWearables::createStandardWearables(BOOL female)
|
||||
new addWearableToAgentInventoryCallback(
|
||||
donecb,
|
||||
(LLWearableType::EType)i,
|
||||
0,
|
||||
wearable,
|
||||
addWearableToAgentInventoryCallback::CALL_CREATESTANDARDDONE);
|
||||
addWearableToAgentInventory(cb, wearable, LLUUID::null, FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
void LLAgentWearables::createStandardWearablesDone(S32 index)
|
||||
void LLAgentWearables::createStandardWearablesDone(S32 type, U32 index)
|
||||
{
|
||||
LLWearable* wearable = getWearable((LLWearableType::EType)index);
|
||||
LLWearable* wearable = getWearable((LLWearableType::EType)type, index);
|
||||
|
||||
if (wearable)
|
||||
{
|
||||
@@ -1126,10 +1182,10 @@ void LLAgentWearables::makeNewOutfit(
|
||||
for( i = 0; i < count; ++i )
|
||||
{
|
||||
S32 index = wearables_to_include[i];
|
||||
LLWearable* old_wearable = getWearable((LLWearableType::EType)index);
|
||||
LLWearable* old_wearable = getWearable((LLWearableType::EType)index, 0);
|
||||
if( old_wearable )
|
||||
{
|
||||
LLViewerInventoryItem* item = gInventory.getItem(getWearableItemID((LLWearableType::EType)index));
|
||||
LLViewerInventoryItem* item = gInventory.getItem(getWearableItemID((LLWearableType::EType)index, 0));
|
||||
llassert(item);
|
||||
if (!item)
|
||||
continue;
|
||||
@@ -1157,7 +1213,7 @@ void LLAgentWearables::makeNewOutfit(
|
||||
LLStringUtil::truncate(new_name, DB_INV_ITEM_NAME_STR_LEN);
|
||||
}
|
||||
|
||||
if (fUseLinks || isWearableCopyable((LLWearableType::EType)index))
|
||||
if (fUseLinks || isWearableCopyable((LLWearableType::EType)index, 0))
|
||||
{
|
||||
LLWearable* new_wearable = LLWearableList::instance().createCopy(old_wearable);
|
||||
if (rename_clothing)
|
||||
@@ -1178,9 +1234,10 @@ void LLAgentWearables::makeNewOutfit(
|
||||
new addWearableToAgentInventoryCallback(
|
||||
cbdone,
|
||||
(LLWearableType::EType)index,
|
||||
0,
|
||||
new_wearable,
|
||||
todo);
|
||||
if (isWearableCopyable((LLWearableType::EType)index))
|
||||
if (isWearableCopyable((LLWearableType::EType)index, 0))
|
||||
{
|
||||
copy_inventory_item(
|
||||
gAgent.getID(),
|
||||
@@ -1292,9 +1349,9 @@ void LLAgentWearables::makeNewOutfit(
|
||||
}
|
||||
}
|
||||
|
||||
void LLAgentWearables::makeNewOutfitDone(S32 type)
|
||||
void LLAgentWearables::makeNewOutfitDone(S32 type, U32 index)
|
||||
{
|
||||
LLUUID first_item_id = getWearableItemID((LLWearableType::EType)type);
|
||||
LLUUID first_item_id = getWearableItemID((LLWearableType::EType)type, index);
|
||||
// Open the inventory and select the first item we added.
|
||||
if( first_item_id.notNull() )
|
||||
{
|
||||
@@ -1325,15 +1382,16 @@ void LLAgentWearables::addWearableToAgentInventory(LLPointer<LLInventoryCallback
|
||||
cb);
|
||||
}
|
||||
|
||||
void LLAgentWearables::removeWearable( LLWearableType::EType type )
|
||||
void LLAgentWearables::removeWearable(const LLWearableType::EType type, bool do_remove_all, U32 index)
|
||||
{
|
||||
llassert_always(index == 0);
|
||||
if (gAgent.isTeen() &&
|
||||
(type == LLWearableType::WT_UNDERSHIRT || type == LLWearableType::WT_UNDERPANTS))
|
||||
{
|
||||
// Can't take off underclothing in simple UI mode or on PG accounts
|
||||
// TODO: enable the removing of a single undershirt/underpants if multiple are worn. - Nyx
|
||||
return;
|
||||
}
|
||||
|
||||
if (getWearableCount(type) == 0)
|
||||
{
|
||||
// no wearables to remove
|
||||
@@ -1346,41 +1404,50 @@ void LLAgentWearables::removeWearable( LLWearableType::EType type )
|
||||
return;
|
||||
}
|
||||
// [/RLVa:KB]
|
||||
|
||||
LLWearable* old_wearable = getWearable(type);
|
||||
|
||||
if( old_wearable )
|
||||
if (do_remove_all)
|
||||
{
|
||||
if( old_wearable->isDirty() )
|
||||
removeWearableFinal(type, do_remove_all, index);
|
||||
}
|
||||
else
|
||||
{
|
||||
LLWearable* old_wearable = getWearable(type,index);
|
||||
|
||||
if (old_wearable)
|
||||
{
|
||||
LLSD payload;
|
||||
payload["wearable_type"] = (S32)type;
|
||||
// Bring up view-modal dialog: Save changes? Yes, No, Cancel
|
||||
LLNotificationsUtil::add("WearableSave", LLSD(), payload, &LLAgentWearables::onRemoveWearableDialog);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
removeWearableFinal( type );
|
||||
if (old_wearable->isDirty())
|
||||
{
|
||||
LLSD payload;
|
||||
payload["wearable_type"] = (S32)type;
|
||||
payload["wearable_index"] = (S32)index;
|
||||
// Bring up view-modal dialog: Save changes? Yes, No, Cancel
|
||||
LLNotificationsUtil::add("WearableSave", LLSD(), payload, &LLAgentWearables::onRemoveWearableDialog);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
removeWearableFinal(type, do_remove_all, index);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// static
|
||||
bool LLAgentWearables::onRemoveWearableDialog(const LLSD& notification, const LLSD& response )
|
||||
bool LLAgentWearables::onRemoveWearableDialog(const LLSD& notification, const LLSD& response)
|
||||
{
|
||||
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
|
||||
LLWearableType::EType type = (LLWearableType::EType)notification["payload"]["wearable_type"].asInteger();
|
||||
switch( option )
|
||||
S32 index = (S32)notification["payload"]["wearable_index"].asInteger();
|
||||
switch(option)
|
||||
{
|
||||
case 0: // "Save"
|
||||
gAgentWearables.saveWearable( type );
|
||||
gAgentWearables.removeWearableFinal( type );
|
||||
break;
|
||||
case 0: // "Save"
|
||||
gAgentWearables.saveWearable(type, index);
|
||||
gAgentWearables.removeWearableFinal(type, false, index);
|
||||
break;
|
||||
|
||||
case 1: // "Don't Save"
|
||||
gAgentWearables.removeWearableFinal( type );
|
||||
break;
|
||||
case 1: // "Don't Save"
|
||||
gAgentWearables.removeWearableFinal(type, false, index);
|
||||
break;
|
||||
|
||||
case 2: // "Cancel"
|
||||
break;
|
||||
@@ -1393,17 +1460,35 @@ bool LLAgentWearables::onRemoveWearableDialog(const LLSD& notification, const LL
|
||||
}
|
||||
|
||||
// Called by removeWearable() and onRemoveWearableDialog() to actually do the removal.
|
||||
void LLAgentWearables::removeWearableFinal( LLWearableType::EType type )
|
||||
void LLAgentWearables::removeWearableFinal( LLWearableType::EType type, bool do_remove_all, U32 index)
|
||||
{
|
||||
gInventory.addChangedMask( LLInventoryObserver::LABEL, getWearableItemID(type) );
|
||||
|
||||
LLWearable* old_wearable = getWearable(type);
|
||||
//queryWearableCache();
|
||||
|
||||
if( old_wearable )
|
||||
llassert_always(index == 0);
|
||||
gInventory.addChangedMask( LLInventoryObserver::LABEL, getWearableItemID(type, index) );
|
||||
if (do_remove_all)
|
||||
{
|
||||
popWearable(old_wearable);
|
||||
old_wearable->removeFromAvatar( TRUE );
|
||||
S32 max_entry = mWearableDatas[type].size()-1;
|
||||
for (S32 i=max_entry; i>=0; i--)
|
||||
{
|
||||
LLWearable* old_wearable = getWearable(type,i);
|
||||
//queryWearableCache(); // moved below
|
||||
if (old_wearable)
|
||||
{
|
||||
popWearable(old_wearable);
|
||||
old_wearable->removeFromAvatar(TRUE);
|
||||
}
|
||||
}
|
||||
mWearableDatas[type].clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
LLWearable* old_wearable = getWearable(type, index);
|
||||
//queryWearableCache(); // moved below
|
||||
|
||||
if (old_wearable)
|
||||
{
|
||||
popWearable(old_wearable);
|
||||
old_wearable->removeFromAvatar(TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
queryWearableCache();
|
||||
@@ -1413,47 +1498,6 @@ void LLAgentWearables::removeWearableFinal( LLWearableType::EType type )
|
||||
gInventory.notifyObservers();
|
||||
}
|
||||
|
||||
void LLAgentWearables::copyWearableToInventory( LLWearableType::EType type )
|
||||
{
|
||||
LLWearable* wearable = getWearable(type);
|
||||
if( wearable )
|
||||
{
|
||||
// Save the old wearable if it has changed.
|
||||
if( wearable->isDirty() )
|
||||
{
|
||||
LLWearable * new_wearable = LLWearableList::instance().createCopyFromAvatar( wearable );
|
||||
new_wearable->setItemID(wearable->getItemID());
|
||||
setWearable(type,new_wearable);
|
||||
wearable = new_wearable;
|
||||
}
|
||||
|
||||
// Make a new entry in the inventory. (Put it in the same folder as the original item if possible.)
|
||||
LLUUID category_id;
|
||||
LLInventoryItem* item = gInventory.getItem( wearable->getItemID() );
|
||||
if( item )
|
||||
{
|
||||
category_id = item->getParentUUID();
|
||||
wearable->setPermissions(item->getPermissions());
|
||||
}
|
||||
LLPointer<LLInventoryCallback> cb =
|
||||
new addWearableToAgentInventoryCallback(
|
||||
LLPointer<LLRefCount>(NULL),
|
||||
type,
|
||||
wearable);
|
||||
addWearableToAgentInventory(cb, wearable, category_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// A little struct to let setWearable() communicate more than one value with onSetWearableDialog().
|
||||
struct LLSetWearableData
|
||||
{
|
||||
LLSetWearableData( const LLUUID& new_item_id, LLWearable* new_wearable ) :
|
||||
mNewItemID( new_item_id ), mNewWearable( new_wearable ) {}
|
||||
LLUUID mNewItemID;
|
||||
LLWearable* mNewWearable;
|
||||
};
|
||||
|
||||
static bool isFirstPhysicsWearable(LLWearableType::EType type, LLInventoryItem *new_item, LLWearable *new_wearable)
|
||||
{
|
||||
if (type == LLWearableType::WT_PHYSICS && gSavedSettings.getWarning("FirstPhysicsWearable"))
|
||||
@@ -1529,10 +1573,10 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
|
||||
LLWearableType::EType type = new_wearable->getType();
|
||||
wearables_to_remove[type] = FALSE;
|
||||
|
||||
LLWearable* old_wearable = getWearable(type);
|
||||
LLWearable* old_wearable = getWearable(type, 0);
|
||||
if( old_wearable )
|
||||
{
|
||||
const LLUUID& old_item_id = getWearableItemID(type);
|
||||
const LLUUID& old_item_id = getWearableItemID(type, 0);
|
||||
if( (old_wearable->getAssetID() == new_wearable->getAssetID()) &&
|
||||
(old_item_id == new_item->getUUID()) )
|
||||
{
|
||||
@@ -1561,11 +1605,11 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
|
||||
if (LLWearableType::getAssetType(type) == LLAssetType::AT_BODYPART)
|
||||
{
|
||||
// exactly one wearable per body part
|
||||
setWearable(type,new_wearable);
|
||||
setWearable(type,0,new_wearable);
|
||||
}
|
||||
else if(old_wearable) //Remove when multi-wearables are implemented.
|
||||
{
|
||||
setWearable(type,new_wearable);
|
||||
setWearable(type,0,new_wearable);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1580,8 +1624,8 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
|
||||
{
|
||||
if( wearables_to_remove[i] )
|
||||
{
|
||||
LLWearable* wearable = getWearable((LLWearableType::EType)i);
|
||||
wearables_being_removed.push_back(getWearable((LLWearableType::EType)i));
|
||||
LLWearable* wearable = getWearable((LLWearableType::EType)i, 0);
|
||||
wearables_being_removed.push_back(getWearable((LLWearableType::EType)i, 0));
|
||||
popWearable(wearable);
|
||||
|
||||
gInventory.addChangedMask(LLInventoryObserver::LABEL, wearable->getItemID());
|
||||
@@ -1644,7 +1688,7 @@ void LLAgentWearables::setWearableItem( LLInventoryItem* new_item, LLWearable* n
|
||||
return;
|
||||
}
|
||||
|
||||
LLWearable* old_wearable = getWearable(type);
|
||||
LLWearable* old_wearable = getWearable(type,0);
|
||||
if( old_wearable )
|
||||
{
|
||||
const LLUUID& old_item_id = old_wearable->getItemID();
|
||||
@@ -1673,6 +1717,7 @@ 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);
|
||||
if( !new_item )
|
||||
{
|
||||
delete wearable;
|
||||
@@ -1682,7 +1727,7 @@ bool LLAgentWearables::onSetWearableDialog( const LLSD& notification, const LLSD
|
||||
switch( option )
|
||||
{
|
||||
case 0: // "Save"
|
||||
gAgentWearables.saveWearable( wearable->getType() );
|
||||
gAgentWearables.saveWearable(wearable->getType(),index);
|
||||
gAgentWearables.setWearableFinal( new_item, wearable );
|
||||
break;
|
||||
|
||||
@@ -1707,24 +1752,29 @@ void LLAgentWearables::setWearableFinal( LLInventoryItem* new_item, LLWearable*
|
||||
{
|
||||
const LLWearableType::EType type = new_wearable->getType();
|
||||
|
||||
// Replace the old wearable with a new one.
|
||||
llassert( new_item->getAssetUUID() == new_wearable->getAssetID() );
|
||||
LLWearable *old_wearable = getWearable(type);
|
||||
LLUUID old_item_id;
|
||||
if (old_wearable)
|
||||
{
|
||||
old_item_id = old_wearable->getItemID();
|
||||
}
|
||||
new_wearable->setItemID(new_item->getUUID());
|
||||
setWearable(type,new_wearable);
|
||||
// Replace the old wearable with a new one.
|
||||
llassert(new_item->getAssetUUID() == new_wearable->getAssetID());
|
||||
|
||||
if (old_item_id.notNull())
|
||||
{
|
||||
gInventory.addChangedMask( LLInventoryObserver::LABEL, old_item_id );
|
||||
gInventory.notifyObservers();
|
||||
LLWearable *old_wearable = getWearable(type,0);
|
||||
LLUUID old_item_id;
|
||||
if (old_wearable)
|
||||
{
|
||||
old_item_id = old_wearable->getItemID();
|
||||
}
|
||||
new_wearable->setItemID(new_item->getUUID());
|
||||
setWearable(type,0,new_wearable);
|
||||
|
||||
if (old_item_id.notNull())
|
||||
{
|
||||
gInventory.addChangedMask(LLInventoryObserver::LABEL, old_item_id);
|
||||
gInventory.notifyObservers();
|
||||
}
|
||||
llinfos << "Replaced current element 0 for type " << type
|
||||
<< " size is now " << mWearableDatas[type].size() << llendl;
|
||||
}
|
||||
|
||||
//llinfos << "LLVOAvatar::setWearable()" << llendl;
|
||||
//llinfos << "LLVOAvatar::setWearableItem()" << llendl;
|
||||
queryWearableCache();
|
||||
new_wearable->writeToAvatar( TRUE );
|
||||
|
||||
@@ -1793,13 +1843,16 @@ LLUUID LLAgentWearables::computeBakedTextureHash(LLVOAvatarDefines::EBakedTextur
|
||||
for (U8 i=0; i < baked_dict->mWearables.size(); i++)
|
||||
{
|
||||
const LLWearableType::EType baked_type = baked_dict->mWearables[i];
|
||||
//TO-DO: MULTI-WEARABLE
|
||||
const LLWearable* wearable = getWearable(baked_type);
|
||||
if (wearable)
|
||||
const U32 num_wearables = getWearableCount(baked_type);
|
||||
for (U32 index = 0; index < num_wearables; ++index)
|
||||
{
|
||||
LLUUID asset_id = wearable->getAssetID();
|
||||
hash.update((const unsigned char*)asset_id.mData, UUID_BYTES);
|
||||
hash_computed = true;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (hash_computed)
|
||||
@@ -1823,12 +1876,22 @@ LLUUID LLAgentWearables::computeBakedTextureHash(LLVOAvatarDefines::EBakedTextur
|
||||
|
||||
// User has picked "remove from avatar" from a menu.
|
||||
// static
|
||||
void LLAgentWearables::userRemoveWearable(const LLWearableType::EType &type)
|
||||
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==WT_UNDERPANTS || type==WT_UNDERSHIRT )) )
|
||||
{
|
||||
gAgentWearables.removeWearable( type );
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1849,18 +1912,18 @@ void LLAgentWearables::userRemoveAllClothesStep2( BOOL proceed, void* userdata )
|
||||
{
|
||||
if( proceed )
|
||||
{
|
||||
gAgentWearables.removeWearable( LLWearableType::WT_SHIRT );
|
||||
gAgentWearables.removeWearable( LLWearableType::WT_PANTS );
|
||||
gAgentWearables.removeWearable( LLWearableType::WT_SHOES );
|
||||
gAgentWearables.removeWearable( LLWearableType::WT_SOCKS );
|
||||
gAgentWearables.removeWearable( LLWearableType::WT_JACKET );
|
||||
gAgentWearables.removeWearable( LLWearableType::WT_GLOVES );
|
||||
gAgentWearables.removeWearable( LLWearableType::WT_UNDERSHIRT );
|
||||
gAgentWearables.removeWearable( LLWearableType::WT_UNDERPANTS );
|
||||
gAgentWearables.removeWearable( LLWearableType::WT_SKIRT );
|
||||
gAgentWearables.removeWearable( LLWearableType::WT_ALPHA );
|
||||
gAgentWearables.removeWearable( LLWearableType::WT_TATTOO );
|
||||
gAgentWearables.removeWearable( LLWearableType::WT_PHYSICS );
|
||||
gAgentWearables.userRemoveWearablesOfType( LLWearableType::WT_SHIRT );
|
||||
gAgentWearables.userRemoveWearablesOfType( LLWearableType::WT_PANTS );
|
||||
gAgentWearables.userRemoveWearablesOfType( LLWearableType::WT_SHOES );
|
||||
gAgentWearables.userRemoveWearablesOfType( LLWearableType::WT_SOCKS );
|
||||
gAgentWearables.userRemoveWearablesOfType( LLWearableType::WT_JACKET );
|
||||
gAgentWearables.userRemoveWearablesOfType( LLWearableType::WT_GLOVES );
|
||||
gAgentWearables.userRemoveWearablesOfType( LLWearableType::WT_UNDERSHIRT );
|
||||
gAgentWearables.userRemoveWearablesOfType( LLWearableType::WT_UNDERPANTS );
|
||||
gAgentWearables.userRemoveWearablesOfType( LLWearableType::WT_SKIRT );
|
||||
gAgentWearables.userRemoveWearablesOfType( LLWearableType::WT_ALPHA );
|
||||
gAgentWearables.userRemoveWearablesOfType( LLWearableType::WT_TATTOO );
|
||||
gAgentWearables.userRemoveWearablesOfType( LLWearableType::WT_PHYSICS );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2099,7 +2162,7 @@ void LLAgentWearables::updateWearablesLoaded()
|
||||
mWearablesLoaded = TRUE;
|
||||
for( S32 i = 0; i < LLWearableType::WT_COUNT; i++ )
|
||||
{
|
||||
if( !getWearableItemID((LLWearableType::EType)i).isNull() && !getWearable((LLWearableType::EType)i) )
|
||||
if( !getWearableItemID((LLWearableType::EType)i, 0).isNull() && !getWearable((LLWearableType::EType)i, 0) )
|
||||
{
|
||||
mWearablesLoaded = FALSE;
|
||||
break;
|
||||
|
||||
@@ -70,7 +70,7 @@ public:
|
||||
// LLInitClass interface
|
||||
static void initClass();
|
||||
protected:
|
||||
void createStandardWearablesDone(S32 type);
|
||||
void createStandardWearablesDone(S32 type, U32 index/* = 0*/);
|
||||
void createStandardWearablesAllDone();
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
@@ -78,10 +78,10 @@ protected:
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
BOOL isWearingItem(const LLUUID& item_id) const;
|
||||
BOOL isWearableModifiable(LLWearableType::EType type) const;
|
||||
BOOL isWearableModifiable(LLWearableType::EType type, U32 index /*= 0*/) const;
|
||||
BOOL isWearableModifiable(const LLUUID& item_id) const;
|
||||
|
||||
BOOL isWearableCopyable(LLWearableType::EType type) const;
|
||||
BOOL isWearableCopyable(LLWearableType::EType type, U32 index /*= 0*/) const;
|
||||
BOOL areWearablesLoaded() const;
|
||||
void updateWearablesLoaded();
|
||||
//void checkWearablesLoaded() const;
|
||||
@@ -93,28 +93,26 @@ public:
|
||||
//void animateAllWearableParams(F32 delta, BOOL upload_bake);
|
||||
|
||||
BOOL needsReplacement(LLWearableType::EType wearableType, S32 remove);
|
||||
U32 getWearablePermMask(LLWearableType::EType type) const;
|
||||
//U32 getWearablePermMask(LLWearableType::EType type) const;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Accessors
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
const LLUUID getWearableItemID(LLWearableType::EType type ) const;
|
||||
const LLUUID getWearableAssetID(LLWearableType::EType type) const;
|
||||
const LLUUID getWearableItemID(LLWearableType::EType type, U32 index /*= 0*/) const;
|
||||
const LLUUID getWearableAssetID(LLWearableType::EType type, U32 index /*= 0*/) const;
|
||||
const LLWearable* getWearableFromItemID(const LLUUID& item_id) const;
|
||||
LLWearable* getWearableFromItemID(const LLUUID& item_id);
|
||||
LLWearable* getWearableFromAssetID(const LLUUID& asset_id);
|
||||
LLInventoryItem* getWearableInventoryItem(LLWearableType::EType type);
|
||||
LLWearable* getWearableFromItemID(const LLUUID& item_id);
|
||||
LLWearable* getWearableFromAssetID(const LLUUID& asset_id);
|
||||
LLInventoryItem* getWearableInventoryItem(LLWearableType::EType type, U32 index /*= 0*/);
|
||||
static BOOL selfHasWearable(LLWearableType::EType type);
|
||||
LLWearable* getWearable( const LLWearableType::EType type );
|
||||
const LLWearable* getWearable( const LLWearableType::EType type ) const;
|
||||
LLWearable* getTopWearable(const LLWearableType::EType type);
|
||||
LLWearable* getWearable(const LLWearableType::EType type, U32 index /*= 0*/);
|
||||
const LLWearable* getWearable(const LLWearableType::EType type, U32 index /*= 0*/) const;
|
||||
LLWearable* getTopWearable(const LLWearableType::EType type);
|
||||
LLWearable* getBottomWearable(const LLWearableType::EType type);
|
||||
U32 getWearableCount(const LLWearableType::EType type) const;
|
||||
U32 getWearableCount(const U32 tex_index) const;
|
||||
|
||||
void copyWearableToInventory( LLWearableType::EType type );
|
||||
|
||||
static const U32 MAX_CLOTHING_PER_TYPE = 1;
|
||||
|
||||
|
||||
@@ -124,11 +122,11 @@ public:
|
||||
|
||||
private:
|
||||
// Low-level data structure setter - public access is via setWearableItem, etc.
|
||||
void setWearable(const LLWearableType::EType type, LLWearable *wearable);
|
||||
void setWearable(const LLWearableType::EType type, U32 index, LLWearable *wearable);
|
||||
U32 pushWearable(const LLWearableType::EType type, LLWearable *wearable);
|
||||
void wearableUpdated(LLWearable *wearable);
|
||||
void popWearable(LLWearable *wearable);
|
||||
void popWearable(const LLWearableType::EType type);
|
||||
void popWearable(const LLWearableType::EType type, U32 index);
|
||||
|
||||
public:
|
||||
void setWearableItem(LLInventoryItem* new_item, LLWearable* wearable);
|
||||
@@ -156,11 +154,11 @@ protected:
|
||||
* @param item_id The inventory item id of the new wearable to wear.
|
||||
* @param wearable The actual wearable data.
|
||||
*/
|
||||
void addWearabletoAgentInventoryDone(const LLWearableType::EType type,
|
||||
const LLUUID& item_id,
|
||||
LLWearable* wearable);
|
||||
|
||||
void recoverMissingWearable(LLWearableType::EType type);
|
||||
void addWearabletoAgentInventoryDone(const LLWearableType::EType type,
|
||||
const U32 index,
|
||||
const LLUUID& item_id,
|
||||
LLWearable* wearable);
|
||||
void recoverMissingWearable(const LLWearableType::EType type, U32 index /*= 0*/);
|
||||
void recoverMissingWearableDone();
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
@@ -182,9 +180,9 @@ private:
|
||||
// Removing wearables
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
void removeWearable( LLWearableType::EType type );
|
||||
void removeWearable(const LLWearableType::EType type, bool do_remove_all /*= false*/, U32 index /*= 0*/);
|
||||
private:
|
||||
void removeWearableFinal( LLWearableType::EType type );
|
||||
void removeWearableFinal(const LLWearableType::EType type, bool do_remove_all /*= false*/, U32 index /*= 0*/);
|
||||
protected:
|
||||
static bool onRemoveWearableDialog(const LLSD& notification, const LLSD& response);
|
||||
static void userRemoveAllClothesStep2(BOOL proceed, void* userdata ); // userdata is NULL
|
||||
@@ -220,25 +218,26 @@ public:
|
||||
BOOL rename_clothing);
|
||||
private:
|
||||
|
||||
void makeNewOutfitDone(S32 type);
|
||||
void makeNewOutfitDone(S32 type, U32 index);
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Save Wearables
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
void saveWearableAs(const LLWearableType::EType type, const std::string& new_name, BOOL save_in_lost_and_found );
|
||||
void saveWearable(const LLWearableType::EType type, BOOL send_update = TRUE,
|
||||
void saveWearableAs(const LLWearableType::EType type, const U32 index, const std::string& new_name, BOOL save_in_lost_and_found );
|
||||
void saveWearable(const LLWearableType::EType type, const U32 index, BOOL send_update = TRUE,
|
||||
const std::string new_name = "");
|
||||
|
||||
void saveAllWearables();
|
||||
void revertWearable( LLWearableType::EType type );
|
||||
void revertWearable( LLWearableType::EType type, const U32 index);
|
||||
void revertAllWearables();
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Static UI hooks
|
||||
//--------------------------------------------------------------------
|
||||
public:
|
||||
static void userRemoveWearable(const LLWearableType::EType &type);
|
||||
static void userRemoveWearable(const LLWearableType::EType &type, const U32 &index);
|
||||
static void userRemoveWearablesOfType(const LLWearableType::EType &type);
|
||||
static void userRemoveAllClothes();
|
||||
|
||||
typedef std::vector<LLViewerObject*> llvo_vec_t;
|
||||
@@ -321,12 +320,14 @@ private:
|
||||
*/
|
||||
addWearableToAgentInventoryCallback(LLPointer<LLRefCount> cb,
|
||||
LLWearableType::EType type,
|
||||
U32 index,
|
||||
LLWearable* wearable,
|
||||
U32 todo = CALL_NONE);
|
||||
virtual void fire(const LLUUID& inv_item);
|
||||
|
||||
private:
|
||||
LLWearableType::EType mType;
|
||||
U32 mIndex;
|
||||
LLWearable* mWearable;
|
||||
U32 mTodo;
|
||||
LLPointer<LLRefCount> mCB;
|
||||
|
||||
@@ -590,7 +590,7 @@ void LLPanelEditWearable::setSubpart( ESubpart subpart )
|
||||
LLVOAvatar* avatar = gAgentAvatarp;
|
||||
ESex avatar_sex = avatar->getSex();
|
||||
LLViewerInventoryItem* item;
|
||||
item = (LLViewerInventoryItem*)gAgentWearables.getWearableInventoryItem(mType);
|
||||
item = (LLViewerInventoryItem*)gAgentWearables.getWearableInventoryItem(mType,0); // TODO: MULTI-WEARABLE
|
||||
U32 perm_mask = 0x0;
|
||||
BOOL is_complete = FALSE;
|
||||
bool can_export = false;
|
||||
@@ -656,27 +656,27 @@ void LLPanelEditWearable::onBtnTakeOff( void* userdata )
|
||||
{
|
||||
LLPanelEditWearable* self = (LLPanelEditWearable*) userdata;
|
||||
|
||||
LLWearable* wearable = gAgentWearables.getWearable( self->mType );
|
||||
LLWearable* wearable = gAgentWearables.getWearable( self->mType, 0 ); // TODO: MULTI-WEARABLE
|
||||
if( !wearable )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
gAgentWearables.removeWearable( self->mType );
|
||||
gAgentWearables.removeWearable( self->mType, false, 0 ); // TODO: MULTI-WEARABLE
|
||||
}
|
||||
|
||||
// static
|
||||
void LLPanelEditWearable::onBtnSave( void* userdata )
|
||||
{
|
||||
LLPanelEditWearable* self = (LLPanelEditWearable*) userdata;
|
||||
gAgentWearables.saveWearable( self->mType );
|
||||
gAgentWearables.saveWearable( self->mType, 0 ); // TODO: MULTI-WEARABLE
|
||||
}
|
||||
|
||||
// static
|
||||
void LLPanelEditWearable::onBtnSaveAs( void* userdata )
|
||||
{
|
||||
LLPanelEditWearable* self = (LLPanelEditWearable*) userdata;
|
||||
LLWearable* wearable = gAgentWearables.getWearable( self->getType() );
|
||||
LLWearable* wearable = gAgentWearables.getWearable( self->getType(), 0 ); // TODO: MULTI-WEARABLE
|
||||
if( wearable )
|
||||
{
|
||||
LLWearableSaveAsDialog* save_as_dialog = new LLWearableSaveAsDialog( wearable->getName(), onSaveAsCommit, self );
|
||||
@@ -692,7 +692,7 @@ void LLPanelEditWearable::onSaveAsCommit( LLWearableSaveAsDialog* save_as_dialog
|
||||
LLVOAvatar* avatar = gAgentAvatarp;
|
||||
if( avatar )
|
||||
{
|
||||
gAgentWearables.saveWearableAs( self->getType(), save_as_dialog->getItemName(), FALSE );
|
||||
gAgentWearables.saveWearableAs( self->getType(), 0, save_as_dialog->getItemName(), FALSE ); // TODO: MULTI-WEARABLE
|
||||
}
|
||||
}
|
||||
|
||||
@@ -701,7 +701,7 @@ void LLPanelEditWearable::onSaveAsCommit( LLWearableSaveAsDialog* save_as_dialog
|
||||
void LLPanelEditWearable::onBtnRevert( void* userdata )
|
||||
{
|
||||
LLPanelEditWearable* self = (LLPanelEditWearable*) userdata;
|
||||
gAgentWearables.revertWearable( self->mType );
|
||||
gAgentWearables.revertWearable( self->mType, 0 ); // TODO: MULTI-WEARABLE
|
||||
}
|
||||
|
||||
// static
|
||||
@@ -740,7 +740,7 @@ bool LLPanelEditWearable::onSelectAutoWearOption(const LLSD& notification, const
|
||||
|
||||
bool LLPanelEditWearable::textureIsInvisible(ETextureIndex te)
|
||||
{
|
||||
if (gAgentWearables.getWearable(mType))
|
||||
if (gAgentWearables.getWearable(mType, 0)) // TODO: MULTI-WEARABLE
|
||||
{
|
||||
LLVOAvatar *avatar = gAgentAvatarp;
|
||||
if (avatar)
|
||||
@@ -876,7 +876,7 @@ void LLPanelEditWearable::addTextureDropTarget( ETextureIndex te, const std::str
|
||||
LLVOAvatar* avatar = gAgentAvatarp;
|
||||
if (avatar)
|
||||
{
|
||||
LLWearable* wearable = gAgentWearables.getWearable(mType);
|
||||
LLWearable* wearable = gAgentWearables.getWearable(mType, 0); // TODO: MULTI-WEARABLE
|
||||
if (wearable && mType == LLWearableType::WT_ALPHA)
|
||||
{
|
||||
const LLTextureEntry* current_te = avatar->getTE(te);
|
||||
@@ -906,7 +906,7 @@ void LLPanelEditWearable::onTextureCommit( LLUICtrl* ctrl, void* userdata )
|
||||
image = LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT_AVATAR);
|
||||
}
|
||||
self->mTextureList[ctrl->getName()] = te;
|
||||
if (gAgentWearables.getWearable(self->mType))
|
||||
if (gAgentWearables.getWearable(self->mType, 0)) // TODO: MULTI-WEARABLE
|
||||
{
|
||||
avatar->setLocTexTE(te, image, TRUE);
|
||||
avatar->wearableUpdated(self->mType, FALSE);
|
||||
@@ -958,14 +958,14 @@ void LLPanelEditWearable::draw()
|
||||
return;
|
||||
}
|
||||
|
||||
LLWearable* wearable = gAgentWearables.getWearable( mType );
|
||||
LLWearable* wearable = gAgentWearables.getWearable( mType, 0 ); // TODO: MULTI-WEARABLE
|
||||
BOOL has_wearable = (wearable != NULL );
|
||||
BOOL is_dirty = isDirty();
|
||||
BOOL is_modifiable = FALSE;
|
||||
BOOL is_copyable = FALSE;
|
||||
BOOL is_complete = FALSE;
|
||||
LLViewerInventoryItem* item;
|
||||
item = (LLViewerInventoryItem*)gAgentWearables.getWearableInventoryItem(mType);
|
||||
item = (LLViewerInventoryItem*)gAgentWearables.getWearableInventoryItem(mType, 0); // TODO: MULTI-WEARABLE
|
||||
if(item)
|
||||
{
|
||||
const LLPermissions& perm = item->getPermissions();
|
||||
@@ -1041,7 +1041,7 @@ void LLPanelEditWearable::draw()
|
||||
childSetTextArg("title_loading", "[DESC]", std::string(LLWearableType::getTypeLabel( mType )));
|
||||
|
||||
std::string path;
|
||||
const LLUUID& item_id = gAgentWearables.getWearableItemID( wearable->getType() );
|
||||
const LLUUID& item_id = gAgentWearables.getWearableItemID( wearable->getType(), 0 ); // TODO: MULTI-WEARABLE
|
||||
append_path(item_id, path);
|
||||
childSetVisible("path", TRUE);
|
||||
childSetTextArg("path", "[PATH]", path);
|
||||
@@ -1054,7 +1054,7 @@ void LLPanelEditWearable::draw()
|
||||
childSetTextArg("title", "[DESC]", wearable->getName() );
|
||||
|
||||
std::string path;
|
||||
const LLUUID& item_id = gAgentWearables.getWearableItemID( wearable->getType() );
|
||||
const LLUUID& item_id = gAgentWearables.getWearableItemID( wearable->getType(), 0 ); // TODO: MULTI-WEARABLE
|
||||
append_path(item_id, path);
|
||||
childSetVisible("path", TRUE);
|
||||
childSetTextArg("path", "[PATH]", path);
|
||||
@@ -1201,7 +1201,7 @@ void LLPanelEditWearable::setVisible(BOOL visible)
|
||||
|
||||
BOOL LLPanelEditWearable::isDirty() const
|
||||
{
|
||||
LLWearable* wearable = gAgentWearables.getWearable( mType );
|
||||
LLWearable* wearable = gAgentWearables.getWearable( mType, 0 ); // TODO: MULTI-WEARABLE
|
||||
if( !wearable )
|
||||
{
|
||||
return FALSE;
|
||||
@@ -1226,7 +1226,7 @@ void LLPanelEditWearable::onCommitSexChange( LLUICtrl*, void* userdata )
|
||||
return;
|
||||
}
|
||||
|
||||
if( !gAgentWearables.isWearableModifiable(self->mType))
|
||||
if( !gAgentWearables.isWearableModifiable(self->mType, 0)) // TODO: MULTI-WEARABLE
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -1936,10 +1936,10 @@ void LLFloaterCustomize::onBtnExport_continued(AIFilePicker* filepicker)
|
||||
for( S32 i=0; i < LLWearableType::WT_COUNT; i++ )
|
||||
{
|
||||
is_modifiable = FALSE;
|
||||
LLWearable* old_wearable = gAgentWearables.getWearable((LLWearableType::EType)i);
|
||||
LLWearable* old_wearable = gAgentWearables.getWearable((LLWearableType::EType)i, 0); // TODO: MULTI-WEARABLE
|
||||
if( old_wearable )
|
||||
{
|
||||
item = (LLViewerInventoryItem*)gAgentWearables.getWearableInventoryItem((LLWearableType::EType)i);
|
||||
item = (LLViewerInventoryItem*)gAgentWearables.getWearableInventoryItem((LLWearableType::EType)i, 0); // TODO: MULTI-WEARABLE
|
||||
if(item)
|
||||
{
|
||||
const LLPermissions& perm = item->getPermissions();
|
||||
@@ -1960,10 +1960,10 @@ void LLFloaterCustomize::onBtnExport_continued(AIFilePicker* filepicker)
|
||||
for( S32 i=0; i < LLWearableType::WT_COUNT; i++ )
|
||||
{
|
||||
is_modifiable = FALSE;
|
||||
LLWearable* old_wearable = gAgentWearables.getWearable((LLWearableType::EType)i);
|
||||
LLWearable* old_wearable = gAgentWearables.getWearable((LLWearableType::EType)i, 0); // TODO: MULTI-WEARABLE
|
||||
if( old_wearable )
|
||||
{
|
||||
item = (LLViewerInventoryItem*)gAgentWearables.getWearableInventoryItem((LLWearableType::EType)i);
|
||||
item = (LLViewerInventoryItem*)gAgentWearables.getWearableInventoryItem((LLWearableType::EType)i, 0); // TODO: MULTI-WEARABLE
|
||||
if(item)
|
||||
{
|
||||
const LLPermissions& perm = item->getPermissions();
|
||||
@@ -2015,7 +2015,7 @@ void LLFloaterCustomize::onBtnMakeOutfit( void* userdata )
|
||||
|
||||
for( S32 i = 0; i < LLWearableType::WT_COUNT; i++ )
|
||||
{
|
||||
BOOL enabled = (gAgentWearables.getWearable( (LLWearableType::EType) i ) != NULL);
|
||||
BOOL enabled = (gAgentWearables.getWearable( (LLWearableType::EType) i, 0 ) != NULL); // TODO: MULTI-WEARABLE
|
||||
BOOL selected = (enabled && (LLWearableType::WT_SHIRT <= i) && (i < LLWearableType::WT_COUNT)); // only select clothing by default
|
||||
if (gAgent.isTeen()
|
||||
&& !edit_wearable_for_teens((LLWearableType::EType)i))
|
||||
@@ -2748,13 +2748,13 @@ bool LLFloaterCustomize::onSaveDialog(const LLSD& notification, const LLSD& resp
|
||||
switch( option )
|
||||
{
|
||||
case 0: // "Save"
|
||||
gAgentWearables.saveWearable( cur );
|
||||
gAgentWearables.saveWearable( cur, 0 ); // TODO: MULTI-WEARABLE
|
||||
proceed = TRUE;
|
||||
break;
|
||||
|
||||
case 1: // "Don't Save"
|
||||
{
|
||||
gAgentWearables.revertWearable( cur );
|
||||
gAgentWearables.revertWearable( cur, 0 ); // TODO: MULTI-WEARABLE
|
||||
proceed = TRUE;
|
||||
}
|
||||
break;
|
||||
@@ -2790,7 +2790,7 @@ void LLFloaterCustomize::fetchInventory()
|
||||
LLUUID item_id;
|
||||
for(S32 type = (S32)LLWearableType::WT_SHAPE; type < (S32)LLWearableType::WT_COUNT; ++type)
|
||||
{
|
||||
item_id = gAgentWearables.getWearableItemID((LLWearableType::EType)type);
|
||||
item_id = gAgentWearables.getWearableItemID((LLWearableType::EType)type, 0); // TODO: MULTI-WEARABLE
|
||||
if(item_id.notNull())
|
||||
{
|
||||
ids.push_back(item_id);
|
||||
@@ -2816,7 +2816,7 @@ void LLFloaterCustomize::updateInventoryUI()
|
||||
panel = mWearablePanelList[i];
|
||||
if(panel)
|
||||
{
|
||||
item = (LLViewerInventoryItem*)gAgentWearables.getWearableInventoryItem(panel->getType());
|
||||
item = (LLViewerInventoryItem*)gAgentWearables.getWearableInventoryItem(panel->getType(), 0); // TODO: MULTI-WEARABLE
|
||||
}
|
||||
if(item)
|
||||
{
|
||||
@@ -2851,7 +2851,7 @@ void LLFloaterCustomize::updateScrollingPanelUI()
|
||||
LLPanelEditWearable* panel = mWearablePanelList[sCurrentWearableType];
|
||||
if(panel)
|
||||
{
|
||||
LLViewerInventoryItem* item = (LLViewerInventoryItem*)gAgentWearables.getWearableInventoryItem(panel->getType());
|
||||
LLViewerInventoryItem* item = (LLViewerInventoryItem*)gAgentWearables.getWearableInventoryItem(panel->getType(), 0); // TODO: MULTI-WEARABLE
|
||||
if(item)
|
||||
{
|
||||
U32 perm_mask = item->getPermissions().getMaskOwner();
|
||||
|
||||
@@ -5422,7 +5422,7 @@ void LLWearableBridge::onRemoveFromAvatarArrived(LLWearable* wearable,
|
||||
if( !(type==LLWearableType::WT_SHAPE || type==LLWearableType::WT_SKIN || type==LLWearableType::WT_HAIR || type==LLWearableType::WT_EYES) ) //&&
|
||||
//!((!gAgent.isTeen()) && ( type==WT_UNDERPANTS || type==WT_UNDERSHIRT )) )
|
||||
{
|
||||
gAgentWearables.removeWearable( type );
|
||||
gAgentWearables.removeWearable( type, false, 0 ); // TODO: MULTI-WEARABLE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ LLBakedUploadData::LLBakedUploadData( LLVOAvatar* avatar,
|
||||
mStartTime = LLFrameTimer::getTotalTime(); // Record starting time
|
||||
for( S32 i = 0; i < LLWearableType::WT_COUNT; i++ )
|
||||
{
|
||||
LLWearable* wearable = gAgentWearables.getWearable( (LLWearableType::EType)i);
|
||||
LLWearable* wearable = gAgentWearables.getWearable( (LLWearableType::EType)i, 0); // TODO: MULTI-WEARABLE
|
||||
if( wearable )
|
||||
{
|
||||
mWearableAssets[i] = wearable->getAssetID();
|
||||
|
||||
@@ -9184,7 +9184,7 @@ class LLEditTakeOff : public view_listener_t
|
||||
LLWearableType::EType type = LLWearableType::typeNameToType(clothing);
|
||||
if (type >= LLWearableType::WT_SHAPE
|
||||
&& type < LLWearableType::WT_COUNT)
|
||||
LLAgentWearables::userRemoveWearable(type);
|
||||
LLAgentWearables::userRemoveWearable(type,0); // TODO: MULTI-WEARABLE
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -659,7 +659,7 @@ void LLWearable::writeToAvatar( BOOL set_by_user )
|
||||
if( gFloaterCustomize )
|
||||
{
|
||||
LLViewerInventoryItem* item;
|
||||
item = (LLViewerInventoryItem*)gInventory.getItem(gAgentWearables.getWearableItemID(mType));
|
||||
item = (LLViewerInventoryItem*)gInventory.getItem(gAgentWearables.getWearableItemID(mType, 0)); // TODO: MULTI-WEARABLE
|
||||
U32 perm_mask = PERM_NONE;
|
||||
BOOL is_complete = FALSE;
|
||||
if(item)
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#ifndef LL_LLWEARABLELIST_H
|
||||
#define LL_LLWEARABLELIST_H
|
||||
|
||||
#include "llmemory.h"
|
||||
#include "llwearable.h"
|
||||
#include "lluuid.h"
|
||||
#include "llassetstorage.h"
|
||||
|
||||
@@ -2005,7 +2005,7 @@ ERlvCmdRet RlvHandler::onGetOutfit(const RlvCommand& rlvCmd, std::string& strRep
|
||||
{
|
||||
// We never hide body parts, even if they're "locked" and we're hiding locked layers
|
||||
// (nor do we hide a layer if the issuing object is the only one that has this layer locked)
|
||||
bool fWorn = (gAgentWearables.getWearable(wtRlvTypes[idxType])) &&
|
||||
bool fWorn = (gAgentWearables.getWearable(wtRlvTypes[idxType], 0)) && // TODO: MULTI-WEARABLE
|
||||
( (!RlvSettings::getHideLockedLayers()) ||
|
||||
(LLAssetType::AT_BODYPART == LLWearableType::getAssetType(wtRlvTypes[idxType])) ||
|
||||
(RlvForceWear::isForceRemovable(wtRlvTypes[idxType], true, rlvCmd.getObjectID())) );
|
||||
@@ -2033,7 +2033,7 @@ ERlvCmdRet RlvHandler::onGetOutfitNames(const RlvCommand& rlvCmd, std::string& s
|
||||
switch (rlvCmd.getBehaviourType())
|
||||
{
|
||||
case RLV_BHVR_GETOUTFITNAMES: // Every layer that's worn
|
||||
fAdd = (gAgentWearables.getWearable(wtType) != NULL);
|
||||
fAdd = (gAgentWearables.getWearable(wtType, 0) != NULL); // TODO: MULTI-WEARABLE
|
||||
break;
|
||||
/*
|
||||
case RLV_BHVR_GETADDOUTFITNAMES: // Every layer that can be worn on (but ignore any locks set by the issuer)
|
||||
|
||||
@@ -213,7 +213,7 @@ RlvCommandOptionGetPath::RlvCommandOptionGetPath(const RlvCommand& rlvCmd)
|
||||
if (rlvCmdOption.isWearableType()) // <option> can be a clothing layer
|
||||
{
|
||||
LLWearableType::EType wtType = rlvCmdOption.getWearableType();
|
||||
m_idItems.push_back(gAgentWearables.getWearableItemID(wtType));
|
||||
m_idItems.push_back(gAgentWearables.getWearableItemID(wtType, 0)); // TODO: MULTI-WEARABLE
|
||||
}
|
||||
else if (rlvCmdOption.isAttachmentPoint()) // ... or it can specify an attachment point
|
||||
{
|
||||
@@ -554,7 +554,7 @@ bool RlvForceWear::isForceRemovable(const LLWearable* pWearable, bool fCheckComp
|
||||
(pWearable) && (LLAssetType::AT_CLOTHING == pWearable->getAssetType())
|
||||
&& ( (idExcept.isNull()) ? !gRlvWearableLocks.isLockedWearable(pWearable)
|
||||
: !gRlvWearableLocks.isLockedWearableExcept(pWearable, idExcept) )
|
||||
&& (isStrippable(gAgentWearables.getWearableItemID(pWearable->getType())))
|
||||
&& (isStrippable(gAgentWearables.getWearableItemID(pWearable->getType(), 0))) // TODO: MULTI-WEARABLE
|
||||
#ifdef RLV_EXPERIMENTAL_COMPOSITEFOLDERS
|
||||
&& ( (!fCheckComposite) || (!RlvSettings::getEnableComposites()) ||
|
||||
(!gRlvHandler.getCompositeInfo(pWearable->getItemID(), NULL, &pFolder)) || (gRlvHandler.canTakeOffComposite(pFolder)) )
|
||||
@@ -566,7 +566,7 @@ bool RlvForceWear::isForceRemovable(const LLWearable* pWearable, bool fCheckComp
|
||||
bool RlvForceWear::isForceRemovable(LLWearableType::EType wtType, bool fCheckComposite /*=true*/, const LLUUID& idExcept /*=LLUUID::null*/)
|
||||
{
|
||||
// Wearable type can be removed by an RLV command if there's at least one currently worn wearable that can be removed
|
||||
if (isForceRemovable(gAgentWearables.getWearable(wtType), fCheckComposite, idExcept))
|
||||
if (isForceRemovable(gAgentWearables.getWearable(wtType, 0), fCheckComposite, idExcept)) // TODO: MULTI-WEARABLE
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
@@ -600,7 +600,7 @@ void RlvForceWear::forceRemove(const LLWearable* pWearable)
|
||||
// Checked: 2010-03-19 (RLVa-1.1.3a) | Added: RLVa-1.2.0a
|
||||
void RlvForceWear::forceRemove(LLWearableType::EType wtType)
|
||||
{
|
||||
forceRemove(gAgentWearables.getWearable(wtType));
|
||||
forceRemove(gAgentWearables.getWearable(wtType,0)); // TODO: MULTI-WEARABLE
|
||||
}
|
||||
|
||||
// Checked: 2010-03-19 (RLVa-1.2.0c) | Modified: RLVa-1.2.0a
|
||||
@@ -741,7 +741,7 @@ void RlvForceWear::addWearable(const LLViewerInventoryItem* pItem, EWearAction e
|
||||
void RlvForceWear::remWearable(const LLWearable* pWearable)
|
||||
{
|
||||
// Remove it from 'm_addWearables' if it's queued for wearing
|
||||
const LLViewerInventoryItem* pItem = gInventory.getItem(gAgentWearables.getWearableItemID(pWearable->getType()));
|
||||
const LLViewerInventoryItem* pItem = gInventory.getItem(gAgentWearables.getWearableItemID(pWearable->getType(), 0)); // TODO: MULTI-WEARABLE
|
||||
if ( (pItem) && (isAddWearable(pItem)) )
|
||||
{
|
||||
addwearables_map_t::iterator itAddWearables = m_addWearables.find(pItem->getWearableType());
|
||||
@@ -775,7 +775,7 @@ void RlvForceWear::done()
|
||||
if (m_remWearables.size())
|
||||
{
|
||||
for (std::list<const LLWearable*>::const_iterator itWearable = m_remWearables.begin(); itWearable != m_remWearables.end(); ++itWearable)
|
||||
gAgentWearables.removeWearable((*itWearable)->getType());
|
||||
gAgentWearables.removeWearable((*itWearable)->getType(), false, 0); // TODO: MULTI-WEARABLE
|
||||
m_remWearables.clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ void RlvInventory::fetchWornItems()
|
||||
// Fetch all currently worn clothing layers and body parts
|
||||
for (int type = 0; type < LLWearableType::WT_COUNT; type++)
|
||||
{
|
||||
const LLUUID idItem = gAgentWearables.getWearableItemID((LLWearableType::EType)type);
|
||||
const LLUUID idItem = gAgentWearables.getWearableItemID((LLWearableType::EType)type, 0); // TODO: MULTI-WEARABLE
|
||||
if (idItem.notNull())
|
||||
idItems.push_back(idItem);
|
||||
}
|
||||
|
||||
@@ -876,7 +876,7 @@ void RlvWearableLocks::addWearableTypeLock(LLWearableType::EType eType, const LL
|
||||
if (eLock & RLV_LOCK_REMOVE)
|
||||
{
|
||||
m_WearableTypeRem.insert(std::pair<LLWearableType::EType, LLUUID>(eType, idRlvObj));
|
||||
LLUUID item_id = gAgentWearables.getWearableItemID(eType);
|
||||
LLUUID item_id = gAgentWearables.getWearableItemID(eType, 0); // TODO: MULTI-WEARABLE
|
||||
if(item_id.notNull())
|
||||
{
|
||||
gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);
|
||||
@@ -891,7 +891,7 @@ void RlvWearableLocks::addWearableTypeLock(LLWearableType::EType eType, const LL
|
||||
bool RlvWearableLocks::canRemove(LLWearableType::EType eType) const
|
||||
{
|
||||
// NOTE: we return TRUE if the wearable type has at least one wearable that can be removed by the user
|
||||
LLWearable* pWearable = gAgentWearables.getWearable(eType);
|
||||
LLWearable* pWearable = gAgentWearables.getWearable(eType, 0); // TODO: MULTI-WEARABLE
|
||||
if ( (pWearable) && (!isLockedWearable(pWearable)) )
|
||||
return true;
|
||||
return false;
|
||||
@@ -901,7 +901,7 @@ bool RlvWearableLocks::canRemove(LLWearableType::EType eType) const
|
||||
bool RlvWearableLocks::hasLockedWearable(LLWearableType::EType eType) const
|
||||
{
|
||||
// NOTE: we return TRUE if there is at least 1 non-removable wearable currently worn on this wearable type
|
||||
LLWearable* pWearable = gAgentWearables.getWearable(eType);
|
||||
LLWearable* pWearable = gAgentWearables.getWearable(eType, 0); // TODO: MULTI-WEARABLE
|
||||
if ( (pWearable) && (isLockedWearable(pWearable)) )
|
||||
return true;
|
||||
return false;
|
||||
@@ -972,7 +972,7 @@ void RlvWearableLocks::removeWearableTypeLock(LLWearableType::EType eType, const
|
||||
{
|
||||
if(m_WearableTypeRem.find(eType) == m_WearableTypeRem.end())
|
||||
{
|
||||
LLUUID item_id = gAgentWearables.getWearableItemID(eType);
|
||||
LLUUID item_id = gAgentWearables.getWearableItemID(eType, 0); // TODO: MULTI-WEARABLE
|
||||
if(item_id.notNull())
|
||||
{
|
||||
gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);
|
||||
|
||||
Reference in New Issue
Block a user