diff options
Diffstat (limited to 'indra/newview/llwearable.cpp')
-rw-r--r-- | indra/newview/llwearable.cpp | 89 |
1 files changed, 45 insertions, 44 deletions
diff --git a/indra/newview/llwearable.cpp b/indra/newview/llwearable.cpp index 63f99273fe..46c736c853 100644 --- a/indra/newview/llwearable.cpp +++ b/indra/newview/llwearable.cpp @@ -33,23 +33,25 @@ #include "llviewerprecompiledheaders.h" #include "llagent.h" +#include "llagentcamera.h" #include "llagentwearables.h" -#include "llfloatercustomize.h" +#include "lldictionary.h" #include "lllocaltextureobject.h" #include "llnotificationsutil.h" #include "llviewertexturelist.h" #include "llinventorymodel.h" #include "llinventoryobserver.h" +#include "llsidepanelappearance.h" +#include "llsidetray.h" +#include "lltexlayer.h" +#include "lltexglobalcolor.h" +#include "lltrans.h" #include "llviewerregion.h" +#include "llvisualparam.h" #include "llvoavatar.h" #include "llvoavatarself.h" #include "llvoavatardefines.h" #include "llwearable.h" -#include "lldictionary.h" -#include "lltrans.h" -#include "lltexlayer.h" -#include "llvisualparam.h" -#include "lltexglobalcolor.h" using namespace LLVOAvatarDefines; @@ -88,7 +90,7 @@ static std::string asset_id_to_filename(const LLUUID &asset_id); LLWearable::LLWearable(const LLTransactionID& transaction_id) : mDefinitionVersion(LLWearable::sCurrentDefinitionVersion), - mType(WT_INVALID) + mType(LLWearableType::WT_INVALID) { mTransactionID = transaction_id; mAssetID = mTransactionID.makeAssetID(gAgent.getSecureSessionID()); @@ -96,7 +98,7 @@ LLWearable::LLWearable(const LLTransactionID& transaction_id) : LLWearable::LLWearable(const LLAssetID& asset_id) : mDefinitionVersion( LLWearable::sCurrentDefinitionVersion ), - mType(WT_INVALID) + mType(LLWearableType::WT_INVALID) { mAssetID = asset_id; mTransactionID.setNull(); @@ -108,17 +110,17 @@ LLWearable::~LLWearable() const std::string& LLWearable::getTypeLabel() const { - return LLWearableDictionary::getTypeLabel(mType); + return LLWearableType::getTypeLabel(mType); } const std::string& LLWearable::getTypeName() const { - return LLWearableDictionary::getTypeName(mType); + return LLWearableType::getTypeName(mType); } LLAssetType::EType LLWearable::getAssetType() const { - return LLWearableDictionary::getAssetType(mType); + return LLWearableType::getAssetType(mType); } BOOL LLWearable::exportFile(LLFILE* file) const @@ -363,13 +365,13 @@ 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 ) { - setType((EWearableType)type); + setType((LLWearableType::EType)type); } else { - mType = WT_COUNT; + mType = LLWearableType::WT_COUNT; llwarns << "Bad Wearable asset: bad type #" << type << llendl; return FALSE; } @@ -442,6 +444,9 @@ BOOL LLWearable::importFile( LLFILE* file ) delete mSavedTEMap[te]; } + image->setLoadedCallback(LLVOAvatarSelf::debugOnTimingLocalTexLoaded,0,TRUE,FALSE, new LLVOAvatarSelf::LLAvatarTexData(id, (LLVOAvatarDefines::ETextureIndex)te)); + + LLUUID textureid(text_buffer); mTEMap[te] = new LLLocalTextureObject(image, textureid); mSavedTEMap[te] = new LLLocalTextureObject(image, textureid); @@ -573,14 +578,6 @@ BOOL LLWearable::isDirty() const } } - //if( gFloaterCustomize ) - //{ - // if( mDescription != gFloaterCustomize->getWearableDescription( mType ) ) - // { - // return TRUE; - // } - //} - return FALSE; } @@ -659,7 +656,7 @@ void LLWearable::writeToAvatar() image_id = LLVOAvatarDictionary::getDefaultTextureImageID((ETextureIndex) te); } LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture( image_id, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE ); - // MULTI-WEARABLE: replace hard-coded 0 + // MULTI-WEARABLE: assume index 0 will be used when writing to avatar. TODO: eliminate the need for this. gAgentAvatarp->setLocalTextureTE(te, image, 0); } } @@ -679,15 +676,15 @@ void LLWearable::writeToAvatar() // Updates the user's avatar's appearance, replacing this wearables' parameters and textures with default values. // static -void LLWearable::removeFromAvatar( EWearableType type, BOOL upload_bake ) +void LLWearable::removeFromAvatar( LLWearableType::EType type, BOOL upload_bake ) { 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; } @@ -702,13 +699,13 @@ void LLWearable::removeFromAvatar( EWearableType type, BOOL upload_bake ) } } - if( gFloaterCustomize ) + if( gAgentCamera.cameraCustomizeAvatar() ) { - gFloaterCustomize->setWearable(type, NULL, PERM_ALL, TRUE); + LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "edit_outfit")); } gAgentAvatarp->updateVisualParams(); - gAgentAvatarp->wearableUpdated(type, TRUE); + gAgentAvatarp->wearableUpdated(type, FALSE); // if( upload_bake ) // { @@ -756,12 +753,12 @@ void LLWearable::copyDataFrom(const LLWearable* src) LLViewerFetchedTexture *image = NULL; if(iter != src->mTEMap.end()) { - image = src->getConstLocalTextureObject(te)->getImage(); - image_id = src->getConstLocalTextureObject(te)->getID(); + image = src->getLocalTextureObject(te)->getImage(); + image_id = src->getLocalTextureObject(te)->getID(); mTEMap[te] = new LLLocalTextureObject(image, image_id); mSavedTEMap[te] = new LLLocalTextureObject(image, image_id); - mTEMap[te]->setBakedReady(src->getConstLocalTextureObject(te)->getBakedReady()); - mTEMap[te]->setDiscard(src->getConstLocalTextureObject(te)->getDiscard()); + mTEMap[te]->setBakedReady(src->getLocalTextureObject(te)->getBakedReady()); + mTEMap[te]->setDiscard(src->getLocalTextureObject(te)->getDiscard()); } else { @@ -789,7 +786,7 @@ const LLUUID& LLWearable::getItemID() const return mItemID; } -void LLWearable::setType(EWearableType type) +void LLWearable::setType(LLWearableType::EType type) { mType = type; createVisualParams(); @@ -806,7 +803,7 @@ LLLocalTextureObject* LLWearable::getLocalTextureObject(S32 index) return NULL; } -const LLLocalTextureObject* LLWearable::getConstLocalTextureObject(S32 index) const +const LLLocalTextureObject* LLWearable::getLocalTextureObject(S32 index) const { te_map_t::const_iterator iter = mTEMap.find(index); if( iter != mTEMap.end() ) @@ -973,9 +970,11 @@ void LLWearable::revertValues() syncImages(mSavedTEMap, mTEMap); - if( gFloaterCustomize ) + + LLSidepanelAppearance *panel = dynamic_cast<LLSidepanelAppearance*>(LLSideTray::getInstance()->getPanel("sidepanel_appearance")); + if( panel ) { - gFloaterCustomize->updateScrollingPanelList(TRUE); + panel->updateScrollingPanelList(); } } @@ -1012,9 +1011,11 @@ void LLWearable::saveValues() // Deep copy of mTEMap (copies only those tes that are current, filling in defaults where needed) syncImages(mTEMap, mSavedTEMap); - if( gFloaterCustomize ) + + LLSidepanelAppearance *panel = dynamic_cast<LLSidepanelAppearance*>(LLSideTray::getInstance()->getPanel("sidepanel_appearance")); + if( panel ) { - gFloaterCustomize->updateScrollingPanelList(TRUE); + panel->updateScrollingPanelList(); } } @@ -1118,7 +1119,7 @@ void LLWearable::refreshName() struct LLWearableSaveData { - EWearableType mType; + LLWearableType::EType mType; }; void LLWearable::saveNewAsset() const @@ -1181,7 +1182,7 @@ void LLWearable::saveNewAsset() const 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 = LLWearableDictionary::getTypeName(data->mType); + const std::string& type_name = LLWearableType::getTypeName(data->mType); if(0 == status) { // Success @@ -1207,7 +1208,7 @@ void LLWearable::onSaveNewAssetComplete(const LLUUID& new_asset_id, void* userda std::ostream& operator<<(std::ostream &s, const LLWearable &w) { - s << "wearable " << LLWearableDictionary::getTypeName(w.mType) << "\n"; + s << "wearable " << LLWearableType::getTypeName(w.mType) << "\n"; s << " Name: " << w.mName << "\n"; s << " Desc: " << w.mDescription << "\n"; //w.mPermissions |