diff options
Diffstat (limited to 'indra/newview/llvoavatar.cpp')
-rwxr-xr-x | indra/newview/llvoavatar.cpp | 225 |
1 files changed, 64 insertions, 161 deletions
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 93247a3625..df54f26ae7 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -707,7 +707,6 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mLastRezzedStatus(-1), mIsEditingAppearance(FALSE), mUseLocalAppearance(FALSE), - mUseServerBakes(FALSE), // FIXME DRANO consider using boost::optional, defaulting to unknown. mLastUpdateRequestCOFVersion(-1), mLastUpdateReceivedCOFVersion(-1) { @@ -1067,7 +1066,7 @@ void LLVOAvatar::restoreGL() gAgentAvatarp->setCompositeUpdatesEnabled(TRUE); for (U32 i = 0; i < gAgentAvatarp->mBakedTextureDatas.size(); i++) { - gAgentAvatarp->invalidateComposite(gAgentAvatarp->getTexLayerSet(i), FALSE); + gAgentAvatarp->invalidateComposite(gAgentAvatarp->getTexLayerSet(i)); } gAgentAvatarp->updateMeshTextures(); } @@ -1885,22 +1884,17 @@ LLViewerFetchedTexture *LLVOAvatar::getBakedTextureImage(const U8 te, const LLUU if (!result) { const std::string url = getImageURL(te,uuid); - if (!url.empty()) + if (url.empty()) { - LL_DEBUGS("Avatar") << avString() << "get server-bake image from URL " << url << llendl; - result = LLViewerTextureManager::getFetchedTextureFromUrl( - url, FTT_SERVER_BAKE, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, uuid); - if (result->isMissingAsset()) - { - result->setIsMissingAsset(false); - } + llwarns << "unable to determine URL for te " << te << " uuid " << uuid << llendl; + return NULL; } - else + LL_DEBUGS("Avatar") << avString() << "get server-bake image from URL " << url << llendl; + result = LLViewerTextureManager::getFetchedTextureFromUrl( + url, FTT_SERVER_BAKE, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, uuid); + if (result->isMissingAsset()) { - LL_DEBUGS("Avatar") << avString() << "get old-bake image from host " << uuid << llendl; - LLHost host = getObjectHost(); - result = LLViewerTextureManager::getFetchedTexture( - uuid, FTT_HOST_BAKE, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, host); + result->setIsMissingAsset(false); } } return result; @@ -2130,8 +2124,8 @@ void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled) if ( mLipSyncActive ) { - if( mOohMorph ) mOohMorph->setWeight(mOohMorph->getMinWeight(), FALSE); - if( mAahMorph ) mAahMorph->setWeight(mAahMorph->getMinWeight(), FALSE); + if( mOohMorph ) mOohMorph->setWeight(mOohMorph->getMinWeight()); + if( mAahMorph ) mAahMorph->setWeight(mAahMorph->getMinWeight()); mLipSyncActive = false; LLCharacter::updateVisualParams(); @@ -2294,14 +2288,10 @@ void LLVOAvatar::idleUpdateAppearanceAnimation() { if (param->isTweakable()) { - param->stopAnimating(FALSE); + param->stopAnimating(); } } updateVisualParams(); - if (isSelf()) - { - gAgent.sendAgentSetAppearance(); - } } else { @@ -2317,7 +2307,7 @@ void LLVOAvatar::idleUpdateAppearanceAnimation() { if (param->isTweakable()) { - param->animate(morph_amt, FALSE); + param->animate(morph_amt); } } } @@ -2370,7 +2360,7 @@ void LLVOAvatar::idleUpdateLipSync(bool voice_enabled) F32 ooh_weight = mOohMorph->getMinWeight() + ooh_morph_amount * (mOohMorph->getMaxWeight() - mOohMorph->getMinWeight()); - mOohMorph->setWeight( ooh_weight, FALSE ); + mOohMorph->setWeight( ooh_weight); } if( mAahMorph ) @@ -2378,7 +2368,7 @@ void LLVOAvatar::idleUpdateLipSync(bool voice_enabled) F32 aah_weight = mAahMorph->getMinWeight() + aah_morph_amount * (mAahMorph->getMaxWeight() - mAahMorph->getMinWeight()); - mAahMorph->setWeight( aah_weight, FALSE ); + mAahMorph->setWeight( aah_weight); } mLipSyncActive = true; @@ -3015,7 +3005,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) isSelf() ? (all_local_downloaded ? "L" : "l") : "-", all_baked_downloaded ? "B" : "b", mUseLocalAppearance, mIsEditingAppearance, - mUseServerBakes, central_bake_version); + 1, central_bake_version); std::string origin_string = bakedTextureOriginInfo(); debug_line += " [" + origin_string + "]"; S32 curr_cof_version = LLAppearanceMgr::instance().getCOFVersion(); @@ -4121,34 +4111,6 @@ bool LLVOAvatar::allBakedTexturesCompletelyDownloaded() const return allTexturesCompletelyDownloaded(baked_ids); } -void LLVOAvatar::bakedTextureOriginCounts(S32 &sb_count, // server-bake, has origin URL. - S32 &host_count, // host-based bake, has host. - S32 &both_count, // error - both host and URL set. - S32 &neither_count) // error - neither set. -{ - sb_count = host_count = both_count = neither_count = 0; - - std::set<LLUUID> baked_ids; - collectBakedTextureUUIDs(baked_ids); - for (std::set<LLUUID>::const_iterator it = baked_ids.begin(); it != baked_ids.end(); ++it) - { - LLViewerFetchedTexture *imagep = gTextureList.findImage(*it); - bool has_url = false, has_host = false; - if (!imagep->getUrl().empty()) - { - has_url = true; - } - if (imagep->getTargetHost().isOk()) - { - has_host = true; - } - if (has_url && !has_host) sb_count++; - else if (has_host && !has_url) host_count++; - else if (has_host && has_url) both_count++; - else if (!has_host && !has_url) neither_count++; - } -} - std::string LLVOAvatar::bakedTextureOriginInfo() { std::string result; @@ -4389,19 +4351,6 @@ void LLVOAvatar::updateTextures() { const S32 boost_level = getAvatarBakedBoostLevel(); imagep = LLViewerTextureManager::staticCastToFetchedTexture(getImage(texture_index,0), TRUE); - // Spam if this is a baked texture, not set to default image, without valid host info - if (isIndexBakedTexture((ETextureIndex)texture_index) - && imagep->getID() != IMG_DEFAULT_AVATAR - && imagep->getID() != IMG_INVISIBLE - && !isUsingServerBakes() - && !imagep->getTargetHost().isOk()) - { - LL_WARNS_ONCE("Texture") << "LLVOAvatar::updateTextures No host for texture " - << imagep->getID() << " for avatar " - << (isSelf() ? "<myself>" : getID().asString()) - << " on host " << getRegion()->getHost() << llendl; - } - addBakedTextureStats( imagep, mPixelArea, texel_area_ratio, boost_level ); } } @@ -4533,22 +4482,19 @@ const std::string LLVOAvatar::getImageURL(const U8 te, const LLUUID &uuid) { llassert(isIndexBakedTexture(ETextureIndex(te))); std::string url = ""; - if (isUsingServerBakes()) + const std::string& appearance_service_url = LLAppearanceMgr::instance().getAppearanceServiceURL(); + if (appearance_service_url.empty()) { - const std::string& appearance_service_url = LLAppearanceMgr::instance().getAppearanceServiceURL(); - if (appearance_service_url.empty()) - { - // Probably a server-side issue if we get here: - llwarns << "AgentAppearanceServiceURL not set - Baked texture requests will fail" << llendl; - return url; - } + // Probably a server-side issue if we get here: + llwarns << "AgentAppearanceServiceURL not set - Baked texture requests will fail" << llendl; + return url; + } - const LLAvatarAppearanceDictionary::TextureEntry* texture_entry = LLAvatarAppearanceDictionary::getInstance()->getTexture((ETextureIndex)te); - if (texture_entry != NULL) - { - url = appearance_service_url + "texture/" + getID().asString() + "/" + texture_entry->mDefaultImageName + "/" + uuid.asString(); - //llinfos << "baked texture url: " << url << llendl; - } + const LLAvatarAppearanceDictionary::TextureEntry* texture_entry = LLAvatarAppearanceDictionary::getInstance()->getTexture((ETextureIndex)te); + if (texture_entry != NULL) + { + url = appearance_service_url + "texture/" + getID().asString() + "/" + texture_entry->mDefaultImageName + "/" + uuid.asString(); + //llinfos << "baked texture url: " << url << llendl; } return url; } @@ -5345,11 +5291,11 @@ BOOL LLVOAvatar::updateGeometry(LLDrawable *drawable) //----------------------------------------------------------------------------- // updateSexDependentLayerSets() //----------------------------------------------------------------------------- -void LLVOAvatar::updateSexDependentLayerSets( BOOL upload_bake ) +void LLVOAvatar::updateSexDependentLayerSets() { - invalidateComposite( mBakedTextureDatas[BAKED_HEAD].mTexLayerSet, upload_bake ); - invalidateComposite( mBakedTextureDatas[BAKED_UPPER].mTexLayerSet, upload_bake ); - invalidateComposite( mBakedTextureDatas[BAKED_LOWER].mTexLayerSet, upload_bake ); + invalidateComposite( mBakedTextureDatas[BAKED_HEAD].mTexLayerSet); + invalidateComposite( mBakedTextureDatas[BAKED_UPPER].mTexLayerSet); + invalidateComposite( mBakedTextureDatas[BAKED_LOWER].mTexLayerSet); } //----------------------------------------------------------------------------- @@ -5829,7 +5775,7 @@ BOOL LLVOAvatar::isWearingWearableType(LLWearableType::EType type) const // virtual -void LLVOAvatar::invalidateComposite( LLTexLayerSet* layerset, BOOL upload_result ) +void LLVOAvatar::invalidateComposite( LLTexLayerSet* layerset) { } @@ -5838,18 +5784,18 @@ void LLVOAvatar::invalidateAll() } // virtual -void LLVOAvatar::onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL upload_bake ) +void LLVOAvatar::onGlobalColorChanged(const LLTexGlobalColor* global_color) { if (global_color == mTexSkinColor) { - invalidateComposite( mBakedTextureDatas[BAKED_HEAD].mTexLayerSet, upload_bake ); - invalidateComposite( mBakedTextureDatas[BAKED_UPPER].mTexLayerSet, upload_bake ); - invalidateComposite( mBakedTextureDatas[BAKED_LOWER].mTexLayerSet, upload_bake ); + invalidateComposite( mBakedTextureDatas[BAKED_HEAD].mTexLayerSet); + invalidateComposite( mBakedTextureDatas[BAKED_UPPER].mTexLayerSet); + invalidateComposite( mBakedTextureDatas[BAKED_LOWER].mTexLayerSet); } else if (global_color == mTexHairColor) { - invalidateComposite( mBakedTextureDatas[BAKED_HEAD].mTexLayerSet, upload_bake ); - invalidateComposite( mBakedTextureDatas[BAKED_HAIR].mTexLayerSet, upload_bake ); + invalidateComposite( mBakedTextureDatas[BAKED_HEAD].mTexLayerSet); + invalidateComposite( mBakedTextureDatas[BAKED_HAIR].mTexLayerSet); // ! BACKWARDS COMPATIBILITY ! // Fix for dealing with avatars from viewers that don't bake hair. @@ -5871,7 +5817,7 @@ void LLVOAvatar::onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL else if (global_color == mTexEyeColor) { // llinfos << "invalidateComposite cause: onGlobalColorChanged( eyecolor )" << llendl; - invalidateComposite( mBakedTextureDatas[BAKED_EYES].mTexLayerSet, upload_bake ); + invalidateComposite( mBakedTextureDatas[BAKED_EYES].mTexLayerSet); } updateMeshTextures(); } @@ -6071,7 +6017,7 @@ void LLVOAvatar::logMetricsTimerRecord(const std::string& phase_name, F32 elapse } record["grid_x"] = LLSD::Integer(grid_x); record["grid_y"] = LLSD::Integer(grid_y); - record["is_using_server_bakes"] = ((bool) isUsingServerBakes()); + record["is_using_server_bakes"] = true; record["is_self"] = isSelf(); if (isAgentAvatarValid()) @@ -6901,19 +6847,18 @@ bool resolve_appearance_version(const LLAppearanceMessageContents& contents, S32 { llwarns << "inconsistent appearance_version settings - field: " << contents.mAppearanceVersion << ", param: " << contents.mParamAppearanceVersion << llendl; - return false; } - if (contents.mParamAppearanceVersion >= 0) // use visual param if available. + if (contents.mParamAppearanceVersion > 0) // use visual param if available. { appearance_version = contents.mParamAppearanceVersion; } - if (contents.mAppearanceVersion >= 0) + else if (contents.mAppearanceVersion > 0) { appearance_version = contents.mAppearanceVersion; } - if (appearance_version < 0) // still not set, go with 0. + else // still not set, go with 1. { - appearance_version = 0; + appearance_version = 1; } LL_DEBUGS("Avatar") << "appearance version info - field " << contents.mAppearanceVersion << " param: " << contents.mParamAppearanceVersion @@ -6951,24 +6896,21 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) llwarns << "bad appearance version info, discarding" << llendl; return; } + llassert(appearance_version > 0); + if (appearance_version > 1) + { + llwarns << "unsupported appearance version " << appearance_version << ", discarding appearance message" << llendl; + return; + } + S32 this_update_cof_version = contents.mCOFVersion; S32 last_update_request_cof_version = mLastUpdateRequestCOFVersion; - // Only now that we have result of appearance_version can we decide whether to bail out. if( isSelf() ) { LL_DEBUGS("Avatar") << "this_update_cof_version " << this_update_cof_version << " last_update_request_cof_version " << last_update_request_cof_version << " my_cof_version " << LLAppearanceMgr::instance().getCOFVersion() << llendl; - - if (getRegion() && (getRegion()->getCentralBakeVersion()==0)) - { - llwarns << avString() << "Received AvatarAppearance message for self in non-server-bake region" << llendl; - } - if( mFirstTEMessageReceived && (appearance_version == 0)) - { - return; - } } else { @@ -6977,7 +6919,6 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) // Check for stale update. if (isSelf() - && (appearance_version>0) && (this_update_cof_version < last_update_request_cof_version)) { llwarns << "Stale appearance update, wanted version " << last_update_request_cof_version @@ -6991,6 +6932,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) return; } + // SUNSHINE CLEANUP - is this case OK now? S32 num_params = contents.mParamWeights.size(); if (num_params <= 1) { @@ -7002,18 +6944,14 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) return; } - // No backsies zone - if we get here, the message should be valid and usable. - if (appearance_version > 0) - { - // Note: - // RequestAgentUpdateAppearanceResponder::onRequestRequested() - // assumes that cof version is only updated with server-bake - // appearance messages. - mLastUpdateReceivedCOFVersion = this_update_cof_version; - } - - setIsUsingServerBakes(appearance_version > 0); + // No backsies zone - if we get here, the message should be valid and usable, will be processed. + // Note: + // RequestAgentUpdateAppearanceResponder::onRequestRequested() + // assumes that cof version is only updated with server-bake + // appearance messages. + mLastUpdateReceivedCOFVersion = this_update_cof_version; + applyParsedTEMessage(contents.mTEContents); // prevent the overwriting of valid baked textures with invalid baked textures @@ -7023,13 +6961,13 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) && mBakedTextureDatas[baked_index].mLastTextureID != IMG_DEFAULT && baked_index != BAKED_SKIRT) { - LL_DEBUGS("Avatar") << avString() << "sb " << (S32) isUsingServerBakes() << " baked_index " << (S32) baked_index << " using mLastTextureID " << mBakedTextureDatas[baked_index].mLastTextureID << llendl; + LL_DEBUGS("Avatar") << avString() << " baked_index " << (S32) baked_index << " using mLastTextureID " << mBakedTextureDatas[baked_index].mLastTextureID << llendl; setTEImage(mBakedTextureDatas[baked_index].mTextureIndex, LLViewerTextureManager::getFetchedTexture(mBakedTextureDatas[baked_index].mLastTextureID, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); } else { - LL_DEBUGS("Avatar") << avString() << "sb " << (S32) isUsingServerBakes() << " baked_index " << (S32) baked_index << " using texture id " + LL_DEBUGS("Avatar") << avString() << " baked_index " << (S32) baked_index << " using texture id " << getTE(mBakedTextureDatas[baked_index].mTextureIndex)->getID() << llendl; } } @@ -7071,13 +7009,13 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) if(is_first_appearance_message) { //LL_DEBUGS("Avatar") << "param slam " << i << " " << newWeight << llendl; - param->setWeight(newWeight, FALSE); + param->setWeight(newWeight); } else { //LL_DEBUGS("Avatar") << std::setprecision(5) << " param target " << i << " " << param->getWeight() << " -> " << newWeight << llendl; interp_params = TRUE; - param->setAnimationTarget(newWeight, FALSE); + param->setAnimationTarget(newWeight); } } } @@ -7100,7 +7038,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) ESex new_sex = getSex(); if( old_sex != new_sex ) { - updateSexDependentLayerSets( FALSE ); + updateSexDependentLayerSets(); } } @@ -7610,41 +7548,6 @@ void LLVOAvatar::startAppearanceAnimation() } } -//virtual -void LLVOAvatar::bodySizeChanged() -{ - if (isSelf() && !LLAppearanceMgr::instance().isInUpdateAppearanceFromCOF()) - { // notify simulator of change in size - // but not if we are in the middle of updating appearance - gAgent.sendAgentSetAppearance(); - } -} - -BOOL LLVOAvatar::isUsingServerBakes() const -{ -#if 1 - // Sanity check - visual param for appearance version should match mUseServerBakes - LLVisualParam* appearance_version_param = getVisualParam(11000); - llassert(appearance_version_param); - F32 wt = appearance_version_param->getWeight(); - F32 expect_wt = mUseServerBakes ? 1.0 : 0.0; - if (!is_approx_equal(wt,expect_wt)) - { - llwarns << "wt " << wt << " differs from expected " << expect_wt << llendl; - } -#endif - - return mUseServerBakes; -} - -void LLVOAvatar::setIsUsingServerBakes(BOOL newval) -{ - mUseServerBakes = newval; - LLVisualParam* appearance_version_param = getVisualParam(11000); - llassert(appearance_version_param); - appearance_version_param->setWeight(newval ? 1.0 : 0.0, false); -} - // virtual void LLVOAvatar::removeMissingBakedTextures() { |