This commit is contained in:
Siana Gearz
2011-10-04 06:17:54 +02:00
42 changed files with 1344 additions and 1290 deletions

View File

@@ -501,6 +501,7 @@ set(viewer_SOURCE_FILES
llwaterparamset.cpp
llwearable.cpp
llwearablelist.cpp
llwearabletype.cpp
llweb.cpp
llmediactrl.cpp
llwind.cpp
@@ -986,6 +987,7 @@ set(viewer_HEADER_FILES
llwaterparamset.h
llwearable.h
llwearablelist.h
llwearabletype.h
llweb.h
llmediactrl.h
llwind.h

View File

@@ -80,9 +80,9 @@ public:
}
// Add all currently worn wearables
for (S32 idxType = 0; idxType < WT_COUNT; idxType++)
for (S32 idxType = 0; idxType < LLWearableType::WT_COUNT; idxType++)
{
const LLUUID& idItem = gAgentWearables.getWearableItemID((EWearableType)idxType);
const LLUUID& idItem = gAgentWearables.getWearableItemID((LLWearableType::EType)idxType);
if (idItem.isNull())
continue;
idItems.push_back(idItem);
@@ -457,9 +457,9 @@ void LLCOFMgr::synchWearables()
// Grab the item UUIDs of all currently worn wearables
uuid_vec_t newItems;
for (S32 idxType = 0; idxType < WT_COUNT; idxType++)
for (S32 idxType = 0; idxType < LLWearableType::WT_COUNT; idxType++)
{
const LLUUID& idItem = gAgentWearables.getWearableItemID((EWearableType)idxType);
const LLUUID& idItem = gAgentWearables.getWearableItemID((LLWearableType::EType)idxType);
if (idItem.isNull())
continue;
newItems.push_back(idItem);

View File

@@ -327,7 +327,7 @@ void DOFloaterHex::onClickUpload(void* user_data)
fake_asset_id.asString(),
item->getType(),
item->getInventoryType(),
(EWearableType)item->getFlags(),
(LLWearableType::EType)item->getFlags(),
PERM_ITEM_UNRESTRICTED,
new NewResourceItemCallback);
}

View File

@@ -290,7 +290,7 @@ void HGFloaterTextEditor::onClickUpload(void* user_data)
fake_asset_id.asString(),
item->getType(),
item->getInventoryType(),
(EWearableType)item->getFlags(),
(LLWearableType::EType)item->getFlags(),
PERM_ITEM_UNRESTRICTED,
new NewResourceItemCallback);
}

View File

@@ -306,7 +306,7 @@ struct InventoryImportInfo
U32 localid;
LLAssetType::EType type;
LLInventoryType::EType inv_type;
EWearableType wear_type;
LLWearableType::EType wear_type;
LLTransactionID tid;
LLUUID assetid;
std::string name;

View File

