From c355fb98d3f4040196b7b8586dc9328fccb906d2 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Mon, 3 Sep 2012 06:12:50 +0000 Subject: Extracted texture baking system into llappearance library. --- indra/newview/llviewerwearable.cpp | 900 +++++++++++++++++++++++++++++++++++++ 1 file changed, 900 insertions(+) create mode 100644 indra/newview/llviewerwearable.cpp (limited to 'indra/newview/llviewerwearable.cpp') diff --git a/indra/newview/llviewerwearable.cpp b/indra/newview/llviewerwearable.cpp new file mode 100644 index 0000000000..b63f1f57cb --- /dev/null +++ b/indra/newview/llviewerwearable.cpp @@ -0,0 +1,900 @@ +/** + * @file llviewerwearable.cpp + * @brief LLViewerWearable class implementation + * + * $LicenseInfo:firstyear=2012&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 "llagent.h" +#include "llagentcamera.h" +#include "llagentwearables.h" +#include "llfloatersidepanelcontainer.h" +#include "llnotificationsutil.h" +#include "llsidepanelappearance.h" +#include "lltextureentry.h" +#include "llviewercontrol.h" +#include "llviewertexlayer.h" +#include "llviewerwearable.h" +#include "llvoavatarself.h" +#include "llvoavatardefines.h" + +using namespace LLVOAvatarDefines; + +// support class - remove for 2.1 (hackity hack hack) +class LLOverrideBakedTextureUpdate +{ +public: + LLOverrideBakedTextureUpdate(bool temp_state) + { + U32 num_bakes = (U32) LLVOAvatarDefines::BAKED_NUM_INDICES; + for( U32 index = 0; index < num_bakes; ++index ) + { + composite_enabled[index] = gAgentAvatarp->isCompositeUpdateEnabled(index); + } + gAgentAvatarp->setCompositeUpdatesEnabled(temp_state); + } + + ~LLOverrideBakedTextureUpdate() + { + U32 num_bakes = (U32)LLVOAvatarDefines::BAKED_NUM_INDICES; + for( U32 index = 0; index < num_bakes; ++index ) + { + gAgentAvatarp->setCompositeUpdatesEnabled(index, composite_enabled[index]); + } + } +private: + bool composite_enabled[LLVOAvatarDefines::BAKED_NUM_INDICES]; +}; + +// Private local functions +static std::string asset_id_to_filename(const LLUUID &asset_id); + +LLViewerWearable::LLViewerWearable(const LLTransactionID& transaction_id) : + LLWearable() +{ + mTransactionID = transaction_id; + mAssetID = mTransactionID.makeAssetID(gAgent.getSecureSessionID()); +} + +LLViewerWearable::LLViewerWearable(const LLAssetID& asset_id) : + LLWearable() +{ + mAssetID = asset_id; + mTransactionID.setNull(); +} + +// virtual +LLViewerWearable::~LLViewerWearable() +{ +} + +void LLViewerWearable::setItemID(const LLUUID& item_id) +{ + mItemID = item_id; +} + +// virtual +BOOL LLViewerWearable::exportFile(LLFILE* file) const +{ + mTextureIDMap.clear(); + for (te_map_t::const_iterator iter = mTEMap.begin(); iter != mTEMap.end(); ++iter) + { + S32 te = iter->first; + const LLUUID& image_id = iter->second->getID(); + mTextureIDMap[te] = image_id; + } + return LLWearable::exportFile(file); +} + +// virtual +LLWearable::EImportResult LLViewerWearable::importFile( LLFILE* file ) +{ + // suppress texlayerset updates while wearables are being imported. Layersets will be updated + // when the wearables are "worn", not loaded. Note state will be restored when this object is destroyed. + LLOverrideBakedTextureUpdate stop_bakes(false); + + LLWearable::EImportResult result = LLWearable::importFile(file); + if (LLWearable::FAILURE == result) return result; + if (LLWearable::BAD_HEADER == result) + { + // Shouldn't really log the asset id for security reasons, but + // we need it in this case. + llwarns << "Bad Wearable asset header: " << mAssetID << llendl; + //gVFS->dumpMap(); + return result; + } + + LLStringUtil::truncate(mName, DB_INV_ITEM_NAME_STR_LEN ); + LLStringUtil::truncate(mDescription, DB_INV_ITEM_DESC_STR_LEN ); + + texture_id_map_t::const_iterator iter = mTextureIDMap.begin(); + texture_id_map_t::const_iterator end = mTextureIDMap.end(); + for (; iter != end; ++iter) + { + S32 te = iter->first; + const LLUUID& textureid = iter->second; + if( mTEMap.find(te) != mTEMap.end() ) + { + delete mTEMap[te]; + } + if( mSavedTEMap.find(te) != mSavedTEMap.end() ) + { + delete mSavedTEMap[te]; + } + + LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTexture( textureid ); + if(gSavedSettings.getBOOL("DebugAvatarLocalTexLoadedTime")) + { + image->setLoadedCallback(LLVOAvatarSelf::debugOnTimingLocalTexLoaded,0,TRUE,FALSE, new LLVOAvatarSelf::LLAvatarTexData(textureid, (LLVOAvatarDefines::ETextureIndex)te), NULL); + } + mTEMap[te] = new LLLocalTextureObject(image, textureid); + mSavedTEMap[te] = new LLLocalTextureObject(image, textureid); + createLayers(te); + } + + // copy all saved param values to working params + revertValues(); + + return result; +} + +// 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 LLViewerWearable::isOldVersion() const +{ + if (!isAgentAvatarValid()) return FALSE; + + if( LLWearable::sCurrentDefinitionVersion < mDefinitionVersion ) + { + llwarns << "Wearable asset has newer version (" << mDefinitionVersion << ") than XML (" << LLWearable::sCurrentDefinitionVersion << ")" << llendl; + llassert(0); + } + + if( LLWearable::sCurrentDefinitionVersion != mDefinitionVersion ) + { + return TRUE; + } + + S32 param_count = 0; + for( LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam(); + param; + param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam() ) + { + if( (param->getWearableType() == mType) && (param->isTweakable() ) ) + { + param_count++; + if( !is_in_map(mVisualParamIndexMap, param->getID() ) ) + { + return TRUE; + } + } + } + if( param_count != mVisualParamIndexMap.size() ) + { + return TRUE; + } + + + S32 te_count = 0; + for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) + { + if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType) + { + te_count++; + if( !is_in_map(mTEMap, te ) ) + { + return TRUE; + } + } + } + if( te_count != mTEMap.size() ) + { + return TRUE; + } + + return FALSE; +} + +// Avatar parameter and texture definitions can change over time. +// * If parameters or textures have been REMOVED since the wearable was created, +// they're just ignored, so we consider the wearable clean even though isOldVersion() +// will return true. +// * 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 LLViewerWearable::isDirty() const +{ + if (!isAgentAvatarValid()) return FALSE; + + for( LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam(); + param; + param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam() ) + { + if( (param->getWearableType() == mType) + && (param->isTweakable() ) + && !param->getCrossWearable()) + { + F32 current_weight = getVisualParamWeight(param->getID()); + current_weight = llclamp( current_weight, param->getMinWeight(), param->getMaxWeight() ); + F32 saved_weight = get_if_there(mSavedVisualParamMap, param->getID(), param->getDefaultWeight()); + saved_weight = llclamp( saved_weight, param->getMinWeight(), param->getMaxWeight() ); + + U8 a = F32_to_U8( saved_weight, param->getMinWeight(), param->getMaxWeight() ); + U8 b = F32_to_U8( current_weight, param->getMinWeight(), param->getMaxWeight() ); + if( a != b ) + { + return TRUE; + } + } + } + + for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) + { + if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType) + { + te_map_t::const_iterator current_iter = mTEMap.find(te); + if(current_iter != mTEMap.end()) + { + const LLUUID& current_image_id = current_iter->second->getID(); + te_map_t::const_iterator saved_iter = mSavedTEMap.find(te); + if(saved_iter != mSavedTEMap.end()) + { + const LLUUID& saved_image_id = saved_iter->second->getID(); + if (saved_image_id != current_image_id) + { + // saved vs current images are different, wearable is dirty + return TRUE; + } + } + else + { + // image found in current image list but not saved image list + return TRUE; + } + } + } + } + + return FALSE; +} + + +void LLViewerWearable::setParamsToDefaults() +{ + if (!isAgentAvatarValid()) return; + + for( LLVisualParam* param = gAgentAvatarp->getFirstVisualParam(); param; param = gAgentAvatarp->getNextVisualParam() ) + { + if( (((LLViewerVisualParam*)param)->getWearableType() == mType ) && (param->isTweakable() ) ) + { + setVisualParamWeight(param->getID(),param->getDefaultWeight(), FALSE); + } + } +} + +void LLViewerWearable::setTexturesToDefaults() +{ + for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) + { + if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType) + { + LLUUID id = getDefaultTextureImageID((ETextureIndex) te); + LLViewerFetchedTexture * image = LLViewerTextureManager::getFetchedTexture( id ); + if( mTEMap.find(te) == mTEMap.end() ) + { + mTEMap[te] = new LLLocalTextureObject(image, id); + createLayers(te); + } + else + { + // Local Texture Object already created, just set image and UUID + LLLocalTextureObject *lto = mTEMap[te]; + lto->setID(id); + lto->setImage(image); + } + } + } +} + + +//static +const LLUUID LLViewerWearable::getDefaultTextureImageID(ETextureIndex index) +{ + const LLVOAvatarDictionary::TextureEntry *texture_dict = LLVOAvatarDictionary::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)); + } +} + + +// Updates the user's avatar's appearance +void LLViewerWearable::writeToAvatar() +{ + if (!isAgentAvatarValid()) return; + + ESex old_sex = gAgentAvatarp->getSex(); + + // Pull params + for( LLVisualParam* param = gAgentAvatarp->getFirstVisualParam(); param; param = gAgentAvatarp->getNextVisualParam() ) + { + // cross-wearable parameters are not authoritative, as they are driven by a different wearable. So don't copy the values to the + // avatar object if cross wearable. Cross wearable params get their values from the avatar, they shouldn't write the other way. + if( (((LLViewerVisualParam*)param)->getWearableType() == mType) && (!((LLViewerVisualParam*)param)->getCrossWearable()) ) + { + S32 param_id = param->getID(); + F32 weight = getVisualParamWeight(param_id); + + gAgentAvatarp->setVisualParamWeight( param_id, weight, FALSE ); + } + } + + // Pull texture entries + for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) + { + if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType) + { + te_map_t::const_iterator iter = mTEMap.find(te); + LLUUID image_id; + if(iter != mTEMap.end()) + { + image_id = iter->second->getID(); + } + else + { + image_id = getDefaultTextureImageID((ETextureIndex) te); + } + LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture( image_id, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE ); + // MULTI-WEARABLE: assume index 0 will be used when writing to avatar. TODO: eliminate the need for this. + gAgentAvatarp->setLocalTextureTE(te, image, 0); + } + } + + ESex new_sex = gAgentAvatarp->getSex(); + if( old_sex != new_sex ) + { + gAgentAvatarp->updateSexDependentLayerSets( FALSE ); + } + +// if( upload_bake ) +// { +// gAgent.sendAgentSetAppearance(); +// } +} + + +// Updates the user's avatar's appearance, replacing this wearables' parameters and textures with default values. +// static +void LLViewerWearable::removeFromAvatar( LLWearableType::EType type, BOOL upload_bake ) +{ + if (!isAgentAvatarValid()) return; + + // You can't just remove body parts. + if( (type == LLWearableType::WT_SHAPE) || + (type == LLWearableType::WT_SKIN) || + (type == LLWearableType::WT_HAIR) || + (type == LLWearableType::WT_EYES) ) + { + return; + } + + // Pull params + for( LLVisualParam* param = gAgentAvatarp->getFirstVisualParam(); param; param = gAgentAvatarp->getNextVisualParam() ) + { + if( (((LLViewerVisualParam*)param)->getWearableType() == type) && (param->isTweakable() ) ) + { + S32 param_id = param->getID(); + gAgentAvatarp->setVisualParamWeight( param_id, param->getDefaultWeight(), upload_bake ); + } + } + + if(gAgentCamera.cameraCustomizeAvatar()) + { + LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "edit_outfit")); + } + + gAgentAvatarp->updateVisualParams(); + gAgentAvatarp->wearableUpdated(type, FALSE); + +// if( upload_bake ) +// { +// gAgent.sendAgentSetAppearance(); +// } +} + +// Does not copy mAssetID. +// Definition version is current: removes obsolete enties and creates default values for new ones. +void LLViewerWearable::copyDataFrom(const LLViewerWearable* src) +{ + if (!isAgentAvatarValid()) return; + + mDefinitionVersion = LLWearable::sCurrentDefinitionVersion; + + mName = src->mName; + mDescription = src->mDescription; + mPermissions = src->mPermissions; + mSaleInfo = src->mSaleInfo; + + setType(src->mType); + + mSavedVisualParamMap.clear(); + // 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) ) + { + S32 id = param->getID(); + F32 weight = src->getVisualParamWeight(id); + mSavedVisualParamMap[id] = weight; + } + } + + destroyTextures(); + // 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) + { + te_map_t::const_iterator iter = src->mTEMap.find(te); + LLUUID image_id; + LLViewerFetchedTexture *image = NULL; + if(iter != src->mTEMap.end()) + { + image = dynamic_cast (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->getLocalTextureObject(te)->getBakedReady()); + mTEMap[te]->setDiscard(src->getLocalTextureObject(te)->getDiscard()); + } + else + { + image_id = getDefaultTextureImageID((ETextureIndex) te); + image = LLViewerTextureManager::getFetchedTexture( image_id ); + mTEMap[te] = new LLLocalTextureObject(image, image_id); + mSavedTEMap[te] = new LLLocalTextureObject(image, image_id); + } + createLayers(te); + } + } + + // Probably reduntant, but ensure that the newly created wearable is not dirty by setting current value of params in new wearable + // to be the same as the saved values (which were loaded from src at param->cloneParam(this)) + revertValues(); +} + + +LLLocalTextureObject* LLViewerWearable::getLocalTextureObject(S32 index) +{ + te_map_t::iterator iter = mTEMap.find(index); + if( iter != mTEMap.end() ) + { + LLLocalTextureObject* lto = iter->second; + return lto; + } + return NULL; +} + +const LLLocalTextureObject* LLViewerWearable::getLocalTextureObject(S32 index) const +{ + te_map_t::const_iterator iter = mTEMap.find(index); + if( iter != mTEMap.end() ) + { + const LLLocalTextureObject* lto = iter->second; + return lto; + } + return NULL; +} + +std::vector LLViewerWearable::getLocalTextureListSeq() +{ + std::vector result; + + for(te_map_t::const_iterator iter = mTEMap.begin(); + iter != mTEMap.end(); iter++) + { + LLLocalTextureObject* lto = iter->second; + result.push_back(lto); + } + + return result; +} + +void LLViewerWearable::setLocalTextureObject(S32 index, LLLocalTextureObject <o) +{ + if( mTEMap.find(index) != mTEMap.end() ) + { + mTEMap.erase(index); + } + mTEMap[index] = new LLLocalTextureObject(lto); +} + +void LLViewerWearable::revertValues() +{ + //update saved settings so wearable is no longer dirty + // non-driver params first + for (param_map_t::const_iterator iter = mSavedVisualParamMap.begin(); iter != mSavedVisualParamMap.end(); iter++) + { + S32 id = iter->first; + F32 value = iter->second; + LLVisualParam *param = getVisualParam(id); + if(param && !dynamic_cast(param) ) + { + setVisualParamWeight(id, value, TRUE); + } + } + + //then driver params + for (param_map_t::const_iterator iter = mSavedVisualParamMap.begin(); iter != mSavedVisualParamMap.end(); iter++) + { + S32 id = iter->first; + F32 value = iter->second; + LLVisualParam *param = getVisualParam(id); + if(param && dynamic_cast(param) ) + { + setVisualParamWeight(id, value, TRUE); + } + } + + // make sure that saved values are sane + for (param_map_t::const_iterator iter = mSavedVisualParamMap.begin(); iter != mSavedVisualParamMap.end(); iter++) + { + S32 id = iter->first; + LLVisualParam *param = getVisualParam(id); + if( param ) + { + mSavedVisualParamMap[id] = param->getWeight(); + } + } + + syncImages(mSavedTEMap, mTEMap); + + + LLSidepanelAppearance *panel = dynamic_cast(LLFloaterSidePanelContainer::getPanel("appearance")); + if( panel ) + { + panel->updateScrollingPanelList(); + } +} + +BOOL LLViewerWearable::isOnTop() const +{ + return (this == gAgentWearables.getTopWearable(mType)); +} + +void LLViewerWearable::saveValues() +{ + //update saved settings so wearable is no longer dirty + mSavedVisualParamMap.clear(); + for (visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.begin(); iter != mVisualParamIndexMap.end(); ++iter) + { + S32 id = iter->first; + LLVisualParam *wearable_param = iter->second; + F32 value = wearable_param->getWeight(); + mSavedVisualParamMap[id] = value; + } + + // Deep copy of mTEMap (copies only those tes that are current, filling in defaults where needed) + syncImages(mTEMap, mSavedTEMap); + + + LLSidepanelAppearance *panel = dynamic_cast(LLFloaterSidePanelContainer::getPanel("appearance")); + if( panel ) + { + panel->updateScrollingPanelList(); + } +} + +void LLViewerWearable::syncImages(te_map_t &src, te_map_t &dst) +{ + // Deep copy of src (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) + { + te_map_t::const_iterator iter = src.find(te); + LLUUID image_id; + LLViewerFetchedTexture *image = NULL; + LLLocalTextureObject *lto = NULL; + if(iter != src.end()) + { + // there's a Local Texture Object in the source image map. Use this to populate the values to store in the destination image map. + lto = iter->second; + image = dynamic_cast (lto->getImage()); + image_id = lto->getID(); + } + else + { + // there is no Local Texture Object in the source image map. Get defaults values for populating the destination image map. + image_id = getDefaultTextureImageID((ETextureIndex) te); + image = LLViewerTextureManager::getFetchedTexture( image_id ); + } + + if( dst.find(te) != dst.end() ) + { + // there's already an entry in the destination map for the texture. Just update its values. + dst[te]->setImage(image); + dst[te]->setID(image_id); + } + else + { + // no entry found in the destination map, we need to create a new Local Texture Object + dst[te] = new LLLocalTextureObject(image, image_id); + } + + if( lto ) + { + // If we pulled values from a Local Texture Object in the source map, make sure the proper flags are set in the new (or updated) entry in the destination map. + dst[te]->setBakedReady(lto->getBakedReady()); + dst[te]->setDiscard(lto->getDiscard()); + } + } + } +} + +void LLViewerWearable::destroyTextures() +{ + for( te_map_t::iterator iter = mTEMap.begin(); iter != mTEMap.end(); ++iter ) + { + LLLocalTextureObject *lto = iter->second; + delete lto; + } + mTEMap.clear(); + for( te_map_t::iterator iter = mSavedTEMap.begin(); iter != mSavedTEMap.end(); ++iter ) + { + LLLocalTextureObject *lto = iter->second; + delete lto; + } + mSavedTEMap.clear(); +} + +void LLViewerWearable::pullCrossWearableValues() +{ + // scan through all of the avatar's visual parameters + for (LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam(); + param; + param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam()) + { + if( param ) + { + LLDriverParam *driver_param = dynamic_cast(param); + if(driver_param) + { + // parameter is a driver parameter, have it update its + driver_param->updateCrossDrivenParams(getType()); + } + } + } +} + + +void LLViewerWearable::setLabelUpdated() const +{ + gInventory.addChangedMask(LLInventoryObserver::LABEL, getItemID()); +} + + +void LLViewerWearable::refreshName() +{ + LLUUID item_id = getItemID(); + LLInventoryItem* item = gInventory.getItem(item_id); + if( item ) + { + mName = item->getName(); + } +} + +struct LLWearableSaveData +{ + LLWearableType::EType mType; +}; + +void LLViewerWearable::saveNewAsset() const +{ +// llinfos << "LLViewerWearable::saveNewAsset() type: " << getTypeName() << llendl; + //llinfos << *this << llendl; + + 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)) + { + successful_save = TRUE; + } + if(fp) + { + fclose(fp); + fp = NULL; + } + if(!successful_save) + { + std::string buffer = llformat("Unable to save '%s' to wearable file.", mName.c_str()); + llwarns << buffer << llendl; + + LLSD args; + args["NAME"] = mName; + LLNotificationsUtil::add("CannotSaveWearableOutOfSpace", args); + return; + } + + // save it out to database + if( gAssetStorage ) + { + /* + std::string url = gAgent.getRegion()->getCapability("NewAgentInventory"); + if (!url.empty()) + { + llinfos << "Update Agent Inventory via capability" << llendl; + LLSD body; + body["folder_id"] = gInventory.findCategoryUUIDForType(LLFolderType::assetToFolderType(getAssetType())); + body["asset_type"] = LLAssetType::lookup(getAssetType()); + body["inventory_type"] = LLInventoryType::lookup(LLInventoryType::IT_WEARABLE); + body["name"] = getName(); + body["description"] = getDescription(); + LLHTTPClient::post(url, body, new LLNewAgentInventoryResponder(body, filename)); + } + else + { + } + */ + LLWearableSaveData* data = new LLWearableSaveData; + data->mType = mType; + gAssetStorage->storeAssetData(filename, mTransactionID, getAssetType(), + &LLViewerWearable::onSaveNewAssetComplete, + (void*)data); + } +} + +// static +void LLViewerWearable::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 = LLWearableType::getTypeName(data->mType); + if(0 == status) + { + // Success + llinfos << "Saved wearable " << type_name << llendl; + } + else + { + std::string buffer = llformat("Unable to save %s to central asset store.", type_name.c_str()); + llwarns << buffer << " Status: " << status << llendl; + LLSD args; + args["NAME"] = type_name; + LLNotificationsUtil::add("CannotSaveToAssetStore", args); + } + + // Delete temp file + const std::string src_filename = asset_id_to_filename(new_asset_id); + LLFile::remove(src_filename); + + // delete the context data + delete data; + +} + +void LLViewerWearable::createLayers(S32 te) +{ + LLViewerTexLayerSet *layer_set = gAgentAvatarp->getLayerSet((ETextureIndex)te); + if (layer_set) + { + layer_set->cloneTemplates(mTEMap[te], (ETextureIndex)te, this); + } + else + { + llerrs << "could not find layerset for LTO in wearable!" << llendl; + } +} + +void LLViewerWearable::createVisualParams() +{ + for (LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam(); + param; + param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam()) + { + if (param->getWearableType() == mType) + { + addVisualParam(param->cloneParam(this)); + } + } + + // resync driver parameters to point to the newly cloned driven parameters + for (visual_param_index_map_t::iterator param_iter = mVisualParamIndexMap.begin(); + param_iter != mVisualParamIndexMap.end(); + ++param_iter) + { + LLVisualParam* param = param_iter->second; + LLVisualParam*(LLWearable::*wearable_function)(S32)const = &LLWearable::getVisualParam; + // need this line to disambiguate between versions of LLCharacter::getVisualParam() + LLVisualParam*(LLAvatarAppearance::*param_function)(S32)const = &LLAvatarAppearance::getVisualParam; + param->resetDrivenParams(); + if(!param->linkDrivenParams(boost::bind(wearable_function,(LLWearable*)this, _1), false)) + { + if( !param->linkDrivenParams(boost::bind(param_function,gAgentAvatarp.get(),_1 ), true)) + { + llwarns << "could not link driven params for wearable " << getName() << " id: " << param->getID() << llendl; + continue; + } + } + } +} + +void LLViewerWearable::setVisualParams() +{ + for (visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.begin(); iter != mVisualParamIndexMap.end(); iter++) + { + S32 id = iter->first; + LLVisualParam *wearable_param = iter->second; + F32 value = wearable_param->getWeight(); + gAgentAvatarp->setVisualParamWeight(id, value, FALSE); + } +} + + + +std::ostream& operator<<(std::ostream &s, const LLViewerWearable &w) +{ + s << "wearable " << LLWearableType::getTypeName(w.mType) << "\n"; + s << " Name: " << w.mName << "\n"; + s << " Desc: " << w.mDescription << "\n"; + //w.mPermissions + //w.mSaleInfo + + s << " Params:" << "\n"; + for (LLWearable::visual_param_index_map_t::const_iterator iter = w.mVisualParamIndexMap.begin(); + iter != w.mVisualParamIndexMap.end(); ++iter) + { + S32 param_id = iter->first; + LLVisualParam *wearable_param = iter->second; + F32 param_weight = wearable_param->getWeight(); + s << " " << param_id << " " << param_weight << "\n"; + } + + s << " Textures:" << "\n"; + for (LLViewerWearable::te_map_t::const_iterator iter = w.mTEMap.begin(); + iter != w.mTEMap.end(); ++iter) + { + S32 te = iter->first; + const LLUUID& image_id = iter->second->getID(); + s << " " << te << " " << image_id << "\n"; + } + return s; +} + +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; +} + -- cgit v1.2.3 From 0c7623f628cbba999860379a2f5c302d94c1d287 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Mon, 3 Sep 2012 08:37:58 +0000 Subject: Cleanup of llappearance refactor file definition order for easier diff'ing --- indra/newview/llviewerwearable.cpp | 134 ++++++++++++++++++------------------- 1 file changed, 66 insertions(+), 68 deletions(-) (limited to 'indra/newview/llviewerwearable.cpp') diff --git a/indra/newview/llviewerwearable.cpp b/indra/newview/llviewerwearable.cpp index b63f1f57cb..2b6649a7ec 100644 --- a/indra/newview/llviewerwearable.cpp +++ b/indra/newview/llviewerwearable.cpp @@ -33,11 +33,11 @@ #include "llnotificationsutil.h" #include "llsidepanelappearance.h" #include "lltextureentry.h" -#include "llviewercontrol.h" #include "llviewertexlayer.h" -#include "llviewerwearable.h" #include "llvoavatarself.h" #include "llvoavatardefines.h" +#include "llviewerwearable.h" +#include "llviewercontrol.h" using namespace LLVOAvatarDefines; @@ -89,11 +89,6 @@ LLViewerWearable::~LLViewerWearable() { } -void LLViewerWearable::setItemID(const LLUUID& item_id) -{ - mItemID = item_id; -} - // virtual BOOL LLViewerWearable::exportFile(LLFILE* file) const { @@ -107,6 +102,40 @@ BOOL LLViewerWearable::exportFile(LLFILE* file) const return LLWearable::exportFile(file); } + +void LLViewerWearable::createVisualParams() +{ + for (LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam(); + param; + param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam()) + { + if (param->getWearableType() == mType) + { + addVisualParam(param->cloneParam(this)); + } + } + + // resync driver parameters to point to the newly cloned driven parameters + for (visual_param_index_map_t::iterator param_iter = mVisualParamIndexMap.begin(); + param_iter != mVisualParamIndexMap.end(); + ++param_iter) + { + LLVisualParam* param = param_iter->second; + LLVisualParam*(LLWearable::*wearable_function)(S32)const = &LLWearable::getVisualParam; + // need this line to disambiguate between versions of LLCharacter::getVisualParam() + LLVisualParam*(LLAvatarAppearance::*param_function)(S32)const = &LLAvatarAppearance::getVisualParam; + param->resetDrivenParams(); + if(!param->linkDrivenParams(boost::bind(wearable_function,(LLWearable*)this, _1), false)) + { + if( !param->linkDrivenParams(boost::bind(param_function,gAgentAvatarp.get(),_1 ), true)) + { + llwarns << "could not link driven params for wearable " << getName() << " id: " << param->getID() << llendl; + continue; + } + } + } +} + // virtual LLWearable::EImportResult LLViewerWearable::importFile( LLFILE* file ) { @@ -159,6 +188,7 @@ LLWearable::EImportResult LLViewerWearable::importFile( LLFILE* file ) return result; } + // 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. @@ -492,6 +522,11 @@ void LLViewerWearable::copyDataFrom(const LLViewerWearable* src) revertValues(); } +void LLViewerWearable::setItemID(const LLUUID& item_id) +{ + mItemID = item_id; +} + LLLocalTextureObject* LLViewerWearable::getLocalTextureObject(S32 index) { @@ -538,6 +573,17 @@ void LLViewerWearable::setLocalTextureObject(S32 index, LLLocalTextureObject < mTEMap[index] = new LLLocalTextureObject(lto); } +void LLViewerWearable::setVisualParams() +{ + for (visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.begin(); iter != mVisualParamIndexMap.end(); iter++) + { + S32 id = iter->first; + LLVisualParam *wearable_param = iter->second; + F32 value = wearable_param->getWeight(); + gAgentAvatarp->setVisualParamWeight(id, value, FALSE); + } +} + void LLViewerWearable::revertValues() { //update saved settings so wearable is no longer dirty @@ -591,6 +637,19 @@ BOOL LLViewerWearable::isOnTop() const return (this == gAgentWearables.getTopWearable(mType)); } +void LLViewerWearable::createLayers(S32 te) +{ + LLViewerTexLayerSet *layer_set = gAgentAvatarp->getLayerSet((ETextureIndex)te); + if (layer_set) + { + layer_set->cloneTemplates(mTEMap[te], (ETextureIndex)te, this); + } + else + { + llerrs << "could not find layerset for LTO in wearable!" << llendl; + } +} + void LLViewerWearable::saveValues() { //update saved settings so wearable is no longer dirty @@ -702,7 +761,6 @@ void LLViewerWearable::setLabelUpdated() const gInventory.addChangedMask(LLInventoryObserver::LABEL, getItemID()); } - void LLViewerWearable::refreshName() { LLUUID item_id = getItemID(); @@ -802,65 +860,6 @@ void LLViewerWearable::onSaveNewAssetComplete(const LLUUID& new_asset_id, void* } -void LLViewerWearable::createLayers(S32 te) -{ - LLViewerTexLayerSet *layer_set = gAgentAvatarp->getLayerSet((ETextureIndex)te); - if (layer_set) - { - layer_set->cloneTemplates(mTEMap[te], (ETextureIndex)te, this); - } - else - { - llerrs << "could not find layerset for LTO in wearable!" << llendl; - } -} - -void LLViewerWearable::createVisualParams() -{ - for (LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam(); - param; - param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam()) - { - if (param->getWearableType() == mType) - { - addVisualParam(param->cloneParam(this)); - } - } - - // resync driver parameters to point to the newly cloned driven parameters - for (visual_param_index_map_t::iterator param_iter = mVisualParamIndexMap.begin(); - param_iter != mVisualParamIndexMap.end(); - ++param_iter) - { - LLVisualParam* param = param_iter->second; - LLVisualParam*(LLWearable::*wearable_function)(S32)const = &LLWearable::getVisualParam; - // need this line to disambiguate between versions of LLCharacter::getVisualParam() - LLVisualParam*(LLAvatarAppearance::*param_function)(S32)const = &LLAvatarAppearance::getVisualParam; - param->resetDrivenParams(); - if(!param->linkDrivenParams(boost::bind(wearable_function,(LLWearable*)this, _1), false)) - { - if( !param->linkDrivenParams(boost::bind(param_function,gAgentAvatarp.get(),_1 ), true)) - { - llwarns << "could not link driven params for wearable " << getName() << " id: " << param->getID() << llendl; - continue; - } - } - } -} - -void LLViewerWearable::setVisualParams() -{ - for (visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.begin(); iter != mVisualParamIndexMap.end(); iter++) - { - S32 id = iter->first; - LLVisualParam *wearable_param = iter->second; - F32 value = wearable_param->getWeight(); - gAgentAvatarp->setVisualParamWeight(id, value, FALSE); - } -} - - - std::ostream& operator<<(std::ostream &s, const LLViewerWearable &w) { s << "wearable " << LLWearableType::getTypeName(w.mType) << "\n"; @@ -897,4 +896,3 @@ std::string asset_id_to_filename(const LLUUID &asset_id) std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,asset_id_string) + ".wbl"; return filename; } - -- cgit v1.2.3 From 21c364c4d455cc05ec176032e8c090be0cc4ed50 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Mon, 3 Sep 2012 09:10:24 +0000 Subject: Renamed LLVOAvatarDefines to LLAvatarAppearanceDefines --- indra/newview/llviewerwearable.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'indra/newview/llviewerwearable.cpp') diff --git a/indra/newview/llviewerwearable.cpp b/indra/newview/llviewerwearable.cpp index 2b6649a7ec..0cd3ded371 100644 --- a/indra/newview/llviewerwearable.cpp +++ b/indra/newview/llviewerwearable.cpp @@ -35,11 +35,11 @@ #include "lltextureentry.h" #include "llviewertexlayer.h" #include "llvoavatarself.h" -#include "llvoavatardefines.h" +#include "llavatarappearancedefines.h" #include "llviewerwearable.h" #include "llviewercontrol.h" -using namespace LLVOAvatarDefines; +using namespace LLAvatarAppearanceDefines; // support class - remove for 2.1 (hackity hack hack) class LLOverrideBakedTextureUpdate @@ -47,7 +47,7 @@ class LLOverrideBakedTextureUpdate public: LLOverrideBakedTextureUpdate(bool temp_state) { - U32 num_bakes = (U32) LLVOAvatarDefines::BAKED_NUM_INDICES; + U32 num_bakes = (U32) LLAvatarAppearanceDefines::BAKED_NUM_INDICES; for( U32 index = 0; index < num_bakes; ++index ) { composite_enabled[index] = gAgentAvatarp->isCompositeUpdateEnabled(index); @@ -57,14 +57,14 @@ public: ~LLOverrideBakedTextureUpdate() { - U32 num_bakes = (U32)LLVOAvatarDefines::BAKED_NUM_INDICES; + U32 num_bakes = (U32)LLAvatarAppearanceDefines::BAKED_NUM_INDICES; for( U32 index = 0; index < num_bakes; ++index ) { gAgentAvatarp->setCompositeUpdatesEnabled(index, composite_enabled[index]); } } private: - bool composite_enabled[LLVOAvatarDefines::BAKED_NUM_INDICES]; + bool composite_enabled[LLAvatarAppearanceDefines::BAKED_NUM_INDICES]; }; // Private local functions @@ -175,7 +175,7 @@ LLWearable::EImportResult LLViewerWearable::importFile( LLFILE* file ) LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTexture( textureid ); if(gSavedSettings.getBOOL("DebugAvatarLocalTexLoadedTime")) { - image->setLoadedCallback(LLVOAvatarSelf::debugOnTimingLocalTexLoaded,0,TRUE,FALSE, new LLVOAvatarSelf::LLAvatarTexData(textureid, (LLVOAvatarDefines::ETextureIndex)te), NULL); + image->setLoadedCallback(LLVOAvatarSelf::debugOnTimingLocalTexLoaded,0,TRUE,FALSE, new LLVOAvatarSelf::LLAvatarTexData(textureid, (LLAvatarAppearanceDefines::ETextureIndex)te), NULL); } mTEMap[te] = new LLLocalTextureObject(image, textureid); mSavedTEMap[te] = new LLLocalTextureObject(image, textureid); @@ -230,7 +230,7 @@ BOOL LLViewerWearable::isOldVersion() const S32 te_count = 0; for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) { - if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType) + if (LLAvatarAppearanceDictionary::getTEWearableType((ETextureIndex) te) == mType) { te_count++; if( !is_in_map(mTEMap, te ) ) @@ -282,7 +282,7 @@ BOOL LLViewerWearable::isDirty() const for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) { - if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType) + if (LLAvatarAppearanceDictionary::getTEWearableType((ETextureIndex) te) == mType) { te_map_t::const_iterator current_iter = mTEMap.find(te); if(current_iter != mTEMap.end()) @@ -328,7 +328,7 @@ void LLViewerWearable::setTexturesToDefaults() { for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) { - if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType) + if (LLAvatarAppearanceDictionary::getTEWearableType((ETextureIndex) te) == mType) { LLUUID id = getDefaultTextureImageID((ETextureIndex) te); LLViewerFetchedTexture * image = LLViewerTextureManager::getFetchedTexture( id ); @@ -352,7 +352,7 @@ void LLViewerWearable::setTexturesToDefaults() //static const LLUUID LLViewerWearable::getDefaultTextureImageID(ETextureIndex index) { - const LLVOAvatarDictionary::TextureEntry *texture_dict = LLVOAvatarDictionary::getInstance()->getTexture(index); + const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearanceDictionary::getInstance()->getTexture(index); const std::string &default_image_name = texture_dict->mDefaultImageName; if (default_image_name == "") { @@ -389,7 +389,7 @@ void LLViewerWearable::writeToAvatar() // Pull texture entries for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) { - if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex) te) == mType) + if (LLAvatarAppearanceDictionary::getTEWearableType((ETextureIndex) te) == mType) { te_map_t::const_iterator iter = mTEMap.find(te); LLUUID image_id; @@ -492,7 +492,7 @@ void LLViewerWearable::copyDataFrom(const LLViewerWearable* src) // 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) + if (LLAvatarAppearanceDictionary::getTEWearableType((ETextureIndex) te) == mType) { te_map_t::const_iterator iter = src->mTEMap.find(te); LLUUID image_id; @@ -678,7 +678,7 @@ void LLViewerWearable::syncImages(te_map_t &src, te_map_t &dst) // Deep copy of src (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) + if (LLAvatarAppearanceDictionary::getTEWearableType((ETextureIndex) te) == mType) { te_map_t::const_iterator iter = src.find(te); LLUUID image_id; -- cgit v1.2.3 From 1f6e20c5bbfd4495e6493facd2363fd133fe7fcd Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Tue, 4 Sep 2012 17:43:08 +0000 Subject: Split gl-specific LLViewerTexture implementation into llrender/LLGLViewerTexture --- indra/newview/llviewerwearable.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llviewerwearable.cpp') diff --git a/indra/newview/llviewerwearable.cpp b/indra/newview/llviewerwearable.cpp index 0cd3ded371..34f24ef330 100644 --- a/indra/newview/llviewerwearable.cpp +++ b/indra/newview/llviewerwearable.cpp @@ -401,7 +401,7 @@ void LLViewerWearable::writeToAvatar() { image_id = getDefaultTextureImageID((ETextureIndex) te); } - LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture( image_id, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE ); + LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture( image_id, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE ); // MULTI-WEARABLE: assume index 0 will be used when writing to avatar. TODO: eliminate the need for this. gAgentAvatarp->setLocalTextureTE(te, image, 0); } -- cgit v1.2.3 From 85d0bcc0630bfbf8b50be3a47a113c4f8d6ec9df Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Thu, 6 Sep 2012 02:53:55 +0000 Subject: Extracted mWearableDatas from LLAgentWearables into llappearance/LLWearableData. Moved LLDriverParam into llappearance --- indra/newview/llviewerwearable.cpp | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-) (limited to 'indra/newview/llviewerwearable.cpp') diff --git a/indra/newview/llviewerwearable.cpp b/indra/newview/llviewerwearable.cpp index 34f24ef330..eb3a212eae 100644 --- a/indra/newview/llviewerwearable.cpp +++ b/indra/newview/llviewerwearable.cpp @@ -632,11 +632,6 @@ void LLViewerWearable::revertValues() } } -BOOL LLViewerWearable::isOnTop() const -{ - return (this == gAgentWearables.getTopWearable(mType)); -} - void LLViewerWearable::createLayers(S32 te) { LLViewerTexLayerSet *layer_set = gAgentAvatarp->getLayerSet((ETextureIndex)te); @@ -736,27 +731,8 @@ void LLViewerWearable::destroyTextures() mSavedTEMap.clear(); } -void LLViewerWearable::pullCrossWearableValues() -{ - // scan through all of the avatar's visual parameters - for (LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam(); - param; - param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam()) - { - if( param ) - { - LLDriverParam *driver_param = dynamic_cast(param); - if(driver_param) - { - // parameter is a driver parameter, have it update its - driver_param->updateCrossDrivenParams(getType()); - } - } - } -} - - -void LLViewerWearable::setLabelUpdated() const +// virtual +void LLViewerWearable::setUpdated() const { gInventory.addChangedMask(LLInventoryObserver::LABEL, getItemID()); } @@ -771,6 +747,13 @@ void LLViewerWearable::refreshName() } } +// virtual +void LLViewerWearable::addToBakedTextureHash(LLMD5& hash) const +{ + LLUUID asset_id = getAssetID(); + hash.update((const unsigned char*)asset_id.mData, UUID_BYTES); +} + struct LLWearableSaveData { LLWearableType::EType mType; -- cgit v1.2.3 From f1d6052e36ed6d817faedf9b32cb9d889395cd88 Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Tue, 11 Sep 2012 11:59:45 -0400 Subject: SH-3264 Moved over a few more items to llappearance moved over: isWearingWearableType wearable::writeToAvatar wearable::mTEMap (stores LocalTextureObject*) more from wearable::import/export wearable::createVisualParams, etc --- indra/newview/llviewerwearable.cpp | 116 +++++++------------------------------ 1 file changed, 21 insertions(+), 95 deletions(-) (limited to 'indra/newview/llviewerwearable.cpp') diff --git a/indra/newview/llviewerwearable.cpp b/indra/newview/llviewerwearable.cpp index eb3a212eae..8fe3aff0b0 100644 --- a/indra/newview/llviewerwearable.cpp +++ b/indra/newview/llviewerwearable.cpp @@ -90,60 +90,13 @@ LLViewerWearable::~LLViewerWearable() } // virtual -BOOL LLViewerWearable::exportFile(LLFILE* file) const -{ - mTextureIDMap.clear(); - for (te_map_t::const_iterator iter = mTEMap.begin(); iter != mTEMap.end(); ++iter) - { - S32 te = iter->first; - const LLUUID& image_id = iter->second->getID(); - mTextureIDMap[te] = image_id; - } - return LLWearable::exportFile(file); -} - - -void LLViewerWearable::createVisualParams() -{ - for (LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam(); - param; - param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam()) - { - if (param->getWearableType() == mType) - { - addVisualParam(param->cloneParam(this)); - } - } - - // resync driver parameters to point to the newly cloned driven parameters - for (visual_param_index_map_t::iterator param_iter = mVisualParamIndexMap.begin(); - param_iter != mVisualParamIndexMap.end(); - ++param_iter) - { - LLVisualParam* param = param_iter->second; - LLVisualParam*(LLWearable::*wearable_function)(S32)const = &LLWearable::getVisualParam; - // need this line to disambiguate between versions of LLCharacter::getVisualParam() - LLVisualParam*(LLAvatarAppearance::*param_function)(S32)const = &LLAvatarAppearance::getVisualParam; - param->resetDrivenParams(); - if(!param->linkDrivenParams(boost::bind(wearable_function,(LLWearable*)this, _1), false)) - { - if( !param->linkDrivenParams(boost::bind(param_function,gAgentAvatarp.get(),_1 ), true)) - { - llwarns << "could not link driven params for wearable " << getName() << " id: " << param->getID() << llendl; - continue; - } - } - } -} - -// virtual -LLWearable::EImportResult LLViewerWearable::importFile( LLFILE* file ) +LLWearable::EImportResult LLViewerWearable::importFile( LLFILE* file, LLAvatarAppearance* avatarp ) { // suppress texlayerset updates while wearables are being imported. Layersets will be updated // when the wearables are "worn", not loaded. Note state will be restored when this object is destroyed. LLOverrideBakedTextureUpdate stop_bakes(false); - LLWearable::EImportResult result = LLWearable::importFile(file); + LLWearable::EImportResult result = LLWearable::importFile(file, avatarp); if (LLWearable::FAILURE == result) return result; if (LLWearable::BAD_HEADER == result) { @@ -157,19 +110,16 @@ LLWearable::EImportResult LLViewerWearable::importFile( LLFILE* file ) LLStringUtil::truncate(mName, DB_INV_ITEM_NAME_STR_LEN ); LLStringUtil::truncate(mDescription, DB_INV_ITEM_DESC_STR_LEN ); - texture_id_map_t::const_iterator iter = mTextureIDMap.begin(); - texture_id_map_t::const_iterator end = mTextureIDMap.end(); + te_map_t::const_iterator iter = mTEMap.begin(); + te_map_t::const_iterator end = mTEMap.end(); for (; iter != end; ++iter) { S32 te = iter->first; - const LLUUID& textureid = iter->second; - if( mTEMap.find(te) != mTEMap.end() ) - { - delete mTEMap[te]; - } - if( mSavedTEMap.find(te) != mSavedTEMap.end() ) + LLLocalTextureObject* lto = iter->second; + LLUUID textureid = LLUUID::null; + if (lto) { - delete mSavedTEMap[te]; + textureid = lto->getID(); } LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTexture( textureid ); @@ -177,9 +127,6 @@ LLWearable::EImportResult LLViewerWearable::importFile( LLFILE* file ) { image->setLoadedCallback(LLVOAvatarSelf::debugOnTimingLocalTexLoaded,0,TRUE,FALSE, new LLVOAvatarSelf::LLAvatarTexData(textureid, (LLAvatarAppearanceDefines::ETextureIndex)te), NULL); } - mTEMap[te] = new LLLocalTextureObject(image, textureid); - mSavedTEMap[te] = new LLLocalTextureObject(image, textureid); - createLayers(te); } // copy all saved param values to working params @@ -335,7 +282,7 @@ void LLViewerWearable::setTexturesToDefaults() if( mTEMap.find(te) == mTEMap.end() ) { mTEMap[te] = new LLLocalTextureObject(image, id); - createLayers(te); + createLayers(te, gAgentAvatarp); } else { @@ -366,25 +313,17 @@ const LLUUID LLViewerWearable::getDefaultTextureImageID(ETextureIndex index) // Updates the user's avatar's appearance -void LLViewerWearable::writeToAvatar() +//virtual +void LLViewerWearable::writeToAvatar(LLAvatarAppearance *avatarp) { - if (!isAgentAvatarValid()) return; + LLVOAvatarSelf* viewer_avatar = dynamic_cast(avatarp); - ESex old_sex = gAgentAvatarp->getSex(); + if (!avatarp || !viewer_avatar) return; - // Pull params - for( LLVisualParam* param = gAgentAvatarp->getFirstVisualParam(); param; param = gAgentAvatarp->getNextVisualParam() ) - { - // cross-wearable parameters are not authoritative, as they are driven by a different wearable. So don't copy the values to the - // avatar object if cross wearable. Cross wearable params get their values from the avatar, they shouldn't write the other way. - if( (((LLViewerVisualParam*)param)->getWearableType() == mType) && (!((LLViewerVisualParam*)param)->getCrossWearable()) ) - { - S32 param_id = param->getID(); - F32 weight = getVisualParamWeight(param_id); + ESex old_sex = avatarp->getSex(); + + LLWearable::writeToAvatar(avatarp); - gAgentAvatarp->setVisualParamWeight( param_id, weight, FALSE ); - } - } // Pull texture entries for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) @@ -403,14 +342,14 @@ void LLViewerWearable::writeToAvatar() } LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture( image_id, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE ); // MULTI-WEARABLE: assume index 0 will be used when writing to avatar. TODO: eliminate the need for this. - gAgentAvatarp->setLocalTextureTE(te, image, 0); + viewer_avatar->setLocalTextureTE(te, image, 0); } } - ESex new_sex = gAgentAvatarp->getSex(); + ESex new_sex = avatarp->getSex(); if( old_sex != new_sex ) { - gAgentAvatarp->updateSexDependentLayerSets( FALSE ); + viewer_avatar->updateSexDependentLayerSets( FALSE ); } // if( upload_bake ) @@ -472,7 +411,7 @@ void LLViewerWearable::copyDataFrom(const LLViewerWearable* src) mPermissions = src->mPermissions; mSaleInfo = src->mSaleInfo; - setType(src->mType); + setType(src->mType, gAgentAvatarp); mSavedVisualParamMap.clear(); // Deep copy of mVisualParamMap (copies only those params that are current, filling in defaults where needed) @@ -513,7 +452,7 @@ void LLViewerWearable::copyDataFrom(const LLViewerWearable* src) mTEMap[te] = new LLLocalTextureObject(image, image_id); mSavedTEMap[te] = new LLLocalTextureObject(image, image_id); } - createLayers(te); + createLayers(te, gAgentAvatarp); } } @@ -632,19 +571,6 @@ void LLViewerWearable::revertValues() } } -void LLViewerWearable::createLayers(S32 te) -{ - LLViewerTexLayerSet *layer_set = gAgentAvatarp->getLayerSet((ETextureIndex)te); - if (layer_set) - { - layer_set->cloneTemplates(mTEMap[te], (ETextureIndex)te, this); - } - else - { - llerrs << "could not find layerset for LTO in wearable!" << llendl; - } -} - void LLViewerWearable::saveValues() { //update saved settings so wearable is no longer dirty -- cgit v1.2.3 From 47403abc3e1787c81707df0fe8852e46d156953c Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 19 Sep 2012 13:16:59 -0400 Subject: work in progress, more debugging/logging of avatar visual param info --- indra/newview/llviewerwearable.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) mode change 100644 => 100755 indra/newview/llviewerwearable.cpp (limited to 'indra/newview/llviewerwearable.cpp') diff --git a/indra/newview/llviewerwearable.cpp b/indra/newview/llviewerwearable.cpp old mode 100644 new mode 100755 index e9fa92e8be..5b74f1a976 --- a/indra/newview/llviewerwearable.cpp +++ b/indra/newview/llviewerwearable.cpp @@ -322,7 +322,7 @@ void LLViewerWearable::writeToAvatar(LLAvatarAppearance *avatarp) if (!viewer_avatar->isValid()) return; -#if 1 +#if 0 // FIXME restrict to server-bake regions. if (!viewer_avatar->isUsingLocalAppearance()) { return; @@ -528,7 +528,10 @@ void LLViewerWearable::setVisualParams() S32 id = iter->first; LLVisualParam *wearable_param = iter->second; F32 value = wearable_param->getWeight(); - gAgentAvatarp->setVisualParamWeight(id, value, FALSE); + if (gAgentAvatarp->isUsingLocalAppearance()) + { + gAgentAvatarp->setVisualParamWeight(id, value, FALSE); + } } } -- cgit v1.2.3 From f3d52b8d54c3be67262d4d8ae9a00253e9d55249 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 19 Sep 2012 17:59:27 -0400 Subject: small tweaks to param debugging, restricting LLWearable::writeToAvatar --- indra/newview/llviewerwearable.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview/llviewerwearable.cpp') diff --git a/indra/newview/llviewerwearable.cpp b/indra/newview/llviewerwearable.cpp index 5b74f1a976..373cc63b41 100755 --- a/indra/newview/llviewerwearable.cpp +++ b/indra/newview/llviewerwearable.cpp @@ -322,12 +322,11 @@ void LLViewerWearable::writeToAvatar(LLAvatarAppearance *avatarp) if (!viewer_avatar->isValid()) return; -#if 0 // FIXME restrict to server-bake regions. + // FIXME restrict this check to server bake regions? if (!viewer_avatar->isUsingLocalAppearance()) { return; } -#endif ESex old_sex = avatarp->getSex(); @@ -523,7 +522,8 @@ void LLViewerWearable::setLocalTextureObject(S32 index, LLLocalTextureObject < void LLViewerWearable::setVisualParams() { - for (visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.begin(); iter != mVisualParamIndexMap.end(); iter++) + for (visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.begin(); + iter != mVisualParamIndexMap.end(); iter++) { S32 id = iter->first; LLVisualParam *wearable_param = iter->second; -- cgit v1.2.3 From 7153d1db11c00245a379fa9601f092020152ea73 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Thu, 20 Sep 2012 04:29:17 +0000 Subject: Partial rewrite of llifstream and llofstream (Windows implementation pending). Moved more functionality from llviewerwearable to llwearable --- indra/newview/llviewerwearable.cpp | 184 ++----------------------------------- 1 file changed, 6 insertions(+), 178 deletions(-) (limited to 'indra/newview/llviewerwearable.cpp') diff --git a/indra/newview/llviewerwearable.cpp b/indra/newview/llviewerwearable.cpp index e9fa92e8be..162c20837a 100644 --- a/indra/newview/llviewerwearable.cpp +++ b/indra/newview/llviewerwearable.cpp @@ -90,13 +90,13 @@ LLViewerWearable::~LLViewerWearable() } // virtual -LLWearable::EImportResult LLViewerWearable::importFile( LLFILE* file, LLAvatarAppearance* avatarp ) +LLWearable::EImportResult LLViewerWearable::importStream( std::istream& input_stream, LLAvatarAppearance* avatarp ) { // suppress texlayerset updates while wearables are being imported. Layersets will be updated // when the wearables are "worn", not loaded. Note state will be restored when this object is destroyed. LLOverrideBakedTextureUpdate stop_bakes(false); - LLWearable::EImportResult result = LLWearable::importFile(file, avatarp); + LLWearable::EImportResult result = LLWearable::importStream(input_stream, avatarp); if (LLWearable::FAILURE == result) return result; if (LLWearable::BAD_HEADER == result) { @@ -129,9 +129,6 @@ LLWearable::EImportResult LLViewerWearable::importFile( LLFILE* file, LLAvatarAp } } - // copy all saved param values to working params - revertValues(); - return result; } @@ -296,8 +293,8 @@ void LLViewerWearable::setTexturesToDefaults() } -//static -const LLUUID LLViewerWearable::getDefaultTextureImageID(ETextureIndex index) +// virtual +LLUUID LLViewerWearable::getDefaultTextureImageID(ETextureIndex index) const { const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearanceDictionary::getInstance()->getTexture(index); const std::string &default_image_name = texture_dict->mDefaultImageName; @@ -475,103 +472,9 @@ void LLViewerWearable::setItemID(const LLUUID& item_id) mItemID = item_id; } - -LLLocalTextureObject* LLViewerWearable::getLocalTextureObject(S32 index) -{ - te_map_t::iterator iter = mTEMap.find(index); - if( iter != mTEMap.end() ) - { - LLLocalTextureObject* lto = iter->second; - return lto; - } - return NULL; -} - -const LLLocalTextureObject* LLViewerWearable::getLocalTextureObject(S32 index) const -{ - te_map_t::const_iterator iter = mTEMap.find(index); - if( iter != mTEMap.end() ) - { - const LLLocalTextureObject* lto = iter->second; - return lto; - } - return NULL; -} - -std::vector LLViewerWearable::getLocalTextureListSeq() -{ - std::vector result; - - for(te_map_t::const_iterator iter = mTEMap.begin(); - iter != mTEMap.end(); iter++) - { - LLLocalTextureObject* lto = iter->second; - result.push_back(lto); - } - - return result; -} - -void LLViewerWearable::setLocalTextureObject(S32 index, LLLocalTextureObject <o) -{ - if( mTEMap.find(index) != mTEMap.end() ) - { - mTEMap.erase(index); - } - mTEMap[index] = new LLLocalTextureObject(lto); -} - -void LLViewerWearable::setVisualParams() -{ - for (visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.begin(); iter != mVisualParamIndexMap.end(); iter++) - { - S32 id = iter->first; - LLVisualParam *wearable_param = iter->second; - F32 value = wearable_param->getWeight(); - gAgentAvatarp->setVisualParamWeight(id, value, FALSE); - } -} - void LLViewerWearable::revertValues() { - //update saved settings so wearable is no longer dirty - // non-driver params first - for (param_map_t::const_iterator iter = mSavedVisualParamMap.begin(); iter != mSavedVisualParamMap.end(); iter++) - { - S32 id = iter->first; - F32 value = iter->second; - LLVisualParam *param = getVisualParam(id); - if(param && !dynamic_cast(param) ) - { - setVisualParamWeight(id, value, TRUE); - } - } - - //then driver params - for (param_map_t::const_iterator iter = mSavedVisualParamMap.begin(); iter != mSavedVisualParamMap.end(); iter++) - { - S32 id = iter->first; - F32 value = iter->second; - LLVisualParam *param = getVisualParam(id); - if(param && dynamic_cast(param) ) - { - setVisualParamWeight(id, value, TRUE); - } - } - - // make sure that saved values are sane - for (param_map_t::const_iterator iter = mSavedVisualParamMap.begin(); iter != mSavedVisualParamMap.end(); iter++) - { - S32 id = iter->first; - LLVisualParam *param = getVisualParam(id); - if( param ) - { - mSavedVisualParamMap[id] = param->getWeight(); - } - } - - syncImages(mSavedTEMap, mTEMap); - + LLWearable::revertValues(); LLSidepanelAppearance *panel = dynamic_cast(LLFloaterSidePanelContainer::getPanel("appearance")); if( panel ) @@ -582,19 +485,7 @@ void LLViewerWearable::revertValues() void LLViewerWearable::saveValues() { - //update saved settings so wearable is no longer dirty - mSavedVisualParamMap.clear(); - for (visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.begin(); iter != mVisualParamIndexMap.end(); ++iter) - { - S32 id = iter->first; - LLVisualParam *wearable_param = iter->second; - F32 value = wearable_param->getWeight(); - mSavedVisualParamMap[id] = value; - } - - // Deep copy of mTEMap (copies only those tes that are current, filling in defaults where needed) - syncImages(mTEMap, mSavedTEMap); - + LLWearable::saveValues(); LLSidepanelAppearance *panel = dynamic_cast(LLFloaterSidePanelContainer::getPanel("appearance")); if( panel ) @@ -603,69 +494,6 @@ void LLViewerWearable::saveValues() } } -void LLViewerWearable::syncImages(te_map_t &src, te_map_t &dst) -{ - // Deep copy of src (copies only those tes that are current, filling in defaults where needed) - for( S32 te = 0; te < TEX_NUM_INDICES; te++ ) - { - if (LLAvatarAppearanceDictionary::getTEWearableType((ETextureIndex) te) == mType) - { - te_map_t::const_iterator iter = src.find(te); - LLUUID image_id; - LLViewerFetchedTexture *image = NULL; - LLLocalTextureObject *lto = NULL; - if(iter != src.end()) - { - // there's a Local Texture Object in the source image map. Use this to populate the values to store in the destination image map. - lto = iter->second; - image = dynamic_cast (lto->getImage()); - image_id = lto->getID(); - } - else - { - // there is no Local Texture Object in the source image map. Get defaults values for populating the destination image map. - image_id = getDefaultTextureImageID((ETextureIndex) te); - image = LLViewerTextureManager::getFetchedTexture( image_id ); - } - - if( dst.find(te) != dst.end() ) - { - // there's already an entry in the destination map for the texture. Just update its values. - dst[te]->setImage(image); - dst[te]->setID(image_id); - } - else - { - // no entry found in the destination map, we need to create a new Local Texture Object - dst[te] = new LLLocalTextureObject(image, image_id); - } - - if( lto ) - { - // If we pulled values from a Local Texture Object in the source map, make sure the proper flags are set in the new (or updated) entry in the destination map. - dst[te]->setBakedReady(lto->getBakedReady()); - dst[te]->setDiscard(lto->getDiscard()); - } - } - } -} - -void LLViewerWearable::destroyTextures() -{ - for( te_map_t::iterator iter = mTEMap.begin(); iter != mTEMap.end(); ++iter ) - { - LLLocalTextureObject *lto = iter->second; - delete lto; - } - mTEMap.clear(); - for( te_map_t::iterator iter = mSavedTEMap.begin(); iter != mSavedTEMap.end(); ++iter ) - { - LLLocalTextureObject *lto = iter->second; - delete lto; - } - mSavedTEMap.clear(); -} - // virtual void LLViewerWearable::setUpdated() const { -- cgit v1.2.3 From 93e210d91f521b01deb10aa6aa25160364e6ae28 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 26 Sep 2012 15:45:58 -0400 Subject: more state management stuff, DRANO flags for problematic areas --- indra/newview/llviewerwearable.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llviewerwearable.cpp') diff --git a/indra/newview/llviewerwearable.cpp b/indra/newview/llviewerwearable.cpp index 373cc63b41..bd277349d6 100755 --- a/indra/newview/llviewerwearable.cpp +++ b/indra/newview/llviewerwearable.cpp @@ -537,6 +537,8 @@ void LLViewerWearable::setVisualParams() void LLViewerWearable::revertValues() { + // FIXME DRANO - this triggers changes to driven params on avatar, potentially clobbering baked appearance. + //update saved settings so wearable is no longer dirty // non-driver params first for (param_map_t::const_iterator iter = mSavedVisualParamMap.begin(); iter != mSavedVisualParamMap.end(); iter++) -- cgit v1.2.3 From 4f93192e7d00f1f03e0e5241e9f1d2f31623729c Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Thu, 27 Sep 2012 00:38:52 +0000 Subject: Fix for mac/linux 'ruth' appearance. Fix for linux build issue --- indra/newview/llviewerwearable.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/llviewerwearable.cpp') diff --git a/indra/newview/llviewerwearable.cpp b/indra/newview/llviewerwearable.cpp index 162c20837a..41cef237ed 100644 --- a/indra/newview/llviewerwearable.cpp +++ b/indra/newview/llviewerwearable.cpp @@ -319,7 +319,8 @@ void LLViewerWearable::writeToAvatar(LLAvatarAppearance *avatarp) if (!viewer_avatar->isValid()) return; -#if 1 + // *TODO: Check with Vir on this: +#if 0 if (!viewer_avatar->isUsingLocalAppearance()) { return; -- cgit v1.2.3 From 352698140775e62498686f80b5aa21aee85524cf Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 27 Sep 2012 05:47:48 -0400 Subject: Fix for ruthing in non-server-bake regions --- indra/newview/llviewerwearable.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'indra/newview/llviewerwearable.cpp') diff --git a/indra/newview/llviewerwearable.cpp b/indra/newview/llviewerwearable.cpp index bd277349d6..440548046f 100755 --- a/indra/newview/llviewerwearable.cpp +++ b/indra/newview/llviewerwearable.cpp @@ -38,6 +38,7 @@ #include "llavatarappearancedefines.h" #include "llviewerwearable.h" #include "llviewercontrol.h" +#include "llviewerregion.h" using namespace LLAvatarAppearanceDefines; @@ -322,8 +323,9 @@ void LLViewerWearable::writeToAvatar(LLAvatarAppearance *avatarp) if (!viewer_avatar->isValid()) return; - // FIXME restrict this check to server bake regions? - if (!viewer_avatar->isUsingLocalAppearance()) + if (viewer_avatar->getRegion() && + (viewer_avatar->getRegion()->getCentralBakeVersion()>0) && + !viewer_avatar->isUsingLocalAppearance()) { return; } -- cgit v1.2.3 From 878eb2b61a26eef3151319cffd1d8d5196b118c2 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 27 Sep 2012 17:46:19 -0400 Subject: audited uses of centralBakeVersion vs. isUsingServerBakes --- indra/newview/llviewerwearable.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indra/newview/llviewerwearable.cpp') diff --git a/indra/newview/llviewerwearable.cpp b/indra/newview/llviewerwearable.cpp index 440548046f..9b1d8d7936 100755 --- a/indra/newview/llviewerwearable.cpp +++ b/indra/newview/llviewerwearable.cpp @@ -323,8 +323,9 @@ void LLViewerWearable::writeToAvatar(LLAvatarAppearance *avatarp) if (!viewer_avatar->isValid()) return; - if (viewer_avatar->getRegion() && - (viewer_avatar->getRegion()->getCentralBakeVersion()>0) && + // FIXME DRANO - kludgy way to avoid overwriting avatar state from wearables. + // Ideally would avoid calling this func in the first place. + if (viewer_avatar->isUsingServerBakes() && !viewer_avatar->isUsingLocalAppearance()) { return; -- cgit v1.2.3 From e29b66ed6ce29528f7b733c51db22a31a05d3a5f Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 3 Oct 2012 17:13:18 -0400 Subject: additional fixes for avoiding avatar param manipulation via wearables, setting correct state from avatar appearance --- indra/newview/llviewerwearable.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/newview/llviewerwearable.cpp') diff --git a/indra/newview/llviewerwearable.cpp b/indra/newview/llviewerwearable.cpp index f3d9b2c678..1200f65b6e 100755 --- a/indra/newview/llviewerwearable.cpp +++ b/indra/newview/llviewerwearable.cpp @@ -476,6 +476,10 @@ void LLViewerWearable::setItemID(const LLUUID& item_id) void LLViewerWearable::revertValues() { + if (isAgentAvatarValid() && gAgentAvatarp->isUsingServerBakes() && !gAgentAvatarp->isUsingLocalAppearance()) + { + return; + } LLWearable::revertValues(); -- cgit v1.2.3 From 2390e21a9d2fc6f5cabe132a2bbd807aec186cfa Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 17 Oct 2012 18:32:26 -0400 Subject: additional diagnostics, improved shape stability at cost of increasing entanglement between baked and local appearance --- indra/newview/llviewerwearable.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/newview/llviewerwearable.cpp') diff --git a/indra/newview/llviewerwearable.cpp b/indra/newview/llviewerwearable.cpp index 1200f65b6e..4477893063 100755 --- a/indra/newview/llviewerwearable.cpp +++ b/indra/newview/llviewerwearable.cpp @@ -320,6 +320,7 @@ void LLViewerWearable::writeToAvatar(LLAvatarAppearance *avatarp) if (!viewer_avatar->isValid()) return; +#if 0 // FIXME DRANO - kludgy way to avoid overwriting avatar state from wearables. // Ideally would avoid calling this func in the first place. if (viewer_avatar->isUsingServerBakes() && @@ -327,6 +328,7 @@ void LLViewerWearable::writeToAvatar(LLAvatarAppearance *avatarp) { return; } +#endif ESex old_sex = avatarp->getSex(); @@ -476,10 +478,13 @@ void LLViewerWearable::setItemID(const LLUUID& item_id) void LLViewerWearable::revertValues() { +#if 0 + // DRANO avoid overwrite when not in local appearance if (isAgentAvatarValid() && gAgentAvatarp->isUsingServerBakes() && !gAgentAvatarp->isUsingLocalAppearance()) { return; } +#endif LLWearable::revertValues(); -- cgit v1.2.3 From 5a436e46f6893719fc91a1cb70813671cb2a6d44 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 8 Mar 2013 17:07:17 -0500 Subject: SH-3959 WIP - pass information about type of fetched image - server bake, host bake, map tile, etc - down the chain so LLTextureFetchWorker can adjust behavior as needed --- indra/newview/llviewerwearable.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llviewerwearable.cpp') diff --git a/indra/newview/llviewerwearable.cpp b/indra/newview/llviewerwearable.cpp index 4477893063..e8425dc76a 100755 --- a/indra/newview/llviewerwearable.cpp +++ b/indra/newview/llviewerwearable.cpp @@ -350,7 +350,7 @@ void LLViewerWearable::writeToAvatar(LLAvatarAppearance *avatarp) { image_id = getDefaultTextureImageID((ETextureIndex) te); } - LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture( image_id, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE ); + LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture( image_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE ); // MULTI-WEARABLE: assume index 0 will be used when writing to avatar. TODO: eliminate the need for this. viewer_avatar->setLocalTextureTE(te, image, 0); } -- cgit v1.2.3