@@ -3254,15 +3254,31 @@ void LLAgent::processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void *
mesgsys->getUUIDFast(_PREHASH_WearableData, _PREHASH_TextureID, texture_id, texture_block);
mesgsys->getU8Fast(_PREHASH_WearableData, _PREHASH_TextureIndex, texture_index, texture_block);
if (texture_id.notNull()
&& (S32)texture_index < BAKED_NUM_INDICES
&& gAgentQueryManager.mActiveCacheQueries[ texture_index ] == query_id)
if ((S32)texture_index < TEX_NUM_INDICES )
{
//llinfos << "Received cached texture " << (U32)texture_index << ": " << texture_id << llendl;
gAgentAvatarp->setCachedBakedTexture(getTextureIndex((EBakedTextureIndex)texture_index), texture_id);
//avatarp->setTETexture( LLVOAvatar::sBakedTextureIndices[texture_index], texture_id );
gAgentQueryManager.mActiveCacheQueries[ texture_index ] = 0;
num_results++;
const LLVOAvatarDictionary::TextureEntry *texture_entry = LLVOAvatarDictionary::instance().getTexture((ETextureIndex)texture_index);
if (texture_entry)
{
EBakedTextureIndex baked_index = texture_entry->mBakedTextureIndex;
if (gAgentQueryManager.mActiveCacheQueries[baked_index] == query_id)
{
if (texture_id.notNull())
{
//llinfos << "Received cached texture " << (U32)texture_index << ": " << texture_id << llendl;
gAgentAvatarp->setCachedBakedTexture((ETextureIndex)texture_index, texture_id);
//gAgentAvatarp->setTETexture( LLVOAvatar::sBakedTextureIndices[texture_index], texture_id );
gAgentQueryManager.mActiveCacheQueries[baked_index] = 0;
num_results++;
}
else
{
// no cache of this bake. request upload.
gAgentAvatarp->requestLayerSetUpload(baked_index);
}
}
}
}
}
@@ -3833,10 +3849,10 @@ void LLAgent::sendAgentSetAppearance()
for(U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++ )
{
const ETextureIndex texture_index = getTextureIndex((EBakedTextureIndex)baked_index);
const ETextureIndex texture_index = LLVOAvatarDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)baked_index);
// if we're not wearing a skirt, we don't need the texture to be baked
if (texture_index == TEX_SKIRT_BAKED && !gAgentAvatarp->isWearingWearableType(WT_SKIRT))
if (texture_index == TEX_SKIRT_BAKED && !gAgentAvatarp->isWearingWearableType(LLWearableType::WT_SKIRT))
{
continue;
}
@@ -3855,28 +3871,16 @@ void LLAgent::sendAgentSetAppearance()
llinfos << "TAT: Sending cached texture data" << llendl;
for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++)
{
const LLVOAvatarDictionary::WearableDictionaryEntry *wearable_dict = LLVOAvatarDictionary::getInstance()->getWearable((EBakedTextureIndex)baked_index);
LLUUID hash;
for (U8 i=0; i < wearable_dict->mWearablesVec.size(); i++)
{
// EWearableType wearable_type = gBakedWearableMap[baked_index][wearable_num];
const EWearableType wearable_type = wearable_dict->mWearablesVec[i];
const LLWearable* wearable = gAgentWearables.getWearable(wearable_type);
if (wearable)
{
hash ^= wearable->getID();
}
}
const LLUUID hash = gAgentWearables.computeBakedTextureHash((EBakedTextureIndex) baked_index, true);
if (hash.notNull())
{
hash ^= wearable_dict->mHashID;
const ETextureIndex texture_index = LLVOAvatarDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)baked_index);
msg->nextBlockFast(_PREHASH_WearableData);
msg->addUUIDFast(_PREHASH_CacheID, hash);
msg->addU8Fast(_PREHASH_TextureIndex, (U8)texture_index);
}
const ETextureIndex texture_index = getTextureIndex((EBakedTextureIndex)baked_index);
msg->nextBlockFast(_PREHASH_WearableData);
msg->addUUIDFast(_PREHASH_CacheID, hash);
msg->addU8Fast(_PREHASH_TextureIndex, (U8)texture_index);
}
msg->nextBlockFast(_PREHASH_ObjectData);
@@ -3930,7 +3934,7 @@ void LLAgent::sendAgentSetAppearance()
static bool send_physics_params = false;
send_physics_params |= !!gAgentWearables.getWearable(WT_PHYSICS);
send_physics_params |= !!gAgentWearables.getWearable(LLWearableType::WT_PHYSICS);
S32 transmitted_params = 0;
for (LLViewerVisualParam* param = (LLViewerVisualParam*)gAgentAvatarp->getFirstVisualParam();
param;

View File

@@ -84,7 +84,7 @@ void LLAgentWearables::initClass()
{
}
void LLAgentWearables::setAvatarObject(LLVOAvatar *avatar)
void LLAgentWearables::setAvatarObject(LLVOAvatarSelf *avatar)
{
if (avatar)
{
@@ -161,7 +161,7 @@ void LLAgentWearables::addWearabletoAgentInventoryDone(
// We're changing the asset id, so we both need to set it
// locally via setAssetUUID() and via setTransactionID() which
// will be decoded on the server. JC
item->setAssetUUID(wearable->getID());
item->setAssetUUID(wearable->getAssetID());
item->setTransactionID(wearable->getTransactionID());
gInventory.addChangedMask(LLInventoryObserver::INTERNAL, item_id);
item->updateServer(FALSE);
@@ -173,7 +173,7 @@ void LLAgentWearables::sendAgentWearablesUpdate()
{
// First make sure that we have inventory items for each wearable
S32 i;
for(i=0; i < WT_COUNT; ++i)
for(i=0; i < LLWearableType::WT_COUNT; ++i)
{
LLWearable* wearable = mWearableEntry[ i ].mWearable;
if (wearable)
@@ -210,7 +210,7 @@ void LLAgentWearables::sendAgentWearablesUpdate()
gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
LL_DEBUGS("Wearables") << "sendAgentWearablesUpdate()" << LL_ENDL;
for(i=0; i < WT_COUNT; ++i)
for(i=0; i < LLWearableType::WT_COUNT; ++i)
{
gMessageSystem->nextBlockFast(_PREHASH_WearableData);
@@ -233,16 +233,16 @@ void LLAgentWearables::sendAgentWearablesUpdate()
}
else
{
LL_DEBUGS("Wearables") << "Not wearing wearable type " << LLWearable::typeToTypeName((EWearableType)i) << LL_ENDL;
LL_DEBUGS("Wearables") << "Not wearing wearable type " << LLWearableType::getTypeName((LLWearableType::EType)i) << LL_ENDL;
gMessageSystem->addUUIDFast(_PREHASH_ItemID, LLUUID::null );
}
LL_DEBUGS("Wearables") << " " << LLWearable::typeToTypeLabel((EWearableType)i) << " : " << (wearable ? wearable->getID() : LLUUID::null) << LL_ENDL;
LL_DEBUGS("Wearables") << " " << LLWearableType::getTypeLabel((LLWearableType::EType)i) << " : " << (wearable ? wearable->getAssetID() : LLUUID::null) << LL_ENDL;
}
gAgent.sendReliableMessage();
}
void LLAgentWearables::saveWearable( EWearableType type, BOOL send_update )
void LLAgentWearables::saveWearable( LLWearableType::EType type, BOOL send_update )
{
LLWearable* old_wearable = mWearableEntry[(S32)type].mWearable;
if( old_wearable && (old_wearable->isDirty() || old_wearable->isOldVersion()) )
@@ -258,7 +258,7 @@ void LLAgentWearables::saveWearable( EWearableType type, BOOL send_update )
new LLViewerInventoryItem(item->getUUID(),
item->getParentUUID(),
item->getPermissions(),
new_wearable->getID(),
new_wearable->getAssetID(),
new_wearable->getAssetType(),
item->getInventoryType(),
item->getName(),
@@ -298,7 +298,7 @@ void LLAgentWearables::saveWearable( EWearableType type, BOOL send_update )
}
void LLAgentWearables::saveWearableAs(
EWearableType type,
LLWearableType::EType type,
const std::string& new_name,
BOOL save_in_lost_and_found)
{
@@ -391,7 +391,7 @@ void LLAgentWearables::saveWearableAs(
*/
}
void LLAgentWearables::revertWearable( EWearableType type )
void LLAgentWearables::revertWearable( LLWearableType::EType type )
{
LLWearable* wearable = mWearableEntry[(S32)type].mWearable;
if( wearable )
@@ -403,9 +403,9 @@ void LLAgentWearables::revertWearable( EWearableType type )
void LLAgentWearables::revertAllWearables()
{
for( S32 i=0; i < WT_COUNT; i++ )
for( S32 i=0; i < LLWearableType::WT_COUNT; i++ )
{
revertWearable( (EWearableType)i );
revertWearable( (LLWearableType::EType)i );
}
}
@@ -416,9 +416,9 @@ void LLAgentWearables::saveAllWearables()
// return;
//}
for( S32 i=0; i < WT_COUNT; i++ )
for( S32 i=0; i < LLWearableType::WT_COUNT; i++ )
{
saveWearable( (EWearableType)i, FALSE );
saveWearable( (LLWearableType::EType)i, FALSE );
}
sendAgentWearablesUpdate();
}
@@ -426,7 +426,7 @@ void LLAgentWearables::saveAllWearables()
// 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 )
{
for( S32 i=0; i < WT_COUNT; i++ )
for( S32 i=0; i < LLWearableType::WT_COUNT; i++ )
{
if( mWearableEntry[i].mItemID == item_id )
{
@@ -451,7 +451,7 @@ void LLAgentWearables::setWearableName( const LLUUID& item_id, const std::string
}
BOOL LLAgentWearables::isWearableModifiable(EWearableType type) const
BOOL LLAgentWearables::isWearableModifiable(LLWearableType::EType type) const
{
LLUUID item_id = getWearableItemID(type);
return item_id.notNull() ? isWearableModifiable(item_id) : FALSE;
@@ -471,7 +471,7 @@ BOOL LLAgentWearables::isWearableModifiable(const LLUUID& item_id) const
return FALSE;
}
BOOL LLAgentWearables::isWearableCopyable(EWearableType type) const
BOOL LLAgentWearables::isWearableCopyable(LLWearableType::EType type) const
{
LLUUID item_id = getWearableItemID(type);
if(!item_id.isNull())
@@ -486,7 +486,7 @@ BOOL LLAgentWearables::isWearableCopyable(EWearableType type) const
return FALSE;
}
U32 LLAgentWearables::getWearablePermMask(EWearableType type) const
U32 LLAgentWearables::getWearablePermMask(LLWearableType::EType type) const
{
LLUUID item_id = getWearableItemID(type);
if(!item_id.isNull())
@@ -500,7 +500,7 @@ U32 LLAgentWearables::getWearablePermMask(EWearableType type) const
return PERM_NONE;
}
LLInventoryItem* LLAgentWearables::getWearableInventoryItem(EWearableType type)
LLInventoryItem* LLAgentWearables::getWearableInventoryItem(LLWearableType::EType type)
{
LLUUID item_id = getWearableItemID(type);
LLInventoryItem* item = NULL;
@@ -513,7 +513,7 @@ LLInventoryItem* LLAgentWearables::getWearableInventoryItem(EWearableType type)
const LLWearable* LLAgentWearables::getWearableFromItemID( const LLUUID& item_id ) const
{
for( S32 i=0; i < WT_COUNT; i++ )
for( S32 i=0; i < LLWearableType::WT_COUNT; i++ )
{
if( mWearableEntry[i].mItemID == item_id )
{
@@ -525,7 +525,7 @@ const LLWearable* LLAgentWearables::getWearableFromItemID( const LLUUID& item_id
LLWearable* LLAgentWearables::getWearableFromItemID( const LLUUID& item_id )
{
for( S32 i=0; i < WT_COUNT; i++ )
for( S32 i=0; i < LLWearableType::WT_COUNT; i++ )
{
if( mWearableEntry[i].mItemID == item_id )
{
@@ -549,21 +549,21 @@ void LLAgentWearables::sendAgentWearablesRequest()
// static
BOOL LLAgentWearables::selfHasWearable( void* userdata )
{
EWearableType type = (EWearableType)(intptr_t)userdata;
LLWearableType::EType type = (LLWearableType::EType)(intptr_t)userdata;
return gAgentWearables.getWearable( type ) != NULL;
}
LLWearable* LLAgentWearables::getWearable(const EWearableType type)
LLWearable* LLAgentWearables::getWearable(const LLWearableType::EType type)
{
return (type < WT_COUNT) ? mWearableEntry[ type ].mWearable : NULL;
return (type < LLWearableType::WT_COUNT) ? mWearableEntry[ type ].mWearable : NULL;
}
const LLWearable* LLAgentWearables::getWearable(const EWearableType type) const
const LLWearable* LLAgentWearables::getWearable(const LLWearableType::EType type) const
{
return (type < WT_COUNT) ? mWearableEntry[ type ].mWearable : NULL;
return (type < LLWearableType::WT_COUNT) ? mWearableEntry[ type ].mWearable : NULL;
}
const LLUUID &LLAgentWearables::getWearableItemID(EWearableType type) const
const LLUUID &LLAgentWearables::getWearableItemID(LLWearableType::EType type) const
{
return (type < WT_COUNT) ? mWearableEntry[ type ].mItemID : LLUUID::null;
return (type < LLWearableType::WT_COUNT) ? mWearableEntry[ type ].mItemID : LLUUID::null;
}
BOOL LLAgentWearables::isWearingItem( const LLUUID& item_id ) const
@@ -600,17 +600,17 @@ void LLAgentWearables::processAgentInitialWearablesUpdate( LLMessageSystem* mesg
//lldebugs << "processAgentInitialWearablesUpdate()" << llendl;
// Add wearables
LLUUID asset_id_array[ WT_COUNT ];
LLUUID asset_id_array[ LLWearableType::WT_COUNT ];
S32 i;
for( i=0; i < num_wearables; i++ )
{
U8 type_u8 = 0;
gMessageSystem->getU8Fast(_PREHASH_WearableData, _PREHASH_WearableType, type_u8, i );
if( type_u8 >= WT_COUNT )
if( type_u8 >= LLWearableType::WT_COUNT )
{
continue;
}
EWearableType type = (EWearableType) type_u8;
LLWearableType::EType type = (LLWearableType::EType) type_u8;
LLUUID item_id;
gMessageSystem->getUUIDFast(_PREHASH_WearableData, _PREHASH_ItemID, item_id, i );
@@ -623,7 +623,7 @@ void LLAgentWearables::processAgentInitialWearablesUpdate( LLMessageSystem* mesg
}
else
{
LLAssetType::EType asset_type = LLWearable::typeToAssetType( type );
LLAssetType::EType asset_type = LLWearableType::getAssetType( type );
if( asset_type == LLAssetType::AT_NONE )
{
continue;
@@ -633,13 +633,13 @@ void LLAgentWearables::processAgentInitialWearablesUpdate( LLMessageSystem* mesg
asset_id_array[type] = asset_id;
}
LL_DEBUGS("Wearables") << " " << LLWearable::typeToTypeLabel(type) << " " << asset_id << " item id " << gAgentWearables.mWearableEntry[type].mItemID.asString() << LL_ENDL;
LL_DEBUGS("Wearables") << " " << LLWearableType::getTypeLabel(type) << " " << asset_id << " item id " << gAgentWearables.mWearableEntry[type].mItemID.asString() << LL_ENDL;
}
LLCOFMgr::instance().fetchCOF();
// now that we have the asset ids...request the wearable assets
for( i = 0; i < WT_COUNT; i++ )
for( i = 0; i < LLWearableType::WT_COUNT; i++ )
{
LL_DEBUGS("Wearables") << " fetching " << asset_id_array[i] << LL_ENDL;
if( !gAgentWearables.mWearableEntry[i].mItemID.isNull() )
@@ -647,7 +647,7 @@ void LLAgentWearables::processAgentInitialWearablesUpdate( LLMessageSystem* mesg
gWearableList.getAsset(
asset_id_array[i],
LLStringUtil::null,
LLWearable::typeToAssetType( (EWearableType) i ),
LLWearableType::getAssetType( (LLWearableType::EType) i ),
LLAgentWearables::onInitialWearableAssetArrived, (void*)(intptr_t)i );
}
}
@@ -661,7 +661,7 @@ void LLAgentWearables::processAgentInitialWearablesUpdate( LLMessageSystem* mesg
// static
void LLAgentWearables::onInitialWearableAssetArrived( LLWearable* wearable, void* userdata )
{
EWearableType type = (EWearableType)(intptr_t)userdata;
LLWearableType::EType type = (LLWearableType::EType)(intptr_t)userdata;
LLVOAvatar* avatar = gAgentAvatarp;
if( !avatar )
@@ -694,7 +694,7 @@ void LLAgentWearables::onInitialWearableAssetArrived( LLWearable* wearable, void
if( !gAgentWearables.mWearablesLoaded )
{
gAgentWearables.mWearablesLoaded = TRUE;
for( S32 i = 0; i < WT_COUNT; i++ )
for( S32 i = 0; i < LLWearableType::WT_COUNT; i++ )
{
if( !gAgentWearables.mWearableEntry[i].mItemID.isNull() && !gAgentWearables.mWearableEntry[i].mWearable )
{
@@ -721,11 +721,11 @@ 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( EWearableType type )
void LLAgentWearables::recoverMissingWearable( LLWearableType::EType type )
{
// Try to recover by replacing missing wearable with a new one.
LLNotificationsUtil::add("ReplacedMissingWearable");
lldebugs << "Wearable " << LLWearable::typeToTypeLabel( type ) << " could not be downloaded. Replaced inventory item with default wearable." << llendl;
lldebugs << "Wearable " << LLWearableType::getTypeLabel( type ) << " could not be downloaded. Replaced inventory item with default wearable." << llendl;
LLWearable* new_wearable = gWearableList.createNewWearable(type);
S32 type_s32 = (S32) type;
@@ -750,7 +750,7 @@ void LLAgentWearables::recoverMissingWearableDone()
{
// Have all the wearables that the avatar was wearing at log-in arrived or been fabricated?
mWearablesLoaded = TRUE;
for( S32 i = 0; i < WT_COUNT; i++ )
for( S32 i = 0; i < LLWearableType::WT_COUNT; i++ )
{
if( !mWearableEntry[i].mItemID.isNull() && !mWearableEntry[i].mWearable )
{
@@ -780,7 +780,7 @@ void LLAgentWearables::createStandardWearables(BOOL female)
gAgentAvatarp->setSex(female ? SEX_FEMALE : SEX_MALE);
const BOOL create[WT_COUNT] =
const BOOL create[LLWearableType::WT_COUNT] =
{
TRUE, //WT_SHAPE
TRUE, //WT_SKIN
@@ -800,7 +800,7 @@ void LLAgentWearables::createStandardWearables(BOOL female)
FALSE, //WT_PHYSICS
};
for( S32 i=0; i < WT_COUNT; i++ )
for( S32 i=0; i < LLWearableType::WT_COUNT; i++ )
{
bool once = false;
LLPointer<LLRefCount> donecb = NULL;
@@ -812,7 +812,7 @@ void LLAgentWearables::createStandardWearables(BOOL female)
donecb = new createStandardWearablesAllDoneCallback;
}
llassert( mWearableEntry[i].mWearable == NULL );
LLWearable* wearable = gWearableList.createNewWearable((EWearableType)i);
LLWearable* wearable = gWearableList.createNewWearable((LLWearableType::EType)i);
mWearableEntry[i].mWearable = wearable;
// no need to update here...
LLPointer<LLInventoryCallback> cb =
@@ -911,7 +911,7 @@ void LLAgentWearables::makeNewOutfit(
LLStringUtil::truncate(new_name, DB_INV_ITEM_NAME_STR_LEN);
}
if (fUseLinks || isWearableCopyable((EWearableType)index))
if (fUseLinks || isWearableCopyable((LLWearableType::EType)index))
{
LLWearable* new_wearable = gWearableList.createCopy(old_wearable);
if (rename_clothing)
@@ -934,7 +934,7 @@ void LLAgentWearables::makeNewOutfit(
index,
new_wearable,
todo);
if (isWearableCopyable((EWearableType)index))
if (isWearableCopyable((LLWearableType::EType)index))
{
copy_inventory_item(
gAgent.getID(),
@@ -1079,12 +1079,12 @@ void LLAgentWearables::addWearableToAgentInventory(LLPointer<LLInventoryCallback
cb);
}
void LLAgentWearables::removeWearable( EWearableType type )
void LLAgentWearables::removeWearable( LLWearableType::EType type )
{
LLWearable* old_wearable = mWearableEntry[ type ].mWearable;
if ( (gAgent.isTeen())
&& (type == WT_UNDERSHIRT || type == WT_UNDERPANTS))
&& (type == LLWearableType::WT_UNDERSHIRT || type == LLWearableType::WT_UNDERPANTS))
{
// Can't take off underclothing in simple UI mode or on PG accounts
return;
@@ -1118,7 +1118,7 @@ void LLAgentWearables::removeWearable( EWearableType type )
bool LLAgentWearables::onRemoveWearableDialog(const LLSD& notification, const LLSD& response )
{
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
EWearableType type = (EWearableType)notification["payload"]["wearable_type"].asInteger();
LLWearableType::EType type = (LLWearableType::EType)notification["payload"]["wearable_type"].asInteger();
switch( option )
{
case 0: // "Save"
@@ -1141,7 +1141,7 @@ bool LLAgentWearables::onRemoveWearableDialog(const LLSD& notification, const LL
}
// Called by removeWearable() and onRemoveWearableDialog() to actually do the removal.
void LLAgentWearables::removeWearableFinal( EWearableType type )
void LLAgentWearables::removeWearableFinal( LLWearableType::EType type )
{
LLWearable* old_wearable = mWearableEntry[ type ].mWearable;
@@ -1163,7 +1163,7 @@ void LLAgentWearables::removeWearableFinal( EWearableType type )
gInventory.notifyObservers();
}
void LLAgentWearables::copyWearableToInventory( EWearableType type )
void LLAgentWearables::copyWearableToInventory( LLWearableType::EType type )
{
LLWearable* wearable = mWearableEntry[ type ].mWearable;
if( wearable )
@@ -1202,9 +1202,9 @@ struct LLSetWearableData
LLWearable* mNewWearable;
};
static bool isFirstPhysicsWearable(EWearableType type, LLInventoryItem *new_item, LLWearable *new_wearable)
static bool isFirstPhysicsWearable(LLWearableType::EType type, LLInventoryItem *new_item, LLWearable *new_wearable)
{
if (type == WT_PHYSICS && gSavedSettings.getWarning("FirstPhysicsWearable"))
if (type == LLWearableType::WT_PHYSICS && gSavedSettings.getWarning("FirstPhysicsWearable"))
{
class WearableDelayedCallback
{
@@ -1226,7 +1226,7 @@ static bool isFirstPhysicsWearable(EWearableType type, LLInventoryItem *new_item
return false;
}
BOOL LLAgentWearables::needsReplacement(EWearableType wearableType, S32 remove)
BOOL LLAgentWearables::needsReplacement(LLWearableType::EType wearableType, S32 remove)
{
return TRUE;
/*if (remove) return TRUE;
@@ -1241,24 +1241,24 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
{
lldebugs << "setWearableOutfit() start" << llendl;
BOOL wearables_to_remove[WT_COUNT];
wearables_to_remove[WT_SHAPE] = FALSE;
wearables_to_remove[WT_SKIN] = FALSE;
wearables_to_remove[WT_HAIR] = FALSE;
wearables_to_remove[WT_EYES] = FALSE;
BOOL wearables_to_remove[LLWearableType::WT_COUNT];
wearables_to_remove[LLWearableType::WT_SHAPE] = FALSE;
wearables_to_remove[LLWearableType::WT_SKIN] = FALSE;
wearables_to_remove[LLWearableType::WT_HAIR] = FALSE;
wearables_to_remove[LLWearableType::WT_EYES] = FALSE;
// [RLVa:KB] - Checked: 2009-07-06 (RLVa-1.1.3b) | Added: RLVa-0.2.2a
wearables_to_remove[WT_SHIRT] = remove && gRlvWearableLocks.canRemove(WT_SHIRT);
wearables_to_remove[WT_PANTS] = remove && gRlvWearableLocks.canRemove(WT_PANTS);
wearables_to_remove[WT_SHOES] = remove && gRlvWearableLocks.canRemove(WT_SHOES);
wearables_to_remove[WT_SOCKS] = remove && gRlvWearableLocks.canRemove(WT_SOCKS);
wearables_to_remove[WT_JACKET] = remove && gRlvWearableLocks.canRemove(WT_JACKET);
wearables_to_remove[WT_GLOVES] = remove && gRlvWearableLocks.canRemove(WT_GLOVES);
wearables_to_remove[WT_UNDERSHIRT] = (!gAgent.isTeen()) && remove && gRlvWearableLocks.canRemove(WT_UNDERSHIRT);
wearables_to_remove[WT_UNDERPANTS] = (!gAgent.isTeen()) && remove && gRlvWearableLocks.canRemove(WT_UNDERPANTS);
wearables_to_remove[WT_SKIRT] = remove && gRlvWearableLocks.canRemove(WT_SKIRT);
wearables_to_remove[WT_ALPHA] = remove && gRlvWearableLocks.canRemove(WT_ALPHA);
wearables_to_remove[WT_TATTOO] = remove && gRlvWearableLocks.canRemove(WT_TATTOO);
wearables_to_remove[WT_PHYSICS] = remove && gRlvWearableLocks.canRemove(WT_PHYSICS);
wearables_to_remove[LLWearableType::WT_SHIRT] = remove && gRlvWearableLocks.canRemove(LLWearableType::WT_SHIRT);
wearables_to_remove[LLWearableType::WT_PANTS] = remove && gRlvWearableLocks.canRemove(LLWearableType::WT_PANTS);
wearables_to_remove[LLWearableType::WT_SHOES] = remove && gRlvWearableLocks.canRemove(LLWearableType::WT_SHOES);
wearables_to_remove[LLWearableType::WT_SOCKS] = remove && gRlvWearableLocks.canRemove(LLWearableType::WT_SOCKS);
wearables_to_remove[LLWearableType::WT_JACKET] = remove && gRlvWearableLocks.canRemove(LLWearableType::WT_JACKET);
wearables_to_remove[LLWearableType::WT_GLOVES] = remove && gRlvWearableLocks.canRemove(LLWearableType::WT_GLOVES);
wearables_to_remove[LLWearableType::WT_UNDERSHIRT] = (!gAgent.isTeen()) && remove && gRlvWearableLocks.canRemove(LLWearableType::WT_UNDERSHIRT);
wearables_to_remove[LLWearableType::WT_UNDERPANTS] = (!gAgent.isTeen()) && remove && gRlvWearableLocks.canRemove(LLWearableType::WT_UNDERPANTS);
wearables_to_remove[LLWearableType::WT_SKIRT] = remove && gRlvWearableLocks.canRemove(LLWearableType::WT_SKIRT);
wearables_to_remove[LLWearableType::WT_ALPHA] = remove && gRlvWearableLocks.canRemove(LLWearableType::WT_ALPHA);
wearables_to_remove[LLWearableType::WT_TATTOO] = remove && gRlvWearableLocks.canRemove(LLWearableType::WT_TATTOO);
wearables_to_remove[LLWearableType::WT_PHYSICS] = remove && gRlvWearableLocks.canRemove(LLWearableType::WT_PHYSICS);
// [/RLVa:KB]
S32 count = wearables.count();
@@ -1271,17 +1271,17 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
LLPointer<LLInventoryItem> new_item = items[i];
llassert(new_wearable);
EWearableType type = new_wearable->getType();
LLWearableType::EType type = new_wearable->getType();
wearables_to_remove[type] = FALSE;
LLWearable* old_wearable = mWearableEntry[ type ].mWearable;
if( old_wearable )
{
const LLUUID& old_item_id = mWearableEntry[ type ].mItemID;
if( (old_wearable->getID() == new_wearable->getID()) &&
if( (old_wearable->getAssetID() == new_wearable->getAssetID()) &&
(old_item_id == new_item->getUUID()) )
{
lldebugs << "No change to wearable asset and item: " << LLWearable::typeToTypeName( type ) << llendl;
lldebugs << "No change to wearable asset and item: " << LLWearableType::getTypeName( type ) << llendl;
continue;
}
@@ -1306,7 +1306,7 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
std::vector<LLWearable*> wearables_being_removed;
for( i = 0; i < WT_COUNT; i++ )
for( i = 0; i < LLWearableType::WT_COUNT; i++ )
{
if( wearables_to_remove[i] )
{
@@ -1352,7 +1352,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 )
{
EWearableType type = new_wearable->getType();
LLWearableType::EType type = new_wearable->getType();
LLWearable* old_wearable = mWearableEntry[ type ].mWearable;
@@ -1372,10 +1372,10 @@ void LLAgentWearables::setWearableItem( LLInventoryItem* new_item, LLWearable* n
if( old_wearable )
{
const LLUUID& old_item_id = mWearableEntry[ type ].mItemID;
if( (old_wearable->getID() == new_wearable->getID()) &&
if( (old_wearable->getAssetID() == new_wearable->getAssetID()) &&
(old_item_id == new_item->getUUID()) )
{
lldebugs << "No change to wearable asset and item: " << LLWearable::typeToTypeName( type ) << llendl;
lldebugs << "No change to wearable asset and item: " << LLWearableType::getTypeName( type ) << llendl;
return;
}
@@ -1429,7 +1429,7 @@ bool LLAgentWearables::onSetWearableDialog( const LLSD& notification, const LLSD
// Called from setWearable() and onSetWearableDialog() to actually set the wearable.
void LLAgentWearables::setWearableFinal( LLInventoryItem* new_item, LLWearable* new_wearable )
{
const EWearableType type = new_wearable->getType();
const LLWearableType::EType type = new_wearable->getType();
// Replace the old wearable with a new one.
llassert( new_item->getAssetUUID() == new_wearable->getID() );
@@ -1454,7 +1454,7 @@ void LLAgentWearables::setWearableFinal( LLInventoryItem* new_item, LLWearable*
void LLAgentWearables::queryWearableCache()
{
if (!mWearablesLoaded)
if (!areWearablesLoaded())
{
return;
}
@@ -1477,28 +1477,18 @@ void LLAgentWearables::queryWearableCache()
S32 num_queries = 0;
for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++ )
{
const LLVOAvatarDictionary::WearableDictionaryEntry *wearable_dict = LLVOAvatarDictionary::getInstance()->getWearable((EBakedTextureIndex)baked_index);
LLUUID hash;
for (U8 i=0; i < wearable_dict->mWearablesVec.size(); i++)
LLUUID hash_id = computeBakedTextureHash((EBakedTextureIndex) baked_index);
if (hash_id.notNull())
{
// EWearableType wearable_type = gBakedWearableMap[baked_index][wearable_num];
const EWearableType wearable_type = wearable_dict->mWearablesVec[i];
const LLWearable* wearable = getWearable(wearable_type);
if (wearable)
{
hash ^= wearable->getID();
}
}
if (hash.notNull())
{
hash ^= wearable_dict->mHashID;
num_queries++;
// *NOTE: make sure at least one request gets packed
ETextureIndex te_index = LLVOAvatarDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)baked_index);
//llinfos << "Requesting texture for hash " << hash << " in baked texture slot " << baked_index << llendl;
gMessageSystem->nextBlockFast(_PREHASH_WearableData);
gMessageSystem->addUUIDFast(_PREHASH_ID, hash);
gMessageSystem->addU8Fast(_PREHASH_TextureIndex, (U8)baked_index);
gMessageSystem->addUUIDFast(_PREHASH_ID, hash_id);
gMessageSystem->addU8Fast(_PREHASH_TextureIndex, (U8)te_index);
}
gAgentQueryManager.mActiveCacheQueries[ baked_index ] = gAgentQueryManager.mWearablesCacheQueryID;
@@ -1513,13 +1503,52 @@ void LLAgentWearables::queryWearableCache()
}
}
LLUUID LLAgentWearables::computeBakedTextureHash(LLVOAvatarDefines::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
{
LLUUID hash_id;
bool hash_computed = false;
LLMD5 hash;
const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture(baked_index);
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)
{
LLUUID asset_id = wearable->getAssetID();
hash.update((const unsigned char*)asset_id.mData, UUID_BYTES);
hash_computed = true;
}
}
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.
// static
void LLAgentWearables::userRemoveWearable( void* userdata )
{
EWearableType type = (EWearableType)(intptr_t)userdata;
LLWearableType::EType type = (LLWearableType::EType)(intptr_t)userdata;
if( !(type==WT_SHAPE || type==WT_SKIN || type==WT_HAIR || type==WT_EYES) ) //&&
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 );
@@ -1543,18 +1572,18 @@ void LLAgentWearables::userRemoveAllClothesStep2( BOOL proceed, void* userdata )
{
if( proceed )
{
gAgentWearables.removeWearable( WT_SHIRT );
gAgentWearables.removeWearable( WT_PANTS );
gAgentWearables.removeWearable( WT_SHOES );
gAgentWearables.removeWearable( WT_SOCKS );
gAgentWearables.removeWearable( WT_JACKET );
gAgentWearables.removeWearable( WT_GLOVES );
gAgentWearables.removeWearable( WT_UNDERSHIRT );
gAgentWearables.removeWearable( WT_UNDERPANTS );
gAgentWearables.removeWearable( WT_SKIRT );
gAgentWearables.removeWearable( WT_ALPHA );
gAgentWearables.removeWearable( WT_TATTOO );
gAgentWearables.removeWearable( WT_PHYSICS );
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 );
}
}
@@ -1570,8 +1599,7 @@ void LLAgentWearables::userUpdateAttachments(LLInventoryModel::item_array_t& obj
// already wearing and in request set -> leave alone.
// not wearing and in request set -> put on.
LLVOAvatar* pAvatar = gAgentAvatarp;
if (!pAvatar) return;
if (!isAgentAvatarValid()) return;
std::set<LLUUID> requested_item_ids;
std::set<LLUUID> current_item_ids;
@@ -1580,8 +1608,8 @@ void LLAgentWearables::userUpdateAttachments(LLInventoryModel::item_array_t& obj
// Build up list of objects to be removed and items currently attached.
llvo_vec_t objects_to_remove;
for (LLVOAvatar::attachment_map_t::iterator iter = pAvatar->mAttachmentPoints.begin();
iter != pAvatar->mAttachmentPoints.end();)
for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
iter != gAgentAvatarp->mAttachmentPoints.end();)
{
LLVOAvatar::attachment_map_t::iterator curiter = iter++;
LLViewerJointAttachment* attachment = curiter->second;
@@ -1643,7 +1671,7 @@ void LLAgentWearables::userUpdateAttachments(LLInventoryModel::item_array_t& obj
void LLAgentWearables::userRemoveMultipleAttachments(llvo_vec_t& objects_to_remove)
{
if (!gAgentAvatarp) return;
if (!isAgentAvatarValid()) return;
// [RLVa:KB] - Checked: 2010-03-04 (RLVa-1.1.3b) | Modified: RLVa-1.2.0a
// RELEASE-RLVa: [SL-2.0.0] Check our callers and verify that erasing elements from the passed vector won't break random things
@@ -1694,17 +1722,12 @@ void LLAgentWearables::userRemoveMultipleAttachments(llvo_vec_t& objects_to_remo
void LLAgentWearables::userRemoveAllAttachments( void* userdata )
{
LLVOAvatar* avatarp = gAgentAvatarp;
if(!avatarp)
{
llwarns << "No avatar found." << llendl;
return;
}
if (!isAgentAvatarValid()) return;
llvo_vec_t objects_to_remove;
for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin();
iter != avatarp->mAttachmentPoints.end();)
for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
iter != gAgentAvatarp->mAttachmentPoints.end();)
{
LLVOAvatar::attachment_map_t::iterator curiter = iter++;
LLViewerJointAttachment* attachment = curiter->second;

View File

@@ -46,7 +46,7 @@
#include "llvoavatardefines.h"
class LLInventoryItem;
class LLVOAvatar;
class LLVOAvatarSelf;
class LLWearable;
class LLInitialWearablesFetch;
class LLViewerObject;
@@ -64,7 +64,7 @@ public:
LLAgentWearables();
virtual ~LLAgentWearables();
void setAvatarObject(LLVOAvatar *avatar);
void setAvatarObject(LLVOAvatarSelf *avatar);
void createStandardWearables(BOOL female);
void cleanup();
//void dump();
@@ -80,10 +80,10 @@ protected:
//--------------------------------------------------------------------
public:
BOOL isWearingItem(const LLUUID& item_id) const;
BOOL isWearableModifiable(EWearableType type) const;
BOOL isWearableModifiable(LLWearableType::EType type) const;
BOOL isWearableModifiable(const LLUUID& item_id) const;
BOOL isWearableCopyable(EWearableType type) const;
BOOL isWearableCopyable(LLWearableType::EType type) const;
BOOL areWearablesLoaded() const { return mWearablesLoaded; };
//void updateWearablesLoaded();
//void checkWearablesLoaded() const;
@@ -94,33 +94,29 @@ public:
//void animateAllWearableParams(F32 delta, BOOL upload_bake);
BOOL needsReplacement(EWearableType wearableType, S32 remove);
U32 getWearablePermMask(EWearableType type) const;
BOOL needsReplacement(LLWearableType::EType wearableType, S32 remove);
U32 getWearablePermMask(LLWearableType::EType type) const;
//--------------------------------------------------------------------
// Accessors
//--------------------------------------------------------------------
public:
const LLUUID& getWearableItemID(EWearableType type ) const;
const LLUUID& getWearableItemID(LLWearableType::EType type ) 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(EWearableType type);
static BOOL selfHasWearable( void* userdata ); // userdata is EWearableType
LLWearable* getWearable( const EWearableType type );
const LLWearable* getWearable( const EWearableType type ) const;
LLInventoryItem* getWearableInventoryItem(LLWearableType::EType type);
static BOOL selfHasWearable( void* userdata ); // userdata is LLWearableType::EType
LLWearable* getWearable( const LLWearableType::EType type );
const LLWearable* getWearable( const LLWearableType::EType type ) const;
//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;
static EWearableType getTEWearableType( S32 te );
static LLUUID getDefaultTEImageID( S32 te );
void copyWearableToInventory( EWearableType type );
void copyWearableToInventory( LLWearableType::EType type );
static const U32 MAX_CLOTHING_PER_TYPE = 5;
@@ -168,7 +164,7 @@ protected:
const LLUUID& item_id,
LLWearable* wearable);
void recoverMissingWearable(EWearableType type);
void recoverMissingWearable(LLWearableType::EType type);
void recoverMissingWearableDone();
//--------------------------------------------------------------------
@@ -190,9 +186,9 @@ private:
// Removing wearables
//--------------------------------------------------------------------
public:
void removeWearable( EWearableType type );
void removeWearable( LLWearableType::EType type );
private:
void removeWearableFinal( EWearableType type );
void removeWearableFinal( LLWearableType::EType type );
protected:
static bool onRemoveWearableDialog(const LLSD& notification, const LLSD& response);
static void userRemoveAllClothesStep2(BOOL proceed, void* userdata ); // userdata is NULL
@@ -203,8 +199,8 @@ protected:
public:
// Processes the initial wearables update message (if necessary, since the outfit folder makes it redundant)
static void processAgentInitialWearablesUpdate(LLMessageSystem* mesgsys, void** user_data);
//LLUUID computeBakedTextureHash(LLVOAvatarDefines::EBakedTextureIndex baked_index,
// BOOL generate_valid_hash = TRUE);
LLUUID computeBakedTextureHash(LLVOAvatarDefines::EBakedTextureIndex baked_index,
BOOL generate_valid_hash = TRUE);
protected:
void sendAgentWearablesUpdate();
@@ -234,18 +230,18 @@ private:
// Save Wearables
//--------------------------------------------------------------------
public:
void saveWearableAs( EWearableType type, const std::string& new_name, BOOL save_in_lost_and_found );
void saveWearable( EWearableType type, BOOL send_update = TRUE );
void saveWearableAs( LLWearableType::EType type, const std::string& new_name, BOOL save_in_lost_and_found );
void saveWearable( LLWearableType::EType type, BOOL send_update = TRUE );
void saveAllWearables();
void revertWearable( EWearableType type );
void revertWearable( LLWearableType::EType type );
void revertAllWearables();
//--------------------------------------------------------------------
// Static UI hooks
//--------------------------------------------------------------------
public:
static void userRemoveWearable( void* userdata ); // userdata is EWearableType
static void userRemoveWearable( void* userdata ); // userdata is LLWearableType::EType
static void userRemoveAllClothes( void* userdata ); // userdata is NULL
// static void userUpdateAttachments(LLInventoryModel::item_array_t& obj_item_array);
// [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2010-09-22 (Catznip-2.2.0a) | Added: Catznip-2.2.0a
@@ -287,7 +283,7 @@ private:
LLUUID mItemID; // ID of the inventory item in the agent's inventory.
LLWearable* mWearable;
};
LLWearableEntry mWearableEntry[ WT_COUNT ];
LLWearableEntry mWearableEntry[ LLWearableType::WT_COUNT ];
BOOL mWearablesLoaded;
//--------------------------------------------------------------------------------

View File

@@ -47,10 +47,10 @@ LLAssetType::EType LLAssetConverter::convert(const std::string &src_filename, co
conversion_list[i].type : LLAssetType::AT_NONE;
}
}
EWearableType wear_type = LLWearable::typeNameToType(exten);
if(wear_type != WT_NONE && copyFile(src_filename, filename))
LLWearableType::EType wear_type = LLWearableType::typeNameToType(exten);
if(wear_type != LLWearableType::WT_NONE && copyFile(src_filename, filename))
{
return LLWearable::typeToAssetType(wear_type);
return LLWearableType::getAssetType(wear_type);
}
llwarns << "Unhandled extension" << llendl;

View File

@@ -162,12 +162,12 @@ public:
////////////////////////////////////////////////////////////////////////////
BOOL edit_wearable_for_teens(EWearableType type)
BOOL edit_wearable_for_teens(LLWearableType::EType type)
{
switch(type)
{
case WT_UNDERSHIRT:
case WT_UNDERPANTS:
case LLWearableType::WT_UNDERSHIRT:
case LLWearableType::WT_UNDERPANTS:
return FALSE;
default:
return TRUE;
@@ -191,16 +191,16 @@ public:
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_new_outfit_dialog.xml");
// Build list of check boxes
for( S32 i = 0; i < WT_COUNT; i++ )
for( S32 i = 0; i < LLWearableType::WT_COUNT; i++ )
{
std::string name = std::string("checkbox_") + LLWearable::typeToTypeLabel( (EWearableType)i );
std::string name = std::string("checkbox_") + LLWearableType::getTypeLabel( (LLWearableType::EType)i );
mCheckBoxList.push_back(std::make_pair(name,i));
// Hide teen items
if (gAgent.isTeen() &&
!edit_wearable_for_teens((EWearableType)i))
!edit_wearable_for_teens((LLWearableType::EType)i))
{
// hide wearable checkboxes that don't apply to this account
std::string name = std::string("checkbox_") + LLWearable::typeToTypeLabel( (EWearableType)i );
std::string name = std::string("checkbox_") + LLWearableType::getTypeLabel( (LLWearableType::EType)i );
childSetVisible(name, FALSE);
}
}
@@ -265,11 +265,11 @@ public:
void setWearableToInclude( S32 wearable, S32 enabled, S32 selected )
{
EWearableType wtType = (EWearableType)wearable;
if ( ( (0 <= wtType) && (wtType < WT_COUNT) ) &&
( (LLAssetType::AT_BODYPART != LLWearable::typeToAssetType(wtType)) || (!gSavedSettings.getBOOL("UseOutfitFolders")) ) )
LLWearableType::EType wtType = (LLWearableType::EType)wearable;
if ( ( (0 <= wtType) && (wtType < LLWearableType::WT_COUNT) ) &&
( (LLAssetType::AT_BODYPART != LLWearableType::getAssetType(wtType)) || (!gSavedSettings.getBOOL("UseOutfitFolders")) ) )
{
std::string name = std::string("checkbox_") + LLWearable::typeToTypeLabel(wtType);
std::string name = std::string("checkbox_") + LLWearableType::getTypeLabel(wtType);
childSetEnabled(name, enabled);
childSetValue(name, selected);
}
@@ -281,7 +281,7 @@ public:
{
std::string name = mCheckBoxList[i].first;
BOOL checked = childGetValue(name).asBoolean();
if (i < WT_COUNT )
if (i < LLWearableType::WT_COUNT )
{
if( checked )
{
@@ -350,12 +350,12 @@ public:
{
BOOL fUseOutfits = gSavedSettings.getBOOL("UseOutfitFolders");
for (S32 idxType = 0; idxType < WT_COUNT; idxType++ )
for (S32 idxType = 0; idxType < LLWearableType::WT_COUNT; idxType++ )
{
EWearableType wtType = (EWearableType)idxType;
if (LLAssetType::AT_BODYPART != LLWearable::typeToAssetType(wtType))
LLWearableType::EType wtType = (LLWearableType::EType)idxType;
if (LLAssetType::AT_BODYPART != LLWearableType::getAssetType(wtType))
continue;
LLCheckBoxCtrl* pCheckCtrl = getChild<LLCheckBoxCtrl>(std::string("checkbox_") + LLWearable::typeToTypeLabel(wtType));
LLCheckBoxCtrl* pCheckCtrl = getChild<LLCheckBoxCtrl>(std::string("checkbox_") + LLWearableType::getTypeLabel(wtType));
if (!pCheckCtrl)
continue;
@@ -436,7 +436,7 @@ struct LLSubpart
class LLPanelEditWearable : public LLPanel
{
public:
LLPanelEditWearable( EWearableType type );
LLPanelEditWearable( LLWearableType::EType type );
virtual ~LLPanelEditWearable();
virtual BOOL postBuild();
@@ -448,8 +448,8 @@ public:
void addInvisibilityCheckbox(ETextureIndex te, const std::string& name);
void addColorSwatch( ETextureIndex te, const std::string& name );
const std::string& getLabel() { return LLWearable::typeToTypeLabel( mType ); }
EWearableType getType() { return mType; }
const std::string& getLabel() { return LLWearableType::getTypeLabel( mType ); }
LLWearableType::EType getType() { return mType; }
LLSubpart* getCurrentSubpart() { return mSubpartList[mCurrentSubpart]; }
ESubpart getDefaultSubpart();
@@ -487,7 +487,7 @@ public:
private:
EWearableType mType;
LLWearableType::EType mType;
BOOL mCanTakeOff;
std::map<std::string, S32> mTextureList;
std::map<std::string, S32> mInvisibilityList;
@@ -499,15 +499,15 @@ private:
////////////////////////////////////////////////////////////////////////////
LLPanelEditWearable::LLPanelEditWearable( EWearableType type )
: LLPanel( LLWearable::typeToTypeLabel( type ) ),
LLPanelEditWearable::LLPanelEditWearable( LLWearableType::EType type )
: LLPanel( LLWearableType::getTypeLabel( type ) ),
mType( type )
{
}
BOOL LLPanelEditWearable::postBuild()
{
LLAssetType::EType asset_type = LLWearable::typeToAssetType( mType );
LLAssetType::EType asset_type = LLWearableType::getAssetType( mType );
/*std::string icon_name = (asset_type == LLAssetType::AT_CLOTHING ?
"inv_item_clothing.tga" :
"inv_item_skin.tga" );*/
@@ -519,8 +519,8 @@ BOOL LLPanelEditWearable::postBuild()
// If PG, can't take off underclothing or shirt
mCanTakeOff =
LLWearable::typeToAssetType( mType ) == LLAssetType::AT_CLOTHING &&
!( gAgent.isTeen() && (mType == WT_UNDERSHIRT || mType == WT_UNDERPANTS) );
LLWearableType::getAssetType( mType ) == LLAssetType::AT_CLOTHING &&
!( gAgent.isTeen() && (mType == LLWearableType::WT_UNDERSHIRT || mType == LLWearableType::WT_UNDERPANTS) );
childSetVisible("Take Off", mCanTakeOff);
childSetAction("Take Off", LLPanelEditWearable::onBtnTakeOff, this );
@@ -719,7 +719,7 @@ bool LLPanelEditWearable::onSelectAutoWearOption(const LLSD& notification, const
if(avatar)
{
// Create a new wearable in the default folder for the wearable's asset type.
LLWearable* wearable = gWearableList.createNewWearable( (EWearableType)notification["payload"]["wearable_type"].asInteger() );
LLWearable* wearable = gWearableList.createNewWearable( (LLWearableType::EType)notification["payload"]["wearable_type"].asInteger() );
LLAssetType::EType asset_type = wearable->getAssetType();
LLUUID folder_id;
@@ -876,7 +876,7 @@ void LLPanelEditWearable::addTextureDropTarget( ETextureIndex te, const std::str
if (avatar)
{
LLWearable* wearable = gAgentWearables.getWearable(mType);
if (wearable && mType == WT_ALPHA)
if (wearable && mType == LLWearableType::WT_ALPHA)
{
const LLTextureEntry* current_te = avatar->getTE(te);
if (current_te)
@@ -910,7 +910,7 @@ void LLPanelEditWearable::onTextureCommit( LLUICtrl* ctrl, void* userdata )
avatar->setLocTexTE(te, image, TRUE);
avatar->wearableUpdated(self->mType, FALSE);
}
if (self->mType == WT_ALPHA && image->getID() != IMG_INVISIBLE)
if (self->mType == LLWearableType::WT_ALPHA && image->getID() != IMG_INVISIBLE)
{
self->mPreviousTextureList[te] = image->getID();
}
@@ -922,22 +922,22 @@ ESubpart LLPanelEditWearable::getDefaultSubpart()
{
switch( mType )
{
case WT_SHAPE: return SUBPART_SHAPE_WHOLE;
case WT_SKIN: return SUBPART_SKIN_COLOR;
case WT_HAIR: return SUBPART_HAIR_COLOR;
case WT_EYES: return SUBPART_EYES;
case WT_SHIRT: return SUBPART_SHIRT;
case WT_PANTS: return SUBPART_PANTS;
case WT_SHOES: return SUBPART_SHOES;
case WT_SOCKS: return SUBPART_SOCKS;
case WT_JACKET: return SUBPART_JACKET;
case WT_GLOVES: return SUBPART_GLOVES;
case WT_UNDERSHIRT: return SUBPART_UNDERSHIRT;
case WT_UNDERPANTS: return SUBPART_UNDERPANTS;
case WT_SKIRT: return SUBPART_SKIRT;
case WT_ALPHA: return SUBPART_ALPHA;
case WT_TATTOO: return SUBPART_TATTOO;
case WT_PHYSICS: return SUBPART_PHYSICS_BELLY_UPDOWN;
case LLWearableType::WT_SHAPE: return SUBPART_SHAPE_WHOLE;
case LLWearableType::WT_SKIN: return SUBPART_SKIN_COLOR;
case LLWearableType::WT_HAIR: return SUBPART_HAIR_COLOR;
case LLWearableType::WT_EYES: return SUBPART_EYES;
case LLWearableType::WT_SHIRT: return SUBPART_SHIRT;
case LLWearableType::WT_PANTS: return SUBPART_PANTS;
case LLWearableType::WT_SHOES: return SUBPART_SHOES;
case LLWearableType::WT_SOCKS: return SUBPART_SOCKS;
case LLWearableType::WT_JACKET: return SUBPART_JACKET;
case LLWearableType::WT_GLOVES: return SUBPART_GLOVES;
case LLWearableType::WT_UNDERSHIRT: return SUBPART_UNDERSHIRT;
case LLWearableType::WT_UNDERPANTS: return SUBPART_UNDERPANTS;
case LLWearableType::WT_SKIRT: return SUBPART_SKIRT;
case LLWearableType::WT_ALPHA: return SUBPART_ALPHA;
case LLWearableType::WT_TATTOO: return SUBPART_TATTOO;
case LLWearableType::WT_PHYSICS: return SUBPART_PHYSICS_BELLY_UPDOWN;
default: llassert(0); return SUBPART_SHAPE_WHOLE;
}
@@ -1029,7 +1029,7 @@ void LLPanelEditWearable::draw()
{
// *TODO:Translate
childSetVisible("title_no_modify", TRUE);
childSetTextArg("title_no_modify", "[DESC]", std::string(LLWearable::typeToTypeLabel( mType )));
childSetTextArg("title_no_modify", "[DESC]", std::string(LLWearableType::getTypeLabel( mType )));
hideTextureControls();
}
@@ -1037,7 +1037,7 @@ void LLPanelEditWearable::draw()
{
// *TODO:Translate
childSetVisible("title_loading", TRUE);
childSetTextArg("title_loading", "[DESC]", std::string(LLWearable::typeToTypeLabel( mType )));
childSetTextArg("title_loading", "[DESC]", std::string(LLWearableType::getTypeLabel( mType )));
std::string path;
const LLUUID& item_id = gAgentWearables.getWearableItemID( wearable->getType() );
@@ -1138,7 +1138,7 @@ void LLPanelEditWearable::draw()
{
// *TODO:Translate
childSetVisible("title_not_worn", TRUE);
childSetTextArg("title_not_worn", "[DESC]", std::string(LLWearable::typeToTypeLabel( mType )));
childSetTextArg("title_not_worn", "[DESC]", std::string(LLWearableType::getTypeLabel( mType )));
hideTextureControls();
}
@@ -1172,7 +1172,7 @@ void LLPanelEditWearable::setWearable(LLWearable* wearable, U32 perm_mask, BOOL
if( wearable )
{
setUIPermissions(perm_mask, is_complete);
if (mType == WT_ALPHA)
if (mType == LLWearableType::WT_ALPHA)
{
initPreviousTextureList();
}
@@ -1722,14 +1722,14 @@ const std::string& LLFloaterCustomize::getEditGroup()
// LLFloaterCustomize
// statics
EWearableType LLFloaterCustomize::sCurrentWearableType = WT_INVALID;
LLWearableType::EType LLFloaterCustomize::sCurrentWearableType = LLWearableType::WT_INVALID;
struct WearablePanelData
{
WearablePanelData(LLFloaterCustomize* floater, EWearableType type)
WearablePanelData(LLFloaterCustomize* floater, LLWearableType::EType type)
: mFloater(floater), mType(type) {}
LLFloaterCustomize* mFloater;
EWearableType mType;
LLWearableType::EType mType;
};
LLFloaterCustomize::LLFloaterCustomize()
@@ -1739,7 +1739,7 @@ LLFloaterCustomize::LLFloaterCustomize()
mNextStepAfterSaveCallback( NULL ),
mNextStepAfterSaveUserdata( NULL )
{
memset(&mWearablePanelList[0],0,sizeof(char*)*WT_COUNT); //Initialize to 0
memset(&mWearablePanelList[0],0,sizeof(char*)*LLWearableType::WT_COUNT); //Initialize to 0
gSavedSettings.setU32("AvatarSex", (gAgentAvatarp->getSex() == SEX_MALE) );
@@ -1750,22 +1750,22 @@ LLFloaterCustomize::LLFloaterCustomize()
gInventory.addObserver(mInventoryObserver);
LLCallbackMap::map_t factory_map;
factory_map["Shape"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, WT_SHAPE) ) );
factory_map["Skin"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, WT_SKIN) ) );
factory_map["Hair"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, WT_HAIR) ) );
factory_map["Eyes"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, WT_EYES) ) );
factory_map["Shirt"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, WT_SHIRT) ) );
factory_map["Pants"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, WT_PANTS) ) );
factory_map["Shoes"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, WT_SHOES) ) );
factory_map["Socks"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, WT_SOCKS) ) );
factory_map["Jacket"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, WT_JACKET) ) );
factory_map["Gloves"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, WT_GLOVES) ) );
factory_map["Undershirt"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, WT_UNDERSHIRT) ) );
factory_map["Underpants"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, WT_UNDERPANTS) ) );
factory_map["Skirt"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, WT_SKIRT) ) );
factory_map["Alpha"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, WT_ALPHA)));
factory_map["Tattoo"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, WT_TATTOO)));
factory_map["Physics"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, WT_PHYSICS)));
factory_map["Shape"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, LLWearableType::WT_SHAPE) ) );
factory_map["Skin"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, LLWearableType::WT_SKIN) ) );
factory_map["Hair"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, LLWearableType::WT_HAIR) ) );
factory_map["Eyes"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, LLWearableType::WT_EYES) ) );
factory_map["Shirt"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, LLWearableType::WT_SHIRT) ) );
factory_map["Pants"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, LLWearableType::WT_PANTS) ) );
factory_map["Shoes"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, LLWearableType::WT_SHOES) ) );
factory_map["Socks"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, LLWearableType::WT_SOCKS) ) );
factory_map["Jacket"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, LLWearableType::WT_JACKET) ) );
factory_map["Gloves"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, LLWearableType::WT_GLOVES) ) );
factory_map["Undershirt"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, LLWearableType::WT_UNDERSHIRT) ) );
factory_map["Underpants"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, LLWearableType::WT_UNDERPANTS) ) );
factory_map["Skirt"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, LLWearableType::WT_SKIRT) ) );
factory_map["Alpha"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, LLWearableType::WT_ALPHA)));
factory_map["Tattoo"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, LLWearableType::WT_TATTOO)));
factory_map["Physics"] = LLCallbackMap(createWearablePanel, (void*)(new WearablePanelData(this, LLWearableType::WT_PHYSICS)));
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_customize.xml", &factory_map);
}
@@ -1784,22 +1784,22 @@ BOOL LLFloaterCustomize::postBuild()
initWearablePanels();
// Tab container
childSetTabChangeCallback("customize tab container", "Shape", onTabChanged, (void*)WT_SHAPE, onTabPrecommit );
childSetTabChangeCallback("customize tab container", "Skin", onTabChanged, (void*)WT_SKIN, onTabPrecommit );
childSetTabChangeCallback("customize tab container", "Hair", onTabChanged, (void*)WT_HAIR, onTabPrecommit );
childSetTabChangeCallback("customize tab container", "Eyes", onTabChanged, (void*)WT_EYES, onTabPrecommit );
childSetTabChangeCallback("customize tab container", "Shirt", onTabChanged, (void*)WT_SHIRT, onTabPrecommit );
childSetTabChangeCallback("customize tab container", "Pants", onTabChanged, (void*)WT_PANTS, onTabPrecommit );
childSetTabChangeCallback("customize tab container", "Shoes", onTabChanged, (void*)WT_SHOES, onTabPrecommit );
childSetTabChangeCallback("customize tab container", "Socks", onTabChanged, (void*)WT_SOCKS, onTabPrecommit );
childSetTabChangeCallback("customize tab container", "Jacket", onTabChanged, (void*)WT_JACKET, onTabPrecommit );
childSetTabChangeCallback("customize tab container", "Gloves", onTabChanged, (void*)WT_GLOVES, onTabPrecommit );
childSetTabChangeCallback("customize tab container", "Undershirt", onTabChanged, (void*)WT_UNDERSHIRT, onTabPrecommit );
childSetTabChangeCallback("customize tab container", "Underpants", onTabChanged, (void*)WT_UNDERPANTS, onTabPrecommit );
childSetTabChangeCallback("customize tab container", "Skirt", onTabChanged, (void*)WT_SKIRT, onTabPrecommit );
childSetTabChangeCallback("customize tab container", "Alpha", onTabChanged, (void*)WT_ALPHA, onTabPrecommit);
childSetTabChangeCallback("customize tab container", "Tattoo", onTabChanged, (void*)WT_TATTOO, onTabPrecommit);
childSetTabChangeCallback("customize tab container", "Physics", onTabChanged, (void*)WT_PHYSICS, onTabPrecommit);
childSetTabChangeCallback("customize tab container", "Shape", onTabChanged, (void*)LLWearableType::WT_SHAPE, onTabPrecommit );
childSetTabChangeCallback("customize tab container", "Skin", onTabChanged, (void*)LLWearableType::WT_SKIN, onTabPrecommit );
childSetTabChangeCallback("customize tab container", "Hair", onTabChanged, (void*)LLWearableType::WT_HAIR, onTabPrecommit );
childSetTabChangeCallback("customize tab container", "Eyes", onTabChanged, (void*)LLWearableType::WT_EYES, onTabPrecommit );
childSetTabChangeCallback("customize tab container", "Shirt", onTabChanged, (void*)LLWearableType::WT_SHIRT, onTabPrecommit );
childSetTabChangeCallback("customize tab container", "Pants", onTabChanged, (void*)LLWearableType::WT_PANTS, onTabPrecommit );
childSetTabChangeCallback("customize tab container", "Shoes", onTabChanged, (void*)LLWearableType::WT_SHOES, onTabPrecommit );
childSetTabChangeCallback("customize tab container", "Socks", onTabChanged, (void*)LLWearableType::WT_SOCKS, onTabPrecommit );
childSetTabChangeCallback("customize tab container", "Jacket", onTabChanged, (void*)LLWearableType::WT_JACKET, onTabPrecommit );
childSetTabChangeCallback("customize tab container", "Gloves", onTabChanged, (void*)LLWearableType::WT_GLOVES, onTabPrecommit );
childSetTabChangeCallback("customize tab container", "Undershirt", onTabChanged, (void*)LLWearableType::WT_UNDERSHIRT, onTabPrecommit );
childSetTabChangeCallback("customize tab container", "Underpants", onTabChanged, (void*)LLWearableType::WT_UNDERPANTS, onTabPrecommit );
childSetTabChangeCallback("customize tab container", "Skirt", onTabChanged, (void*)LLWearableType::WT_SKIRT, onTabPrecommit );
childSetTabChangeCallback("customize tab container", "Alpha", onTabChanged, (void*)LLWearableType::WT_ALPHA, onTabPrecommit);
childSetTabChangeCallback("customize tab container", "Tattoo", onTabChanged, (void*)LLWearableType::WT_TATTOO, onTabPrecommit);
childSetTabChangeCallback("customize tab container", "Physics", onTabChanged, (void*)LLWearableType::WT_PHYSICS, onTabPrecommit);
// Remove underwear panels for teens
if (gAgent.isTeen())
@@ -1826,13 +1826,13 @@ void LLFloaterCustomize::open()
LLFloater::open();
// childShowTab depends on gFloaterCustomize being defined and therefore must be called after the constructor. - Nyx
childShowTab("customize tab container", "Shape", true);
setCurrentWearableType(WT_SHAPE);
setCurrentWearableType(LLWearableType::WT_SHAPE);
}
////////////////////////////////////////////////////////////////////////////
// static
void LLFloaterCustomize::setCurrentWearableType( EWearableType type )
void LLFloaterCustomize::setCurrentWearableType( LLWearableType::EType type )
{
if( LLFloaterCustomize::sCurrentWearableType != type )
{
@@ -1877,7 +1877,7 @@ void LLFloaterCustomize::onBtnImport_continued(AIFilePicker* filepicker)
F32 param_weight=0;
S32 fields_read;
for( S32 i=0; i < WT_COUNT; i++ )
for( S32 i=0; i < LLWearableType::WT_COUNT; i++ )
{
fields_read = fscanf( fp, "type %d\n", &typ);
if( fields_read != 1 )
@@ -1932,13 +1932,13 @@ void LLFloaterCustomize::onBtnExport_continued(AIFilePicker* filepicker)
FILE* fp = LLFile::fopen(filename, "wb");
for( S32 i=0; i < WT_COUNT; i++ )
for( S32 i=0; i < LLWearableType::WT_COUNT; i++ )
{
is_modifiable = FALSE;
LLWearable* old_wearable = gAgentWearables.getWearable((EWearableType)i);
LLWearable* old_wearable = gAgentWearables.getWearable((LLWearableType::EType)i);
if( old_wearable )
{
item = (LLViewerInventoryItem*)gAgentWearables.getWearableInventoryItem((EWearableType)i);
item = (LLViewerInventoryItem*)gAgentWearables.getWearableInventoryItem((LLWearableType::EType)i);
if(item)
{
const LLPermissions& perm = item->getPermissions();
@@ -1956,13 +1956,13 @@ void LLFloaterCustomize::onBtnExport_continued(AIFilePicker* filepicker)
}
}
for( S32 i=0; i < WT_COUNT; i++ )
for( S32 i=0; i < LLWearableType::WT_COUNT; i++ )
{
is_modifiable = FALSE;
LLWearable* old_wearable = gAgentWearables.getWearable((EWearableType)i);
LLWearable* old_wearable = gAgentWearables.getWearable((LLWearableType::EType)i);
if( old_wearable )
{
item = (LLViewerInventoryItem*)gAgentWearables.getWearableInventoryItem((EWearableType)i);
item = (LLViewerInventoryItem*)gAgentWearables.getWearableInventoryItem((LLWearableType::EType)i);
if(item)
{
const LLPermissions& perm = item->getPermissions();
@@ -2012,12 +2012,12 @@ void LLFloaterCustomize::onBtnMakeOutfit( void* userdata )
LLMakeOutfitDialog* dialog = new LLMakeOutfitDialog( onMakeOutfitCommit, NULL );
// LLMakeOutfitDialog deletes itself.
for( S32 i = 0; i < WT_COUNT; i++ )
for( S32 i = 0; i < LLWearableType::WT_COUNT; i++ )
{
BOOL enabled = (gAgentWearables.getWearable( (EWearableType) i ) != NULL);
BOOL selected = (enabled && (WT_SHIRT <= i) && (i < WT_COUNT)); // only select clothing by default
BOOL enabled = (gAgentWearables.getWearable( (LLWearableType::EType) i ) != NULL);
BOOL selected = (enabled && (LLWearableType::WT_SHIRT <= i) && (i < LLWearableType::WT_COUNT)); // only select clothing by default
if (gAgent.isTeen()
&& !edit_wearable_for_teens((EWearableType)i))
&& !edit_wearable_for_teens((LLWearableType::EType)i))
{
dialog->setWearableToInclude( i, FALSE, FALSE );
}
@@ -2051,7 +2051,7 @@ void LLFloaterCustomize::onMakeOutfitCommit( LLMakeOutfitDialog* dialog, void* u
void* LLFloaterCustomize::createWearablePanel(void* userdata)
{
WearablePanelData* data = (WearablePanelData*)userdata;
EWearableType type = data->mType;
LLWearableType::EType type = data->mType;
LLPanelEditWearable* panel;
if ((gAgent.isTeen() && !edit_wearable_for_teens(data->mType) ))
{
@@ -2072,7 +2072,7 @@ void LLFloaterCustomize::initWearablePanels()
/////////////////////////////////////////
// Shape
LLPanelEditWearable* panel = mWearablePanelList[ WT_SHAPE ];
LLPanelEditWearable* panel = mWearablePanelList[ LLWearableType::WT_SHAPE ];
// body
part = new LLSubpart();
@@ -2147,7 +2147,7 @@ void LLFloaterCustomize::initWearablePanels()
/////////////////////////////////////////
// Skin
panel = mWearablePanelList[ WT_SKIN ];
panel = mWearablePanelList[ LLWearableType::WT_SKIN ];
part = new LLSubpart();
part->mTargetJoint = "mHead";
@@ -2183,7 +2183,7 @@ void LLFloaterCustomize::initWearablePanels()
/////////////////////////////////////////
// Hair
panel = mWearablePanelList[ WT_HAIR ];
panel = mWearablePanelList[ LLWearableType::WT_HAIR ];
part = new LLSubpart();
part->mTargetJoint = "mHead";
@@ -2220,7 +2220,7 @@ void LLFloaterCustomize::initWearablePanels()
/////////////////////////////////////////
// Eyes
panel = mWearablePanelList[ WT_EYES ];
panel = mWearablePanelList[ LLWearableType::WT_EYES ];
part = new LLSubpart();
part->mTargetJoint = "mHead";
@@ -2235,7 +2235,7 @@ void LLFloaterCustomize::initWearablePanels()
/////////////////////////////////////////
// Shirt
panel = mWearablePanelList[ WT_SHIRT ];
panel = mWearablePanelList[ LLWearableType::WT_SHIRT ];
part = new LLSubpart();
part->mTargetJoint = "mTorso";
@@ -2253,7 +2253,7 @@ void LLFloaterCustomize::initWearablePanels()
/////////////////////////////////////////
// Pants
panel = mWearablePanelList[ WT_PANTS ];
panel = mWearablePanelList[ LLWearableType::WT_PANTS ];
part = new LLSubpart();
part->mTargetJoint = "mPelvis";
@@ -2271,7 +2271,7 @@ void LLFloaterCustomize::initWearablePanels()
/////////////////////////////////////////
// Shoes
panel = mWearablePanelList[ WT_SHOES ];
panel = mWearablePanelList[ LLWearableType::WT_SHOES ];
if (panel)
{
@@ -2292,7 +2292,7 @@ void LLFloaterCustomize::initWearablePanels()
/////////////////////////////////////////
// Socks
panel = mWearablePanelList[ WT_SOCKS ];
panel = mWearablePanelList[ LLWearableType::WT_SOCKS ];
if (panel)
{
@@ -2312,7 +2312,7 @@ void LLFloaterCustomize::initWearablePanels()
/////////////////////////////////////////
// Jacket
panel = mWearablePanelList[ WT_JACKET ];
panel = mWearablePanelList[ LLWearableType::WT_JACKET ];
if (panel)
{
@@ -2335,7 +2335,7 @@ void LLFloaterCustomize::initWearablePanels()
/////////////////////////////////////////
// Skirt
panel = mWearablePanelList[ WT_SKIRT ];
panel = mWearablePanelList[ LLWearableType::WT_SKIRT ];
if (panel)
{
@@ -2356,7 +2356,7 @@ void LLFloaterCustomize::initWearablePanels()
/////////////////////////////////////////
// Gloves
panel = mWearablePanelList[ WT_GLOVES ];
panel = mWearablePanelList[ LLWearableType::WT_GLOVES ];
if (panel)
{
@@ -2377,7 +2377,7 @@ void LLFloaterCustomize::initWearablePanels()
/////////////////////////////////////////
// Undershirt
panel = mWearablePanelList[ WT_UNDERSHIRT ];
panel = mWearablePanelList[ LLWearableType::WT_UNDERSHIRT ];
if (panel)
{
@@ -2397,7 +2397,7 @@ void LLFloaterCustomize::initWearablePanels()
/////////////////////////////////////////
// Underpants
panel = mWearablePanelList[ WT_UNDERPANTS ];
panel = mWearablePanelList[ LLWearableType::WT_UNDERPANTS ];
if (panel)
{
@@ -2417,7 +2417,7 @@ void LLFloaterCustomize::initWearablePanels()
/////////////////////////////////////////
// Alpha
panel = mWearablePanelList[WT_ALPHA];
panel = mWearablePanelList[LLWearableType::WT_ALPHA];
if (panel)
{
@@ -2453,7 +2453,7 @@ void LLFloaterCustomize::initWearablePanels()
/////////////////////////////////////////
// Tattoo
panel = mWearablePanelList[WT_TATTOO];
panel = mWearablePanelList[LLWearableType::WT_TATTOO];
if (panel)
{
@@ -2479,7 +2479,7 @@ void LLFloaterCustomize::initWearablePanels()
/////////////////////////////////////////
// Physics
panel = mWearablePanelList[WT_PHYSICS];
panel = mWearablePanelList[LLWearableType::WT_PHYSICS];
if(panel)
{
@@ -2584,7 +2584,7 @@ void LLFloaterCustomize::draw()
BOOL LLFloaterCustomize::isDirty() const
{
for(S32 i = 0; i < WT_COUNT; i++)
for(S32 i = 0; i < LLWearableType::WT_COUNT; i++)
{
if( mWearablePanelList[i]
&& mWearablePanelList[i]->isDirty() )
@@ -2598,8 +2598,8 @@ BOOL LLFloaterCustomize::isDirty() const
// static
void LLFloaterCustomize::onTabPrecommit( void* userdata, bool from_click )
{
EWearableType type = (EWearableType)(intptr_t) userdata;
if (type != WT_INVALID && gFloaterCustomize && gFloaterCustomize->getCurrentWearableType() != type)
LLWearableType::EType type = (LLWearableType::EType)(intptr_t) userdata;
if (type != LLWearableType::WT_INVALID && gFloaterCustomize && gFloaterCustomize->getCurrentWearableType() != type)
{
gFloaterCustomize->askToSaveIfDirty(onCommitChangeTab, userdata);
}
@@ -2613,8 +2613,8 @@ void LLFloaterCustomize::onTabPrecommit( void* userdata, bool from_click )
// static
void LLFloaterCustomize::onTabChanged( void* userdata, bool from_click )
{
EWearableType wearable_type = (EWearableType) (intptr_t)userdata;
if (wearable_type != WT_INVALID)
LLWearableType::EType wearable_type = (LLWearableType::EType) (intptr_t)userdata;
if (wearable_type != LLWearableType::WT_INVALID)
{
LLFloaterCustomize::setCurrentWearableType(wearable_type);
}
@@ -2692,7 +2692,7 @@ void LLFloaterCustomize::generateVisualParamHints(LLViewerJointMesh* joint_mesh,
}
}
void LLFloaterCustomize::setWearable(EWearableType type, LLWearable* wearable, U32 perm_mask, BOOL is_complete)
void LLFloaterCustomize::setWearable(LLWearableType::EType type, LLWearable* wearable, U32 perm_mask, BOOL is_complete)
{
llassert( type < WT_COUNT );
gSavedSettings.setU32("AvatarSex", (gAgentAvatarp->getSex() == SEX_MALE) );
@@ -2742,7 +2742,7 @@ bool LLFloaterCustomize::onSaveDialog(const LLSD& notification, const LLSD& resp
S32 option = LLNotification::getSelectedOption(notification, response);
BOOL proceed = FALSE;
EWearableType cur = getCurrentWearableType();
LLWearableType::EType cur = getCurrentWearableType();
switch( option )
{
@@ -2787,9 +2787,9 @@ void LLFloaterCustomize::fetchInventory()
// Fetch currently worn items
LLInventoryFetchObserver::item_ref_t ids;
LLUUID item_id;
for(S32 type = (S32)WT_SHAPE; type < (S32)WT_COUNT; ++type)
for(S32 type = (S32)LLWearableType::WT_SHAPE; type < (S32)LLWearableType::WT_COUNT; ++type)
{
item_id = gAgentWearables.getWearableItemID((EWearableType)type);
item_id = gAgentWearables.getWearableItemID((LLWearableType::EType)type);
if(item_id.notNull())
{
ids.push_back(item_id);
@@ -2809,7 +2809,7 @@ void LLFloaterCustomize::updateInventoryUI()
U32 perm_mask = 0x0;
LLPanelEditWearable* panel;
LLViewerInventoryItem* item;
for(S32 i = 0; i < WT_COUNT; ++i)
for(S32 i = 0; i < LLWearableType::WT_COUNT; ++i)
{
item = NULL;
panel = mWearablePanelList[i];

View File

@@ -94,7 +94,7 @@ public:
const std::string& getEditGroup();
void updateScrollingPanelList(BOOL allow_modify);
void setWearable(EWearableType type, LLWearable* wearable, U32 perm_mask, BOOL is_complete);
void setWearable(LLWearableType::EType type, LLWearable* wearable, U32 perm_mask, BOOL is_complete);
LLPanelEditWearable* getCurrentWearablePanel() { return mWearablePanelList[ sCurrentWearableType ]; }
virtual BOOL isDirty() const;
@@ -103,8 +103,8 @@ public:
void switchToDefaultSubpart();
static void setCurrentWearableType( EWearableType type );
static EWearableType getCurrentWearableType() { return sCurrentWearableType; }
static void setCurrentWearableType( LLWearableType::EType type );
static LLWearableType::EType getCurrentWearableType() { return sCurrentWearableType; }
// Callbacks
static void onBtnOk( void* userdata );
@@ -125,9 +125,9 @@ public:
void updateScrollingPanelUI();
protected:
LLPanelEditWearable* mWearablePanelList[ WT_COUNT ];
LLPanelEditWearable* mWearablePanelList[ LLWearableType::WT_COUNT ];
static EWearableType sCurrentWearableType;
static LLWearableType::EType sCurrentWearableType;
LLScrollingPanelList* mScrollingPanelList;
LLScrollableContainerView* mScrollContainer;

View File

@@ -392,13 +392,13 @@ void do_create(LLInventoryModel *model, LLInventoryPanel *ptr, std::string type,
}
else
{
EWearableType wear_type = LLWearable::typeNameToType(type);
if(wear_type != WT_INVALID)
{
LLFolderType::EType folder_type = LLFolderType::assetTypeToFolderType(LLWearable::typeToAssetType(LLWearable::typeNameToType(type)));
LLUUID parent_id = self ? self->getUUID() : gInventory.findCategoryUUIDForType(folder_type);
LLFolderBridge::createWearable(parent_id, wear_type);
}
LLWearableType::EType wear_type = LLWearableType::typeNameToType(type);
if(wear_type != LLWearableType::WT_INVALID)
{
LLFolderType::EType folder_type = LLFolderType::assetTypeToFolderType(LLWearableType::getAssetType(wear_type));
LLUUID parent_id = self ? self->getUUID() : gInventory.findCategoryUUIDForType(folder_type);
LLFolderBridge::createWearable(parent_id, wear_type);
}
}
ptr->getRootFolder()->setNeedsAutoRename(TRUE);
}

View File

@@ -166,7 +166,7 @@ bool LLInventoryBackup::itemIsFolder(LLInventoryItem* item)
ESaveFilter LLInventoryBackup::getSaveFilter(LLInventoryItem* item)
{
LLAssetType::EType type = item->getType();
EWearableType wear = (EWearableType)(item->getFlags() & 0xFF);
LLWearableType::EType wear = (LLWearableType::EType)(item->getFlags() & 0xFF);
switch(type)
{
case LLAssetType::AT_TEXTURE:
@@ -188,33 +188,33 @@ ESaveFilter LLInventoryBackup::getSaveFilter(LLInventoryItem* item)
case LLAssetType::AT_CLOTHING:
switch(wear)
{
case WT_EYES:
case LLWearableType::WT_EYES:
return FFSAVE_EYES;
case WT_GLOVES:
case LLWearableType::WT_GLOVES:
return FFSAVE_GLOVES;
case WT_HAIR:
case LLWearableType::WT_HAIR:
return FFSAVE_HAIR;
case WT_JACKET:
case LLWearableType::WT_JACKET:
return FFSAVE_JACKET;
case WT_PANTS:
case LLWearableType::WT_PANTS:
return FFSAVE_PANTS;
case WT_SHAPE:
case LLWearableType::WT_SHAPE:
return FFSAVE_SHAPE;
case WT_SHIRT:
case LLWearableType::WT_SHIRT:
return FFSAVE_SHIRT;
case WT_SHOES:
case LLWearableType::WT_SHOES:
return FFSAVE_SHOES;
case WT_SKIN:
case LLWearableType::WT_SKIN:
return FFSAVE_SKIN;
case WT_SKIRT:
case LLWearableType::WT_SKIRT:
return FFSAVE_SKIRT;
case WT_SOCKS:
case LLWearableType::WT_SOCKS:
return FFSAVE_SOCKS;
case WT_UNDERPANTS:
case LLWearableType::WT_UNDERPANTS:
return FFSAVE_UNDERPANTS;
case WT_UNDERSHIRT:
case LLWearableType::WT_UNDERSHIRT:
return FFSAVE_UNDERSHIRT;
case WT_PHYSICS:
case LLWearableType::WT_PHYSICS:
return FFSAVE_PHYSICS;
default:
return FFSAVE_ALL;
@@ -228,7 +228,7 @@ ESaveFilter LLInventoryBackup::getSaveFilter(LLInventoryItem* item)
std::string LLInventoryBackup::getExtension(LLInventoryItem* item)
{
LLAssetType::EType type = item->getType();
EWearableType wear = (EWearableType)(item->getFlags() & 0xFF);
LLWearableType::EType wear = (LLWearableType::EType)(item->getFlags() & 0xFF);
std::string scratch;
switch(type)
{
@@ -249,7 +249,7 @@ std::string LLInventoryBackup::getExtension(LLInventoryItem* item)
return ".landmark";
case LLAssetType::AT_BODYPART:
case LLAssetType::AT_CLOTHING:
scratch = LLWearable::typeToTypeName(wear);
scratch = LLWearableType::getTypeName(wear);
if(scratch == "invalid")
{
if(type == LLAssetType::AT_BODYPART)

View File

@@ -1101,7 +1101,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type,
{
llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl;
}
new_listener = new LLWearableBridge(inventory, uuid, asset_type, inv_type, (EWearableType)flags);
new_listener = new LLWearableBridge(inventory, uuid, asset_type, inv_type, (LLWearableType::EType)flags);
break;
case LLAssetType::AT_CATEGORY:
@@ -2819,85 +2819,85 @@ void LLFolderBridge::createNewCategory(void* user_data)
void LLFolderBridge::createNewShirt(void* user_data)
{
LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_SHIRT);
LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_SHIRT);
}
void LLFolderBridge::createNewPants(void* user_data)
{
LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_PANTS);
LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_PANTS);
}
void LLFolderBridge::createNewShoes(void* user_data)
{
LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_SHOES);
LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_SHOES);
}
void LLFolderBridge::createNewSocks(void* user_data)
{
LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_SOCKS);
LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_SOCKS);
}
void LLFolderBridge::createNewJacket(void* user_data)
{
LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_JACKET);
LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_JACKET);
}
void LLFolderBridge::createNewSkirt(void* user_data)
{
LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_SKIRT);
LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_SKIRT);
}
void LLFolderBridge::createNewGloves(void* user_data)
{
LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_GLOVES);
LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_GLOVES);
}
void LLFolderBridge::createNewUndershirt(void* user_data)
{
LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_UNDERSHIRT);
LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_UNDERSHIRT);
}
void LLFolderBridge::createNewUnderpants(void* user_data)
{
LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_UNDERPANTS);
LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_UNDERPANTS);
}
void LLFolderBridge::createNewAlpha(void* user_data)
{
LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_ALPHA);
LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_ALPHA);
}
void LLFolderBridge::createNewTattoo(void* user_data)
{
LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_TATTOO);
LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_TATTOO);
}
void LLFolderBridge::createNewShape(void* user_data)
{
LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_SHAPE);
LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_SHAPE);
}
void LLFolderBridge::createNewSkin(void* user_data)
{
LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_SKIN);
LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_SKIN);
}
void LLFolderBridge::createNewHair(void* user_data)
{
LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_HAIR);
LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_HAIR);
}
void LLFolderBridge::createNewEyes(void* user_data)
{
LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_EYES);
LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_EYES);
}
void LLFolderBridge::createNewPhysics(void* user_data)
{
LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_PHYSICS);
LLFolderBridge::createWearable((LLFolderBridge*)user_data, LLWearableType::WT_PHYSICS);
}
// static
void LLFolderBridge::createWearable(LLFolderBridge* bridge, EWearableType type)
void LLFolderBridge::createWearable(LLFolderBridge* bridge, LLWearableType::EType type)
{
if(!bridge) return;
LLUUID parent_id = bridge->getUUID();
@@ -2907,7 +2907,7 @@ void LLFolderBridge::createWearable(LLFolderBridge* bridge, EWearableType type)
// Separate function so can be called by global menu as well as right-click
// menu.
// static
void LLFolderBridge::createWearable(LLUUID parent_id, EWearableType type)
void LLFolderBridge::createWearable(LLUUID parent_id, LLWearableType::EType type)
{
LLWearable* wearable = gWearableList.createNewWearable(type);
LLAssetType::EType asset_type = wearable->getAssetType();
@@ -4450,7 +4450,7 @@ LLWearableBridge::LLWearableBridge(LLInventoryPanel* inventory,
const LLUUID& uuid,
LLAssetType::EType asset_type,
LLInventoryType::EType inv_type,
EWearableType wearable_type) :
LLWearableType::EType wearable_type) :
LLItemBridge(inventory, /*root,*/ uuid),
mAssetType( asset_type ),
mWearableType(wearable_type)
@@ -4982,7 +4982,7 @@ void wear_inventory_category_on_avatar_loop(LLWearable* wearable, void* data)
iter != holder->mFoundList.end(); ++iter)
{
LLFoundData* data = *iter;
if(wearable->getID() == data->mAssetID)
if(wearable->getAssetID() == data->mAssetID)
{
data->mWearable = wearable;
break;
@@ -5010,7 +5010,7 @@ void wear_inventory_category_on_avatar_step3(LLWearableHoldingPattern* holder, B
// For each wearable type, find the first instance in the category
// that we recursed through.
for( S32 i = 0; i < WT_COUNT; i++ )
for( S32 i = 0; i < LLWearableType::WT_COUNT; i++ )
{
for (LLWearableHoldingPattern::found_list_t::iterator iter = holder->mFoundList.begin();
iter != holder->mFoundList.end(); ++iter)
@@ -5021,7 +5021,7 @@ void wear_inventory_category_on_avatar_step3(LLWearableHoldingPattern* holder, B
{
LLViewerInventoryItem* item;
item = (LLViewerInventoryItem*)gInventory.getLinkedItem(data->mItemID);
if( item && (item->getAssetUUID() == wearable->getID()) )
if( item && (item->getAssetUUID() == wearable->getAssetID()) )
{
//RN: after discussing with Brashears, I disabled this code
//Metadata should reside in the item, not the asset
@@ -5454,7 +5454,7 @@ void LLWearableBridge::onWearOnAvatarArrived( LLWearable* wearable, void* userda
item = (LLViewerInventoryItem*)gInventory.getItem(*item_id);
if(item)
{
if(item->getAssetUUID() == wearable->getID())
if(item->getAssetUUID() == wearable->getAssetID())
{
//RN: after discussing with Brashears, I disabled this code
//Metadata should reside in the item, not the asset
@@ -5560,9 +5560,9 @@ void LLWearableBridge::onRemoveFromAvatarArrived(LLWearable* wearable,
{
if( get_is_item_worn( item_id ) )
{
EWearableType type = wearable->getType();
LLWearableType::EType type = wearable->getType();
if( !(type==WT_SHAPE || type==WT_SKIN || type==WT_HAIR || type==WT_EYES) ) //&&
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 );

View File

@@ -258,7 +258,7 @@ public:
EDragAndDropType cargo_type,
void* cargo_data) { return FALSE; }
virtual LLInventoryType::EType getInventoryType() const { return mInvType; }
virtual EWearableType getWearableType() const { return WT_NONE; }
virtual LLWearableType::EType getWearableType() const { return LLWearableType::WT_NONE; }
protected:
virtual void addTrashContextMenuOptions(menuentry_vec_t &items,
@@ -373,8 +373,8 @@ public:
virtual BOOL isClipboardPasteable() const;
virtual BOOL isClipboardPasteableAsLink() const;
static void createWearable(LLFolderBridge* bridge, EWearableType type);
static void createWearable(LLUUID parent_folder_id, EWearableType type);
static void createWearable(LLFolderBridge* bridge, LLWearableType::EType type);
static void createWearable(LLUUID parent_folder_id, LLWearableType::EType type);
LLViewerInventoryCategory* getCategory() const;
@@ -588,7 +588,7 @@ public:
const LLUUID& uuid,
LLAssetType::EType asset_type,
LLInventoryType::EType inv_type,
EWearableType wearable_type);
LLWearableType::EType wearable_type);
virtual LLUIImagePtr getIcon() const;
virtual void performAction(LLFolderView* folder, LLInventoryModel* model, std::string action);
virtual void openItem();
@@ -596,7 +596,7 @@ public:
virtual std::string getLabelSuffix() const;
virtual BOOL isItemRemovable();
virtual BOOL renameItem(const std::string& new_name);
virtual EWearableType getWearableType() const { return mWearableType; }
virtual LLWearableType::EType getWearableType() const { return mWearableType; }
static void onWearOnAvatar( void* userdata ); // Access to wearOnAvatar() from menu
static BOOL canWearOnAvatar( void* userdata );
@@ -612,7 +612,7 @@ public:
static void onRemoveFromAvatarArrived( LLWearable* wearable, void* userdata );
protected:
LLAssetType::EType mAssetType;
EWearableType mWearableType;
LLWearableType::EType mWearableType;
};
class LLLinkItemBridge : public LLItemBridge

View File

@@ -1479,52 +1479,52 @@ std::string get_item_icon_name(LLAssetType::EType asset_type,
}
switch(LLInventoryItemFlags::II_FLAGS_WEARABLES_MASK & attachment_point)
{
case WT_SHAPE:
case LLWearableType::WT_SHAPE:
idx = BODYPART_SHAPE_ICON_NAME;
break;
case WT_SKIN:
case LLWearableType::WT_SKIN:
idx = BODYPART_SKIN_ICON_NAME;
break;
case WT_HAIR:
case LLWearableType::WT_HAIR:
idx = BODYPART_HAIR_ICON_NAME;
break;
case WT_EYES:
case LLWearableType::WT_EYES:
idx = BODYPART_EYES_ICON_NAME;
break;
case WT_SHIRT:
case LLWearableType::WT_SHIRT:
idx = CLOTHING_SHIRT_ICON_NAME;
break;
case WT_PANTS:
case LLWearableType::WT_PANTS:
idx = CLOTHING_PANTS_ICON_NAME;
break;
case WT_SHOES:
case LLWearableType::WT_SHOES:
idx = CLOTHING_SHOES_ICON_NAME;
break;
case WT_SOCKS:
case LLWearableType::WT_SOCKS:
idx = CLOTHING_SOCKS_ICON_NAME;
break;
case WT_JACKET:
case LLWearableType::WT_JACKET:
idx = CLOTHING_JACKET_ICON_NAME;
break;
case WT_GLOVES:
case LLWearableType::WT_GLOVES:
idx = CLOTHING_GLOVES_ICON_NAME;
break;
case WT_UNDERSHIRT:
case LLWearableType::WT_UNDERSHIRT:
idx = CLOTHING_UNDERSHIRT_ICON_NAME;
break;
case WT_UNDERPANTS:
case LLWearableType::WT_UNDERPANTS:
idx = CLOTHING_UNDERPANTS_ICON_NAME;
break;
case WT_SKIRT:
case LLWearableType::WT_SKIRT:
idx = CLOTHING_SKIRT_ICON_NAME;
break;
case WT_ALPHA:
case LLWearableType::WT_ALPHA:
idx = CLOTHING_ALPHA_ICON_NAME;
break;
case WT_TATTOO:
case LLWearableType::WT_TATTOO:
idx = CLOTHING_TATTOO_ICON_NAME;
break;
case WT_PHYSICS:
case LLWearableType::WT_PHYSICS:
idx = CLOTHING_PHYSICS_ICON_NAME;
break;
default:

View File

@@ -81,12 +81,12 @@ LLBakedUploadData::LLBakedUploadData( LLVOAvatar* avatar,
mID(id)
{
mStartTime = LLFrameTimer::getTotalTime(); // Record starting time
for( S32 i = 0; i < WT_COUNT; i++ )
for( S32 i = 0; i < LLWearableType::WT_COUNT; i++ )
{
LLWearable* wearable = gAgentWearables.getWearable( (EWearableType)i);
LLWearable* wearable = gAgentWearables.getWearable( (LLWearableType::EType)i);
if( wearable )
{
mWearableAssets[i] = wearable->getID();
mWearableAssets[i] = wearable->getAssetID();
}
}
}
@@ -223,7 +223,7 @@ BOOL LLTexLayerSetBuffer::needsRender()
BOOL needs_update = (mNeedsUpdate || upload_now) && !avatar->getIsAppearanceAnimating();
if (needs_update)
{
BOOL invalid_skirt = avatar->getBakedTE(mTexLayerSet) == TEX_SKIRT_BAKED && !avatar->isWearingWearableType(WT_SKIRT);
BOOL invalid_skirt = avatar->getBakedTE(mTexLayerSet) == TEX_SKIRT_BAKED && !avatar->isWearingWearableType(LLWearableType::WT_SKIRT);
if (invalid_skirt)
{
// we were trying to create a skirt texture
@@ -2059,8 +2059,8 @@ BOOL LLTexLayerParamAlpha::getSkip()
}
}
EWearableType type = (EWearableType)getWearableType();
if( (type != WT_INVALID) && !avatar->isWearingWearableType( type ) )
LLWearableType::EType type = (LLWearableType::EType)getWearableType();
if( (type != LLWearableType::WT_INVALID) && !avatar->isWearingWearableType( type ) )
{
return TRUE;
}

View File

@@ -547,7 +547,7 @@ public:
LLVOAvatar* mAvatar; // just backlink, don't LLPointer
LLTexLayerSet* mTexLayerSet;
LLTexLayerSetBuffer* mLayerSetBuffer;
LLUUID mWearableAssets[WT_COUNT];
LLUUID mWearableAssets[LLWearableType::WT_COUNT];
U64 mStartTime; // Used to measure time baked texture upload requires
};

View File

@@ -236,7 +236,7 @@ BOOL LLTexLayerParamAlpha::getSkip() const
}
}
EWearableType type = (EWearableType)getWearableType();
LLWearableType::EType type = (LLWearableType::EType)getWearableType();
if ((type != WT_INVALID) && !avatar->isWearingWearableType(type))
{
return TRUE;

View File

@@ -368,13 +368,13 @@ bool LLViewerInventoryItem::isWearableType() const
return (getInventoryType() == LLInventoryType::IT_WEARABLE);
}
EWearableType LLViewerInventoryItem::getWearableType() const
LLWearableType::EType LLViewerInventoryItem::getWearableType() const
{
if (!isWearableType())
{
return WT_INVALID;
return LLWearableType::WT_INVALID;
}
return EWearableType(getFlags() & LLInventoryItemFlags::II_FLAGS_WEARABLES_MASK);
return LLWearableType::EType(getFlags() & LLInventoryItemFlags::II_FLAGS_WEARABLES_MASK);
}
// [/RLVa:KB]
@@ -755,7 +755,7 @@ void create_inventory_item(const LLUUID& agent_id, const LLUUID& session_id,
const LLUUID& parent, const LLTransactionID& transaction_id,
const std::string& name,
const std::string& desc, LLAssetType::EType asset_type,
LLInventoryType::EType inv_type, EWearableType wtype,
LLInventoryType::EType inv_type, LLWearableType::EType wtype,
U32 next_owner_perm,
LLPointer<LLInventoryCallback> cb)
{

View File

@@ -127,7 +127,7 @@ public:
//void updateAssetOnServer() const;
// [RLVa:KB] - Checked: 2010-09-27 (RLVa-1.1.3a) | Added: RLVa-1.1.3a
virtual bool isWearableType() const;
virtual EWearableType getWearableType() const;
virtual LLWearableType::EType getWearableType() const;
// [/RLVa:KB]
virtual void packMessage(LLMessageSystem* msg) const;
@@ -272,13 +272,13 @@ public:
extern LLInventoryCallbackManager gInventoryCallbacks;
#define NOT_WEARABLE (EWearableType)0
#define NOT_WEARABLE (LLWearableType::EType)0
void create_inventory_item(const LLUUID& agent_id, const LLUUID& session_id,
const LLUUID& parent, const LLTransactionID& transaction_id,
const std::string& name,
const std::string& desc, LLAssetType::EType asset_type,
LLInventoryType::EType inv_type, EWearableType wtype,
LLInventoryType::EType inv_type, LLWearableType::EType wtype,
U32 next_owner_perm,
LLPointer<LLInventoryCallback> cb);

View File

@@ -9165,68 +9165,19 @@ class LLEditEnableTakeOff : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
bool new_value = false;
std::string control_name = userdata["control"].asString();
std::string clothing = userdata["data"].asString();
bool new_value = false;
if (clothing == "shirt")
{
new_value = LLAgentWearables::selfHasWearable((void *)WT_SHIRT);
}
if (clothing == "pants")
{
new_value = LLAgentWearables::selfHasWearable((void *)WT_PANTS);
}
if (clothing == "shoes")
{
new_value = LLAgentWearables::selfHasWearable((void *)WT_SHOES);
}
if (clothing == "socks")
{
new_value = LLAgentWearables::selfHasWearable((void *)WT_SOCKS);
}
if (clothing == "jacket")
{
new_value = LLAgentWearables::selfHasWearable((void *)WT_JACKET);
}
if (clothing == "gloves")
{
new_value = LLAgentWearables::selfHasWearable((void *)WT_GLOVES);
}
if (clothing == "undershirt")
{
new_value = LLAgentWearables::selfHasWearable((void *)WT_UNDERSHIRT);
}
if (clothing == "underpants")
{
new_value = LLAgentWearables::selfHasWearable((void *)WT_UNDERPANTS);
}
if (clothing == "skirt")
{
new_value = LLAgentWearables::selfHasWearable((void *)WT_SKIRT);
}
if (clothing == "alpha")
{
new_value = LLAgentWearables::selfHasWearable((void *)WT_ALPHA);
}
if (clothing == "tattoo")
{
new_value = LLAgentWearables::selfHasWearable((void *)WT_TATTOO);
}
if (clothing == "physics")
{
new_value = LLAgentWearables::selfHasWearable((void *)WT_PHYSICS);
}
LLWearableType::EType type = LLWearableType::typeNameToType(clothing);
if (type >= LLWearableType::WT_SHAPE && type < LLWearableType::WT_COUNT)
// [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.1.3b) | Modified: RLVa-1.1.3b | OK
// Why aren't they using LLWearable::typeNameToType()? *confuzzled*
if ( (rlv_handler_t::isEnabled()) && (!gRlvWearableLocks.canRemove(LLWearable::typeNameToType(clothing))) )
{
new_value = false;
}
if ( !(rlv_handler_t::isEnabled()) || (gRlvWearableLocks.canRemove(type)) )
// [/RLVa:KB]
new_value = LLAgentWearables::selfHasWearable((void *)type);
gMenuHolder->findControl(control_name)->setValue(new_value);
return true;
return false;
}
};
@@ -9235,58 +9186,17 @@ class LLEditTakeOff : public view_listener_t
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
std::string clothing = userdata.asString();
if (clothing == "shirt")
{
LLAgentWearables::userRemoveWearable((void*)WT_SHIRT);
}
else if (clothing == "pants")
{
LLAgentWearables::userRemoveWearable((void*)WT_PANTS);
}
else if (clothing == "shoes")
{
LLAgentWearables::userRemoveWearable((void*)WT_SHOES);
}
else if (clothing == "socks")
{
LLAgentWearables::userRemoveWearable((void*)WT_SOCKS);
}
else if (clothing == "jacket")
{
LLAgentWearables::userRemoveWearable((void*)WT_JACKET);
}
else if (clothing == "gloves")
{
LLAgentWearables::userRemoveWearable((void*)WT_GLOVES);
}
else if (clothing == "undershirt")
{
LLAgentWearables::userRemoveWearable((void*)WT_UNDERSHIRT);
}
else if (clothing == "underpants")
{
LLAgentWearables::userRemoveWearable((void*)WT_UNDERPANTS);
}
else if (clothing == "skirt")
{
LLAgentWearables::userRemoveWearable((void*)WT_SKIRT);
}
else if (clothing == "alpha")
{
LLAgentWearables::userRemoveWearable((void*)WT_ALPHA);
}
else if (clothing == "tattoo")
{
LLAgentWearables::userRemoveWearable((void*)WT_TATTOO);
}
else if (clothing == "physics")
{
LLAgentWearables::userRemoveWearable((void*)WT_PHYSICS);
}
else if (clothing == "all")
if (clothing == "all")
{
LLAgentWearables::userRemoveAllClothes(NULL);
}
else
{
LLWearableType::EType type = LLWearableType::typeNameToType(clothing);
if (type >= LLWearableType::WT_SHAPE
&& type < LLWearableType::WT_COUNT)
LLAgentWearables::userRemoveWearable((void*)type);
}
return true;
}
};

View File

@@ -143,8 +143,6 @@ LLViewerObject *LLViewerObject::createObject(const LLUUID &id, const LLPCode pco
lldebugs << "Marking avatar as self " << id << llendl;
gAgentAvatarp = new LLVOAvatarSelf(id, pcode, regionp);
gAgentAvatarp->initInstance();
//gAgentCamera.setAvatarObject(this);
//gAgentWearables.setAvatarObject(this);
}
else
{

View File

@@ -45,7 +45,7 @@
//-----------------------------------------------------------------------------
LLViewerVisualParamInfo::LLViewerVisualParamInfo()
:
mWearableType( WT_INVALID ),
mWearableType( LLWearableType::WT_INVALID ),
mCamDist( 0.5f ),
mCamAngle( 0.f ),
mCamElevation( 0.f ),
@@ -76,7 +76,7 @@ BOOL LLViewerVisualParamInfo::parseXml(LLXmlTreeNode *node)
static LLStdStringHandle wearable_string = LLXmlTree::addAttributeString("wearable");
if( node->getFastAttributeString( wearable_string, wearable) )
{
mWearableType = LLWearable::typeNameToType( wearable );
mWearableType = LLWearableType::typeNameToType( wearable );
}
static LLStdStringHandle edit_group_string = LLXmlTree::addAttributeString("edit_group");

View File

@@ -32,7 +32,7 @@
#include "llviewerprecompiledheaders.h"
#include "llvoavatarself.h"
#include "llvoavatar.h"
#include <stdio.h>
#include <ctype.h>
@@ -87,6 +87,7 @@
#include "llviewerobjectlist.h"
#include "llviewerparcelmgr.h"
#include "llviewerstats.h"
#include "llvoavatarself.h"
#include "llvovolume.h"
#include "llworld.h"
#include "pipeline.h"
@@ -119,19 +120,11 @@
// disable boost::lexical_cast warning
#pragma warning (disable:4702)
#endif
#include <boost/lexical_cast.hpp>
using namespace LLVOAvatarDefines;
// for macs
#if LL_DARWIN
size_t strnlen(const char *s, size_t n)
{
const char *p = (const char *)memchr(s, 0, n);
return(p ? p-s : n);
}
#endif
//-----------------------------------------------------------------------------
// Global constants
//-----------------------------------------------------------------------------
@@ -217,8 +210,8 @@ const F32 DERUTHING_TIMEOUT_SECONDS = 30.f;
enum ERenderName
{
RENDER_NAME_NEVER,
RENDER_NAME_FADE,
RENDER_NAME_ALWAYS
RENDER_NAME_ALWAYS,
RENDER_NAME_FADE
};
//-----------------------------------------------------------------------------
@@ -623,20 +616,15 @@ private:
//-----------------------------------------------------------------------------
LLXmlTree LLVOAvatar::sXMLTree;
LLXmlTree LLVOAvatar::sSkeletonXMLTree;
BOOL LLVOAvatar::sDebugAvatarRotation = FALSE;
LLVOAvatarSkeletonInfo* LLVOAvatar::sAvatarSkeletonInfo = NULL;
LLVOAvatar::LLVOAvatarXmlInfo* LLVOAvatar::sAvatarXmlInfo = NULL;
LLVOAvatarDictionary *LLVOAvatar::sAvatarDictionary = NULL;
S32 LLVOAvatar::sFreezeCounter = 0;
U32 LLVOAvatar::sMaxVisible = 50;
LLMap< LLGLenum, LLGLuint*> LLVOAvatar::sScratchTexNames;
LLMap< LLGLenum, F32*> LLVOAvatar::sScratchTexLastBindTime;
S32 LLVOAvatar::sScratchTexBytes = 0;
F32 LLVOAvatar::sRenderDistance = 256.f;
S32 LLVOAvatar::sNumVisibleAvatars = 0;
S32 LLVOAvatar::sNumLODChangesThisFrame = 0;
LLSD LLVOAvatar::sClientResolutionList;
const LLUUID LLVOAvatar::sStepSoundOnLand("e8af4a28-aa83-4310-a7c4-c047e15ea0df");
@@ -664,11 +652,21 @@ F32 LLVOAvatar::sPhysicsLODFactor = 1.f;
BOOL LLVOAvatar::sUseImpostors = FALSE;
BOOL LLVOAvatar::sJointDebug = FALSE;
EmeraldGlobalBoobConfig LLVOAvatar::sBoobConfig;
F32 LLVOAvatar::sUnbakedTime = 0.f;
F32 LLVOAvatar::sUnbakedUpdateTime = 0.f;
F32 LLVOAvatar::sGreyTime = 0.f;
F32 LLVOAvatar::sGreyUpdateTime = 0.f;
//Move to LLVOAvatarSelf
BOOL LLVOAvatar::sDebugAvatarRotation = FALSE;
LLMap< LLGLenum, LLGLuint*> LLVOAvatar::sScratchTexNames;
LLMap< LLGLenum, F32*> LLVOAvatar::sScratchTexLastBindTime;
S32 LLVOAvatar::sScratchTexBytes = 0;
//Custom stuff.
LLSD LLVOAvatar::sClientResolutionList;
EmeraldGlobalBoobConfig LLVOAvatar::sBoobConfig;
bool LLVOAvatar::sDoProperArc = true;
//-----------------------------------------------------------------------------
@@ -773,7 +771,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
mBakedTextureDatas[i].mIsLoaded = false;
mBakedTextureDatas[i].mIsUsed = false;
mBakedTextureDatas[i].mMaskTexName = 0;
mBakedTextureDatas[i].mTextureIndex = getTextureIndex((EBakedTextureIndex)i);
mBakedTextureDatas[i].mTextureIndex = LLVOAvatarDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)i);
}
mDirtyMesh = 2; // Dirty geometry, need to regenerate.
@@ -857,6 +855,7 @@ LLVOAvatar::~LLVOAvatar()
for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
{
deleteAndClear(mBakedTextureDatas[i].mTexLayerSet);
mBakedTextureDatas[i].mMeshes.clear();
}
std::for_each(mAttachmentPoints.begin(), mAttachmentPoints.end(), DeletePairedPointer());
@@ -911,7 +910,7 @@ BOOL LLVOAvatar::isFullyBaked()
for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
{
if (!isTextureDefined(mBakedTextureDatas[i].mTextureIndex)
&& ( (i != BAKED_SKIRT) || isWearingWearableType(WT_SKIRT) ) )
&& ( (i != BAKED_SKIRT) || isWearingWearableType(LLWearableType::WT_SKIRT) ) )
{
return FALSE;
}
@@ -1074,11 +1073,11 @@ void LLVOAvatar::dumpBakedStatus()
{
llcont << " Unbaked (";
for (LLVOAvatarDictionary::baked_map_t::const_iterator iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin();
for (LLVOAvatarDictionary::BakedTextures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin();
iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end();
++iter)
{
const LLVOAvatarDictionary::BakedDictionaryEntry *baked_dict = iter->second;
const LLVOAvatarDictionary::BakedEntry *baked_dict = iter->second;
const ETextureIndex index = baked_dict->mTextureIndex;
if (!inst->isTextureDefined(index))
{
@@ -1347,12 +1346,12 @@ void LLVOAvatar::initInstance(void)
//-------------------------------------------------------------------------
mRoot.setName( "mRoot" );
for (LLVOAvatarDictionary::mesh_map_t::const_iterator iter = LLVOAvatarDictionary::getInstance()->getMeshes().begin();
for (LLVOAvatarDictionary::Meshes::const_iterator iter = LLVOAvatarDictionary::getInstance()->getMeshes().begin();
iter != LLVOAvatarDictionary::getInstance()->getMeshes().end();
iter++)
{
const EMeshIndex mesh_index = iter->first;
const LLVOAvatarDictionary::MeshDictionaryEntry *mesh_dict = iter->second;
const LLVOAvatarDictionary::MeshEntry *mesh_dict = iter->second;
LLViewerJoint* joint = new LLViewerJoint();
joint->setName(mesh_dict->mName);
@@ -1393,12 +1392,12 @@ void LLVOAvatar::initInstance(void)
//-------------------------------------------------------------------------
// associate baked textures with meshes
//-------------------------------------------------------------------------
for (LLVOAvatarDictionary::mesh_map_t::const_iterator iter = LLVOAvatarDictionary::getInstance()->getMeshes().begin();
for (LLVOAvatarDictionary::Meshes::const_iterator iter = LLVOAvatarDictionary::getInstance()->getMeshes().begin();
iter != LLVOAvatarDictionary::getInstance()->getMeshes().end();
iter++)
{
const EMeshIndex mesh_index = iter->first;
const LLVOAvatarDictionary::MeshDictionaryEntry *mesh_dict = iter->second;
const LLVOAvatarDictionary::MeshEntry *mesh_dict = iter->second;
const EBakedTextureIndex baked_texture_index = mesh_dict->mBakedID;
// Skip it if there's no associated baked texture.
@@ -1603,6 +1602,7 @@ void LLVOAvatar::getSpatialExtents(LLVector4a& newMin, LLVector4a& newMax)
{
continue ;
}
for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
attachment_iter != attachment->mAttachedObjects.end();
++attachment_iter)
@@ -2435,7 +2435,7 @@ U32 LLVOAvatar::processUpdateMessage(LLMessageSystem *mesgsys,
if(retval & LLViewerObject::INVALID_UPDATE)
{
if(this == gAgentAvatarp)
if(isSelf())
{
//tell sim to cancel this update
gAgent.teleportViaLocation(gAgent.getPositionGlobal());
@@ -2629,8 +2629,19 @@ BOOL LLVOAvatar::detachAttachmentIntoInventory(const LLUUID &item_id)
void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled)
{
// disable voice visualizer when in mouselook
mVoiceVisualizer->setVoiceEnabled( voice_enabled && !(isSelf() && gAgentCamera.cameraMouselook()) );
bool render_visualizer = voice_enabled;
// Don't render the user's own voice visualizer when in mouselook
if(isSelf())
{
if(gAgentCamera.cameraMouselook()/* || gSavedSettings.getBOOL("VoiceDisableMic")*/)
{
render_visualizer = false;
}
}
mVoiceVisualizer->setVoiceEnabled(render_visualizer);
if ( voice_enabled )
{
//----------------------------------------------------------------
@@ -2880,39 +2891,25 @@ void LLVOAvatar::idleUpdateAppearanceAnimation()
}
else
{
F32 blend_frac = calc_bouncy_animation(appearance_anim_time / APPEARANCE_MORPH_TIME);
F32 last_blend_frac = calc_bouncy_animation(mLastAppearanceBlendTime / APPEARANCE_MORPH_TIME);
F32 morph_amt;
// if it's over 5 seconds, just forget the bouncy anim
if(APPEARANCE_MORPH_TIME > 5.f)
{
blend_frac = appearance_anim_time / APPEARANCE_MORPH_TIME;
last_blend_frac = mLastAppearanceBlendTime / APPEARANCE_MORPH_TIME;
}
if (last_blend_frac == 1.f)
{
morph_amt = 1.f;
}
else
{
morph_amt = (blend_frac - last_blend_frac) / (1.f - last_blend_frac);
}
F32 morph_amt = calcMorphAmount();
LLVisualParam *param;
// animate only top level params
for (param = getFirstVisualParam();
param;
param = getNextVisualParam())
if (!isSelf())
{
if (param->isTweakable())
// animate only top level params
for (param = getFirstVisualParam();
param;
param = getNextVisualParam())
{
param->animate(morph_amt, mAppearanceAnimSetByUser);
if (param->isTweakable())
{
param->animate(morph_amt, mAppearanceAnimSetByUser);
}
}
}
// apply all params
for (param = getFirstVisualParam();
param;
@@ -2927,6 +2924,25 @@ void LLVOAvatar::idleUpdateAppearanceAnimation()
}
}
F32 LLVOAvatar::calcMorphAmount()
{
F32 appearance_anim_time = mAppearanceMorphTimer.getElapsedTimeF32();
F32 blend_frac = calc_bouncy_animation(appearance_anim_time / APPEARANCE_MORPH_TIME);
F32 last_blend_frac = calc_bouncy_animation(mLastAppearanceBlendTime / APPEARANCE_MORPH_TIME);
F32 morph_amt;
if (last_blend_frac == 1.f)
{
morph_amt = 1.f;
}
else
{
morph_amt = (blend_frac - last_blend_frac) / (1.f - last_blend_frac);
}
return morph_amt;
}
// ------------------------------------------------------------
// Danny: ZOMG Boob Phsyics go!
// ------------------------------------------------------------
@@ -4765,7 +4781,7 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass)
mMeshLOD[MESH_ID_LOWER_BODY]->updateJointGeometry();
mMeshLOD[MESH_ID_UPPER_BODY]->updateJointGeometry();
if( isWearingWearableType( WT_SKIRT ) )
if( isWearingWearableType( LLWearableType::WT_SKIRT ) )
{
mMeshLOD[MESH_ID_SKIRT]->updateJointGeometry();
}
@@ -4931,7 +4947,7 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass)
U32 LLVOAvatar::renderTransparent(BOOL first_pass)
{
U32 num_indices = 0;
if( isWearingWearableType( WT_SKIRT ) && (mIsDummy || isTextureVisible(TEX_SKIRT_BAKED)) )
if( isWearingWearableType( LLWearableType::WT_SKIRT ) && (mIsDummy || isTextureVisible(TEX_SKIRT_BAKED)) )
{
gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.25f);
num_indices += mMeshLOD[MESH_ID_SKIRT]->render(mAdjustedPixelArea, FALSE);
@@ -5192,7 +5208,7 @@ void LLVOAvatar::updateTextures()
/* switch(index)
case TEX_HEAD_BODYPAINT:
addLocalTextureStats( LOCTEX_HEAD_BODYPAINT, imagep, texel_area_ratio, render_avatar, head_baked ); */
const LLVOAvatarDictionary::TextureDictionaryEntry *texture_dict = LLVOAvatarDictionary::getInstance()->getTexture((ETextureIndex)index);
const LLVOAvatarDictionary::TextureEntry *texture_dict = LLVOAvatarDictionary::getInstance()->getTexture((ETextureIndex)index);
if (texture_dict->mIsUsedByBakedTexture)
{
const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex;
@@ -6094,11 +6110,11 @@ BOOL LLVOAvatar::loadAvatar()
return FALSE;
}
bool found_baked_entry = false;
for (LLVOAvatarDictionary::baked_map_t::const_iterator baked_iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin();
for (LLVOAvatarDictionary::BakedTextures::const_iterator baked_iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin();
baked_iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end();
baked_iter++)
{
const LLVOAvatarDictionary::BakedDictionaryEntry *baked_dict = baked_iter->second;
const LLVOAvatarDictionary::BakedEntry *baked_dict = baked_iter->second;
if (layer_set->isBodyRegion(baked_dict->mName))
{
mBakedTextureDatas[baked_iter->first].mTexLayerSet = layer_set;
@@ -6297,12 +6313,12 @@ BOOL LLVOAvatar::loadMeshNodes()
switch(lod)
case 0:
mesh = &mHairMesh0; */
for (LLVOAvatarDictionary::mesh_map_t::const_iterator mesh_iter = LLVOAvatarDictionary::getInstance()->getMeshes().begin();
for (LLVOAvatarDictionary::Meshes::const_iterator mesh_iter = LLVOAvatarDictionary::getInstance()->getMeshes().begin();
mesh_iter != LLVOAvatarDictionary::getInstance()->getMeshes().end();
mesh_iter++)
{
const EMeshIndex mesh_index = mesh_iter->first;
const LLVOAvatarDictionary::MeshDictionaryEntry *mesh_dict = mesh_iter->second;
const LLVOAvatarDictionary::MeshEntry *mesh_dict = mesh_iter->second;
if (type.compare(mesh_dict->mName) == 0)
{
mesh_id = mesh_index;
@@ -6686,12 +6702,11 @@ void LLVOAvatar::updateShadowFaces()
//-----------------------------------------------------------------------------
// updateSexDependentLayerSets()
//-----------------------------------------------------------------------------
void LLVOAvatar::updateSexDependentLayerSets( BOOL set_by_user )
void LLVOAvatar::updateSexDependentLayerSets( BOOL upload_bake )
{
invalidateComposite( mBakedTextureDatas[BAKED_HEAD].mTexLayerSet, set_by_user );
invalidateComposite( mBakedTextureDatas[BAKED_UPPER].mTexLayerSet, set_by_user );
invalidateComposite( mBakedTextureDatas[BAKED_LOWER].mTexLayerSet, set_by_user );
updateMeshTextures();
invalidateComposite( mBakedTextureDatas[BAKED_HEAD].mTexLayerSet, upload_bake );
invalidateComposite( mBakedTextureDatas[BAKED_UPPER].mTexLayerSet, upload_bake );
invalidateComposite( mBakedTextureDatas[BAKED_LOWER].mTexLayerSet, upload_bake );
}
//-----------------------------------------------------------------------------
@@ -6739,7 +6754,7 @@ void LLVOAvatar::requestLayerSetUpdate(ETextureIndex index )
case LOCTEX_UPPER_SHIRT:
if( mUpperBodyLayerSet )
mUpperBodyLayerSet->requestUpdate(); */
const LLVOAvatarDictionary::TextureDictionaryEntry *texture_dict = LLVOAvatarDictionary::getInstance()->getTexture(index);
const LLVOAvatarDictionary::TextureEntry *texture_dict = LLVOAvatarDictionary::getInstance()->getTexture(index);
if (!texture_dict->mIsLocalTexture || !texture_dict->mIsUsedByBakedTexture)
return;
const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex;
@@ -7498,7 +7513,7 @@ void LLVOAvatar::updateComposites()
for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
{
if ( mBakedTextureDatas[i].mTexLayerSet
&& ((i != BAKED_SKIRT) || isWearingWearableType( WT_SKIRT )) )
&& ((i != BAKED_SKIRT) || isWearingWearableType( LLWearableType::WT_SKIRT )) )
{
mBakedTextureDatas[i].mTexLayerSet->updateComposite();
}
@@ -7527,7 +7542,7 @@ LLColor4 LLVOAvatar::getGlobalColor( const std::string& color_name ) const
}
void LLVOAvatar::invalidateComposite( LLTexLayerSet* layerset, BOOL set_by_user )
void LLVOAvatar::invalidateComposite( LLTexLayerSet* layerset, BOOL upload_result )
{
if( !layerset || !layerset->getUpdatesEnabled() )
{
@@ -7569,7 +7584,7 @@ void LLVOAvatar::invalidateComposite( LLTexLayerSet* layerset, BOOL set_by_user
layerset->requestUpdate();
if( set_by_user )
if( upload_result )
{
llassert( isSelf() );
@@ -7675,12 +7690,12 @@ void LLVOAvatar::processRebakeAvatarTextures(LLMessageSystem* msg, void**)
/* ETextureIndex baked_texture_indices[BAKED_NUM_INDICES] =
TEX_HEAD_BAKED,
TEX_UPPER_BAKED, */
for (LLVOAvatarDictionary::texture_map_t::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin();
for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin();
iter != LLVOAvatarDictionary::getInstance()->getTextures().end();
iter++)
{
const ETextureIndex index = iter->first;
const LLVOAvatarDictionary::TextureDictionaryEntry *text_dict = iter->second;
const LLVOAvatarDictionary::TextureEntry *text_dict = iter->second;
if (text_dict->mIsBakedTexture)
{
if (texture_id == self->getTEImage(index)->getID())
@@ -8232,12 +8247,12 @@ void LLVOAvatar::updateMeshTextures()
/* // Head
BOOL head_baked_ready = (is_layer_baked[BAKED_HEAD] && mBakedTextureDatas[BAKED_HEAD].mIsLoaded) || other_culled;
setLocalTexture( TEX_HEAD_BODYPAINT, getTEImage( TEX_HEAD_BODYPAINT ), head_baked_ready ); */
for (LLVOAvatarDictionary::baked_map_t::const_iterator baked_iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin();
for (LLVOAvatarDictionary::BakedTextures::const_iterator baked_iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin();
baked_iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end();
++baked_iter)
{
const EBakedTextureIndex baked_index = baked_iter->first;
const LLVOAvatarDictionary::BakedDictionaryEntry *baked_dict = baked_iter->second;
const LLVOAvatarDictionary::BakedEntry *baked_dict = baked_iter->second;
for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin();
local_tex_iter != baked_dict->mLocalTextures.end();
@@ -8300,16 +8315,21 @@ void LLVOAvatar::setLocalTexture( ETextureIndex index, LLViewerFetchedTexture* t
//-----------------------------------------------------------------------------
void LLVOAvatar::requestLayerSetUploads()
{
llassert_always(isSelf());
for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
{
bool layer_baked = isTextureDefined(mBakedTextureDatas[i].mTextureIndex);
if ( !layer_baked && mBakedTextureDatas[i].mTexLayerSet )
{
mBakedTextureDatas[i].mTexLayerSet->requestUpload();
}
requestLayerSetUpload((EBakedTextureIndex)i);
}
}
void LLVOAvatar::requestLayerSetUpload(LLVOAvatarDefines::EBakedTextureIndex i)
{
bool layer_baked = isTextureDefined(mBakedTextureDatas[i].mTextureIndex);
if ( !layer_baked && mBakedTextureDatas[i].mTexLayerSet )
{
mBakedTextureDatas[i].mTexLayerSet->requestUpload();
}
}
//-----------------------------------------------------------------------------
// setCompositeUpdatesEnabled()
@@ -8400,7 +8420,7 @@ BOOL LLVOAvatar::isLocalTextureDataFinal( const LLTexLayerSet* layerset )
{
if (layerset == mBakedTextureDatas[i].mTexLayerSet)
{
const LLVOAvatarDictionary::BakedDictionaryEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i);
const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i);
for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin();
local_tex_iter != baked_dict->mLocalTextures.end();
local_tex_iter++)
@@ -8427,7 +8447,7 @@ BOOL LLVOAvatar::isLocalTextureDataAvailable( const LLTexLayerSet* layerset )
{
/* if( layerset == mBakedTextureDatas[BAKED_HEAD].mTexLayerSet )
return getLocalDiscardLevel( TEX_HEAD_BODYPAINT ) >= 0; */
for (LLVOAvatarDictionary::baked_map_t::const_iterator baked_iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin();
for (LLVOAvatarDictionary::BakedTextures::const_iterator baked_iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin();
baked_iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end();
baked_iter++)
{
@@ -8435,7 +8455,7 @@ BOOL LLVOAvatar::isLocalTextureDataAvailable( const LLTexLayerSet* layerset )
if (layerset == mBakedTextureDatas[baked_index].mTexLayerSet)
{
bool ret = true;
const LLVOAvatarDictionary::BakedDictionaryEntry *baked_dict = baked_iter->second;
const LLVOAvatarDictionary::BakedEntry *baked_dict = baked_iter->second;
for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin();
local_tex_iter != baked_dict->mLocalTextures.end();
local_tex_iter++)
@@ -8492,7 +8512,7 @@ void LLVOAvatar::setNewBakedTexture( ETextureIndex te, const LLUUID& uuid )
/* switch(te)
case TEX_HEAD_BAKED:
llinfos << "New baked texture: HEAD" << llendl; */
const LLVOAvatarDictionary::TextureDictionaryEntry *text_dict = LLVOAvatarDictionary::getInstance()->getTexture(te);
const LLVOAvatarDictionary::TextureEntry *text_dict = LLVOAvatarDictionary::getInstance()->getTexture(te);
if (text_dict->mIsBakedTexture)
{
llinfos << "New baked texture: " << text_dict->mName << " UUID: " << uuid <<llendl;
@@ -8546,13 +8566,13 @@ void LLVOAvatar::setCachedBakedTexture( ETextureIndex te, const LLUUID& uuid )
}
//-----------------------------------------------------------------------------
// releaseUnneccesaryTextures()
// releaseComponentTextures()
// release any component texture UUIDs for which we have a baked texture
// ! BACKWARDS COMPATIBILITY !
// This is only called for non-self avatars, it can be taken out once component
// textures aren't communicated by non-self avatars.
//-----------------------------------------------------------------------------
void LLVOAvatar::releaseUnnecessaryTextures()
void LLVOAvatar::releaseComponentTextures()
{
// ! BACKWARDS COMPATIBILITY !
// Detect if the baked hair texture actually wasn't sent, and if so set to default
@@ -8567,10 +8587,10 @@ void LLVOAvatar::releaseUnnecessaryTextures()
for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++)
{
const LLVOAvatarDictionary::BakedDictionaryEntry * bakedDicEntry = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index);
const LLVOAvatarDictionary::BakedEntry * bakedDicEntry = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index);
// skip if this is a skirt and av is not wearing one, or if we don't have a baked texture UUID
if (!isTextureDefined(bakedDicEntry->mTextureIndex)
&& ( (baked_index != BAKED_SKIRT) || isWearingWearableType(WT_SKIRT) ))
&& ( (baked_index != BAKED_SKIRT) || isWearingWearableType(LLWearableType::WT_SKIRT) ))
{
continue;
}
@@ -8738,11 +8758,11 @@ void LLVOAvatar::dumpAvatarTEs( const std::string& context ) const
"TEX_HEAD_BODYPAINT ",
"TEX_UPPER_SHIRT ", */
llinfos << (isSelf() ? "Self: " : "Other: ") << context << llendl;
for (LLVOAvatarDictionary::texture_map_t::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin();
for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin();
iter != LLVOAvatarDictionary::getInstance()->getTextures().end();
++iter)
{
const LLVOAvatarDictionary::TextureDictionaryEntry *text_dict = iter->second;
const LLVOAvatarDictionary::TextureEntry *text_dict = iter->second;
const LLViewerTexture* te_image = getTEImage(iter->first);
if( !te_image )
{
@@ -8807,25 +8827,6 @@ void LLVOAvatar::updateAttachmentVisibility(U32 camera_mode)
}
}
// Given a texture entry, determine which wearable type owns it.
// static
LLUUID LLVOAvatar::getDefaultTEImageID(ETextureIndex index )
{
/* switch( index )
case TEX_UPPER_SHIRT: return LLUUID( gSavedSettings.getString("UIImgDefaultShirtUUID") ); */
const LLVOAvatarDictionary::TextureDictionaryEntry *text_dict = LLVOAvatarDictionary::getInstance()->getTexture(index);
const std::string &default_image_name = text_dict->mDefaultImageName;
if (default_image_name == "")
{
return IMG_DEFAULT_AVATAR;
}
else
{
return LLUUID(gSavedSettings.getString(default_image_name));
}
}
void LLVOAvatar::setInvisible(BOOL newvalue)
{
if (newvalue)
@@ -8851,27 +8852,17 @@ LLColor4 LLVOAvatar::getDummyColor()
return DUMMY_COLOR;
}
// Given a texture entry, determine which wearable type owns it.
// static
EWearableType LLVOAvatar::getTEWearableType(ETextureIndex index )
{
/* switch(index)
case TEX_UPPER_SHIRT:
return WT_SHIRT; */
return LLVOAvatarDictionary::getInstance()->getTexture(index)->mWearableType;
}
// Unlike most wearable functions, this works for both self and other.
BOOL LLVOAvatar::isWearingWearableType( EWearableType type ) const
BOOL LLVOAvatar::isWearingWearableType( LLWearableType::EType type ) const
{
if (mIsDummy) return TRUE;
switch( type )
{
case WT_SHAPE:
case WT_SKIN:
case WT_HAIR:
case WT_EYES:
case LLWearableType::WT_SHAPE:
case LLWearableType::WT_SKIN:
case LLWearableType::WT_HAIR:
case LLWearableType::WT_EYES:
return TRUE; // everyone has all bodyparts
default:
break; // Do nothing
@@ -8880,12 +8871,12 @@ BOOL LLVOAvatar::isWearingWearableType( EWearableType type ) const
/* switch(type)
case WT_SHIRT:
indicator_te = TEX_UPPER_SHIRT; */
for (LLVOAvatarDictionary::texture_map_t::const_iterator tex_iter = LLVOAvatarDictionary::getInstance()->getTextures().begin();
for (LLVOAvatarDictionary::Textures::const_iterator tex_iter = LLVOAvatarDictionary::getInstance()->getTextures().begin();
tex_iter != LLVOAvatarDictionary::getInstance()->getTextures().end();
++tex_iter)
{
const LLVOAvatarDefines::ETextureIndex index = tex_iter->first;
const LLVOAvatarDictionary::TextureDictionaryEntry *text_dict = tex_iter->second;
const LLVOAvatarDictionary::TextureEntry *text_dict = tex_iter->second;
if (text_dict->mWearableType == type)
{
// If you're checking your own clothing, check the component texture
@@ -8907,11 +8898,11 @@ BOOL LLVOAvatar::isWearingWearableType( EWearableType type ) const
// this works for detecting a skirt (most important), but is ineffective at any piece of clothing that
// gets baked into a texture that always exists (upper or lower).
const std::string name = text_dict->mName;
for (LLVOAvatarDictionary::baked_map_t::const_iterator iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin();
for (LLVOAvatarDictionary::BakedTextures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin();
iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end();
iter++)
{
const LLVOAvatarDictionary::BakedDictionaryEntry *baked_dict = iter->second;
const LLVOAvatarDictionary::BakedEntry *baked_dict = iter->second;
if (baked_dict->mName == name)
{
if (isTextureDefined(baked_dict->mTextureIndex))
@@ -8935,21 +8926,22 @@ BOOL LLVOAvatar::isWearingWearableType( EWearableType type ) const
// forces an update to any baked textures relevant to type.
// will force an upload of the resulting bake if the second parameter is TRUE
//-----------------------------------------------------------------------------
void LLVOAvatar::wearableUpdated(EWearableType type, BOOL upload_result)
void LLVOAvatar::wearableUpdated(LLWearableType::EType type, BOOL upload_result)
{
for (LLVOAvatarDictionary::wearable_map_t::const_iterator wearable_iter = LLVOAvatarDictionary::getInstance()->getWearables().begin();
wearable_iter != LLVOAvatarDictionary::getInstance()->getWearables().end();
wearable_iter++)
for (LLVOAvatarDictionary::BakedTextures::const_iterator baked_iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin();
baked_iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end();
++baked_iter)
{
const LLVOAvatarDictionary::WearableDictionaryEntry *wearable_dict = wearable_iter->second;
const LLVOAvatarDefines::EBakedTextureIndex index = wearable_iter->first;
if (wearable_dict)
const LLVOAvatarDictionary::BakedEntry *baked_dict = baked_iter->second;
const LLVOAvatarDefines::EBakedTextureIndex index = baked_iter->first;
if (baked_dict)
{
for (LLVOAvatarDefines::wearables_vec_t::const_iterator type_iter = wearable_dict->mWearablesVec.begin();
type_iter != wearable_dict->mWearablesVec.end();
type_iter++)
for (LLVOAvatarDefines::wearables_vec_t::const_iterator type_iter = baked_dict->mWearables.begin();
type_iter != baked_dict->mWearables.end();
++type_iter)
{
const EWearableType comp_type = *type_iter;
const LLWearableType::EType comp_type = *type_iter;
if (comp_type == type)
{
if (mBakedTextureDatas[index].mTexLayerSet)
@@ -8965,7 +8957,7 @@ void LLVOAvatar::wearableUpdated(EWearableType type, BOOL upload_result)
// Physics type has no associated baked textures, but change of params needs to be sent to
// other avatars.
if (isSelf() && type == WT_PHYSICS)
if (isSelf() && type == LLWearableType::WT_PHYSICS)
{
gAgent.sendAgentSetAppearance();
}
@@ -9370,12 +9362,12 @@ void LLVOAvatar::onBakedTextureMasksLoaded( BOOL success, LLViewerFetchedTexture
self->mBakedTextureDatas[BAKED_HEAD].mTexLayerSet->applyMorphMask(aux_src->getData(), aux_src->getWidth(), aux_src->getHeight(), 1);
maskData->mLastDiscardLevel = discard_level; */
bool found_texture_id = false;
for (LLVOAvatarDictionary::texture_map_t::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin();
for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin();
iter != LLVOAvatarDictionary::getInstance()->getTextures().end();
++iter)
{
const LLVOAvatarDictionary::TextureDictionaryEntry *text_dict = iter->second;
const LLVOAvatarDictionary::TextureEntry *text_dict = iter->second;
if (text_dict->mIsUsedByBakedTexture)
{
const ETextureIndex texture_index = iter->first;
@@ -9488,7 +9480,7 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id )
{
mBakedTextureDatas[i].mTexLayerSet->destroyComposite();
}
const LLVOAvatarDictionary::BakedDictionaryEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i);
const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i);
for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin();
local_tex_iter != baked_dict->mLocalTextures.end();
++local_tex_iter)
@@ -9528,9 +9520,9 @@ void LLVOAvatar::dumpArchetypeXML( void* )
apr_file_printf( file, "\n\t<archetype name=\"???\">\n" );
// only body parts, not clothing.
for( S32 type = WT_SHAPE; type <= WT_EYES; type++ )
for( S32 type = LLWearableType::WT_SHAPE; type <= LLWearableType::WT_EYES; type++ )
{
const std::string& wearable_name = LLWearable::typeToTypeName( (EWearableType) type );
const std::string& wearable_name = LLWearableType::getTypeName( (LLWearableType::EType) type );
apr_file_printf( file, "\n\t\t<!-- wearable: %s -->\n", wearable_name.c_str() );
for( LLVisualParam* param = avatar->getFirstVisualParam(); param; param = avatar->getNextVisualParam() )
@@ -9546,7 +9538,7 @@ void LLVOAvatar::dumpArchetypeXML( void* )
for(U8 te = 0; te < TEX_NUM_INDICES; te++)
{
if( LLVOAvatar::getTEWearableType((ETextureIndex)te) == type )
if( LLVOAvatarDictionary::getTEWearableType((ETextureIndex)te) == type )
{
LLViewerTexture* te_image = avatar->getTEImage((ETextureIndex)te);
if( te_image )
@@ -9690,11 +9682,11 @@ BOOL LLVOAvatar::canGrabLocalTexture(ETextureIndex index)
/* switch(index)
case TEX_EYES_BAKED:
textures.push_back(TEX_EYES_IRIS); */
const LLVOAvatarDictionary::TextureDictionaryEntry *text_dict = LLVOAvatarDictionary::getInstance()->getTexture(index);
const LLVOAvatarDictionary::TextureEntry *text_dict = LLVOAvatarDictionary::getInstance()->getTexture(index);
if (!text_dict->mIsUsedByBakedTexture) return FALSE;
const EBakedTextureIndex baked_index = text_dict->mBakedTextureIndex;
const LLVOAvatarDictionary::BakedDictionaryEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture(baked_index);
const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture(baked_index);
for (texture_vec_t::const_iterator iter = baked_dict->mLocalTextures.begin();
iter != baked_dict->mLocalTextures.end();
iter++)
@@ -9749,11 +9741,11 @@ void LLVOAvatar::dumpLocalTextures()
/* ETextureIndex baked_equiv[] = {
TEX_UPPER_BAKED,
if (isTextureDefined(baked_equiv[i])) */
for (LLVOAvatarDictionary::texture_map_t::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin();
for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin();
iter != LLVOAvatarDictionary::getInstance()->getTextures().end();
iter++)
{
const LLVOAvatarDictionary::TextureDictionaryEntry *text_dict = iter->second;
const LLVOAvatarDictionary::TextureEntry *text_dict = iter->second;
if (!text_dict->mIsLocalTexture || !text_dict->mIsUsedByBakedTexture)
continue;
@@ -9812,31 +9804,9 @@ void LLVOAvatar::startAppearanceAnimation(BOOL set_by_user, BOOL play_sound)
}
}
// virtual
void LLVOAvatar::removeMissingBakedTextures()
{
if (!isSelf()) return;
BOOL removed = FALSE;
for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
{
const S32 te = mBakedTextureDatas[i].mTextureIndex;
if (getTEImage(te)->isMissingAsset())
{
setTEImage(te, LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT_AVATAR));
removed = TRUE;
}
}
if (removed)
{
for(U32 i = 0; i < mBakedTextureDatas.size(); i++)
{
invalidateComposite(mBakedTextureDatas[i].mTexLayerSet, FALSE);
}
updateMeshTextures();
requestLayerSetUploads();
}
{
}
//-----------------------------------------------------------------------------
@@ -9853,9 +9823,9 @@ LLVOAvatar::LLVOAvatarXmlInfo::~LLVOAvatarXmlInfo()
std::for_each(mMeshInfoList.begin(), mMeshInfoList.end(), DeletePointer());
std::for_each(mSkeletalDistortionInfoList.begin(), mSkeletalDistortionInfoList.end(), DeletePointer());
std::for_each(mAttachmentInfoList.begin(), mAttachmentInfoList.end(), DeletePointer());
delete mTexSkinColorInfo;
delete mTexHairColorInfo;
delete mTexEyeColorInfo;
deleteAndClear(mTexSkinColorInfo);
deleteAndClear(mTexHairColorInfo);
deleteAndClear(mTexEyeColorInfo);
std::for_each(mLayerInfoList.begin(), mLayerInfoList.end(), DeletePointer());
std::for_each(mDriverInfoList.begin(), mDriverInfoList.end(), DeletePointer());
}
@@ -10315,7 +10285,7 @@ LLTexLayerSet* LLVOAvatar::getLayerSet(ETextureIndex index) const
case TEX_HEAD_BAKED:
case TEX_HEAD_BODYPAINT:
return mHeadLayerSet; */
const LLVOAvatarDictionary::TextureDictionaryEntry *text_dict = LLVOAvatarDictionary::getInstance()->getTexture(index);
const LLVOAvatarDictionary::TextureEntry *text_dict = LLVOAvatarDictionary::getInstance()->getTexture(index);
if (text_dict->mIsUsedByBakedTexture)
{
const EBakedTextureIndex baked_index = text_dict->mBakedTextureIndex;
@@ -10545,12 +10515,12 @@ const std::string LLVOAvatar::getBakedStatusForPrintout() const
{
std::string line;
for (LLVOAvatarDictionary::texture_map_t::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin();
for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin();
iter != LLVOAvatarDictionary::getInstance()->getTextures().end();
++iter)
{
const ETextureIndex index = iter->first;
const LLVOAvatarDictionary::TextureDictionaryEntry *text_dict = iter->second;
const LLVOAvatarDictionary::TextureEntry *text_dict = iter->second;
if (text_dict->mIsBakedTexture)
{
line += text_dict->mName;

View File

@@ -287,6 +287,7 @@ public:
protected:
bool sendAvatarTexturesRequest();
void updateRuthTimer(bool loading);
F32 calcMorphAmount();
private:
BOOL mFullyLoaded;
BOOL mPreviousFullyLoaded;
@@ -483,11 +484,6 @@ public:
private:
static S32 sFreezeCounter;
//--------------------------------------------------------------------
// Internal functions
//--------------------------------------------------------------------
protected:
BOOL needsRenderBeam();
/** Rendering
** **
*******************************************************************************/
@@ -512,11 +508,12 @@ protected:
// Baked textures
//--------------------------------------------------------------------
public:
void releaseComponentTextures(); // ! BACKWARDS COMPATIBILITY !
protected:
static void onBakedTextureMasksLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata);
static void onInitialBakedTextureLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata);
static void onBakedTextureLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata);
void removeMissingBakedTextures();
virtual void removeMissingBakedTextures();
void useBakedTexture(const LLUUID& id);
struct BakedTextureData
@@ -549,8 +546,8 @@ protected:
// Composites
//--------------------------------------------------------------------
public:
void invalidateComposite( LLTexLayerSet* layerset, BOOL set_by_user );
void invalidateAll();
virtual void invalidateComposite(LLTexLayerSet* layerset, BOOL upload_result);
virtual void invalidateAll();
//--------------------------------------------------------------------
// Static texture/mesh/baked dictionary
@@ -624,16 +621,14 @@ public:
static void processRebakeAvatarTextures(LLMessageSystem* msg, void**);
void setNewBakedTexture( LLVOAvatarDefines::ETextureIndex i, const LLUUID& uuid );
void setCachedBakedTexture( LLVOAvatarDefines::ETextureIndex i, const LLUUID& uuid );
void releaseUnnecessaryTextures();
void requestLayerSetUploads();
void requestLayerSetUpload(LLVOAvatarDefines::EBakedTextureIndex i);
bool hasPendingBakedUploads();
static void onLocalTextureLoaded( BOOL succcess, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata );
static enum EWearableType getTEWearableType(LLVOAvatarDefines::ETextureIndex te );
static LLUUID getDefaultTEImageID(LLVOAvatarDefines::ETextureIndex te );
static void onChangeSelfInvisible(BOOL newvalue);
void setInvisible(BOOL newvalue);
void wearableUpdated(EWearableType type, BOOL upload_result = TRUE);
void wearableUpdated(LLWearableType::EType type, BOOL upload_result = TRUE);
//--------------------------------------------------------------------
// texture compositing
@@ -653,12 +648,12 @@ public:
public:
void updateMeshTextures();
void updateSexDependentLayerSets(BOOL set_by_user);
void updateSexDependentLayerSets(BOOL upload_bake);
void dirtyMesh(); // Dirty the avatar mesh
void updateMeshData();
protected:
void releaseMeshData();
void restoreMeshData();
virtual void restoreMeshData();
private:
void dirtyMesh(S32 priority); // Dirty the avatar mesh, with priority
S32 mDirtyMesh; // 0 -- not dirty, 1 -- morphed, 2 -- LOD
@@ -752,7 +747,7 @@ public:
**/
public:
BOOL isWearingWearableType( EWearableType type ) const;
BOOL isWearingWearableType( LLWearableType::EType type ) const;
//--------------------------------------------------------------------
// Attachments

View File

@@ -32,6 +32,7 @@
#include "llviewerprecompiledheaders.h"
#include "llvoavatardefines.h"
#include "llviewercontrol.h" // gSavedSettings
const S32 LLVOAvatarDefines::SCRATCH_TEX_WIDTH = 512;
const S32 LLVOAvatarDefines::SCRATCH_TEX_HEIGHT = 512;
@@ -42,64 +43,90 @@ using namespace LLVOAvatarDefines;
/*********************************************************************************
* Edit this function to add/remove/change textures and mesh definitions for avatars.
*/
void LLVOAvatarDictionary::initData()
LLVOAvatarDictionary::Textures::Textures()
{
// Textures
mTextureMap[TEX_HEAD_BODYPAINT] = new TextureDictionaryEntry("head bodypaint", TRUE, BAKED_NUM_INDICES, "", WT_SKIN);
mTextureMap[TEX_UPPER_SHIRT] = new TextureDictionaryEntry("shirt", TRUE, BAKED_NUM_INDICES, "UIImgDefaultShirtUUID", WT_SHIRT);
mTextureMap[TEX_LOWER_PANTS] = new TextureDictionaryEntry("pants", TRUE, BAKED_NUM_INDICES, "UIImgDefaultPantsUUID", WT_PANTS);
mTextureMap[TEX_EYES_IRIS] = new TextureDictionaryEntry("iris", TRUE, BAKED_NUM_INDICES, "UIImgDefaultEyesUUID", WT_EYES);
mTextureMap[TEX_HAIR] = new TextureDictionaryEntry("hair", TRUE, BAKED_NUM_INDICES, "UIImgDefaultHairUUID", WT_HAIR);
mTextureMap[TEX_UPPER_BODYPAINT] = new TextureDictionaryEntry("upper bodypaint", TRUE, BAKED_NUM_INDICES, "", WT_SKIN);
mTextureMap[TEX_LOWER_BODYPAINT] = new TextureDictionaryEntry("lower bodypaint", TRUE, BAKED_NUM_INDICES, "", WT_SKIN);
mTextureMap[TEX_LOWER_SHOES] = new TextureDictionaryEntry("shoes", TRUE, BAKED_NUM_INDICES, "UIImgDefaultShoesUUID", WT_SHOES);
mTextureMap[TEX_LOWER_SOCKS] = new TextureDictionaryEntry("socks", TRUE, BAKED_NUM_INDICES, "UIImgDefaultSocksUUID", WT_SOCKS);
mTextureMap[TEX_UPPER_JACKET] = new TextureDictionaryEntry("upper jacket", TRUE, BAKED_NUM_INDICES, "UIImgDefaultJacketUUID", WT_JACKET);
mTextureMap[TEX_LOWER_JACKET] = new TextureDictionaryEntry("lower jacket", TRUE, BAKED_NUM_INDICES, "UIImgDefaultJacketUUID", WT_JACKET);
mTextureMap[TEX_UPPER_GLOVES] = new TextureDictionaryEntry("gloves", TRUE, BAKED_NUM_INDICES, "UIImgDefaultGlovesUUID", WT_GLOVES);
mTextureMap[TEX_UPPER_UNDERSHIRT] = new TextureDictionaryEntry("undershirt", TRUE, BAKED_NUM_INDICES, "UIImgDefaultUnderwearUUID", WT_UNDERSHIRT);
mTextureMap[TEX_LOWER_UNDERPANTS] = new TextureDictionaryEntry("underpants", TRUE, BAKED_NUM_INDICES, "UIImgDefaultUnderwearUUID", WT_UNDERPANTS);
mTextureMap[TEX_SKIRT] = new TextureDictionaryEntry("skirt", TRUE, BAKED_NUM_INDICES, "UIImgDefaultSkirtUUID", WT_SKIRT);
mTextureMap[TEX_LOWER_ALPHA] = new TextureDictionaryEntry("lower_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", WT_ALPHA);
mTextureMap[TEX_UPPER_ALPHA] = new TextureDictionaryEntry("upper_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", WT_ALPHA);
mTextureMap[TEX_HEAD_ALPHA] = new TextureDictionaryEntry("head_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", WT_ALPHA);
mTextureMap[TEX_EYES_ALPHA] = new TextureDictionaryEntry("eyes_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", WT_ALPHA);
mTextureMap[TEX_HAIR_ALPHA] = new TextureDictionaryEntry("hair_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", WT_ALPHA);
mTextureMap[TEX_HEAD_TATTOO] = new TextureDictionaryEntry("head_tattoo", TRUE, BAKED_NUM_INDICES, "", WT_TATTOO);
mTextureMap[TEX_UPPER_TATTOO] = new TextureDictionaryEntry("upper_tattoo", TRUE, BAKED_NUM_INDICES, "", WT_TATTOO);
mTextureMap[TEX_LOWER_TATTOO] = new TextureDictionaryEntry("lower_tattoo", TRUE, BAKED_NUM_INDICES, "", WT_TATTOO);
mTextureMap[TEX_HEAD_BAKED] = new TextureDictionaryEntry("head-baked", FALSE, BAKED_HEAD);
mTextureMap[TEX_UPPER_BAKED] = new TextureDictionaryEntry("upper-baked", FALSE, BAKED_UPPER);
mTextureMap[TEX_LOWER_BAKED] = new TextureDictionaryEntry("lower-baked", FALSE, BAKED_LOWER);
mTextureMap[TEX_EYES_BAKED] = new TextureDictionaryEntry("eyes-baked", FALSE, BAKED_EYES);
mTextureMap[TEX_HAIR_BAKED] = new TextureDictionaryEntry("hair-baked", FALSE, BAKED_HAIR);
mTextureMap[TEX_SKIRT_BAKED] = new TextureDictionaryEntry("skirt-baked", FALSE, BAKED_SKIRT);
addEntry(TEX_HEAD_BODYPAINT, new TextureEntry("head_bodypaint", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_SKIN));
addEntry(TEX_UPPER_SHIRT, new TextureEntry("upper_shirt", TRUE, BAKED_NUM_INDICES, "UIImgDefaultShirtUUID", LLWearableType::WT_SHIRT));
addEntry(TEX_LOWER_PANTS, new TextureEntry("lower_pants", TRUE, BAKED_NUM_INDICES, "UIImgDefaultPantsUUID", LLWearableType::WT_PANTS));
addEntry(TEX_EYES_IRIS, new TextureEntry("eyes_iris", TRUE, BAKED_NUM_INDICES, "UIImgDefaultEyesUUID", LLWearableType::WT_EYES));
addEntry(TEX_HAIR, new TextureEntry("hair_grain", TRUE, BAKED_NUM_INDICES, "UIImgDefaultHairUUID", LLWearableType::WT_HAIR));
addEntry(TEX_UPPER_BODYPAINT, new TextureEntry("upper_bodypaint", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_SKIN));
addEntry(TEX_LOWER_BODYPAINT, new TextureEntry("lower_bodypaint", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_SKIN));
addEntry(TEX_LOWER_SHOES, new TextureEntry("lower_shoes", TRUE, BAKED_NUM_INDICES, "UIImgDefaultShoesUUID", LLWearableType::WT_SHOES));
addEntry(TEX_LOWER_SOCKS, new TextureEntry("lower_socks", TRUE, BAKED_NUM_INDICES, "UIImgDefaultSocksUUID", LLWearableType::WT_SOCKS));
addEntry(TEX_UPPER_JACKET, new TextureEntry("upper_jacket", TRUE, BAKED_NUM_INDICES, "UIImgDefaultJacketUUID", LLWearableType::WT_JACKET));
addEntry(TEX_LOWER_JACKET, new TextureEntry("lower_jacket", TRUE, BAKED_NUM_INDICES, "UIImgDefaultJacketUUID", LLWearableType::WT_JACKET));
addEntry(TEX_UPPER_GLOVES, new TextureEntry("upper_gloves", TRUE, BAKED_NUM_INDICES, "UIImgDefaultGlovesUUID", LLWearableType::WT_GLOVES));
addEntry(TEX_UPPER_UNDERSHIRT, new TextureEntry("upper_undershirt", TRUE, BAKED_NUM_INDICES, "UIImgDefaultUnderwearUUID", LLWearableType::WT_UNDERSHIRT));
addEntry(TEX_LOWER_UNDERPANTS, new TextureEntry("lower_underpants", TRUE, BAKED_NUM_INDICES, "UIImgDefaultUnderwearUUID", LLWearableType::WT_UNDERPANTS));
addEntry(TEX_SKIRT, new TextureEntry("skirt", TRUE, BAKED_NUM_INDICES, "UIImgDefaultSkirtUUID", LLWearableType::WT_SKIRT));
addEntry(TEX_LOWER_ALPHA, new TextureEntry("lower_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", LLWearableType::WT_ALPHA));
addEntry(TEX_UPPER_ALPHA, new TextureEntry("upper_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", LLWearableType::WT_ALPHA));
addEntry(TEX_HEAD_ALPHA, new TextureEntry("head_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", LLWearableType::WT_ALPHA));
addEntry(TEX_EYES_ALPHA, new TextureEntry("eyes_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", LLWearableType::WT_ALPHA));
addEntry(TEX_HAIR_ALPHA, new TextureEntry("hair_alpha", TRUE, BAKED_NUM_INDICES, "UIImgDefaultAlphaUUID", LLWearableType::WT_ALPHA));
addEntry(TEX_HEAD_TATTOO, new TextureEntry("head_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_TATTOO));
addEntry(TEX_UPPER_TATTOO, new TextureEntry("upper_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_TATTOO));
addEntry(TEX_LOWER_TATTOO, new TextureEntry("lower_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_TATTOO));
addEntry(TEX_HEAD_BAKED, new TextureEntry("head-baked", FALSE, BAKED_HEAD));
addEntry(TEX_UPPER_BAKED, new TextureEntry("upper-baked", FALSE, BAKED_UPPER));
addEntry(TEX_LOWER_BAKED, new TextureEntry("lower-baked", FALSE, BAKED_LOWER));
addEntry(TEX_EYES_BAKED, new TextureEntry("eyes-baked", FALSE, BAKED_EYES));
addEntry(TEX_HAIR_BAKED, new TextureEntry("hair-baked", FALSE, BAKED_HAIR));
addEntry(TEX_SKIRT_BAKED, new TextureEntry("skirt-baked", FALSE, BAKED_SKIRT));
}
LLVOAvatarDictionary::BakedTextures::BakedTextures()
{
// Baked textures
mBakedTextureMap[BAKED_HEAD] = new BakedDictionaryEntry(TEX_HEAD_BAKED, "head", 3, TEX_HEAD_BODYPAINT, TEX_HEAD_TATTOO, TEX_HEAD_ALPHA);
mBakedTextureMap[BAKED_UPPER] = new BakedDictionaryEntry(TEX_UPPER_BAKED, "upper_body", 7, TEX_UPPER_SHIRT, TEX_UPPER_BODYPAINT, TEX_UPPER_JACKET, TEX_UPPER_GLOVES, TEX_UPPER_UNDERSHIRT, TEX_UPPER_TATTOO, TEX_UPPER_ALPHA);
mBakedTextureMap[BAKED_LOWER] = new BakedDictionaryEntry(TEX_LOWER_BAKED, "lower_body", 8, TEX_LOWER_PANTS, TEX_LOWER_BODYPAINT, TEX_LOWER_SHOES, TEX_LOWER_SOCKS, TEX_LOWER_JACKET, TEX_LOWER_UNDERPANTS, TEX_LOWER_TATTOO, TEX_LOWER_ALPHA);
mBakedTextureMap[BAKED_EYES] = new BakedDictionaryEntry(TEX_EYES_BAKED, "eyes", 2, TEX_EYES_IRIS, TEX_EYES_ALPHA);
mBakedTextureMap[BAKED_SKIRT] = new BakedDictionaryEntry(TEX_SKIRT_BAKED, "skirt", 1, TEX_SKIRT);
mBakedTextureMap[BAKED_HAIR] = new BakedDictionaryEntry(TEX_HAIR_BAKED, "hair", 2, TEX_HAIR, TEX_HAIR_ALPHA);
// Meshes
mMeshMap[MESH_ID_HAIR] = new MeshDictionaryEntry(BAKED_HAIR, "hairMesh", 6, LLViewerJoint::PN_4);
mMeshMap[MESH_ID_HEAD] = new MeshDictionaryEntry(BAKED_HEAD, "headMesh", 5, LLViewerJoint::PN_5);
mMeshMap[MESH_ID_EYELASH] = new MeshDictionaryEntry(BAKED_HEAD, "eyelashMesh", 1, LLViewerJoint::PN_0); // no baked mesh associated currently
mMeshMap[MESH_ID_UPPER_BODY] = new MeshDictionaryEntry(BAKED_UPPER, "upperBodyMesh", 5, LLViewerJoint::PN_1);
mMeshMap[MESH_ID_LOWER_BODY] = new MeshDictionaryEntry(BAKED_LOWER, "lowerBodyMesh", 5, LLViewerJoint::PN_2);
mMeshMap[MESH_ID_EYEBALL_LEFT] = new MeshDictionaryEntry(BAKED_EYES, "eyeBallLeftMesh", 2, LLViewerJoint::PN_3);
mMeshMap[MESH_ID_EYEBALL_RIGHT] = new MeshDictionaryEntry(BAKED_EYES, "eyeBallRightMesh", 2, LLViewerJoint::PN_3);
mMeshMap[MESH_ID_SKIRT] = new MeshDictionaryEntry(BAKED_SKIRT, "skirtMesh", 5, LLViewerJoint::PN_5);
addEntry(BAKED_HEAD, new BakedEntry(TEX_HEAD_BAKED,
"head", "a4b9dc38-e13b-4df9-b284-751efb0566ff",
3, TEX_HEAD_BODYPAINT, TEX_HEAD_TATTOO, TEX_HEAD_ALPHA,
5, LLWearableType::WT_SHAPE, LLWearableType::WT_SKIN, LLWearableType::WT_HAIR, LLWearableType::WT_TATTOO, LLWearableType::WT_ALPHA));
// Wearables
mWearableMap[BAKED_HEAD] = new WearableDictionaryEntry("18ded8d6-bcfc-e415-8539-944c0f5ea7a6", 5, WT_SHAPE, WT_SKIN, WT_HAIR, WT_TATTOO, WT_ALPHA);
mWearableMap[BAKED_UPPER] = new WearableDictionaryEntry("338c29e3-3024-4dbb-998d-7c04cf4fa88f", 8, WT_SHAPE, WT_SKIN, WT_SHIRT, WT_JACKET, WT_GLOVES, WT_UNDERSHIRT, WT_TATTOO, WT_ALPHA);
mWearableMap[BAKED_LOWER] = new WearableDictionaryEntry("91b4a2c7-1b1a-ba16-9a16-1f8f8dcc1c3f", 9, WT_SHAPE, WT_SKIN, WT_PANTS, WT_SHOES, WT_SOCKS, WT_JACKET, WT_UNDERPANTS, WT_TATTOO, WT_ALPHA);
mWearableMap[BAKED_EYES] = new WearableDictionaryEntry("b2cf28af-b840-1071-3c6a-78085d8128b5", 2, WT_EYES, WT_ALPHA);
mWearableMap[BAKED_SKIRT] = new WearableDictionaryEntry("ea800387-ea1a-14e0-56cb-24f2022f969a", 1, WT_SKIRT);
mWearableMap[BAKED_HAIR] = new WearableDictionaryEntry("0af1ef7c-ad24-11dd-8790-001f5bf833e8", 2, WT_HAIR, WT_ALPHA);
addEntry(BAKED_UPPER, new BakedEntry(TEX_UPPER_BAKED,
"upper_body", "5943ff64-d26c-4a90-a8c0-d61f56bd98d4",
7, TEX_UPPER_SHIRT,TEX_UPPER_BODYPAINT, TEX_UPPER_JACKET,
TEX_UPPER_GLOVES, TEX_UPPER_UNDERSHIRT, TEX_UPPER_TATTOO, TEX_UPPER_ALPHA,
8, LLWearableType::WT_SHAPE, LLWearableType::WT_SKIN, LLWearableType::WT_SHIRT, LLWearableType::WT_JACKET, LLWearableType::WT_GLOVES, LLWearableType::WT_UNDERSHIRT, LLWearableType::WT_TATTOO, LLWearableType::WT_ALPHA));
addEntry(BAKED_LOWER, new BakedEntry(TEX_LOWER_BAKED,
"lower_body", "2944ee70-90a7-425d-a5fb-d749c782ed7d",
8, TEX_LOWER_PANTS,TEX_LOWER_BODYPAINT,TEX_LOWER_SHOES, TEX_LOWER_SOCKS,
TEX_LOWER_JACKET, TEX_LOWER_UNDERPANTS, TEX_LOWER_TATTOO, TEX_LOWER_ALPHA,
9, LLWearableType::WT_SHAPE, LLWearableType::WT_SKIN, LLWearableType::WT_PANTS, LLWearableType::WT_SHOES, LLWearableType::WT_SOCKS, LLWearableType::WT_JACKET, LLWearableType::WT_UNDERPANTS, LLWearableType::WT_TATTOO, LLWearableType::WT_ALPHA));
addEntry(BAKED_EYES, new BakedEntry(TEX_EYES_BAKED,
"eyes", "27b1bc0f-979f-4b13-95fe-b981c2ba9788",
2, TEX_EYES_IRIS, TEX_EYES_ALPHA,
2, LLWearableType::WT_EYES, LLWearableType::WT_ALPHA));
addEntry(BAKED_SKIRT, new BakedEntry(TEX_SKIRT_BAKED,
"skirt", "03e7e8cb-1368-483b-b6f3-74850838ba63",
1, TEX_SKIRT,
1, LLWearableType::WT_SKIRT));
addEntry(BAKED_HAIR, new BakedEntry(TEX_HAIR_BAKED,
"hair", "a60e85a9-74e8-48d8-8a2d-8129f28d9b61",
2, TEX_HAIR, TEX_HAIR_ALPHA,
2, LLWearableType::WT_HAIR, LLWearableType::WT_ALPHA));
}
LLVOAvatarDictionary::Meshes::Meshes()
{
// Meshes
addEntry(MESH_ID_HAIR, new MeshEntry(BAKED_HAIR, "hairMesh", 6, LLViewerJoint::PN_4));
addEntry(MESH_ID_HEAD, new MeshEntry(BAKED_HEAD, "headMesh", 5, LLViewerJoint::PN_5));
addEntry(MESH_ID_EYELASH, new MeshEntry(BAKED_HEAD, "eyelashMesh", 1, LLViewerJoint::PN_0)); // no baked mesh associated currently
addEntry(MESH_ID_UPPER_BODY, new MeshEntry(BAKED_UPPER, "upperBodyMesh", 5, LLViewerJoint::PN_1));
addEntry(MESH_ID_LOWER_BODY, new MeshEntry(BAKED_LOWER, "lowerBodyMesh", 5, LLViewerJoint::PN_2));
addEntry(MESH_ID_EYEBALL_LEFT, new MeshEntry(BAKED_EYES, "eyeBallLeftMesh", 2, LLViewerJoint::PN_3));
addEntry(MESH_ID_EYEBALL_RIGHT, new MeshEntry(BAKED_EYES, "eyeBallRightMesh", 2, LLViewerJoint::PN_3));
addEntry(MESH_ID_SKIRT, new MeshEntry(BAKED_SKIRT, "skirtMesh", 5, LLViewerJoint::PN_5));
}
/*
@@ -108,18 +135,22 @@ void LLVOAvatarDictionary::initData()
LLVOAvatarDictionary::LLVOAvatarDictionary()
{
initData();
createAssociations();
}
//virtual
LLVOAvatarDictionary::~LLVOAvatarDictionary()
{
}
// Baked textures are composites of textures; for each such composited texture,
// map it to the baked texture.
void LLVOAvatarDictionary::createAssociations()
{
for (baked_map_t::const_iterator iter = mBakedTextureMap.begin(); iter != mBakedTextureMap.end(); iter++)
for (BakedTextures::const_iterator iter = mBakedTextures.begin(); iter != mBakedTextures.end(); iter++)
{
const EBakedTextureIndex baked_index = (iter->first);
const BakedDictionaryEntry *dict = (iter->second);
const BakedEntry *dict = (iter->second);
// For each texture that this baked texture index affects, associate those textures
// with this baked texture index.
@@ -128,19 +159,19 @@ void LLVOAvatarDictionary::createAssociations()
local_texture_iter++)
{
const ETextureIndex local_texture_index = (ETextureIndex) *local_texture_iter;
mTextureMap[local_texture_index]->mIsUsedByBakedTexture = true;
mTextureMap[local_texture_index]->mBakedTextureIndex = baked_index;
mTextures[local_texture_index]->mIsUsedByBakedTexture = true;
mTextures[local_texture_index]->mBakedTextureIndex = baked_index;
}
}
}
LLVOAvatarDictionary::TextureDictionaryEntry::TextureDictionaryEntry(const std::string &name,
LLVOAvatarDictionary::TextureEntry::TextureEntry(const std::string &name,
bool is_local_texture,
EBakedTextureIndex baked_texture_index,
const std::string &default_image_name,
EWearableType wearable_type) :
mName(name),
LLWearableType::EType wearable_type) :
LLDictionaryEntry(name),
mIsLocalTexture(is_local_texture),
mIsBakedTexture(!is_local_texture),
mIsUsedByBakedTexture(baked_texture_index != BAKED_NUM_INDICES),
@@ -150,87 +181,87 @@ LLVOAvatarDictionary::TextureDictionaryEntry::TextureDictionaryEntry(const std::
{
}
LLVOAvatarDictionary::MeshDictionaryEntry::MeshDictionaryEntry(EBakedTextureIndex baked_index,
const std::string &name,
U8 level,
LLViewerJoint::PickName pick) :
LLVOAvatarDictionary::MeshEntry::MeshEntry(EBakedTextureIndex baked_index,
const std::string &name,
U8 level,
LLViewerJoint::PickName pick) :
LLDictionaryEntry(name),
mBakedID(baked_index),
mName(name),
mLOD(level),
mPickName(pick)
{
}
LLVOAvatarDictionary::BakedDictionaryEntry::BakedDictionaryEntry(ETextureIndex tex_index,
const std::string &name,
U32 num_local_textures, ... ) :
mName(name),
LLVOAvatarDictionary::BakedEntry::BakedEntry(ETextureIndex tex_index,
const std::string &name,
const std::string &hash_name,
U32 num_local_textures,
... ) :
LLDictionaryEntry(name),
mWearablesHashID(LLUUID(hash_name)),
mTextureIndex(tex_index)
{
va_list argp;
va_start(argp, num_local_textures);
// Read in local textures
for (U8 i=0; i < num_local_textures; i++)
{
ETextureIndex t = (ETextureIndex)va_arg(argp,int);
mLocalTextures.push_back(t);
}
}
LLVOAvatarDictionary::WearableDictionaryEntry::WearableDictionaryEntry(const std::string &hash_name,
U32 num_wearables, ... ) :
mHashID(LLUUID(hash_name))
{
va_list argp;
va_start(argp, num_wearables);
// Read in number of wearables
const U32 num_wearables = (U32)va_arg(argp,int);
// Read in wearables
for (U8 i=0; i < num_wearables; i++)
{
EWearableType t = (EWearableType)va_arg(argp,int);
mWearablesVec.push_back(t);
LLWearableType::EType t = (LLWearableType::EType)va_arg(argp,int);
mWearables.push_back(t);
}
}
//virtual
LLVOAvatarDictionary::~LLVOAvatarDictionary()
{
for (mesh_map_t::iterator iter = mMeshMap.begin(); iter != mMeshMap.end(); iter++)
delete (iter->second);
for (baked_map_t::iterator iter = mBakedTextureMap.begin(); iter != mBakedTextureMap.end(); iter++)
delete (iter->second);
for (texture_map_t::iterator iter = mTextureMap.begin(); iter != mTextureMap.end(); iter++)
delete (iter->second);
}
const LLVOAvatarDictionary::MeshDictionaryEntry *LLVOAvatarDictionary::getMesh(EMeshIndex index) const
{
mesh_map_t::const_iterator mesh_iter = mMeshMap.find(index);
if (mesh_iter == mMeshMap.end()) return NULL;
return mesh_iter->second;
}
const LLVOAvatarDictionary::BakedDictionaryEntry *LLVOAvatarDictionary::getBakedTexture(EBakedTextureIndex index) const
{
baked_map_t::const_iterator baked_iter = mBakedTextureMap.find(index);
if (baked_iter == mBakedTextureMap.end()) return NULL;
return baked_iter->second;
}
const LLVOAvatarDictionary::TextureDictionaryEntry *LLVOAvatarDictionary::getTexture(ETextureIndex index) const
{
texture_map_t::const_iterator texture_iter = mTextureMap.find(index);
if (texture_iter == mTextureMap.end()) return NULL;
return texture_iter->second;
}
const LLVOAvatarDictionary::WearableDictionaryEntry *LLVOAvatarDictionary::getWearable(EBakedTextureIndex index) const
{
wearable_map_t::const_iterator wearable_iter = mWearableMap.find(index);
if (wearable_iter == mWearableMap.end()) return NULL;
return wearable_iter->second;
}
ETextureIndex LLVOAvatarDefines::getTextureIndex(EBakedTextureIndex index)
// static
ETextureIndex LLVOAvatarDictionary::bakedToLocalTextureIndex(EBakedTextureIndex index)
{
return LLVOAvatarDictionary::getInstance()->getBakedTexture(index)->mTextureIndex;
}
//static
EBakedTextureIndex LLVOAvatarDictionary::findBakedByRegionName(std::string name)
{
U8 index = 0;
while (index < BAKED_NUM_INDICES)
{
const BakedEntry *be = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex) index);
if (be && be->mName.compare(name) == 0)
{
// baked texture found
return (EBakedTextureIndex) index;
}
index++;
}
// baked texture could not be found
return BAKED_NUM_INDICES;
}
//static
const LLUUID LLVOAvatarDictionary::getDefaultTextureImageID(ETextureIndex index)
{
const TextureEntry *texture_dict = getInstance()->getTexture(index);
const std::string &default_image_name = texture_dict->mDefaultImageName;
if (default_image_name == "")
{
return IMG_DEFAULT_AVATAR;
}
else
{
return LLUUID(gSavedSettings.getString(default_image_name));
}
}
// static
LLWearableType::EType LLVOAvatarDictionary::getTEWearableType(ETextureIndex index )
{
return getInstance()->getTexture(index)->mWearableType;
}

View File

@@ -37,6 +37,7 @@
#include <vector>
#include "llwearable.h"
#include "llviewerjoint.h"
#include "lldictionary.h"
namespace LLVOAvatarDefines
{
@@ -82,8 +83,6 @@ enum ETextureIndex
TEX_NUM_INDICES
};
typedef std::vector<ETextureIndex> texture_vec_t;
enum EBakedTextureIndex
{
BAKED_HEAD = 0,
@@ -94,7 +93,6 @@ enum EBakedTextureIndex
BAKED_HAIR,
BAKED_NUM_INDICES
};
typedef std::vector<EBakedTextureIndex> bakedtexture_vec_t;
// Reference IDs for each mesh. Used as indices for vector of joints
enum EMeshIndex
@@ -109,18 +107,14 @@ enum EMeshIndex
MESH_ID_SKIRT,
MESH_ID_NUM_INDICES
};
//--------------------------------------------------------------------
// Vector Types
//--------------------------------------------------------------------
typedef std::vector<ETextureIndex> texture_vec_t;
typedef std::vector<EBakedTextureIndex> bakedtexture_vec_t;
typedef std::vector<EMeshIndex> mesh_vec_t;
typedef std::vector<EWearableType> wearables_vec_t;
//--------------------------------------------------------------------------------
// Convenience Functions
//--------------------------------------------------------------------------------
// Convert from baked texture to associated texture; e.g. BAKED_HEAD -> TEX_HEAD_BAKED
ETextureIndex getTextureIndex(EBakedTextureIndex t);
typedef std::vector<LLWearableType::EType> wearables_vec_t;
//------------------------------------------------------------------------
// LLVOAvatarDictionary
@@ -132,20 +126,28 @@ ETextureIndex getTextureIndex(EBakedTextureIndex t);
//------------------------------------------------------------------------
class LLVOAvatarDictionary : public LLSingleton<LLVOAvatarDictionary>
{
//--------------------------------------------------------------------
// Constructors and Destructors
//--------------------------------------------------------------------
public:
LLVOAvatarDictionary();
virtual ~LLVOAvatarDictionary();
private:
void createAssociations();
struct TextureDictionaryEntry
//--------------------------------------------------------------------
// Local and baked textures
//--------------------------------------------------------------------
public:
struct TextureEntry : public LLDictionaryEntry
{
TextureDictionaryEntry(const std::string &name,
TextureEntry(const std::string &name,
bool is_local_texture,
EBakedTextureIndex baked_texture_index = BAKED_NUM_INDICES,
const std::string &default_image_name = "",
EWearableType wearable_type = WT_INVALID);
const std::string mName;
LLWearableType::EType wearable_type = LLWearableType::WT_INVALID);
const std::string mDefaultImageName;
const EWearableType mWearableType;
const LLWearableType::EType mWearableType;
// It's either a local texture xor baked
BOOL mIsLocalTexture;
BOOL mIsBakedTexture;
@@ -153,14 +155,24 @@ public:
BOOL mIsUsedByBakedTexture;
EBakedTextureIndex mBakedTextureIndex;
};
struct MeshDictionaryEntry
struct Textures : public LLDictionary<ETextureIndex, TextureEntry>
{
MeshDictionaryEntry(EBakedTextureIndex baked_index,
Textures();
} mTextures;
const TextureEntry* getTexture(ETextureIndex index) const { return mTextures.lookup(index); }
const Textures& getTextures() const { return mTextures; }
//--------------------------------------------------------------------
// Meshes
//--------------------------------------------------------------------
public:
struct MeshEntry : public LLDictionaryEntry
{
MeshEntry(EBakedTextureIndex baked_index,
const std::string &name,
U8 level,
LLViewerJoint::PickName pick);
const std::string mName; // names of mesh types as they are used in avatar_lad.xml
// Levels of Detail for each mesh. Must match levels of detail present in avatar_lad.xml
// Otherwise meshes will be unable to be found, or levels of detail will be ignored
const U8 mLOD;
@@ -168,47 +180,52 @@ public:
const LLViewerJoint::PickName mPickName;
};
struct BakedDictionaryEntry
struct Meshes : public LLDictionary<EMeshIndex, MeshEntry>
{
BakedDictionaryEntry(ETextureIndex tex_index,
const std::string &name,
U32 num_local_textures, ... );
Meshes();
} mMeshes;
const MeshEntry* getMesh(EMeshIndex index) const { return mMeshes.lookup(index); }
const Meshes& getMeshes() const { return mMeshes; }
//--------------------------------------------------------------------
// Baked Textures
//--------------------------------------------------------------------
public:
struct BakedEntry : public LLDictionaryEntry
{
BakedEntry(ETextureIndex tex_index,
const std::string &name, // unused, but necessary for templating.
const std::string &hash_name,
U32 num_local_textures, ... ); // # local textures, local texture list, # wearables, wearable list
// Local Textures
const ETextureIndex mTextureIndex;
const std::string mName;
texture_vec_t mLocalTextures;
texture_vec_t mLocalTextures;
// Wearables
const LLUUID mWearablesHashID;
wearables_vec_t mWearables;
};
struct WearableDictionaryEntry
struct BakedTextures: public LLDictionary<EBakedTextureIndex, BakedEntry>
{
WearableDictionaryEntry(const std::string &hash_name,
U32 num_wearables, ... );
const LLUUID mHashID;
wearables_vec_t mWearablesVec;
};
typedef std::map<EBakedTextureIndex, BakedDictionaryEntry*> baked_map_t;
typedef std::map<ETextureIndex, TextureDictionaryEntry*> texture_map_t;
typedef std::map<EMeshIndex, MeshDictionaryEntry*> mesh_map_t;
typedef std::map<EBakedTextureIndex, WearableDictionaryEntry*> wearable_map_t;
const MeshDictionaryEntry *getMesh(EMeshIndex index) const;
const BakedDictionaryEntry *getBakedTexture(EBakedTextureIndex index) const;
const TextureDictionaryEntry *getTexture(ETextureIndex index) const;
const WearableDictionaryEntry *getWearable(EBakedTextureIndex index) const;
const texture_map_t &getTextures() const { return mTextureMap; }
const baked_map_t &getBakedTextures() const { return mBakedTextureMap; }
const mesh_map_t &getMeshes() const { return mMeshMap; }
const wearable_map_t &getWearables() const { return mWearableMap; }
BakedTextures();
} mBakedTextures;
const BakedEntry* getBakedTexture(EBakedTextureIndex index) const { return mBakedTextures.lookup(index); }
const BakedTextures& getBakedTextures() const { return mBakedTextures; }
private:
void initData();
void createAssociations();
//--------------------------------------------------------------------
// Convenience Functions
//--------------------------------------------------------------------
public:
// Convert from baked texture to associated texture; e.g. BAKED_HEAD -> TEX_HEAD_BAKED
static ETextureIndex bakedToLocalTextureIndex(EBakedTextureIndex t);
texture_map_t mTextureMap;
baked_map_t mBakedTextureMap;
mesh_map_t mMeshMap;
wearable_map_t mWearableMap;
// find a baked texture index based on its name
static EBakedTextureIndex findBakedByRegionName(std::string name);
static const LLUUID getDefaultTextureImageID(ETextureIndex index);
// Given a texture entry, determine which wearable type owns it.
static LLWearableType::EType getTEWearableType(ETextureIndex index);
}; // End LLVOAvatarDictionary

View File

@@ -469,6 +469,40 @@ void LLVOAvatarSelf::stopMotionFromSource(const LLUUID& source_id)
object->mFlags &= ~FLAGS_ANIM_SOURCE;
}
}
//virtual
void LLVOAvatarSelf::removeMissingBakedTextures()
{
BOOL removed = FALSE;
for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
{
const S32 te = mBakedTextureDatas[i].mTextureIndex;
const LLViewerTexture* tex = getTEImage(te);
// Replace with default if we can't find the asset, assuming the
// default is actually valid (which it should be unless something
// is seriously wrong).
if (!tex || tex->isMissingAsset())
{
LLViewerTexture *imagep = LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT_AVATAR);
if (imagep)
{
setTEImage(te, imagep);
removed = TRUE;
}
}
}
if (removed)
{
for(U32 i = 0; i < mBakedTextureDatas.size(); i++)
{
invalidateComposite(mBakedTextureDatas[i].mTexLayerSet, FALSE);
}
updateMeshTextures();
requestLayerSetUploads();
}
}
//virtual
void LLVOAvatarSelf::updateRegion(LLViewerRegion *regionp)
{

View File

@@ -133,6 +133,8 @@ private:
/** Rendering
** **
*******************************************************************************/
protected:
/*virtual*/ void removeMissingBakedTextures();
/********************************************************************************
** **
** MESHES

View File

@@ -41,6 +41,7 @@
#include "llagent.h"
#include "llagentcamera.h"
#include "llagentwearables.h"
#include "lldictionary.h"
#include "llnotificationsutil.h"
#include "llassetuploadresponders.h"
#include "llviewerwindow.h"
@@ -57,83 +58,13 @@ using namespace LLVOAvatarDefines;
// static
S32 LLWearable::sCurrentDefinitionVersion = 1;
// static
const std::string LLWearable::sTypeName[ WT_COUNT+1 ] =
{
"shape",
"skin",
"hair",
"eyes",
"shirt",
"pants",
"shoes",
"socks",
"jacket",
"gloves",
"undershirt",
"underpants",
"skirt",
"alpha",
"tattoo",
"physics",
"invalid"
};
// static
const std::string LLWearable::sTypeLabel[ WT_COUNT+1 ] =
{
"Shape",
"Skin",
"Hair",
"Eyes",
"Shirt",
"Pants",
"Shoes",
"Socks",
"Jacket",
"Gloves",
"Undershirt",
"Underpants",
"Skirt",
"Alpha",
"Tattoo",
"Physics",
"invalid"
};
// static
LLAssetType::EType LLWearable::typeToAssetType(EWearableType wearable_type)
{
switch( wearable_type )
{
case WT_SHAPE:
case WT_SKIN:
case WT_HAIR:
case WT_EYES:
return LLAssetType::AT_BODYPART;
case WT_SHIRT:
case WT_PANTS:
case WT_SHOES:
case WT_SOCKS:
case WT_JACKET:
case WT_GLOVES:
case WT_UNDERSHIRT:
case WT_UNDERPANTS:
case WT_SKIRT:
case WT_ALPHA:
case WT_TATTOO:
case WT_PHYSICS:
return LLAssetType::AT_CLOTHING;
default:
return LLAssetType::AT_NONE;
}
}
// Private local functions
static std::string terse_F32_to_string(F32 f);
static std::string asset_id_to_filename(const LLUUID &asset_id);
LLWearable::LLWearable(const LLTransactionID& transaction_id) :
mDefinitionVersion(LLWearable::sCurrentDefinitionVersion),
mType(WT_SHAPE)
mType(LLWearableType::WT_INVALID)
{
mTransactionID = transaction_id;
mAssetID = mTransactionID.makeAssetID(gAgent.getSecureSessionID());
@@ -141,7 +72,7 @@ LLWearable::LLWearable(const LLTransactionID& transaction_id) :
LLWearable::LLWearable(const LLAssetID& asset_id) :
mDefinitionVersion( LLWearable::sCurrentDefinitionVersion ),
mType(WT_SHAPE)
mType(LLWearableType::WT_INVALID)
{
mAssetID = asset_id;
mTransactionID.setNull();
@@ -151,55 +82,22 @@ LLWearable::~LLWearable()
{
}
// static
EWearableType LLWearable::typeNameToType( const std::string& type_name )
const std::string& LLWearable::getTypeLabel() const
{
for( S32 i = 0; i < WT_COUNT; i++ )
{
if( type_name == LLWearable::sTypeName[ i ] )
{
return (EWearableType)i;
}
}
return WT_INVALID;
return LLWearableType::getTypeLabel(mType);
}
std::string terse_F32_to_string( F32 f )
const std::string& LLWearable::getTypeName() const
{
std::string r = llformat( "%.2f", f );
// "1.20" -> "1.2"
// "24.00" -> "24."
S32 len = r.length();
while( len > 0 && '0' == r[len - 1] )
{
r.erase(len-1, 1);
len--;
}
if( '.' == r[len - 1] )
{
// "24." -> "24"
r.erase(len-1, 1);
}
else
if( ('-' == r[0]) && ('0' == r[1]) )
{
// "-0.59" -> "-.59"
r.erase(1, 1);
}
else
if( '0' == r[0] )
{
// "0.59" -> ".59"
r.erase(0, 1);
}
return r;
return LLWearableType::getTypeName(mType);
}
LLAssetType::EType LLWearable::getAssetType() const
{
return LLWearableType::getAssetType(mType);
}
// reX: new function
BOOL LLWearable::FileExportParams( FILE* file )
{
@@ -244,7 +142,7 @@ BOOL LLWearable::FileExportTextures( FILE* file )
return TRUE;
}
BOOL LLWearable::exportFile( LLFILE* file )
BOOL LLWearable::exportFile(LLFILE* file) const
{
// header and version
if( fprintf( file, "LLWearable version %d\n", mDefinitionVersion ) < 0 )
@@ -290,7 +188,7 @@ BOOL LLWearable::exportFile( LLFILE* file )
return FALSE;
}
for (param_map_t::iterator iter = mVisualParamMap.begin();
for (param_map_t::const_iterator iter = mVisualParamMap.begin();
iter != mVisualParamMap.end(); ++iter)
{
S32 param_id = iter->first;
@@ -308,17 +206,16 @@ BOOL LLWearable::exportFile( LLFILE* file )
return FALSE;
}
for (te_map_t::iterator iter = mTEMap.begin();
for (te_map_t::const_iterator iter = mTEMap.begin();
iter != mTEMap.end(); ++iter)
{
S32 te = iter->first;
LLUUID& image_id = iter->second;
const LLUUID& image_id = iter->second;
if( fprintf( file, "%d %s\n", te, image_id.asString().c_str()) < 0 )
{
return FALSE;
}
}
return TRUE;
}
@@ -350,7 +247,7 @@ BOOL LLWearable::importFile( LLFILE* file )
}
// name
char next_char = fgetc( file ); /* Flawfinder: ignore */
int next_char = fgetc( file ); /* Flawfinder: ignore */
if( '\n' == next_char )
{
// no name
@@ -444,18 +341,17 @@ BOOL LLWearable::importFile( LLFILE* file )
llwarns << "Bad Wearable asset: bad type" << llendl;
return FALSE;
}
if( 0 <= type && type < WT_COUNT )
if( 0 <= type && type < LLWearableType::WT_COUNT )
{
mType = (EWearableType)type;
setType((LLWearableType::EType)type);
}
else
{
mType = WT_COUNT;
mType = LLWearableType::WT_COUNT;
llwarns << "Bad Wearable asset: bad type #" << type << llendl;
return FALSE;
}
// parameters header
S32 num_parameters = 0;
fields_read = fscanf( file, "parameters %d\n", &num_parameters );
@@ -519,14 +415,9 @@ BOOL LLWearable::importFile( LLFILE* file )
// Avatar parameter and texture definitions can change over time.
// This function returns true if parameters or textures have been added or removed
// since this wearable was created.
BOOL LLWearable::isOldVersion()
BOOL LLWearable::isOldVersion() const
{
LLVOAvatar* avatar = gAgentAvatarp;
llassert( avatar );
if( !avatar )
{
return FALSE;
}
if (!isAgentAvatarValid()) return FALSE;
if( LLWearable::sCurrentDefinitionVersion < mDefinitionVersion )
{
@@ -540,9 +431,9 @@ BOOL LLWearable::isOldVersion()
}
S32 param_count = 0;
for( LLViewerVisualParam* param = (LLViewerVisualParam*) avatar->getFirstVisualParam();
for( LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam();
param;
param = (LLViewerVisualParam*) avatar->getNextVisualParam() )
param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam() )
{
if( (param->getWearableType() == mType) && (param->isTweakable()) )
{
@@ -562,7 +453,7 @@ BOOL LLWearable::isOldVersion()
S32 te_count = 0;
for( S32 te = 0; te < TEX_NUM_INDICES; te++ )
{
if( LLVOAvatar::getTEWearableType((ETextureIndex) te ) == mType )
if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType)
{
te_count++;
if( !is_in_map(mTEMap, te ) )
@@ -586,19 +477,13 @@ BOOL LLWearable::isOldVersion()
// * If parameters or textures have been ADDED since the wearable was created,
// they are taken to have default values, so we consider the wearable clean
// only if those values are the same as the defaults.
BOOL LLWearable::isDirty()
BOOL LLWearable::isDirty() const
{
LLVOAvatar* avatar = gAgentAvatarp;
llassert( avatar );
if( !avatar )
{
return FALSE;
}
if (!isAgentAvatarValid()) return FALSE;
for( LLViewerVisualParam* param = (LLViewerVisualParam*) avatar->getFirstVisualParam();
for( LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam();
param;
param = (LLViewerVisualParam*) avatar->getNextVisualParam() )
param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam() )
{
if( (param->getWearableType() == mType) && (param->isTweakable()) )
{
@@ -607,12 +492,12 @@ BOOL LLWearable::isDirty()
U8 a = F32_to_U8( param->getWeight(), param->getMinWeight(), param->getMaxWeight() );
if(avatar->getAppearanceFlag() == true)
if(gAgentAvatarp->getAppearanceFlag() == true)
{
//boob
if(param->getID() == 507)
{
weight = get_if_there(mVisualParamMap, param->getID(), avatar->getActualBoobGrav());
weight = get_if_there(mVisualParamMap, param->getID(), gAgentAvatarp->getActualBoobGrav());
weight = llclamp( weight, param->getMinWeight(), param->getMaxWeight() );
}
/*//butt
@@ -634,17 +519,17 @@ BOOL LLWearable::isDirty()
//boob
if(param->getID() == 507)
{
a = F32_to_U8( avatar->getActualBoobGrav(), param->getMinWeight(), param->getMaxWeight() );
a = F32_to_U8( gAgentAvatarp->getActualBoobGrav(), param->getMinWeight(), param->getMaxWeight() );
}
/*//butt
if(param->getID() == 795)
{
a = F32_to_U8( avatar->getActualButtGrav(), param->getMinWeight(), param->getMaxWeight() );
a = F32_to_U8( gAgentAvatarp->getActualButtGrav(), param->getMinWeight(), param->getMaxWeight() );
}
//fat
if(param->getID() == 157)
{
a = F32_to_U8( avatar->getActualFatGrav(), param->getMinWeight(), param->getMaxWeight() );
a = F32_to_U8( gAgentAvatarp->getActualFatGrav(), param->getMinWeight(), param->getMaxWeight() );
}
*/
}
@@ -661,15 +546,15 @@ BOOL LLWearable::isDirty()
for( S32 te = 0; te < TEX_NUM_INDICES; te++ )
{
if( LLVOAvatar::getTEWearableType((ETextureIndex) te ) == mType )
if( LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te ) == mType )
{
LLViewerTexture* avatar_image = avatar->getTEImage( te );
LLViewerTexture* avatar_image = gAgentAvatarp->getTEImage( te );
if( !avatar_image )
{
llassert( 0 );
continue;
}
const LLUUID& image_id = get_if_there(mTEMap, te, LLVOAvatar::getDefaultTEImageID((ETextureIndex) te ) );
const LLUUID& image_id = get_if_there(mTEMap, te, LLVOAvatarDictionary::getDefaultTextureImageID((ETextureIndex) te ) );
if( avatar_image->getID() != image_id )
{
llwarns << "image ID " << avatar_image->getID() << " was changed." << llendl;
@@ -692,15 +577,10 @@ BOOL LLWearable::isDirty()
void LLWearable::setParamsToDefaults()
{
LLVOAvatar* avatar = gAgentAvatarp;
llassert( avatar );
if( !avatar )
{
return;
}
if (!isAgentAvatarValid()) return;
mVisualParamMap.clear();
for( LLVisualParam* param = avatar->getFirstVisualParam(); param; param = avatar->getNextVisualParam() )
for( LLVisualParam* param = gAgentAvatarp->getFirstVisualParam(); param; param = gAgentAvatarp->getNextVisualParam() )
{
if( (((LLViewerVisualParam*)param)->getWearableType() == mType ) && (param->isTweakable()) )
{
@@ -714,9 +594,9 @@ void LLWearable::setTexturesToDefaults()
mTEMap.clear();
for( S32 te = 0; te < TEX_NUM_INDICES; te++ )
{
if( LLVOAvatar::getTEWearableType((ETextureIndex) te ) == mType )
if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType)
{
mTEMap[te] = LLVOAvatar::getDefaultTEImageID((ETextureIndex) te );
mTEMap[te] = LLVOAvatarDictionary::getDefaultTextureImageID((ETextureIndex) te);
}
}
}
@@ -724,17 +604,12 @@ void LLWearable::setTexturesToDefaults()
// Updates the user's avatar's appearance
void LLWearable::writeToAvatar( BOOL set_by_user )
{
LLVOAvatar* avatar = gAgentAvatarp;
llassert( avatar );
if( !avatar )
{
return;
}
if (!isAgentAvatarValid()) return;
ESex old_sex = avatar->getSex();
ESex old_sex = gAgentAvatarp->getSex();
// Pull params
for( LLVisualParam* param = avatar->getFirstVisualParam(); param; param = avatar->getNextVisualParam() )
for( LLVisualParam* param = gAgentAvatarp->getFirstVisualParam(); param; param = gAgentAvatarp->getNextVisualParam() )
{
if( (((LLViewerVisualParam*)param)->getWearableType() == mType) && (param->isTweakable()) )
{
@@ -743,11 +618,11 @@ void LLWearable::writeToAvatar( BOOL set_by_user )
//ZOMG: When switching shapes from inventory
if(param_id == 507)
avatar->setActualBoobGrav(weight);
gAgentAvatarp->setActualBoobGrav(weight);
/*if(param_id == 795)
avatar->setActualButtGrav(weight);
gAgentAvatarp->setActualButtGrav(weight);
if(param_id == 157)
avatar->setActualFatGrav(weight);
gAgentAvatarp->setActualFatGrav(weight);
*/
// only animate with user-originated changes
@@ -757,7 +632,7 @@ void LLWearable::writeToAvatar( BOOL set_by_user )
}
else
{
avatar->setVisualParamWeight( param_id, weight, set_by_user );
gAgentAvatarp->setVisualParamWeight( param_id, weight, set_by_user );
}
}
}
@@ -765,21 +640,21 @@ void LLWearable::writeToAvatar( BOOL set_by_user )
// only interpolate with user-originated changes
if (set_by_user)
{
avatar->startAppearanceAnimation(TRUE, TRUE);
gAgentAvatarp->startAppearanceAnimation(TRUE, TRUE);
}
// Pull texture entries
for( S32 te = 0; te < TEX_NUM_INDICES; te++ )
{
if( LLVOAvatar::getTEWearableType((ETextureIndex) te ) == mType )
if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType)
{
const LLUUID& image_id = get_if_there(mTEMap, te, LLVOAvatar::getDefaultTEImageID((ETextureIndex) te ) );
const LLUUID& image_id = get_if_there(mTEMap, te, LLVOAvatarDictionary::getDefaultTextureImageID((ETextureIndex) te ) );
LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture( image_id );
avatar->setLocTexTE( te, image, set_by_user );
gAgentAvatarp->setLocTexTE( te, image, set_by_user );
}
}
avatar->updateVisualParams();
gAgentAvatarp->updateVisualParams();
if( gFloaterCustomize )
{
@@ -800,13 +675,13 @@ void LLWearable::writeToAvatar( BOOL set_by_user )
LLFloaterCustomize::setCurrentWearableType( mType );
}
ESex new_sex = avatar->getSex();
ESex new_sex = gAgentAvatarp->getSex();
if( old_sex != new_sex )
{
avatar->updateSexDependentLayerSets( set_by_user );
gAgentAvatarp->updateSexDependentLayerSets( set_by_user );
}
avatar->updateMeshTextures();
gAgentAvatarp->updateMeshTextures();
// if( set_by_user )
// {
@@ -816,31 +691,26 @@ void LLWearable::writeToAvatar( BOOL set_by_user )
// Updates the user's avatar's appearance, replacing this wearables' parameters and textures with default values.
// static
void LLWearable::removeFromAvatar( EWearableType type, BOOL set_by_user )
void LLWearable::removeFromAvatar( LLWearableType::EType type, BOOL upload_bake )
{
LLVOAvatar* avatar = gAgentAvatarp;
llassert( avatar );
if( !avatar )
{
return;
}
if (!isAgentAvatarValid()) return;
// You can't just remove body parts.
if( (type == WT_SHAPE) ||
(type == WT_SKIN) ||
(type == WT_HAIR) ||
(type == WT_EYES) )
if( (type == LLWearableType::WT_SHAPE) ||
(type == LLWearableType::WT_SKIN) ||
(type == LLWearableType::WT_HAIR) ||
(type == LLWearableType::WT_EYES) )
{
return;
}
// Pull params
for( LLVisualParam* param = avatar->getFirstVisualParam(); param; param = avatar->getNextVisualParam() )
for( LLVisualParam* param = gAgentAvatarp->getFirstVisualParam(); param; param = gAgentAvatarp->getNextVisualParam() )
{
if( (((LLViewerVisualParam*)param)->getWearableType() == type) && (param->isTweakable()) )
{
S32 param_id = param->getID();
avatar->setVisualParamWeight( param_id, param->getDefaultWeight(), set_by_user );
gAgentAvatarp->setVisualParamWeight( param_id, param->getDefaultWeight(), upload_bake );
}
}
@@ -848,9 +718,9 @@ void LLWearable::removeFromAvatar( EWearableType type, BOOL set_by_user )
LLViewerTexture* image =LLViewerTextureManager::getFetchedTexture( IMG_DEFAULT_AVATAR );
for( S32 te = 0; te < TEX_NUM_INDICES; te++ )
{
if( LLVOAvatar::getTEWearableType((ETextureIndex) te ) == type )
if( LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te ) == type )
{
avatar->setLocTexTE( te, image, set_by_user );
gAgentAvatarp->setLocTexTE( te, image, upload_bake );
}
}
@@ -859,16 +729,78 @@ void LLWearable::removeFromAvatar( EWearableType type, BOOL set_by_user )
gFloaterCustomize->setWearable(type, NULL, PERM_ALL, TRUE);
}
avatar->updateVisualParams();
avatar->updateMeshTextures();
gAgentAvatarp->updateVisualParams();
gAgentAvatarp->updateMeshTextures();
// if( set_by_user )
// if( upload_bake )
// {
// gAgent.sendAgentSetAppearance();
// }
}
// Does not copy mAssetID.
// Definition version is current: removes obsolete enties and creates default values for new ones.
void LLWearable::copyDataFrom( LLWearable* src )
{
if (!isAgentAvatarValid()) return;
mDefinitionVersion = LLWearable::sCurrentDefinitionVersion;
mName = src->mName;
mDescription = src->mDescription;
mPermissions = src->mPermissions;
mSaleInfo = src->mSaleInfo;
setType(src->mType);
// Deep copy of mVisualParamMap (copies only those params that are current, filling in defaults where needed)
for( LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam();
param;
param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam() )
{
if( (param->getWearableType() == mType) && (param->isTweakable()) )
{
S32 id = param->getID();
F32 weight = get_if_there(src->mVisualParamMap, id, param->getDefaultWeight() );
//llwarns << "------------------------------" << llendl;
//llwarns << "copydatafrom" << llendl;
//llwarns << "------------------------------" << llendl;
//if(id == 507)
//{
// llwarns << "weight = " << weight << llendl;
// llwarns << "actual = " << avatar->getActualBoobGrav() << llendl;
// llwarns << "mVisualParamMap[id] = " << mVisualParamMap[id] << llendl;
//}
//pretty sure right
if(id == 507)
gAgentAvatarp->setActualBoobGrav(weight);
/*if(id == 795)
gAgentAvatarp->setActualButtGrav(weight);
if(id == 157)
gAgentAvatarp->setActualFatGrav(weight);
*/
mVisualParamMap[id] = weight;
}
}
// Deep copy of mTEMap (copies only those tes that are current, filling in defaults where needed)
for( S32 te = 0; te < TEX_NUM_INDICES; te++ )
{
if( LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te ) == mType )
{
const LLUUID& image_id = get_if_there(src->mTEMap, te, LLVOAvatarDictionary::getDefaultTextureImageID((ETextureIndex) te ) );
mTEMap[te] = image_id;
}
}
}
void LLWearable::setType(LLWearableType::EType type)
{
mType = type;
}
// Updates asset from the user's avatar
void LLWearable::readFromAvatar()
@@ -910,7 +842,7 @@ void LLWearable::readFromAvatar()
mTEMap.clear();
for( S32 te = 0; te < TEX_NUM_INDICES; te++ )
{
if( LLVOAvatar::getTEWearableType((ETextureIndex) te ) == mType )
if( LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te ) == mType )
{
LLViewerTexture* image = avatar->getTEImage( te );
if( image )
@@ -926,84 +858,19 @@ void LLWearable::readFromAvatar()
//}
}
// Does not copy mAssetID.
// Definition version is current: removes obsolete enties and creates default values for new ones.
void LLWearable::copyDataFrom( LLWearable* src )
{
LLVOAvatar* avatar = gAgentAvatarp;
llassert( avatar );
if( !avatar )
{
return;
}
mDefinitionVersion = LLWearable::sCurrentDefinitionVersion;
mName = src->mName;
mDescription = src->mDescription;
mPermissions = src->mPermissions;
mSaleInfo = src->mSaleInfo;
mType = src->mType;
// Deep copy of mVisualParamMap (copies only those params that are current, filling in defaults where needed)
for( LLViewerVisualParam* param = (LLViewerVisualParam*) avatar->getFirstVisualParam();
param;
param = (LLViewerVisualParam*) avatar->getNextVisualParam() )
{
if( (param->getWearableType() == mType) && (param->isTweakable()) )
{
S32 id = param->getID();
F32 weight = get_if_there(src->mVisualParamMap, id, param->getDefaultWeight() );
//llwarns << "------------------------------" << llendl;
//llwarns << "copydatafrom" << llendl;
//llwarns << "------------------------------" << llendl;
//if(id == 507)
//{
// llwarns << "weight = " << weight << llendl;
// llwarns << "actual = " << avatar->getActualBoobGrav() << llendl;
// llwarns << "mVisualParamMap[id] = " << mVisualParamMap[id] << llendl;
//}
//pretty sure right
if(id == 507)
avatar->setActualBoobGrav(weight);
/*if(id == 795)
avatar->setActualButtGrav(weight);
if(id == 157)
avatar->setActualFatGrav(weight);
*/
mVisualParamMap[id] = weight;
}
}
// Deep copy of mTEMap (copies only those tes that are current, filling in defaults where needed)
for( S32 te = 0; te < TEX_NUM_INDICES; te++ )
{
if( LLVOAvatar::getTEWearableType((ETextureIndex) te ) == mType )
{
const LLUUID& image_id = get_if_there(src->mTEMap, te, LLVOAvatar::getDefaultTEImageID((ETextureIndex) te ) );
mTEMap[te] = image_id;
}
}
}
struct LLWearableSaveData
{
EWearableType mType;
LLWearableType::EType mType;
};
void LLWearable::saveNewAsset()
void LLWearable::saveNewAsset() const
{
// llinfos << "LLWearable::saveNewAsset() type: " << getTypeName() << llendl;
//llinfos << *this << llendl;
std::string new_asset_id_string;
mAssetID.toString(new_asset_id_string);
std::string filename;
filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,new_asset_id_string) + ".wbl";
const std::string filename = asset_id_to_filename(mAssetID);
LLFILE* fp = LLFile::fopen(filename, "wb"); /* Flawfinder: ignore */
BOOL successful_save = FALSE;
if(fp && exportFile(fp))
@@ -1058,7 +925,7 @@ void LLWearable::saveNewAsset()
void LLWearable::onSaveNewAssetComplete(const LLUUID& new_asset_id, void* userdata, S32 status, LLExtStat ext_status) // StoreAssetData callback (fixed)
{
LLWearableSaveData* data = (LLWearableSaveData*)userdata;
const std::string& type_name = LLWearable::typeToTypeName(data->mType);
const std::string& type_name = LLWearableType::getTypeName(data->mType);
if(0 == status)
{
// Success
@@ -1074,10 +941,7 @@ void LLWearable::onSaveNewAssetComplete(const LLUUID& new_asset_id, void* userda
}
// Delete temp file
std::string new_asset_id_string;
new_asset_id.toString(new_asset_id_string);
std::string src_filename;
src_filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,new_asset_id_string) + ".wbl";
const std::string src_filename = asset_id_to_filename(new_asset_id);
LLFile::remove(src_filename);
// delete the context data
@@ -1095,7 +959,7 @@ BOOL LLWearable::isMatchedToInventoryItem( LLViewerInventoryItem* item )
std::ostream& operator<<(std::ostream &s, const LLWearable &w)
{
s << "wearable " << LLWearable::typeToTypeName( w.mType ) << "\n";
s << "wearable " << LLWearableType::getTypeName( w.mType ) << "\n";
s << " Name: " << w.mName << "\n";
s << " Desc: " << w.mDescription << "\n";
//w.mPermissions
@@ -1122,3 +986,40 @@ std::ostream& operator<<(std::ostream &s, const LLWearable &w)
}
std::string terse_F32_to_string( F32 f )
{
std::string r = llformat("%.2f", f);
S32 len = r.length();
// "1.20" -> "1.2"
// "24.00" -> "24."
while (len > 0 && ('0' == r[len - 1]))
{
r.erase(len-1, 1);
len--;
}
if ('.' == r[len - 1])
{
// "24." -> "24"
r.erase(len-1, 1);
}
else if (('-' == r[0]) && ('0' == r[1]))
{
// "-0.59" -> "-.59"
r.erase(1, 1);
}
else if ('0' == r[0])
{
// "0.59" -> ".59"
r.erase(0, 1);
}
return r;
}
std::string asset_id_to_filename(const LLUUID &asset_id)
{
std::string asset_id_string;
asset_id.toString(asset_id_string);
std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,asset_id_string) + ".wbl";
return filename;
}

View File

@@ -38,84 +38,67 @@
#include "llpermissions.h"
#include "llsaleinfo.h"
#include "llassetstorage.h"
#include "llwearabletype.h"
class LLViewerInventoryItem;
enum EWearableType // If you change this, update LLWearable::getTypeName(), getTypeLabel(), and LLVOAvatar::getTEWearableType()
{
WT_SHAPE = 0,
WT_SKIN = 1,
WT_HAIR = 2,
WT_EYES = 3,
WT_SHIRT = 4,
WT_PANTS = 5,
WT_SHOES = 6,
WT_SOCKS = 7,
WT_JACKET = 8,
WT_GLOVES = 9,
WT_UNDERSHIRT = 10,
WT_UNDERPANTS = 11,
WT_SKIRT = 12,
WT_ALPHA = 13,
WT_TATTOO = 14,
WT_PHYSICS = 15,
WT_COUNT = 16,
WT_INVALID = 255,
WT_NONE = -1,
};
class LLWearable
{
friend class LLWearableList;
public:
~LLWearable();
const LLAssetID& getID() const { return mAssetID; }
//--------------------------------------------------------------------
// Constructors and destructors
//--------------------------------------------------------------------
private:
// Private constructor used by LLWearableList
LLWearable(const LLTransactionID& transactionID);
LLWearable(const LLAssetID& assetID);
public:
virtual ~LLWearable();
//--------------------------------------------------------------------
// Accessors
//--------------------------------------------------------------------
public:
const LLUUID& getItemID() const;
const LLAssetID& getAssetID() const { return mAssetID; }
const LLTransactionID& getTransactionID() const { return mTransactionID; }
BOOL isDirty();
BOOL isOldVersion();
void writeToAvatar( BOOL set_by_user );
void readFromAvatar();
void removeFromAvatar( BOOL set_by_user ) { LLWearable::removeFromAvatar( mType, set_by_user ); }
static void removeFromAvatar( EWearableType type, BOOL set_by_user );
BOOL exportFile(LLFILE* file);
BOOL importFile(LLFILE* file);
BOOL FileExportParams(FILE* file);
BOOL FileExportTextures(FILE* file);
EWearableType getType() const { return mType; }
void setType( EWearableType type ) { mType = type; }
LLWearableType::EType getType() const { return mType; }
void setType( LLWearableType::EType type );
const std::string& getName() const { return mName; }
void setName( const std::string& name ) { mName = name; }
const std::string& getDescription() const { return mDescription; }
void setDescription( const std::string& desc ) { mDescription = desc; }
const LLPermissions& getPermissions() const { return mPermissions; }
void setPermissions( const LLPermissions& p ) { mPermissions = p; }
const LLSaleInfo& getSaleInfo() const { return mSaleInfo; }
void setName( const std::string& name ) { mName = name; }
const std::string& getName() const { return mName; }
void setSaleInfo( const LLSaleInfo& info ) { mSaleInfo = info; }
const std::string& getTypeLabel() const;
const std::string& getTypeName() const;
LLAssetType::EType getAssetType() const;
void setDescription( const std::string& desc ) { mDescription = desc; }
const std::string& getDescription() const { return mDescription; }
BOOL isDirty() const;
BOOL isOldVersion() const;
void setPermissions( const LLPermissions& p ) { mPermissions = p; }
const LLPermissions& getPermissions() const { return mPermissions; }
void writeToAvatar( BOOL set_by_user );
void readFromAvatar();
void removeFromAvatar( BOOL upload_bake ) { LLWearable::removeFromAvatar( mType, upload_bake ); }
static void removeFromAvatar( LLWearableType::EType type, BOOL upload_bake );
void setSaleInfo( const LLSaleInfo& info ) { mSaleInfo = info; }
const LLSaleInfo& getSaleInfo() const { return mSaleInfo; }
const std::string& getTypeLabel() const { return LLWearable::sTypeLabel[ mType ]; }
const std::string& getTypeName() const { return LLWearable::sTypeName[ mType ]; }
BOOL exportFile(LLFILE* file) const;
BOOL importFile(LLFILE* file);
void setParamsToDefaults();
void setTexturesToDefaults();
LLAssetType::EType getAssetType() const { return LLWearable::typeToAssetType( mType ); }
static EWearableType typeNameToType( const std::string& type_name );
static const std::string& typeToTypeName( EWearableType type ) { return LLWearable::sTypeName[llmin(type,WT_COUNT)]; }
static const std::string& typeToTypeLabel( EWearableType type ) { return LLWearable::sTypeLabel[llmin(type,WT_COUNT)]; }
static LLAssetType::EType typeToAssetType( EWearableType wearable_type );
void saveNewAsset();
void saveNewAsset() const;
static void onSaveNewAssetComplete( const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status );
BOOL isMatchedToInventoryItem( LLViewerInventoryItem* item );
@@ -126,10 +109,6 @@ public:
friend std::ostream& operator<<(std::ostream &s, const LLWearable &w);
private:
// Private constructor used by LLWearableList
LLWearable(const LLTransactionID& transactionID);
LLWearable(const LLAssetID& assetID);
static S32 sCurrentDefinitionVersion; // Depends on the current state of the avatar_lad.xml.
S32 mDefinitionVersion; // Depends on the state of the avatar_lad.xml when this asset was created.
@@ -139,15 +118,12 @@ private:
LLSaleInfo mSaleInfo;
LLAssetID mAssetID;
LLTransactionID mTransactionID;
EWearableType mType;
LLWearableType::EType mType;
typedef std::map<S32, F32> param_map_t;
param_map_t mVisualParamMap; // maps visual param id to weight
typedef std::map<S32, LLUUID> te_map_t;
te_map_t mTEMap; // maps TE to Image ID
static const std::string sTypeName[ WT_COUNT+1 ];
static const std::string sTypeLabel[ WT_COUNT+1 ];
};
#endif // LL_LLWEARABLE_H

View File

@@ -125,7 +125,7 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID
bool res = wearable->importFile( fp );
if (!res)
{
if (wearable->getType() == WT_COUNT)
if (wearable->getType() == LLWearableType::WT_COUNT)
{
isNewWearable = TRUE;
}
@@ -271,7 +271,7 @@ LLWearable* LLWearableList::createCopy( LLWearable* old_wearable )
return wearable;
}
LLWearable* LLWearableList::createNewWearable( EWearableType type )
LLWearable* LLWearableList::createNewWearable( LLWearableType::EType type )
{
lldebugs << "LLWearableList::createNewWearable()" << llendl;

View File

@@ -54,7 +54,7 @@ public:
LLWearable* createWearableMatchedToInventoryItem( LLWearable* old_wearable, LLViewerInventoryItem* item );
LLWearable* createCopyFromAvatar( LLWearable* old_wearable, const std::string& new_name = std::string() );
LLWearable* createCopy( LLWearable* old_wearable );
LLWearable* createNewWearable( EWearableType type );
LLWearable* createNewWearable( LLWearableType::EType type );
// Callback
static void processGetAssetReply(const char* filename, const LLAssetID& assetID, void* user_data, S32 status, LLExtStat ext_status);

View File

@@ -0,0 +1,122 @@
/**
* @file llwearabletype.cpp
* @brief LLWearableType class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include "llwearabletype.h"
#include "lltrans.h"
struct WearableEntry : public LLDictionaryEntry
{
WearableEntry(const std::string &name,
const std::string& default_new_name,
LLAssetType::EType assetType) :
LLDictionaryEntry(name),
mAssetType(assetType),
mDefaultNewName(default_new_name),
mLabel(/*(LLTrans::getString*/(name))
{
}
const LLAssetType::EType mAssetType;
const std::string mLabel;
const std::string mDefaultNewName; //keep mLabel for backward compatibility
};
class LLWearableDictionary : public LLSingleton<LLWearableDictionary>,
public LLDictionary<LLWearableType::EType, WearableEntry>
{
public:
LLWearableDictionary();
};
LLWearableDictionary::LLWearableDictionary()
{
addEntry(LLWearableType::WT_SHAPE, new WearableEntry("shape", "New Shape", LLAssetType::AT_BODYPART));
addEntry(LLWearableType::WT_SKIN, new WearableEntry("skin", "New Skin", LLAssetType::AT_BODYPART));
addEntry(LLWearableType::WT_HAIR, new WearableEntry("hair", "New Hair", LLAssetType::AT_BODYPART));
addEntry(LLWearableType::WT_EYES, new WearableEntry("eyes", "New Eyes", LLAssetType::AT_BODYPART));
addEntry(LLWearableType::WT_SHIRT, new WearableEntry("shirt", "New Shirt", LLAssetType::AT_CLOTHING));
addEntry(LLWearableType::WT_PANTS, new WearableEntry("pants", "New Pants", LLAssetType::AT_CLOTHING));
addEntry(LLWearableType::WT_SHOES, new WearableEntry("shoes", "New Shoes", LLAssetType::AT_CLOTHING));
addEntry(LLWearableType::WT_SOCKS, new WearableEntry("socks", "New Socks", LLAssetType::AT_CLOTHING));
addEntry(LLWearableType::WT_JACKET, new WearableEntry("jacket", "New Jacket", LLAssetType::AT_CLOTHING));
addEntry(LLWearableType::WT_GLOVES, new WearableEntry("gloves", "New Gloves", LLAssetType::AT_CLOTHING));
addEntry(LLWearableType::WT_UNDERSHIRT, new WearableEntry("undershirt", "New Undershirt", LLAssetType::AT_CLOTHING));
addEntry(LLWearableType::WT_UNDERPANTS, new WearableEntry("underpants", "New Underpants", LLAssetType::AT_CLOTHING));
addEntry(LLWearableType::WT_SKIRT, new WearableEntry("skirt", "New Skirt", LLAssetType::AT_CLOTHING));
addEntry(LLWearableType::WT_ALPHA, new WearableEntry("alpha", "New Alpha", LLAssetType::AT_CLOTHING));
addEntry(LLWearableType::WT_TATTOO, new WearableEntry("tattoo", "New Tattoo", LLAssetType::AT_CLOTHING));
addEntry(LLWearableType::WT_PHYSICS, new WearableEntry("physics", "New Physics", LLAssetType::AT_CLOTHING));
addEntry(LLWearableType::WT_INVALID, new WearableEntry("invalid", "Invalid Wearable", LLAssetType::AT_NONE));
addEntry(LLWearableType::WT_NONE, new WearableEntry("none", "Invalid Wearable", LLAssetType::AT_NONE));
}
// static
LLWearableType::EType LLWearableType::typeNameToType(const std::string& type_name)
{
const LLWearableDictionary *dict = LLWearableDictionary::getInstance();
const LLWearableType::EType wearable = dict->lookup(type_name);
return wearable;
}
// static
const std::string& LLWearableType::getTypeName(LLWearableType::EType type)
{
const LLWearableDictionary *dict = LLWearableDictionary::getInstance();
const WearableEntry *entry = dict->lookup(type);
if (!entry) return getTypeName(WT_INVALID);
return entry->mName;
}
//static
const std::string& LLWearableType::getTypeDefaultNewName(LLWearableType::EType type)
{
const LLWearableDictionary *dict = LLWearableDictionary::getInstance();
const WearableEntry *entry = dict->lookup(type);
if (!entry) return getTypeDefaultNewName(WT_INVALID);
return entry->mDefaultNewName;
}
// static
const std::string& LLWearableType::getTypeLabel(LLWearableType::EType type)
{
const LLWearableDictionary *dict = LLWearableDictionary::getInstance();
const WearableEntry *entry = dict->lookup(type);
if (!entry) return getTypeLabel(WT_INVALID);
return entry->mLabel;
}
// static
LLAssetType::EType LLWearableType::getAssetType(LLWearableType::EType type)
{
const LLWearableDictionary *dict = LLWearableDictionary::getInstance();
const WearableEntry *entry = dict->lookup(type);
if (!entry) return getAssetType(WT_INVALID);
return entry->mAssetType;
}

View File

@@ -0,0 +1,73 @@
/**
* @file llwearabletype.h
* @brief LLWearableType class header file
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLWEARABLETYPE_H
#define LL_LLWEARABLETYPE_H
#include "llassettype.h"
#include "lldictionary.h"
#include "llsingleton.h"
class LLWearableType
{
public:
enum EType
{
WT_SHAPE = 0,
WT_SKIN = 1,
WT_HAIR = 2,
WT_EYES = 3,
WT_SHIRT = 4,
WT_PANTS = 5,
WT_SHOES = 6,
WT_SOCKS = 7,
WT_JACKET = 8,
WT_GLOVES = 9,
WT_UNDERSHIRT = 10,
WT_UNDERPANTS = 11,
WT_SKIRT = 12,
WT_ALPHA = 13,
WT_TATTOO = 14,
WT_PHYSICS = 15,
WT_COUNT = 16,
WT_INVALID = 255,
WT_NONE = -1,
};
static const std::string& getTypeName(EType type);
static const std::string& getTypeDefaultNewName(EType type);
static const std::string& getTypeLabel(EType type);
static LLAssetType::EType getAssetType(EType type);
static EType typeNameToType(const std::string& type_name);
protected:
LLWearableType() {}
~LLWearableType() {}
};
#endif // LL_LLWEARABLETYPE_H

View File

@@ -735,11 +735,11 @@ bool RlvHandler::redirectChatOrEmote(const std::string& strUTF8Text) const
// Example: #RLV/Separates/Shoes/ChiChi Pumps/.[shoes] with items: "Shoe Base", "Shoe (left foot)" and "Shoe (right foot)"
// -> as long as "Shoe Base" is worn, @getattach should not reflect "left foot", nor "right foot"
std::string strComposite; LLViewerInventoryCategory* pFolder;
EWearableType type; S32 idxAttachPt;
LLWearableType::EType type; S32 idxAttachPt;
if ( (getCompositeInfo(idItem, &strComposite, &pFolder)) && (cstrItemType != strComposite) )
{
LLUUID idCompositeItem;
if ((type = LLWearable::typeNameToType(strComposite)) != WT_INVALID)
if ((type = LLWearable::typeNameToType(strComposite)) != LLWearableType::WT_INVALID)
{
idCompositeItem = gAgentWearables.getWearableItemID(type);
}
@@ -837,7 +837,7 @@ bool RlvHandler::redirectChatOrEmote(const std::string& strUTF8Text) const
case LLAssetType::AT_CLOTHING:
{
// NOTE: without its asset we don't know what type the wearable is so we need to look at the item's flags instead
EWearableType wtType = (EWearableType)(pItem->getFlags() & LLInventoryItemFlags::II_FLAGS_WEARABLES_MASK);
LLWearableType::EType wtType = (LLWearableType::EType)(pItem->getFlags() & LLInventoryItemFlags::II_FLAGS_WEARABLES_MASK);
LLViewerInventoryCategory* pFolder;
if ( (!isWearable(wtType)) ||
( (gAgent.getWearable(wtType)) && (!isRemovable(wtType)) ) ||
@@ -956,14 +956,14 @@ ERlvCmdRet RlvHandler::processAddRemCommand(const RlvCommand& rlvCmd)
RlvForceWear::instance().done();
ERlvLockMask eLock = (RLV_BHVR_ADDOUTFIT == eBhvr) ? RLV_LOCK_ADD : RLV_LOCK_REMOVE;
for (int idxType = 0; idxType < WT_COUNT; idxType++)
for (int idxType = 0; idxType < LLWearableType::WT_COUNT; idxType++)
{
if ( (rlvCmdOption.isEmpty()) || ((EWearableType)idxType == rlvCmdOption.getWearableType()) )
if ( (rlvCmdOption.isEmpty()) || ((LLWearableType::EType)idxType == rlvCmdOption.getWearableType()) )
{
if (RLV_TYPE_ADD == eType)
gRlvWearableLocks.addWearableTypeLock((EWearableType)idxType, rlvCmd.getObjectID(), eLock);
gRlvWearableLocks.addWearableTypeLock((LLWearableType::EType)idxType, rlvCmd.getObjectID(), eLock);
else
gRlvWearableLocks.removeWearableTypeLock((EWearableType)idxType, rlvCmd.getObjectID(), eLock);
gRlvWearableLocks.removeWearableTypeLock((LLWearableType::EType)idxType, rlvCmd.getObjectID(), eLock);
}
}
}
@@ -1559,10 +1559,10 @@ ERlvCmdRet RlvHandler::onForceRemOutfit(const RlvCommand& rlvCmd) const
if ( (!rlvCmdOption.isWearableType()) && (!rlvCmdOption.isEmpty()) )
return RLV_RET_FAILED_OPTION;
for (int idxType = 0; idxType < WT_COUNT; idxType++)
for (int idxType = 0; idxType < LLWearableType::WT_COUNT; idxType++)
{
if ( (rlvCmdOption.isEmpty()) || ((EWearableType)idxType == rlvCmdOption.getWearableType()))
RlvForceWear::instance().forceRemove((EWearableType)idxType);
if ( (rlvCmdOption.isEmpty()) || ((LLWearableType::EType)idxType == rlvCmdOption.getWearableType()))
RlvForceWear::instance().forceRemove((LLWearableType::EType)idxType);
}
return RLV_RET_SUCCESS;
}
@@ -1988,25 +1988,25 @@ ERlvCmdRet RlvHandler::onGetOutfit(const RlvCommand& rlvCmd, std::string& strRep
RLV_ASSERT(RLV_BHVR_GETOUTFIT == rlvCmd.getBehaviourType());
// (Compatibility: RLV-1.16.1 will execute @getoutfit=<channel> if <layer> is invalid while we just return failure)
EWearableType wtType = LLWearable::typeNameToType(rlvCmd.getOption());
if ( (WT_INVALID == wtType) && (!rlvCmd.getOption().empty()) )
LLWearableType::EType wtType = LLWearableType::typeNameToType(rlvCmd.getOption());
if ( (LLWearableType::WT_INVALID == wtType) && (!rlvCmd.getOption().empty()) )
return RLV_RET_FAILED_OPTION;
const EWearableType wtRlvTypes[] =
const LLWearableType::EType wtRlvTypes[] =
{
WT_GLOVES, WT_JACKET, WT_PANTS, WT_SHIRT, WT_SHOES, WT_SKIRT, WT_SOCKS,
WT_UNDERPANTS, WT_UNDERSHIRT, WT_SKIN, WT_EYES, WT_HAIR, WT_SHAPE, WT_ALPHA, WT_TATTOO, WT_PHYSICS
LLWearableType::WT_GLOVES, LLWearableType::WT_JACKET, LLWearableType::WT_PANTS, LLWearableType::WT_SHIRT, LLWearableType::WT_SHOES, LLWearableType::WT_SKIRT, LLWearableType::WT_SOCKS,
LLWearableType::WT_UNDERPANTS, LLWearableType::WT_UNDERSHIRT, LLWearableType::WT_SKIN, LLWearableType::WT_EYES, LLWearableType::WT_HAIR, LLWearableType::WT_SHAPE, LLWearableType::WT_ALPHA, LLWearableType::WT_TATTOO, LLWearableType::WT_PHYSICS
};
for (int idxType = 0, cntType = sizeof(wtRlvTypes) / sizeof(EWearableType); idxType < cntType; idxType++)
for (int idxType = 0, cntType = sizeof(wtRlvTypes) / sizeof(LLWearableType::EType); idxType < cntType; idxType++)
{
if ( (WT_INVALID == wtType) || (wtRlvTypes[idxType] == wtType) )
if ( (LLWearableType::WT_INVALID == wtType) || (wtRlvTypes[idxType] == wtType) )
{
// 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])) &&
( (!RlvSettings::getHideLockedLayers()) ||
(LLAssetType::AT_BODYPART == LLWearable::typeToAssetType(wtRlvTypes[idxType])) ||
(LLAssetType::AT_BODYPART == LLWearableType::getAssetType(wtRlvTypes[idxType])) ||
(RlvForceWear::isForceRemovable(wtRlvTypes[idxType], true, rlvCmd.getObjectID())) );
strReply.push_back( (fWorn) ? '1' : '0' );
}
@@ -2026,9 +2026,9 @@ ERlvCmdRet RlvHandler::onGetOutfitNames(const RlvCommand& rlvCmd, std::string& s
return RLV_RET_FAILED_OPTION;
// RELEASE-RLVa: [SL-2.0.0] Needs revisiting/rewriting once 'LLAgentWearables::MAX_WEARABLES_PER_TYPE > 1'
for (int idxType = 0; idxType < WT_COUNT; idxType++)
for (int idxType = 0; idxType < LLWearableType::WT_COUNT; idxType++)
{
bool fAdd = false; EWearableType wtType = (EWearableType)idxType;
bool fAdd = false; LLWearableType::EType wtType = (LLWearableType::EType)idxType;
switch (rlvCmd.getBehaviourType())
{
case RLV_BHVR_GETOUTFITNAMES: // Every layer that's worn
@@ -2050,7 +2050,7 @@ ERlvCmdRet RlvHandler::onGetOutfitNames(const RlvCommand& rlvCmd, std::string& s
{
if (!strReply.empty())
strReply.push_back(',');
strReply.append(LLWearable::typeToTypeName((EWearableType)idxType));
strReply.append(LLWearableType::getTypeName((LLWearableType::EType)idxType));
}
}
return RLV_RET_SUCCESS;

View File

@@ -183,12 +183,12 @@ void RlvCommand::initLookupTable()
// Checked: 2010-09-28 (RLVa-1.1.3a) | Added: RLVa-1.2.1c
RlvCommandOptionGeneric::RlvCommandOptionGeneric(const std::string& strOption)
{
EWearableType wtType(WT_INVALID); LLUUID idOption; ERlvAttachGroupType eAttachGroup(RLV_ATTACHGROUP_INVALID);
LLWearableType::EType wtType(LLWearableType::WT_INVALID); LLUUID idOption; ERlvAttachGroupType eAttachGroup(RLV_ATTACHGROUP_INVALID);
LLViewerJointAttachment* pAttachPt = NULL; LLViewerInventoryCategory* pFolder = NULL;
if (!(m_fEmpty = strOption.empty())) // <option> could be an empty string
{
if ((wtType = LLWearable::typeNameToType(strOption)) != WT_INVALID)
if ((wtType = LLWearableType::typeNameToType(strOption)) != LLWearableType::WT_INVALID)
m_varOption = wtType; // ... or specify a clothing layer
else if ((pAttachPt = RlvAttachPtLookup::getAttachPoint(strOption)) != NULL)
m_varOption = pAttachPt; // ... or specify an attachment point
@@ -212,7 +212,7 @@ RlvCommandOptionGetPath::RlvCommandOptionGetPath(const RlvCommand& rlvCmd)
RlvCommandOptionGeneric rlvCmdOption(rlvCmd.getOption());
if (rlvCmdOption.isWearableType()) // <option> can be a clothing layer
{
EWearableType wtType = rlvCmdOption.getWearableType();
LLWearableType::EType wtType = rlvCmdOption.getWearableType();
m_idItems.push_back(gAgentWearables.getWearableItemID(wtType));
}
else if (rlvCmdOption.isAttachmentPoint()) // ... or it can specify an attachment point
@@ -563,7 +563,7 @@ bool RlvForceWear::isForceRemovable(const LLWearable* pWearable, bool fCheckComp
}
// Checked: 2010-03-19 (RLVa-1.1.3b) | Added: RLVa-1.2.0a
bool RlvForceWear::isForceRemovable(EWearableType wtType, bool fCheckComposite /*=true*/, const LLUUID& idExcept /*=LLUUID::null*/)
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))
@@ -598,7 +598,7 @@ void RlvForceWear::forceRemove(const LLWearable* pWearable)
}
// Checked: 2010-03-19 (RLVa-1.1.3a) | Added: RLVa-1.2.0a
void RlvForceWear::forceRemove(EWearableType wtType)
void RlvForceWear::forceRemove(LLWearableType::EType wtType)
{
forceRemove(gAgentWearables.getWearable(wtType));
}

View File

@@ -121,7 +121,7 @@ public:
virtual LLViewerInventoryCategory* getSharedFolder() const { return NULL; }
virtual const std::string& getString() const { return LLStringUtil::null; }
virtual const LLUUID& getUUID() const { return LLUUID::null; }
virtual EWearableType getWearableType() const { return WT_INVALID; }
virtual LLWearableType::EType getWearableType() const { return LLWearableType::WT_INVALID; }
};
class RlvCommandOptionGeneric : public RlvCommandOption
@@ -131,7 +131,7 @@ public:
RlvCommandOptionGeneric(LLViewerJointAttachment* pAttachPt) : m_fEmpty(false) { m_varOption = pAttachPt; }
RlvCommandOptionGeneric(LLViewerInventoryCategory* pFolder) : m_fEmpty(false) { m_varOption = pFolder; }
RlvCommandOptionGeneric(const LLUUID& idOption) : m_fEmpty(false) { m_varOption = idOption; }
RlvCommandOptionGeneric(EWearableType wtType) : m_fEmpty(false) { m_varOption = wtType; }
RlvCommandOptionGeneric(LLWearableType::EType wtType) : m_fEmpty(false) { m_varOption = wtType; }
/*virtual*/ ~RlvCommandOptionGeneric() {}
public:
@@ -142,7 +142,7 @@ public:
/*virtual*/ bool isString() const { return (!isEmpty()) && (typeid(std::string) == m_varOption.type()); }
/*virtual*/ bool isUUID() const { return (!isEmpty()) && (typeid(LLUUID) == m_varOption.type()); }
/*virtual*/ bool isValid() const { return true; } // This doesn't really have any significance for the generic class
/*virtual*/ bool isWearableType() const { return (!isEmpty()) && (typeid(EWearableType) == m_varOption.type()); }
/*virtual*/ bool isWearableType() const { return (!isEmpty()) && (typeid(LLWearableType::EType) == m_varOption.type()); }
/*virtual*/ LLViewerJointAttachment* getAttachmentPoint() const
{ return (isAttachmentPoint()) ? boost::get<LLViewerJointAttachment*>(m_varOption) : RlvCommandOption::getAttachmentPoint(); }
@@ -154,12 +154,12 @@ public:
{ return (isString()) ? boost::get<std::string>(m_varOption) : RlvCommandOption::getString(); }
/*virtual*/ const LLUUID& getUUID() const
{ return (isUUID()) ? boost::get<LLUUID>(m_varOption) : RlvCommandOption::getUUID(); }
/*virtual*/ EWearableType getWearableType() const
{ return (isWearableType()) ? boost::get<EWearableType>(m_varOption) : RlvCommandOption::getWearableType(); }
/*virtual*/ LLWearableType::EType getWearableType() const
{ return (isWearableType()) ? boost::get<LLWearableType::EType>(m_varOption) : RlvCommandOption::getWearableType(); }
protected:
bool m_fEmpty;
boost::variant<LLViewerJointAttachment*, ERlvAttachGroupType, LLViewerInventoryCategory*, std::string, LLUUID, EWearableType> m_varOption;
boost::variant<LLViewerJointAttachment*, ERlvAttachGroupType, LLViewerInventoryCategory*, std::string, LLUUID, LLWearableType::EType> m_varOption;
};
class RlvCommandOptionGetPath : public RlvCommandOption
@@ -245,9 +245,9 @@ public:
// Wearables
static bool isForceRemovable(const LLWearable* pWearable, bool fCheckComposite = true, const LLUUID& idExcept = LLUUID::null);
static bool isForceRemovable(EWearableType wtType, bool fCheckComposite = true, const LLUUID& idExcept = LLUUID::null);
static bool isForceRemovable(LLWearableType::EType wtType, bool fCheckComposite = true, const LLUUID& idExcept = LLUUID::null);
void forceRemove(const LLWearable* pWearable);
void forceRemove(EWearableType wtType);
void forceRemove(LLWearableType::EType wtType);
public:
void done();
@@ -290,8 +290,8 @@ protected:
}
protected:
typedef std::pair<EWearableType, LLInventoryModel::item_array_t> addwearable_pair_t;
typedef std::map<EWearableType, LLInventoryModel::item_array_t> addwearables_map_t;
typedef std::pair<LLWearableType::EType, LLInventoryModel::item_array_t> addwearable_pair_t;
typedef std::map<LLWearableType::EType, LLInventoryModel::item_array_t> addwearables_map_t;
addwearables_map_t m_addWearables;
typedef std::pair<S32, LLInventoryModel::item_array_t> addattachment_pair_t;
typedef std::map<S32, LLInventoryModel::item_array_t> addattachments_map_t;

View File

@@ -140,9 +140,9 @@ void RlvInventory::fetchWornItems()
uuid_vec_t idItems;
// Fetch all currently worn clothing layers and body parts
for (int type = 0; type < WT_COUNT; type++)
for (int type = 0; type < LLWearableType::WT_COUNT; type++)
{
const LLUUID& idItem = gAgentWearables.getWearableItemID((EWearableType)type);
const LLUUID& idItem = gAgentWearables.getWearableItemID((LLWearableType::EType)type);
if (idItem.notNull())
idItems.push_back(idItem);
}

View File

@@ -804,7 +804,7 @@ void RlvAttachmentLockWatchdog::onWearAttachment(const LLUUID& idItem, ERlvWearM
RlvWearableLocks gRlvWearableLocks;
// Checked: 2010-03-18 (RLVa-1.2.0c) | Added: RLVa-1.2.0a
void RlvWearableLocks::addWearableTypeLock(EWearableType eType, const LLUUID& idRlvObj, ERlvLockMask eLock)
void RlvWearableLocks::addWearableTypeLock(LLWearableType::EType eType, const LLUUID& idRlvObj, ERlvLockMask eLock)
{
/*
// Sanity check - make sure it's an object we know about
@@ -814,13 +814,13 @@ void RlvWearableLocks::addWearableTypeLock(EWearableType eType, const LLUUID& id
// NOTE: m_WearableTypeXXX can contain duplicate <eType, idRlvObj> pairs (ie @remoutfit:shirt=n,remoutfit=n from the same object)
if (eLock & RLV_LOCK_REMOVE)
m_WearableTypeRem.insert(std::pair<EWearableType, LLUUID>(eType, idRlvObj));
m_WearableTypeRem.insert(std::pair<LLWearableType::EType, LLUUID>(eType, idRlvObj));
if (eLock & RLV_LOCK_ADD)
m_WearableTypeAdd.insert(std::pair<EWearableType, LLUUID>(eType, idRlvObj));
m_WearableTypeAdd.insert(std::pair<LLWearableType::EType, LLUUID>(eType, idRlvObj));
}
// Checked: 2010-03-19 (RLVa-1.1.3b) | Added: RLVa-1.2.0a
bool RlvWearableLocks::canRemove(EWearableType eType) const
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);
@@ -830,7 +830,7 @@ bool RlvWearableLocks::canRemove(EWearableType eType) const
}
// Checked: 2010-03-19 (RLVa-1.1.3b) | Added: RLVa-1.2.0a
bool RlvWearableLocks::hasLockedWearable(EWearableType 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);
@@ -850,7 +850,7 @@ bool RlvWearableLocks::isLockedWearableExcept(const LLWearable* pWearable, const
}
// Checked: 2010-03-19 (RLVa-1.2.0a) | Added: RLVa-1.2.0a
bool RlvWearableLocks::isLockedWearableTypeExcept(EWearableType eType, ERlvLockMask eLock, const LLUUID& idRlvObj) const
bool RlvWearableLocks::isLockedWearableTypeExcept(LLWearableType::EType eType, ERlvLockMask eLock, const LLUUID& idRlvObj) const
{
if (idRlvObj.isNull())
return isLockedWearableType(eType, eLock);
@@ -878,7 +878,7 @@ bool RlvWearableLocks::isLockedWearableTypeExcept(EWearableType eType, ERlvLockM
}
// Checked: 2010-03-18 (RLVa-1.2.0c) | Added: RLVa-1.2.0a
void RlvWearableLocks::removeWearableTypeLock(EWearableType eType, const LLUUID& idRlvObj, ERlvLockMask eLock)
void RlvWearableLocks::removeWearableTypeLock(LLWearableType::EType eType, const LLUUID& idRlvObj, ERlvLockMask eLock)
{
/*
// Sanity check - make sure it's an object we know about

View File

@@ -225,16 +225,16 @@ class RlvWearableLocks
{
public:
// Adds an eLock type lock (held by idRlvObj) for the wearable type
void addWearableTypeLock(EWearableType eType, const LLUUID& idRlvObj, ERlvLockMask eLock);
void addWearableTypeLock(LLWearableType::EType eType, const LLUUID& idRlvObj, ERlvLockMask eLock);
// Returns TRUE if there is at least 1 non-removable wearable currently worn on this wearable type
bool hasLockedWearable(EWearableType eType) const;
bool hasLockedWearable(LLWearableType::EType eType) const;
// Returns TRUE if there is at least 1 eLock type locked wearable type (RLV_LOCK_ANY = RLV_LOCK_ADD *or* RLV_LOCK_REMOVE)
// - RLV_LOCK_REMOVE: specific wearable locked *or* any wearable type locked (regardless of whether it currently has wearables)
bool hasLockedWearableType(ERlvLockMask eLock) const;
// Removes an eLock type lock (held by idRlvObj) for the wearable type
void removeWearableTypeLock(EWearableType eType, const LLUUID& idRlvObj, ERlvLockMask eLock);
void removeWearableTypeLock(LLWearableType::EType eType, const LLUUID& idRlvObj, ERlvLockMask eLock);
// Returns TRUE if the wearable is RLV_LOCK_REMOVE locked
bool isLockedWearable(const LLWearable* pWearable) const;
@@ -244,9 +244,9 @@ public:
// NOTE: isLockedWearableType doesn't check if a worn wearable is a specific wearable lock so don't let these be called by the outside
protected:
// Returns TRUE if the wearable type is eLock type locked
bool isLockedWearableType(EWearableType eType, ERlvLockMask eLock) const;
bool isLockedWearableType(LLWearableType::EType eType, ERlvLockMask eLock) const;
// Returns TRUE if the wearable type is eLock type locked by anything other than idRlvObj
bool isLockedWearableTypeExcept(EWearableType eType, ERlvLockMask eLock, const LLUUID& idRlvObj) const;
bool isLockedWearableTypeExcept(LLWearableType::EType eType, ERlvLockMask eLock, const LLUUID& idRlvObj) const;
/*
* canWear/canRemove trivial helper functions (note that a more approriate name might be userCanWear/userCanRemove)
@@ -255,18 +255,18 @@ public:
// Returns whether the inventory item can be worn by the user
ERlvWearMask canWear(const LLViewerInventoryItem* pItem) const;
// Returns whether the wearable type can be worn to by the user
ERlvWearMask canWear(EWearableType eType) const;
ERlvWearMask canWear(LLWearableType::EType eType) const;
// Returns TRUE if the inventory item can be removed by the user
bool canRemove(const LLInventoryItem* pItem) const;
// Returns TRUE if the wearable type has at least one wearable that can be removed by the user
bool canRemove(EWearableType eType) const;
bool canRemove(LLWearableType::EType eType) const;
/*
* Member variables
*/
public:
typedef std::multimap<EWearableType, LLUUID> rlv_wearabletypelock_map_t;
typedef std::multimap<LLWearableType::EType, LLUUID> rlv_wearabletypelock_map_t;
// Accessors for RlvFloaterLocks
const rlv_wearabletypelock_map_t& getWearableTypeLocks(ERlvLockMask eLock) { return (RLV_LOCK_ADD == eLock) ? m_WearableTypeAdd : m_WearableTypeRem; }
protected:
@@ -415,7 +415,7 @@ inline ERlvWearMask RlvWearableLocks::canWear(const LLViewerInventoryItem* pItem
}
// Checked: 2010-05-14 (RLVa-1.2.0g) | Modified: RLVa-1.2.0g
inline ERlvWearMask RlvWearableLocks::canWear(EWearableType eType) const
inline ERlvWearMask RlvWearableLocks::canWear(LLWearableType::EType eType) const
{
// The specified wearable type can be worn on if:
// - the wearable type itself isn't RLV_LOCK_ADD locked => RLV_WEAR_ADD
@@ -447,7 +447,7 @@ inline bool RlvWearableLocks::isLockedWearable(const LLWearable* pWearable) cons
}
// Checked: 2010-03-19 (RLVa-1.2.0c) | Added: RLVa-1.2.0a
inline bool RlvWearableLocks::isLockedWearableType(EWearableType eType, ERlvLockMask eLock) const
inline bool RlvWearableLocks::isLockedWearableType(LLWearableType::EType eType, ERlvLockMask eLock) const
{
return
( (eLock & RLV_LOCK_REMOVE) && (m_WearableTypeRem.find(eType) != m_WearableTypeRem.end()) ) ||