From e4a0dda457039b1a04c74024d9fbcf02e071b13d Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 28 Jun 2012 14:24:04 -0400 Subject: SH-3228 WIP - always respond to processAppearance for self, convert baked textures to checkerboards --- indra/newview/llvoavatar.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index d2247ed5cb..531d3b4940 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -7283,7 +7283,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) if( isSelf() ) { llwarns << avString() << "Received AvatarAppearance for self" << llendl; - if( mFirstTEMessageReceived ) + if( mFirstTEMessageReceived && !LLAppearanceMgr::instance().useServerTextureBaking()) { // llinfos << "processAvatarAppearance end " << mID << llendl; return; @@ -7294,7 +7294,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) // llinfos << "LLVOAvatar::processAvatarAppearance()" << llendl; // dumpAvatarTEs( "PRE processAvatarAppearance()" ); - unpackTEMessage(mesgsys, _PREHASH_ObjectData); + unpackTEMessage(mesgsys, _PREHASH_ObjectData, LLAppearanceMgr::instance().useServerTextureBaking()); // dumpAvatarTEs( "POST processAvatarAppearance()" ); // prevent the overwriting of valid baked textures with invalid baked textures -- cgit v1.2.3 From 033c84dc9452f4b38cdf87446203241c4554d126 Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Mon, 9 Jul 2012 14:03:08 -0400 Subject: SH-3171 FIX switched texture pipeline to use the new cap request URL If we support server side texture baking, requests for baked textures will go through the http url received at login. --- indra/newview/llvoavatar.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 531d3b4940..d48d79f807 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2370,6 +2370,17 @@ S32 LLVOAvatar::setTETexture(const U8 te, const LLUUID& uuid) // to redirect certain avatar texture requests to different sims. if (isIndexBakedTexture((ETextureIndex)te)) { + std::string url = gSavedSettings.getString("AgentAppearanceServiceURL"); + if (LLAppearanceMgr::instance().useServerTextureBaking() && !url.empty()) + { + const LLVOAvatarDictionary::TextureEntry* texture_entry = LLVOAvatarDictionary::getInstance()->getTexture((ETextureIndex)te); + if (texture_entry != NULL) + { + url += "texture/" + getID().asString() + "/" + texture_entry->mDefaultImageName + "/" + uuid.asString(); + return setTETextureCore(te, uuid, url); + } + } + LLHost target_host = getObjectHost(); return setTETextureCore(te, uuid, target_host); } @@ -4669,7 +4680,10 @@ void LLVOAvatar::addBakedTextureStats( LLViewerFetchedTexture* imagep, F32 pixel //the texture pipeline will stop fetching this texture. imagep->resetTextureStats(); - imagep->setCanUseHTTP(false) ; //turn off http fetching for baked textures. + if (!LLAppearanceMgr::instance().useServerTextureBaking()) + { + imagep->setCanUseHTTP(false); //turn off http fetching for baked textures. + } imagep->setMaxVirtualSizeResetInterval(MAX_TEXTURE_VIRTURE_SIZE_RESET_INTERVAL); imagep->resetMaxVirtualSizeResetCounter() ; @@ -7294,7 +7308,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) // llinfos << "LLVOAvatar::processAvatarAppearance()" << llendl; // dumpAvatarTEs( "PRE processAvatarAppearance()" ); - unpackTEMessage(mesgsys, _PREHASH_ObjectData, LLAppearanceMgr::instance().useServerTextureBaking()); + unpackTEMessage(mesgsys, _PREHASH_ObjectData, FALSE); // dumpAvatarTEs( "POST processAvatarAppearance()" ); // prevent the overwriting of valid baked textures with invalid baked textures -- cgit v1.2.3 From 64ad1aba304c50173195e15477c1882c5b6e7d37 Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Wed, 11 Jul 2012 18:30:39 -0400 Subject: SH-3258 WIP initial work: refactoring appearance editing mode Added flags for appearance editing status as well as which textures we should be using at a time. Also refactored so we are not using camera state to track appearance editing mode. Need to add more handling for which textures we actually use. --- indra/newview/llvoavatar.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index d48d79f807..6bcb0c6882 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -692,8 +692,9 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mLoadedCallbacksPaused(FALSE), mHasPelvisOffset( FALSE ), mRenderUnloadedAvatar(LLCachedControl(gSavedSettings, "RenderUnloadedAvatar")), - mLastRezzedStatus(-1) - + mLastRezzedStatus(-1), + mIsEditingAppearance(FALSE), + mUseLocalAppearance(FALSE) { LLMemType mt(LLMemType::MTYPE_AVATAR); //VTResume(); // VTune @@ -7336,13 +7337,6 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) mMeshTexturesDirty = TRUE; gPipeline.markGLRebuild(this); - // ! BACKWARDS COMPATIBILITY ! - // Non-self avatars will no longer have component textures - if (!isSelf()) - { - releaseComponentTextures(); - } - // parse visual params S32 num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_VisualParam); bool drop_visual_params_debug = gSavedSettings.getBOOL("BlockSomeAvatarAppearanceVisualParams") && (ll_rand(2) == 0); // pretend that ~12% of AvatarAppearance messages arrived without a VisualParam block, for testing -- cgit v1.2.3 From 27c7b259b417d5843422e8bd4e8e480a186e44f4 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 12 Jul 2012 18:24:23 -0400 Subject: SH-3267 WIP --- indra/newview/llvoavatar.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 6bcb0c6882..f85b59b8c6 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -7309,9 +7309,27 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) // llinfos << "LLVOAvatar::processAvatarAppearance()" << llendl; // dumpAvatarTEs( "PRE processAvatarAppearance()" ); - unpackTEMessage(mesgsys, _PREHASH_ObjectData, FALSE); + LLTEContents tec; + parseTEMessage(mesgsys, _PREHASH_ObjectData, -1, FALSE, tec); // dumpAvatarTEs( "POST processAvatarAppearance()" ); + // Check for stale update. + if (isSelf() && LLAppearanceMgr::instance().useServerTextureBaking()) + { + // Extract COF Version field hacked into local texture id. + LLUUID texture_id = ((LLUUID*)tec.image_data)[0]; + S32 last_update_request_cof_version = LLAppearanceMgr::instance().mLastUpdateRequestCOFVersion; + S32 *s_words = (S32*) texture_id.mData; + S32 this_update_cof_version = s_words[0]; + if (this_update_cof_version < last_update_request_cof_version) + { + llwarns << "Stale appearance update, wanted version " << last_update_request_cof_version + << ", got " << this_update_cof_version << llendl; + return; + } + } + unpackParsedTEMessage(tec); + // prevent the overwriting of valid baked textures with invalid baked textures for (U8 baked_index = 0; baked_index < mBakedTextureDatas.size(); baked_index++) { -- cgit v1.2.3 From 409be9dcc4e372385f0fb0de274a4b17913bd124 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 13 Jul 2012 16:59:57 -0400 Subject: SH-3267 WIP - extract cof version from avatar appearance message, use to reject stale updates --- indra/newview/llvoavatar.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index f85b59b8c6..e686948fa2 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -7310,7 +7310,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) // llinfos << "LLVOAvatar::processAvatarAppearance()" << llendl; // dumpAvatarTEs( "PRE processAvatarAppearance()" ); LLTEContents tec; - parseTEMessage(mesgsys, _PREHASH_ObjectData, -1, FALSE, tec); + parseTEMessage(mesgsys, _PREHASH_ObjectData, -1, tec); // dumpAvatarTEs( "POST processAvatarAppearance()" ); // Check for stale update. @@ -7321,14 +7321,16 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) S32 last_update_request_cof_version = LLAppearanceMgr::instance().mLastUpdateRequestCOFVersion; S32 *s_words = (S32*) texture_id.mData; S32 this_update_cof_version = s_words[0]; - if (this_update_cof_version < last_update_request_cof_version) + if ((this_update_cof_version > 0) && + (this_update_cof_version < last_update_request_cof_version)) { llwarns << "Stale appearance update, wanted version " << last_update_request_cof_version << ", got " << this_update_cof_version << llendl; return; } + ((LLUUID*)tec.image_data)[0].setNull(); } - unpackParsedTEMessage(tec); + applyParsedTEMessage(tec); // prevent the overwriting of valid baked textures with invalid baked textures for (U8 baked_index = 0; baked_index < mBakedTextureDatas.size(); baked_index++) -- cgit v1.2.3 From 3679631887f0acec0b0d180525a56d318692a0e2 Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Mon, 16 Jul 2012 17:29:01 -0400 Subject: SH-3261 WIP Updated texture switching code Updated texture switching code to use the proper request URL, even if reverting to a "last known good" baked texture UUID. Viewer should now switch to a locally-generated composite on entering appearance mode, and should remain using such until a new appearance message is received. Still to do: handling adjacent regions with varying support for the new system, fixing switch back to server-generated bakes. --- indra/newview/llvoavatar.cpp | 71 +++++++++++++++++++++++++------------------- 1 file changed, 40 insertions(+), 31 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 6bcb0c6882..9c5998b976 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -688,7 +688,6 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mFullyLoaded(FALSE), mPreviousFullyLoaded(FALSE), mFullyLoadedInitialized(FALSE), - mSupportsAlphaLayers(FALSE), mLoadedCallbacksPaused(FALSE), mHasPelvisOffset( FALSE ), mRenderUnloadedAvatar(LLCachedControl(gSavedSettings, "RenderUnloadedAvatar")), @@ -2371,15 +2370,10 @@ S32 LLVOAvatar::setTETexture(const U8 te, const LLUUID& uuid) // to redirect certain avatar texture requests to different sims. if (isIndexBakedTexture((ETextureIndex)te)) { - std::string url = gSavedSettings.getString("AgentAppearanceServiceURL"); - if (LLAppearanceMgr::instance().useServerTextureBaking() && !url.empty()) + const std::string url = getImageURL(te,uuid); + if (!url.empty()) { - const LLVOAvatarDictionary::TextureEntry* texture_entry = LLVOAvatarDictionary::getInstance()->getTexture((ETextureIndex)te); - if (texture_entry != NULL) - { - url += "texture/" + getID().asString() + "/" + texture_entry->mDefaultImageName + "/" + uuid.asString(); - return setTETextureCore(te, uuid, url); - } + return setTETextureCore(te, uuid, url); } LLHost target_host = getObjectHost(); @@ -4152,7 +4146,7 @@ void LLVOAvatar::updateVisibility() // private bool LLVOAvatar::shouldAlphaMask() { - const bool should_alpha_mask = mSupportsAlphaLayers && !LLDrawPoolAlpha::sShowDebugAlpha // Don't alpha mask if "Highlight Transparent" checked + const bool should_alpha_mask = !LLDrawPoolAlpha::sShowDebugAlpha // Don't alpha mask if "Highlight Transparent" checked && !LLDrawPoolAvatar::sSkipTransparent; return should_alpha_mask; @@ -4726,6 +4720,20 @@ void LLVOAvatar::setTexEntry(const U8 index, const LLTextureEntry &te) setTE(index, te); } +const std::string LLVOAvatar::getImageURL(const U8 te, const LLUUID &uuid) +{ + std::string url = ""; + if (LLAppearanceMgr::instance().useServerTextureBaking() && !gSavedSettings.getString("AgentAppearanceServiceURL").empty()) + { + const LLVOAvatarDictionary::TextureEntry* texture_entry = LLVOAvatarDictionary::getInstance()->getTexture((ETextureIndex)te); + if (texture_entry != NULL) + { + url = gSavedSettings.getString("AgentAppearanceServiceURL") + "texture/" + getID().asString() + "/" + texture_entry->mDefaultImageName + "/" + uuid.asString(); + } + } + return url; +} + //----------------------------------------------------------------------------- // resolveHeight() //----------------------------------------------------------------------------- @@ -6658,7 +6666,6 @@ void LLVOAvatar::updateMeshTextures() } } - const BOOL self_customizing = isSelf() && gAgentCamera.cameraCustomizeAvatar(); // During face edit mode, we don't use baked textures const BOOL other_culled = !isSelf() && mCulled; LLLoadedCallbackEntry::source_callback_list_t* src_callback_list = NULL ; BOOL paused = FALSE; @@ -6698,36 +6705,39 @@ void LLVOAvatar::updateMeshTextures() { use_lkg_baked_layer[i] = (!is_layer_baked[i] && mBakedTextureDatas[i].mLastTextureIndex != IMG_DEFAULT_AVATAR); - if (mBakedTextureDatas[i].mTexLayerSet) - { - mBakedTextureDatas[i].mTexLayerSet->destroyComposite(); - } } } - - // Turn on alpha masking correctly for yourself and other avatars on 1.23+ - mSupportsAlphaLayers = isSelf() || is_layer_baked[BAKED_HAIR]; - - // Baked textures should be requested from the sim this avatar is on. JC - const LLHost target_host = getObjectHost(); - if (!target_host.isOk()) - { - llwarns << "updateMeshTextures: invalid host for object: " << getID() << llendl; - } for (U32 i=0; i < mBakedTextureDatas.size(); i++) { - if (use_lkg_baked_layer[i] && !self_customizing ) + if (use_lkg_baked_layer[i] && !mUseLocalAppearance ) { - LLViewerFetchedTexture* baked_img = LLViewerTextureManager::getFetchedTextureFromHost( mBakedTextureDatas[i].mLastTextureIndex, target_host ); + LLViewerFetchedTexture* baked_img; + const std::string url = getImageURL(i, mBakedTextureDatas[i].mLastTextureIndex); + if (!url.empty()) + { + baked_img = LLViewerTextureManager::getFetchedTextureFromUrl(url, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, mBakedTextureDatas[i].mLastTextureIndex); + } + else + { + // Baked textures should be requested from the sim this avatar is on. JC + const LLHost target_host = getObjectHost(); + if (!target_host.isOk()) + { + llwarns << "updateMeshTextures: invalid host for object: " << getID() << llendl; + } + + baked_img = LLViewerTextureManager::getFetchedTextureFromHost( mBakedTextureDatas[i].mLastTextureIndex, target_host ); + } + mBakedTextureDatas[i].mIsUsed = TRUE; for (U32 k=0; k < mBakedTextureDatas[i].mMeshes.size(); k++) { mBakedTextureDatas[i].mMeshes[k]->setTexture( baked_img ); } } - else if (!self_customizing && is_layer_baked[i]) + else if (!mUseLocalAppearance && is_layer_baked[i]) { LLViewerFetchedTexture* baked_img = LLViewerTextureManager::staticCastToFetchedTexture(getImage( mBakedTextureDatas[i].mTextureIndex, 0 ), TRUE) ; if( baked_img->getID() == mBakedTextureDatas[i].mLastTextureIndex ) @@ -6747,8 +6757,7 @@ void LLVOAvatar::updateMeshTextures() src_callback_list, paused ); } } - else if (mBakedTextureDatas[i].mTexLayerSet - && !other_culled) + else if (mBakedTextureDatas[i].mTexLayerSet && mUseLocalAppearance) { mBakedTextureDatas[i].mTexLayerSet->createComposite(); mBakedTextureDatas[i].mTexLayerSet->setUpdatesEnabled( TRUE ); @@ -6763,7 +6772,7 @@ void LLVOAvatar::updateMeshTextures() // set texture and color of hair manually if we are not using a baked image. // This can happen while loading hair for yourself, or for clients that did not // bake a hair texture. Still needed for yourself after 1.22 is depricated. - if (!is_layer_baked[BAKED_HAIR] || self_customizing) + if (!is_layer_baked[BAKED_HAIR] || mIsEditingAppearance) { const LLColor4 color = mTexHairColor ? mTexHairColor->getColor() : LLColor4(1,1,1,1); LLViewerTexture* hair_img = getImage( TEX_HAIR, 0 ); -- cgit v1.2.3 From d2801da16f9ce6addf6d34b3532a574e24f5d9be Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Tue, 17 Jul 2012 14:34:35 -0400 Subject: SH-3258 WIP revert to server-generated textures After exiting appearance mode, next server-generated appearance message should over-ride the locally-generated textures. --- indra/newview/llvoavatar.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 236cc1b089..d953a4b99e 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4581,6 +4581,7 @@ void LLVOAvatar::updateTextures() if (isIndexBakedTexture((ETextureIndex)texture_index) && imagep->getID() != IMG_DEFAULT_AVATAR && imagep->getID() != IMG_INVISIBLE + && !LLAppearanceMgr::instance().useServerTextureBaking() && !imagep->getTargetHost().isOk()) { LL_WARNS_ONCE("Texture") << "LLVOAvatar::updateTextures No host for texture " @@ -7363,7 +7364,6 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) } setCompositeUpdatesEnabled( FALSE ); - mMeshTexturesDirty = TRUE; gPipeline.markGLRebuild(this); // parse visual params @@ -7475,6 +7475,13 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) // If all of the avatars are completely baked, release the global image caches to conserve memory. LLVOAvatar::cullAvatarsByPixelArea(); + if (isSelf() && LLAppearanceMgr::instance().useServerTextureBaking()) + { + mUseLocalAppearance = false; + } + + updateMeshTextures(); + // llinfos << "processAvatarAppearance end " << mID << llendl; } -- cgit v1.2.3 From 020980fb4cd5f2cc18b56fa795c08c153a15bd4a Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Wed, 25 Jul 2012 15:22:13 -0400 Subject: SH-3258 WIP Adding new switching of new vs old appearance based on appearance message Not all appearance messages on a region will be new or old style at all times. Thus we're using a specific flag to mark the new appearance messages. --- indra/newview/llvoavatar.cpp | 41 ++++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 13 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index d953a4b99e..45c7a59b24 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -192,6 +192,8 @@ const S32 MAX_BUBBLE_CHAT_UTTERANCES = 12; const F32 CHAT_FADE_TIME = 8.0; const F32 BUBBLE_CHAT_TIME = CHAT_FADE_TIME * 3.f; +const S32 SERVER_GENERATED_APPEARANCE = 359949045; + const LLColor4 DUMMY_COLOR = LLColor4(0.5,0.5,0.5,1.0); enum ERenderName @@ -693,7 +695,8 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mRenderUnloadedAvatar(LLCachedControl(gSavedSettings, "RenderUnloadedAvatar")), mLastRezzedStatus(-1), mIsEditingAppearance(FALSE), - mUseLocalAppearance(FALSE) + mUseLocalAppearance(FALSE), + mUseServerBakes(TRUE) { LLMemType mt(LLMemType::MTYPE_AVATAR); //VTResume(); // VTune @@ -4581,7 +4584,7 @@ void LLVOAvatar::updateTextures() if (isIndexBakedTexture((ETextureIndex)texture_index) && imagep->getID() != IMG_DEFAULT_AVATAR && imagep->getID() != IMG_INVISIBLE - && !LLAppearanceMgr::instance().useServerTextureBaking() + && !mUseServerBakes && !imagep->getTargetHost().isOk()) { LL_WARNS_ONCE("Texture") << "LLVOAvatar::updateTextures No host for texture " @@ -4676,10 +4679,10 @@ void LLVOAvatar::addBakedTextureStats( LLViewerFetchedTexture* imagep, F32 pixel //the texture pipeline will stop fetching this texture. imagep->resetTextureStats(); - if (!LLAppearanceMgr::instance().useServerTextureBaking()) - { - imagep->setCanUseHTTP(false); //turn off http fetching for baked textures. - } + // TODO: currently default to HTTP texture and fall back to UDP if cannot be found there. + // Once server messaging is in place, we should call setCanUseHTTP(false) for old style + // appearance requests + imagep->setCanUseHTTP(true); imagep->setMaxVirtualSizeResetInterval(MAX_TEXTURE_VIRTURE_SIZE_RESET_INTERVAL); imagep->resetMaxVirtualSizeResetCounter() ; @@ -4730,6 +4733,7 @@ const std::string LLVOAvatar::getImageURL(const U8 te, const LLUUID &uuid) if (texture_entry != NULL) { url = gSavedSettings.getString("AgentAppearanceServiceURL") + "texture/" + getID().asString() + "/" + texture_entry->mDefaultImageName + "/" + uuid.asString(); + //llinfos << "baked texture url: " << url << llendl; } } return url; @@ -7323,14 +7327,25 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) parseTEMessage(mesgsys, _PREHASH_ObjectData, -1, tec); // dumpAvatarTEs( "POST processAvatarAppearance()" ); + // Extract COF Version field hacked into local texture id. + LLUUID flags_id = ((LLUUID*)tec.image_data)[0]; + S32 this_update_cof_version = (flags_id.mData[0] << 24) + (flags_id.mData[1] << 16) +(flags_id.mData[2] << 8) +flags_id.mData[3]; + S32 message_type = (flags_id.mData[4] << 24) + (flags_id.mData[5] << 16) +(flags_id.mData[6] << 8) +flags_id.mData[7]; + + if (message_type == SERVER_GENERATED_APPEARANCE) + { + mUseServerBakes = true; + } + else + { + mUseServerBakes = false; + } + + S32 last_update_request_cof_version = LLAppearanceMgr::instance().mLastUpdateRequestCOFVersion; + // Check for stale update. - if (isSelf() && LLAppearanceMgr::instance().useServerTextureBaking()) + if (isSelf() && mUseServerBakes) { - // Extract COF Version field hacked into local texture id. - LLUUID texture_id = ((LLUUID*)tec.image_data)[0]; - S32 last_update_request_cof_version = LLAppearanceMgr::instance().mLastUpdateRequestCOFVersion; - S32 *s_words = (S32*) texture_id.mData; - S32 this_update_cof_version = s_words[0]; if ((this_update_cof_version > 0) && (this_update_cof_version < last_update_request_cof_version)) { @@ -7475,7 +7490,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) // If all of the avatars are completely baked, release the global image caches to conserve memory. LLVOAvatar::cullAvatarsByPixelArea(); - if (isSelf() && LLAppearanceMgr::instance().useServerTextureBaking()) + if (isSelf()) { mUseLocalAppearance = false; } -- cgit v1.2.3 From dfce4c451c0b12f5836db1af0c26bffc316837fa Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Thu, 2 Aug 2012 22:54:01 +0000 Subject: Added AppearanceData block to AvatarAppearance message --- indra/newview/llvoavatar.cpp | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index b7bb4e6b47..0d85666d88 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -192,8 +192,6 @@ const S32 MAX_BUBBLE_CHAT_UTTERANCES = 12; const F32 CHAT_FADE_TIME = 8.0; const F32 BUBBLE_CHAT_TIME = CHAT_FADE_TIME * 3.f; -const S32 SERVER_GENERATED_APPEARANCE = 359949045; - const LLColor4 DUMMY_COLOR = LLColor4(0.5,0.5,0.5,1.0); enum ERenderName @@ -7355,12 +7353,21 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) parseTEMessage(mesgsys, _PREHASH_ObjectData, -1, tec); // dumpAvatarTEs( "POST processAvatarAppearance()" ); - // Extract COF Version field hacked into local texture id. - LLUUID flags_id = ((LLUUID*)tec.image_data)[0]; - S32 this_update_cof_version = (flags_id.mData[0] << 24) + (flags_id.mData[1] << 16) +(flags_id.mData[2] << 8) +flags_id.mData[3]; - S32 message_type = (flags_id.mData[4] << 24) + (flags_id.mData[5] << 16) +(flags_id.mData[6] << 8) +flags_id.mData[7]; + U8 appearance_version = 0; + S32 this_update_cof_version = LLViewerInventoryCategory::VERSION_UNKNOWN; + S32 last_update_request_cof_version = LLAppearanceMgr::instance().mLastUpdateRequestCOFVersion; + // For future use: + //U32 appearance_flags = 0; + + if (mesgsys->has(_PREHASH_AppearanceData)) + { + mesgsys->getU8Fast(_PREHASH_AppearanceData, _PREHASH_AppearanceVersion, appearance_version, 0); + mesgsys->getS32Fast(_PREHASH_AppearanceData, _PREHASH_CofVersion, this_update_cof_version, 0); + // For future use: + //mesgsys->getU32Fast(_PREHASH_AppearanceData, _PREHASH_Flags, appearance_flags, 0); + } - if (message_type == SERVER_GENERATED_APPEARANCE) + if (appearance_version > 0) { mUseServerBakes = true; } @@ -7369,19 +7376,14 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) mUseServerBakes = false; } - S32 last_update_request_cof_version = LLAppearanceMgr::instance().mLastUpdateRequestCOFVersion; - // Check for stale update. - if (isSelf() && mUseServerBakes) + if (mUseServerBakes && isSelf() + && this_update_cof_version >= LLViewerInventoryCategory::VERSION_INITIAL + && this_update_cof_version < last_update_request_cof_version) { - if ((this_update_cof_version > 0) && - (this_update_cof_version < last_update_request_cof_version)) - { - llwarns << "Stale appearance update, wanted version " << last_update_request_cof_version - << ", got " << this_update_cof_version << llendl; - return; - } - ((LLUUID*)tec.image_data)[0].setNull(); + llwarns << "Stale appearance update, wanted version " << last_update_request_cof_version + << ", got " << this_update_cof_version << llendl; + return; } applyParsedTEMessage(tec); -- cgit v1.2.3 From e7a63cb356d49925131edfadb5a0e8d5368a9096 Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Tue, 14 Aug 2012 17:12:01 -0400 Subject: SH-3310 WIP setting up architecture for switching texture baking on per-region basis Set up an architecture to minimize the use of the baked texture debug setting. Instead concentrating on setting a per-region flag at the region handshake point. This should be processed once the new regions are using the updated handshake. The debug setting is being used in this one location as a placeholder. Builds, but not fully tested/commented yet, passing this work off to Vir. --- indra/newview/llvoavatar.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 45c7a59b24..66674d8c19 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4727,7 +4727,7 @@ void LLVOAvatar::setTexEntry(const U8 index, const LLTextureEntry &te) const std::string LLVOAvatar::getImageURL(const U8 te, const LLUUID &uuid) { std::string url = ""; - if (LLAppearanceMgr::instance().useServerTextureBaking() && !gSavedSettings.getString("AgentAppearanceServiceURL").empty()) + if (mUseServerBakes && !gSavedSettings.getString("AgentAppearanceServiceURL").empty()) { const LLVOAvatarDictionary::TextureEntry* texture_entry = LLVOAvatarDictionary::getInstance()->getTexture((ETextureIndex)te); if (texture_entry != NULL) @@ -7312,7 +7312,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) if( isSelf() ) { llwarns << avString() << "Received AvatarAppearance for self" << llendl; - if( mFirstTEMessageReceived && !LLAppearanceMgr::instance().useServerTextureBaking()) + if( mFirstTEMessageReceived && !mUseServerBakes) { // llinfos << "processAvatarAppearance end " << mID << llendl; return; -- cgit v1.2.3 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/llvoavatar.cpp | 171 +++++++++---------------------------------- 1 file changed, 33 insertions(+), 138 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 4894f21e67..dac479b2e0 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -77,15 +77,16 @@ #include "llselectmgr.h" #include "llsprite.h" #include "lltargetingmotion.h" -#include "lltexlayer.h" #include "lltoolmorph.h" #include "llviewercamera.h" +#include "llviewertexlayer.h" #include "llviewertexturelist.h" #include "llviewermenu.h" #include "llviewerobjectlist.h" #include "llviewerparcelmgr.h" #include "llviewershadermgr.h" #include "llviewerstats.h" +#include "llviewerwearable.h" #include "llvoavatarself.h" #include "llvovolume.h" #include "llworld.h" @@ -192,8 +193,6 @@ const S32 MAX_BUBBLE_CHAT_UTTERANCES = 12; const F32 CHAT_FADE_TIME = 8.0; const F32 BUBBLE_CHAT_TIME = CHAT_FADE_TIME * 3.f; -const LLColor4 DUMMY_COLOR = LLColor4(0.5,0.5,0.5,1.0); - enum ERenderName { RENDER_NAME_NEVER, @@ -645,8 +644,8 @@ static F32 calc_bouncy_animation(F32 x); LLVOAvatar::LLVOAvatar(const LLUUID& id, const LLPCode pcode, LLViewerRegion* regionp) : + LLAvatarAppearance(), LLViewerObject(id, pcode, regionp), - mIsDummy(FALSE), mSpecialRenderMode(0), mAttachmentGeometryBytes(0), mAttachmentSurfaceArea(0.f), @@ -678,9 +677,6 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mFirstAppearanceMessageReceived( FALSE ), mCulled( FALSE ), mVisibilityRank(0), - mTexSkinColor( NULL ), - mTexHairColor( NULL ), - mTexEyeColor( NULL ), mNeedsSkin(FALSE), mLastSkinTime(0.f), mUpdatePeriod(1), @@ -768,7 +764,6 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mRuthTimer.reset(); mRuthDebugTimer.reset(); - mDebugExistenceTimer.reset(); mPelvisOffset = LLVector3(0.0f,0.0f,0.0f); mLastPelvisToFoot = 0.0f; mPelvisFixup = 0.0f; @@ -1133,7 +1128,7 @@ void LLVOAvatar::resetImpostors() // static void LLVOAvatar::deleteCachedImages(bool clearAll) { - if (LLTexLayerSet::sHasCaches) + if (LLViewerTexLayerSet::sHasCaches) { lldebugs << "Deleting layer set caches" << llendl; for (std::vector::iterator iter = LLCharacter::sInstances.begin(); @@ -1142,7 +1137,7 @@ void LLVOAvatar::deleteCachedImages(bool clearAll) LLVOAvatar* inst = (LLVOAvatar*) *iter; inst->deleteLayerSetCaches(clearAll); } - LLTexLayerSet::sHasCaches = FALSE; + LLViewerTexLayerSet::sHasCaches = FALSE; } LLVOAvatarSelf::deleteScratchTextures(); LLTexLayerStaticImageList::getInstance()->deleteCachedImages(); @@ -5864,6 +5859,30 @@ void LLVOAvatar::updateVisualParams() updateHeadOffset(); } +// virtual +U32 LLVOAvatar::getWearableCount(const LLWearableType::EType type) const +{ + return gAgentWearables.getWearableCount(type); +} + +// virtual +U32 LLVOAvatar::getWearableCount(const U32 tex_index) const +{ + return gAgentWearables.getWearableCount(tex_index); +} + +// virtual +LLWearable* LLVOAvatar::getWearable(const LLWearableType::EType type, U32 index /*= 0*/) +{ + return gAgentWearables.getWearable(type, index); +} + +// virtual +const LLWearable* LLVOAvatar::getWearable(const LLWearableType::EType type, U32 index /*= 0*/) const +{ + return gAgentWearables.getWearable(type, index); +} + //----------------------------------------------------------------------------- // isActive() //----------------------------------------------------------------------------- @@ -6453,26 +6472,6 @@ S32 LLVOAvatar::getAttachmentCount() return count; } -LLColor4 LLVOAvatar::getGlobalColor( const std::string& color_name ) const -{ - if (color_name=="skin_color" && mTexSkinColor) - { - return mTexSkinColor->getColor(); - } - else if(color_name=="hair_color" && mTexHairColor) - { - return mTexHairColor->getColor(); - } - if(color_name=="eye_color" && mTexEyeColor) - { - return mTexEyeColor->getColor(); - } - else - { -// return LLColor4( .5f, .5f, .5f, .5f ); - return LLColor4( 0.f, 1.f, 1.f, 1.f ); // good debugging color - } -} // virtual void LLVOAvatar::invalidateComposite( LLTexLayerSet* layerset, BOOL upload_result ) @@ -6483,6 +6482,7 @@ void LLVOAvatar::invalidateAll() { } +// virtual void LLVOAvatar::onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL upload_bake ) { if (global_color == mTexSkinColor) @@ -6682,6 +6682,7 @@ LLMotion* LLVOAvatar::findMotion(const LLUUID& id) const // updateMeshTextures() // Uses the current TE values to set the meshes' and layersets' textures. //----------------------------------------------------------------------------- +// virtual void LLVOAvatar::updateMeshTextures() { // llinfos << "updateMeshTextures" << llendl; @@ -6903,7 +6904,7 @@ BOOL LLVOAvatar::morphMaskNeedsUpdate(LLVOAvatarDefines::EBakedTextureIndex inde { if (isSelf()) { - LLTexLayerSet *layer_set = mBakedTextureDatas[index].mTexLayerSet; + LLViewerTexLayerSet *layer_set = mBakedTextureDatas[index].mTexLayerSet; if (layer_set) { return !layer_set->isMorphValid(); @@ -6973,112 +6974,6 @@ void LLVOAvatar::releaseComponentTextures() } } -//static -BOOL LLVOAvatar::teToColorParams( ETextureIndex te, U32 *param_name ) -{ - switch( te ) - { - case TEX_UPPER_SHIRT: - param_name[0] = 803; //"shirt_red"; - param_name[1] = 804; //"shirt_green"; - param_name[2] = 805; //"shirt_blue"; - break; - - case TEX_LOWER_PANTS: - param_name[0] = 806; //"pants_red"; - param_name[1] = 807; //"pants_green"; - param_name[2] = 808; //"pants_blue"; - break; - - case TEX_LOWER_SHOES: - param_name[0] = 812; //"shoes_red"; - param_name[1] = 813; //"shoes_green"; - param_name[2] = 817; //"shoes_blue"; - break; - - case TEX_LOWER_SOCKS: - param_name[0] = 818; //"socks_red"; - param_name[1] = 819; //"socks_green"; - param_name[2] = 820; //"socks_blue"; - break; - - case TEX_UPPER_JACKET: - case TEX_LOWER_JACKET: - param_name[0] = 834; //"jacket_red"; - param_name[1] = 835; //"jacket_green"; - param_name[2] = 836; //"jacket_blue"; - break; - - case TEX_UPPER_GLOVES: - param_name[0] = 827; //"gloves_red"; - param_name[1] = 829; //"gloves_green"; - param_name[2] = 830; //"gloves_blue"; - break; - - case TEX_UPPER_UNDERSHIRT: - param_name[0] = 821; //"undershirt_red"; - param_name[1] = 822; //"undershirt_green"; - param_name[2] = 823; //"undershirt_blue"; - break; - - case TEX_LOWER_UNDERPANTS: - param_name[0] = 824; //"underpants_red"; - param_name[1] = 825; //"underpants_green"; - param_name[2] = 826; //"underpants_blue"; - break; - - case TEX_SKIRT: - param_name[0] = 921; //"skirt_red"; - param_name[1] = 922; //"skirt_green"; - param_name[2] = 923; //"skirt_blue"; - break; - - case TEX_HEAD_TATTOO: - case TEX_LOWER_TATTOO: - case TEX_UPPER_TATTOO: - param_name[0] = 1071; //"tattoo_red"; - param_name[1] = 1072; //"tattoo_green"; - param_name[2] = 1073; //"tattoo_blue"; - break; - - default: - llassert(0); - return FALSE; - } - - return TRUE; -} - -void LLVOAvatar::setClothesColor( ETextureIndex te, const LLColor4& new_color, BOOL upload_bake ) -{ - U32 param_name[3]; - if( teToColorParams( te, param_name ) ) - { - setVisualParamWeight( param_name[0], new_color.mV[VX], upload_bake ); - setVisualParamWeight( param_name[1], new_color.mV[VY], upload_bake ); - setVisualParamWeight( param_name[2], new_color.mV[VZ], upload_bake ); - } -} - -LLColor4 LLVOAvatar::getClothesColor( ETextureIndex te ) -{ - LLColor4 color; - U32 param_name[3]; - if( teToColorParams( te, param_name ) ) - { - color.mV[VX] = getVisualParamWeight( param_name[0] ); - color.mV[VY] = getVisualParamWeight( param_name[1] ); - color.mV[VZ] = getVisualParamWeight( param_name[2] ); - } - return color; -} - -// static -LLColor4 LLVOAvatar::getDummyColor() -{ - return DUMMY_COLOR; -} - void LLVOAvatar::dumpAvatarTEs( const std::string& context ) const { LL_DEBUGS("Avatar") << avString() << (isSelf() ? "Self: " : "Other: ") << context << LL_ENDL; @@ -8787,7 +8682,7 @@ BOOL LLVOAvatar::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, U32 ind } //virtual -BOOL LLVOAvatar::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, LLWearable *wearable) const +BOOL LLVOAvatar::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, LLViewerWearable *wearable) const { // non-self avatars don't have wearables return FALSE; -- 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/llvoavatar.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index dac479b2e0..e3d8f9135e 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -764,6 +764,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mRuthTimer.reset(); mRuthDebugTimer.reset(); + mDebugExistenceTimer.reset(); mPelvisOffset = LLVector3(0.0f,0.0f,0.0f); mLastPelvisToFoot = 0.0f; mPelvisFixup = 0.0f; -- 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/llvoavatar.cpp | 102 +++++++++++++++++++++---------------------- 1 file changed, 51 insertions(+), 51 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index e3d8f9135e..56ded53b5d 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -118,7 +118,7 @@ extern F32 ANIM_SPEED_MIN; // #define OUTPUT_BREAST_DATA -using namespace LLVOAvatarDefines; +using namespace LLAvatarAppearanceDefines; //----------------------------------------------------------------------------- // Global constants @@ -597,7 +597,7 @@ LLXmlTree LLVOAvatar::sXMLTree; LLXmlTree LLVOAvatar::sSkeletonXMLTree; LLVOAvatarSkeletonInfo* LLVOAvatar::sAvatarSkeletonInfo = NULL; LLVOAvatar::LLVOAvatarXmlInfo* LLVOAvatar::sAvatarXmlInfo = NULL; -LLVOAvatarDictionary *LLVOAvatar::sAvatarDictionary = NULL; +LLAvatarAppearanceDictionary *LLVOAvatar::sAvatarDictionary = NULL; S32 LLVOAvatar::sFreezeCounter = 0; U32 LLVOAvatar::sMaxVisible = 12; F32 LLVOAvatar::sRenderDistance = 256.f; @@ -711,7 +711,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mBakedTextureDatas[i].mIsLoaded = false; mBakedTextureDatas[i].mIsUsed = false; mBakedTextureDatas[i].mMaskTexName = 0; - mBakedTextureDatas[i].mTextureIndex = LLVOAvatarDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)i); + mBakedTextureDatas[i].mTextureIndex = LLAvatarAppearanceDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)i); } mDirtyMesh = 2; // Dirty geometry, need to regenerate. @@ -1073,15 +1073,15 @@ void LLVOAvatar::dumpBakedStatus() { llcont << " Unbaked ("; - for (LLVOAvatarDictionary::BakedTextures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin(); - iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end(); + for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().begin(); + iter != LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().end(); ++iter) { - const LLVOAvatarDictionary::BakedEntry *baked_dict = iter->second; + const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = iter->second; const ETextureIndex index = baked_dict->mTextureIndex; if (!inst->isTextureDefined(index)) { - llcont << " " << LLVOAvatarDictionary::getInstance()->getTexture(index)->mName; + llcont << " " << LLAvatarAppearanceDictionary::getInstance()->getTexture(index)->mName; } } llcont << " ) " << inst->getUnbakedPixelAreaRank(); @@ -1282,12 +1282,12 @@ void LLVOAvatar::initInstance(void) //------------------------------------------------------------------------- mRoot.setName( "mRoot" ); - for (LLVOAvatarDictionary::Meshes::const_iterator iter = LLVOAvatarDictionary::getInstance()->getMeshes().begin(); - iter != LLVOAvatarDictionary::getInstance()->getMeshes().end(); + for (LLAvatarAppearanceDictionary::Meshes::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getMeshes().begin(); + iter != LLAvatarAppearanceDictionary::getInstance()->getMeshes().end(); ++iter) { const EMeshIndex mesh_index = iter->first; - const LLVOAvatarDictionary::MeshEntry *mesh_dict = iter->second; + const LLAvatarAppearanceDictionary::MeshEntry *mesh_dict = iter->second; LLViewerJoint* joint = new LLViewerJoint(); joint->setName(mesh_dict->mName); joint->setMeshID(mesh_index); @@ -1328,12 +1328,12 @@ void LLVOAvatar::initInstance(void) //------------------------------------------------------------------------- // associate baked textures with meshes //------------------------------------------------------------------------- - for (LLVOAvatarDictionary::Meshes::const_iterator iter = LLVOAvatarDictionary::getInstance()->getMeshes().begin(); - iter != LLVOAvatarDictionary::getInstance()->getMeshes().end(); + for (LLAvatarAppearanceDictionary::Meshes::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getMeshes().begin(); + iter != LLAvatarAppearanceDictionary::getInstance()->getMeshes().end(); ++iter) { const EMeshIndex mesh_index = iter->first; - const LLVOAvatarDictionary::MeshEntry *mesh_dict = iter->second; + const LLAvatarAppearanceDictionary::MeshEntry *mesh_dict = iter->second; const EBakedTextureIndex baked_texture_index = mesh_dict->mBakedID; // Skip it if there's no associated baked texture. if (baked_texture_index == BAKED_NUM_INDICES) continue; @@ -4565,7 +4565,7 @@ void LLVOAvatar::updateTextures() mHasGrey = FALSE; // debug for (U32 texture_index = 0; texture_index < getNumTEs(); texture_index++) { - LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType((ETextureIndex)texture_index); + LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getTEWearableType((ETextureIndex)texture_index); U32 num_wearables = gAgentWearables.getWearableCount(wearable_type); const LLTextureEntry *te = getTE(texture_index); const F32 texel_area_ratio = fabs(te->mScaleS * te->mScaleT); @@ -4575,7 +4575,7 @@ void LLVOAvatar::updateTextures() imagep = LLViewerTextureManager::staticCastToFetchedTexture(getImage(texture_index, wearable_index), TRUE); if (imagep) { - const LLVOAvatarDictionary::TextureEntry *texture_dict = LLVOAvatarDictionary::getInstance()->getTexture((ETextureIndex)texture_index); + const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearanceDictionary::getInstance()->getTexture((ETextureIndex)texture_index); const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex; if (texture_dict->mIsLocalTexture) { @@ -4736,7 +4736,7 @@ const std::string LLVOAvatar::getImageURL(const U8 te, const LLUUID &uuid) std::string url = ""; if (mUseServerBakes && !gSavedSettings.getString("AgentAppearanceServiceURL").empty()) { - const LLVOAvatarDictionary::TextureEntry* texture_entry = LLVOAvatarDictionary::getInstance()->getTexture((ETextureIndex)te); + const LLAvatarAppearanceDictionary::TextureEntry* texture_entry = LLAvatarAppearanceDictionary::getInstance()->getTexture((ETextureIndex)te); if (texture_entry != NULL) { url = gSavedSettings.getString("AgentAppearanceServiceURL") + "texture/" + getID().asString() + "/" + texture_entry->mDefaultImageName + "/" + uuid.asString(); @@ -5515,7 +5515,7 @@ BOOL LLVOAvatar::loadAvatar() { LLVOAvatarXmlInfo::LLVOAvatarMorphInfo *info = *iter; - EBakedTextureIndex baked = LLVOAvatarDictionary::findBakedByRegionName(info->mRegion); + EBakedTextureIndex baked = LLAvatarAppearanceDictionary::findBakedByRegionName(info->mRegion); if (baked != BAKED_NUM_INDICES) { LLPolyMorphTarget *morph_param; @@ -5723,12 +5723,12 @@ BOOL LLVOAvatar::loadMeshNodes() switch(lod) case 0: mesh = &mHairMesh0; */ - for (LLVOAvatarDictionary::Meshes::const_iterator mesh_iter = LLVOAvatarDictionary::getInstance()->getMeshes().begin(); - mesh_iter != LLVOAvatarDictionary::getInstance()->getMeshes().end(); + for (LLAvatarAppearanceDictionary::Meshes::const_iterator mesh_iter = LLAvatarAppearanceDictionary::getInstance()->getMeshes().begin(); + mesh_iter != LLAvatarAppearanceDictionary::getInstance()->getMeshes().end(); ++mesh_iter) { const EMeshIndex mesh_index = mesh_iter->first; - const LLVOAvatarDictionary::MeshEntry *mesh_dict = mesh_iter->second; + const LLAvatarAppearanceDictionary::MeshEntry *mesh_dict = mesh_iter->second; if (type.compare(mesh_dict->mName) == 0) { mesh_id = mesh_index; @@ -6815,12 +6815,12 @@ void LLVOAvatar::updateMeshTextures() } - for (LLVOAvatarDictionary::BakedTextures::const_iterator baked_iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin(); - baked_iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end(); + for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().begin(); + baked_iter != LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().end(); ++baked_iter) { const EBakedTextureIndex baked_index = baked_iter->first; - const LLVOAvatarDictionary::BakedEntry *baked_dict = baked_iter->second; + const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = baked_iter->second; for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin(); local_tex_iter != baked_dict->mLocalTextures.end(); @@ -6848,7 +6848,7 @@ void LLVOAvatar::setLocalTexture( ETextureIndex type, LLViewerTexture* in_tex, B } //virtual -void LLVOAvatar::setBakedReady(LLVOAvatarDefines::ETextureIndex type, BOOL baked_version_exists, U32 index) +void LLVOAvatar::setBakedReady(LLAvatarAppearanceDefines::ETextureIndex type, BOOL baked_version_exists, U32 index) { // invalid for anyone but self llassert(0); @@ -6894,7 +6894,7 @@ void LLVOAvatar::addMaskedMorph(EBakedTextureIndex index, LLPolyMorphTarget* mor } // returns TRUE if morph masks are present and not valid for a given baked texture, FALSE otherwise -BOOL LLVOAvatar::morphMaskNeedsUpdate(LLVOAvatarDefines::EBakedTextureIndex index) +BOOL LLVOAvatar::morphMaskNeedsUpdate(LLAvatarAppearanceDefines::EBakedTextureIndex index) { if (index >= BAKED_NUM_INDICES) { @@ -6920,7 +6920,7 @@ BOOL LLVOAvatar::morphMaskNeedsUpdate(LLVOAvatarDefines::EBakedTextureIndex inde return FALSE; } -void LLVOAvatar::applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components, LLVOAvatarDefines::EBakedTextureIndex index) +void LLVOAvatar::applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components, LLAvatarAppearanceDefines::EBakedTextureIndex index) { if (index >= BAKED_NUM_INDICES) { @@ -6959,7 +6959,7 @@ void LLVOAvatar::releaseComponentTextures() for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++) { - const LLVOAvatarDictionary::BakedEntry * bakedDicEntry = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index); + const LLAvatarAppearanceDictionary::BakedEntry * bakedDicEntry = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index); // skip if this is a skirt and av is not wearing one, or if we don't have a baked texture UUID if (!isTextureDefined(bakedDicEntry->mTextureIndex) && ( (baked_index != BAKED_SKIRT) || isWearingWearableType(LLWearableType::WT_SKIRT) )) @@ -6978,11 +6978,11 @@ void LLVOAvatar::releaseComponentTextures() void LLVOAvatar::dumpAvatarTEs( const std::string& context ) const { LL_DEBUGS("Avatar") << avString() << (isSelf() ? "Self: " : "Other: ") << context << LL_ENDL; - for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); - iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); + for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin(); + iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end(); ++iter) { - const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second; + const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second; // TODO: MULTI-WEARABLE: handle multiple textures for self const LLViewerTexture* te_image = getImage(iter->first,0); if( !te_image ) @@ -7027,11 +7027,11 @@ BOOL LLVOAvatar::isWearingWearableType(LLWearableType::EType type) const /* switch(type) case LLWearableType::WT_SHIRT: indicator_te = TEX_UPPER_SHIRT; */ - for (LLVOAvatarDictionary::Textures::const_iterator tex_iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); - tex_iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); + for (LLAvatarAppearanceDictionary::Textures::const_iterator tex_iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin(); + tex_iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end(); ++tex_iter) { - const LLVOAvatarDictionary::TextureEntry *texture_dict = tex_iter->second; + const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = tex_iter->second; if (texture_dict->mWearableType == type) { // If you're checking another avatar's clothing, you don't have component textures. @@ -7042,7 +7042,7 @@ BOOL LLVOAvatar::isWearingWearableType(LLWearableType::EType type) const if (texture_dict->mIsUsedByBakedTexture) { const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex; - return isTextureDefined(LLVOAvatarDictionary::getInstance()->getBakedTexture(baked_index)->mTextureIndex); + return isTextureDefined(LLAvatarAppearanceDictionary::getInstance()->getBakedTexture(baked_index)->mTextureIndex); } return FALSE; } @@ -7495,12 +7495,12 @@ void LLVOAvatar::onBakedTextureMasksLoaded( BOOL success, LLViewerFetchedTexture self->mBakedTextureDatas[BAKED_HEAD].mTexLayerSet->applyMorphMask(aux_src->getData(), aux_src->getWidth(), aux_src->getHeight(), 1); maskData->mLastDiscardLevel = discard_level; */ BOOL found_texture_id = false; - for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); - iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); + for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin(); + iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end(); ++iter) { - const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second; + const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second; if (texture_dict->mIsUsedByBakedTexture) { const ETextureIndex texture_index = iter->first; @@ -7622,7 +7622,7 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) { //mBakedTextureDatas[i].mTexLayerSet->destroyComposite(); } - const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i); + const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i); for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin(); local_tex_iter != baked_dict->mLocalTextures.end(); ++local_tex_iter) @@ -7684,7 +7684,7 @@ void LLVOAvatar::dumpArchetypeXML( void* ) for (U8 te = 0; te < TEX_NUM_INDICES; te++) { - if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex)te) == type) + if (LLAvatarAppearanceDictionary::getTEWearableType((ETextureIndex)te) == type) { // MULTIPLE_WEARABLES: extend to multiple wearables? LLViewerTexture* te_image = ((LLVOAvatar *)(gAgentAvatarp))->getImage((ETextureIndex)te, 0); @@ -8491,7 +8491,7 @@ void LLVOAvatar::idleUpdateRenderCost() for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++) { - const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index); + const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index); ETextureIndex tex_index = baked_dict->mTextureIndex; if ((tex_index != TEX_SKIRT_BAKED) || (isWearingWearableType(LLWearableType::WT_SKIRT))) { @@ -8571,11 +8571,11 @@ void LLVOAvatar::idleUpdateRenderCost() } // print any avatar textures we didn't already know about - for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); - iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); + for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin(); + iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end(); ++iter) { - const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second; + const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second; // TODO: MULTI-WEARABLE: handle multiple textures for self const LLViewerTexture* te_image = getImage(iter->first,0); if (!te_image) @@ -8604,26 +8604,26 @@ void LLVOAvatar::idleUpdateRenderCost() BOOL LLVOAvatar::isIndexLocalTexture(ETextureIndex index) { if (index < 0 || index >= TEX_NUM_INDICES) return false; - return LLVOAvatarDictionary::getInstance()->getTexture(index)->mIsLocalTexture; + return LLAvatarAppearanceDictionary::getInstance()->getTexture(index)->mIsLocalTexture; } // static BOOL LLVOAvatar::isIndexBakedTexture(ETextureIndex index) { if (index < 0 || index >= TEX_NUM_INDICES) return false; - return LLVOAvatarDictionary::getInstance()->getTexture(index)->mIsBakedTexture; + return LLAvatarAppearanceDictionary::getInstance()->getTexture(index)->mIsBakedTexture; } const std::string LLVOAvatar::getBakedStatusForPrintout() const { std::string line; - for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); - iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); + for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin(); + iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end(); ++iter) { const ETextureIndex index = iter->first; - const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second; + const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second; if (texture_dict->mIsBakedTexture) { line += texture_dict->mName; @@ -8655,7 +8655,7 @@ F32 calc_bouncy_animation(F32 x) } //virtual -BOOL LLVOAvatar::isTextureDefined(LLVOAvatarDefines::ETextureIndex te, U32 index ) const +BOOL LLVOAvatar::isTextureDefined(LLAvatarAppearanceDefines::ETextureIndex te, U32 index ) const { if (isIndexLocalTexture(te)) { @@ -8667,7 +8667,7 @@ BOOL LLVOAvatar::isTextureDefined(LLVOAvatarDefines::ETextureIndex te, U32 index } //virtual -BOOL LLVOAvatar::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, U32 index) const +BOOL LLVOAvatar::isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const { if (isIndexLocalTexture(type)) { @@ -8683,7 +8683,7 @@ BOOL LLVOAvatar::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, U32 ind } //virtual -BOOL LLVOAvatar::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, LLViewerWearable *wearable) const +BOOL LLVOAvatar::isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerWearable *wearable) const { // non-self avatars don't have wearables return FALSE; -- cgit v1.2.3 From 204be2ba5261d794f8264e004b65725450bf1be9 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Tue, 4 Sep 2012 15:18:15 +0000 Subject: Split LLTexLayerSetBuffer into llappearance portion, and viewer-specific LLViewerTexLayerSetBuffer --- indra/newview/llvoavatar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 56ded53b5d..4e17884e0e 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6722,7 +6722,7 @@ void LLVOAvatar::updateMeshTextures() // use the last-known good baked texture until it finish the first // render of the new layerset. const BOOL layerset_invalid = mBakedTextureDatas[i].mTexLayerSet - && ( !mBakedTextureDatas[i].mTexLayerSet->getComposite()->isInitialized() + && ( !mBakedTextureDatas[i].mTexLayerSet->getViewerComposite()->isInitialized() || !mBakedTextureDatas[i].mTexLayerSet->isLocalTextureDataAvailable() ); use_lkg_baked_layer[i] = (!is_layer_baked[i] && (mBakedTextureDatas[i].mLastTextureIndex != IMG_DEFAULT_AVATAR) -- 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/llvoavatar.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 4e17884e0e..b86c5d5e8f 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4698,7 +4698,7 @@ void LLVOAvatar::addBakedTextureStats( LLViewerFetchedTexture* imagep, F32 pixel imagep->addTextureStats(pixel_area / texel_area_ratio); imagep->setBoostLevel(boost_level); - if(boost_level != LLViewerTexture::BOOST_AVATAR_BAKED_SELF) + if(boost_level != LLGLTexture::BOOST_AVATAR_BAKED_SELF) { imagep->setAdditionalDecodePriority(ADDITIONAL_PRI) ; } @@ -6748,7 +6748,7 @@ void LLVOAvatar::updateMeshTextures() const std::string url = getImageURL(i, mBakedTextureDatas[i].mLastTextureIndex); if (!url.empty()) { - baked_img = LLViewerTextureManager::getFetchedTextureFromUrl(url, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, mBakedTextureDatas[i].mLastTextureIndex); + baked_img = LLViewerTextureManager::getFetchedTextureFromUrl(url, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, mBakedTextureDatas[i].mLastTextureIndex); } else { @@ -7289,7 +7289,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) && baked_index != BAKED_SKIRT) { setTEImage(mBakedTextureDatas[baked_index].mTextureIndex, - LLViewerTextureManager::getFetchedTexture(mBakedTextureDatas[baked_index].mLastTextureIndex, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); + LLViewerTextureManager::getFetchedTexture(mBakedTextureDatas[baked_index].mLastTextureIndex, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); } } -- cgit v1.2.3 From b146490e1b46799ccb35e156b4751eddea3a23ce Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Wed, 5 Sep 2012 17:46:11 -0400 Subject: SH-3264 Worked to move over mBakedTextureDatas from LLVOAvatar to LLAvatarAppearance. Appear to have been able to move over the parts that are common to both the backend and the viewer into LLAvatarAppearance. --- indra/newview/llvoavatar.cpp | 139 +++++++++++++++++++++++-------------------- 1 file changed, 75 insertions(+), 64 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index b86c5d5e8f..ce0b65ca89 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -703,17 +703,6 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mPelvisp = NULL; - mBakedTextureDatas.resize(BAKED_NUM_INDICES); - for (U32 i = 0; i < mBakedTextureDatas.size(); i++ ) - { - mBakedTextureDatas[i].mLastTextureIndex = IMG_DEFAULT_AVATAR; - mBakedTextureDatas[i].mTexLayerSet = NULL; - mBakedTextureDatas[i].mIsLoaded = false; - mBakedTextureDatas[i].mIsUsed = false; - mBakedTextureDatas[i].mMaskTexName = 0; - mBakedTextureDatas[i].mTextureIndex = LLAvatarAppearanceDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)i); - } - mDirtyMesh = 2; // Dirty geometry, need to regenerate. mMeshTexturesDirty = FALSE; mHeadp = NULL; @@ -821,19 +810,6 @@ LLVOAvatar::~LLVOAvatar() mNumJoints = 0; - for (U32 i = 0; i < mBakedTextureDatas.size(); i++) - { - deleteAndClear(mBakedTextureDatas[i].mTexLayerSet); - mBakedTextureDatas[i].mMeshes.clear(); - - for (morph_list_t::iterator iter2 = mBakedTextureDatas[i].mMaskedMorphs.begin(); - iter2 != mBakedTextureDatas[i].mMaskedMorphs.end(); iter2++) - { - LLMaskedMorph* masked_morph = (*iter2); - delete masked_morph; - } - } - std::for_each(mAttachmentPoints.begin(), mAttachmentPoints.end(), DeletePairedPointer()); mAttachmentPoints.clear(); @@ -1102,7 +1078,7 @@ void LLVOAvatar::restoreGL() gAgentAvatarp->setCompositeUpdatesEnabled(TRUE); for (U32 i = 0; i < gAgentAvatarp->mBakedTextureDatas.size(); i++) { - gAgentAvatarp->invalidateComposite(gAgentAvatarp->mBakedTextureDatas[i].mTexLayerSet, FALSE); + gAgentAvatarp->invalidateComposite(gAgentAvatarp->getTexLayerSet(i), FALSE); } gAgentAvatarp->updateMeshTextures(); } @@ -5518,9 +5494,9 @@ BOOL LLVOAvatar::loadAvatar() EBakedTextureIndex baked = LLAvatarAppearanceDictionary::findBakedByRegionName(info->mRegion); if (baked != BAKED_NUM_INDICES) { - LLPolyMorphTarget *morph_param; + LLVisualParam* morph_param; const std::string *name = &info->mName; - morph_param = (LLPolyMorphTarget *)(getVisualParam(name->c_str())); + morph_param = getVisualParam(name->c_str()); if (morph_param) { BOOL invert = info->mInvert; @@ -6504,7 +6480,11 @@ void LLVOAvatar::onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL LLColor4 color = mTexHairColor->getColor(); for (U32 i = 0; i < mBakedTextureDatas[BAKED_HAIR].mMeshes.size(); i++) { - mBakedTextureDatas[BAKED_HAIR].mMeshes[i]->setColor( color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW] ); + LLViewerJointMesh* mesh = dynamic_cast(mBakedTextureDatas[BAKED_HAIR].mMeshes[i]); + if (mesh) + { + mesh->setColor( color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW] ); + } } } } @@ -6721,15 +6701,16 @@ void LLVOAvatar::updateMeshTextures() // When an avatar is changing clothes and not in Appearance mode, // use the last-known good baked texture until it finish the first // render of the new layerset. - const BOOL layerset_invalid = mBakedTextureDatas[i].mTexLayerSet - && ( !mBakedTextureDatas[i].mTexLayerSet->getViewerComposite()->isInitialized() - || !mBakedTextureDatas[i].mTexLayerSet->isLocalTextureDataAvailable() ); + LLViewerTexLayerSet* layerset = getTexLayerSet(i); + const BOOL layerset_invalid = layerset + && ( !layerset->getViewerComposite()->isInitialized() + || !layerset->isLocalTextureDataAvailable() ); use_lkg_baked_layer[i] = (!is_layer_baked[i] && (mBakedTextureDatas[i].mLastTextureIndex != IMG_DEFAULT_AVATAR) && layerset_invalid); if (use_lkg_baked_layer[i]) { - mBakedTextureDatas[i].mTexLayerSet->setUpdatesEnabled(TRUE); + layerset->setUpdatesEnabled(TRUE); } } else @@ -6742,6 +6723,7 @@ void LLVOAvatar::updateMeshTextures() for (U32 i=0; i < mBakedTextureDatas.size(); i++) { + LLViewerTexLayerSet* layerset = getTexLayerSet(i); if (use_lkg_baked_layer[i] && !mUseLocalAppearance ) { LLViewerFetchedTexture* baked_img; @@ -6765,7 +6747,11 @@ void LLVOAvatar::updateMeshTextures() mBakedTextureDatas[i].mIsUsed = TRUE; for (U32 k=0; k < mBakedTextureDatas[i].mMeshes.size(); k++) { - mBakedTextureDatas[i].mMeshes[k]->setTexture( baked_img ); + LLViewerJointMesh* mesh = dynamic_cast(mBakedTextureDatas[i].mMeshes[k]); + if (mesh) + { + mesh->setTexture( baked_img ); + } } } else if (!mUseLocalAppearance && is_layer_baked[i]) @@ -6788,14 +6774,18 @@ void LLVOAvatar::updateMeshTextures() src_callback_list, paused ); } } - else if (mBakedTextureDatas[i].mTexLayerSet && mUseLocalAppearance) + else if (layerset && mUseLocalAppearance) { - mBakedTextureDatas[i].mTexLayerSet->createComposite(); - mBakedTextureDatas[i].mTexLayerSet->setUpdatesEnabled( TRUE ); + layerset->createComposite(); + layerset->setUpdatesEnabled( TRUE ); mBakedTextureDatas[i].mIsUsed = FALSE; for (U32 k=0; k < mBakedTextureDatas[i].mMeshes.size(); k++) { - mBakedTextureDatas[i].mMeshes[k]->setLayerSet( mBakedTextureDatas[i].mTexLayerSet ); + LLViewerJointMesh* mesh = dynamic_cast(mBakedTextureDatas[i].mMeshes[k]); + if (mesh) + { + mesh->setLayerSet( layerset ); + } } } } @@ -6809,8 +6799,12 @@ void LLVOAvatar::updateMeshTextures() LLViewerTexture* hair_img = getImage( TEX_HAIR, 0 ); for (U32 i = 0; i < mBakedTextureDatas[BAKED_HAIR].mMeshes.size(); i++) { - mBakedTextureDatas[BAKED_HAIR].mMeshes[i]->setColor( color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW] ); - mBakedTextureDatas[BAKED_HAIR].mMeshes[i]->setTexture( hair_img ); + LLViewerJointMesh* mesh = dynamic_cast(mBakedTextureDatas[BAKED_HAIR].mMeshes[i]); + if (mesh) + { + mesh->setColor( color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW] ); + mesh->setTexture( hair_img ); + } } } @@ -6883,16 +6877,28 @@ void LLVOAvatar::clearChat() mChats.clear(); } -// adds a morph mask to the appropriate baked texture structure -void LLVOAvatar::addMaskedMorph(EBakedTextureIndex index, LLPolyMorphTarget* morph_target, BOOL invert, std::string layer) + +void LLVOAvatar::applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components, LLAvatarAppearanceDefines::EBakedTextureIndex index) { - if (index < BAKED_NUM_INDICES) + if (index >= BAKED_NUM_INDICES) { - LLMaskedMorph *morph = new LLMaskedMorph(morph_target, invert, layer); - mBakedTextureDatas[index].mMaskedMorphs.push_front(morph); + llwarns << "invalid baked texture index passed to applyMorphMask" << llendl; + return; + } + + for (morph_list_t::const_iterator iter = mBakedTextureDatas[index].mMaskedMorphs.begin(); + iter != mBakedTextureDatas[index].mMaskedMorphs.end(); ++iter) + { + const LLMaskedMorph* maskedMorph = (*iter); + LLPolyMorphTarget* morph_target = dynamic_cast(maskedMorph->mMorphTarget); + if (morph_target) + { + morph_target->applyMask(tex_data, width, height, num_components, maskedMorph->mInvert); + } } } + // returns TRUE if morph masks are present and not valid for a given baked texture, FALSE otherwise BOOL LLVOAvatar::morphMaskNeedsUpdate(LLAvatarAppearanceDefines::EBakedTextureIndex index) { @@ -6905,7 +6911,7 @@ BOOL LLVOAvatar::morphMaskNeedsUpdate(LLAvatarAppearanceDefines::EBakedTextureIn { if (isSelf()) { - LLViewerTexLayerSet *layer_set = mBakedTextureDatas[index].mTexLayerSet; + LLViewerTexLayerSet *layer_set = getTexLayerSet(index); if (layer_set) { return !layer_set->isMorphValid(); @@ -6920,23 +6926,6 @@ BOOL LLVOAvatar::morphMaskNeedsUpdate(LLAvatarAppearanceDefines::EBakedTextureIn return FALSE; } -void LLVOAvatar::applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components, LLAvatarAppearanceDefines::EBakedTextureIndex index) -{ - if (index >= BAKED_NUM_INDICES) - { - llwarns << "invalid baked texture index passed to applyMorphMask" << llendl; - return; - } - - for (morph_list_t::const_iterator iter = mBakedTextureDatas[index].mMaskedMorphs.begin(); - iter != mBakedTextureDatas[index].mMaskedMorphs.end(); ++iter) - { - const LLMaskedMorph* maskedMorph = (*iter); - maskedMorph->mMorphTarget->applyMask(tex_data, width, height, num_components, maskedMorph->mInvert); - } -} - - //----------------------------------------------------------------------------- // releaseComponentTextures() // release any component texture UUIDs for which we have a baked texture @@ -7616,7 +7605,11 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) mBakedTextureDatas[i].mIsUsed = true; for (U32 k = 0; k < mBakedTextureDatas[i].mMeshes.size(); k++) { - mBakedTextureDatas[i].mMeshes[k]->setTexture( image_baked ); + LLViewerJointMesh* mesh = dynamic_cast(mBakedTextureDatas[i].mMeshes[k]); + if (mesh) + { + mesh->setTexture( image_baked ); + } } if (mBakedTextureDatas[i].mTexLayerSet) { @@ -7637,7 +7630,11 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) { for (U32 i = 0; i < mBakedTextureDatas[BAKED_HAIR].mMeshes.size(); i++) { - mBakedTextureDatas[BAKED_HAIR].mMeshes[i]->setColor( 1.f, 1.f, 1.f, 1.f ); + LLViewerJointMesh* mesh = dynamic_cast(mBakedTextureDatas[BAKED_HAIR].mMeshes[i]); + if (mesh) + { + mesh->setColor( 1.f, 1.f, 1.f, 1.f ); + } } } } @@ -8689,3 +8686,17 @@ BOOL LLVOAvatar::isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, return FALSE; } +//virtual +LLAvatarAppearance::LLMaskedMorph::LLMaskedMorph(LLVisualParam *morph_target, BOOL invert, std::string layer) : + mMorphTarget(morph_target), + mInvert(invert), + mLayer(layer) +{ + LLPolyMorphTarget *target = dynamic_cast(morph_target); + if (target) + { + target->addPendingMorphMask(); + } +} + + -- cgit v1.2.3 From 201d9853f9d57efab9b819ff07745141a5265e98 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 5 Sep 2012 18:25:51 -0400 Subject: Debug display for baked vs. composite status, via setting DebugAvatarCompositeBaked --- indra/newview/llvoavatar.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 4894f21e67..d92caf1edb 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5763,7 +5763,7 @@ BOOL LLVOAvatar::loadMeshNodes() // If this isn't set to white (1.0), avatars will *ALWAYS* be darker than their surroundings. // Do not touch!!! - mesh->setColor( 1.0f, 1.0f, 1.0f, 1.0f ); + mesh->setColor( LLColor4::white ); LLPolyMesh *poly_mesh = NULL; @@ -6503,7 +6503,7 @@ void LLVOAvatar::onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL LLColor4 color = mTexHairColor->getColor(); for (U32 i = 0; i < mBakedTextureDatas[BAKED_HAIR].mMeshes.size(); i++) { - mBakedTextureDatas[BAKED_HAIR].mMeshes[i]->setColor( color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW] ); + mBakedTextureDatas[BAKED_HAIR].mMeshes[i]->setColor( color ); } } } @@ -6764,6 +6764,10 @@ void LLVOAvatar::updateMeshTextures() for (U32 k=0; k < mBakedTextureDatas[i].mMeshes.size(); k++) { mBakedTextureDatas[i].mMeshes[k]->setTexture( baked_img ); + if (gSavedSettings.getBOOL("DebugAvatarCompositeBaked")) + { + mBakedTextureDatas[i].mMeshes[k]->setColor(LLColor4::red); + } } } else if (!mUseLocalAppearance && is_layer_baked[i]) @@ -6794,6 +6798,10 @@ void LLVOAvatar::updateMeshTextures() for (U32 k=0; k < mBakedTextureDatas[i].mMeshes.size(); k++) { mBakedTextureDatas[i].mMeshes[k]->setLayerSet( mBakedTextureDatas[i].mTexLayerSet ); + if (gSavedSettings.getBOOL("DebugAvatarCompositeBaked")) + { + mBakedTextureDatas[i].mMeshes[k]->setColor( LLColor4::yellow ); + } } } } @@ -6807,7 +6815,7 @@ void LLVOAvatar::updateMeshTextures() LLViewerTexture* hair_img = getImage( TEX_HAIR, 0 ); for (U32 i = 0; i < mBakedTextureDatas[BAKED_HAIR].mMeshes.size(); i++) { - mBakedTextureDatas[BAKED_HAIR].mMeshes[i]->setColor( color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW] ); + mBakedTextureDatas[BAKED_HAIR].mMeshes[i]->setColor( color ); mBakedTextureDatas[BAKED_HAIR].mMeshes[i]->setTexture( hair_img ); } } @@ -7721,6 +7729,10 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) for (U32 k = 0; k < mBakedTextureDatas[i].mMeshes.size(); k++) { mBakedTextureDatas[i].mMeshes[k]->setTexture( image_baked ); + if (gSavedSettings.getBOOL("DebugAvatarCompositeBaked")) + { + mBakedTextureDatas[i].mMeshes[k]->setColor( LLColor4::green ); + } } if (mBakedTextureDatas[i].mTexLayerSet) { @@ -7741,7 +7753,7 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) { for (U32 i = 0; i < mBakedTextureDatas[BAKED_HAIR].mMeshes.size(); i++) { - mBakedTextureDatas[BAKED_HAIR].mMeshes[i]->setColor( 1.f, 1.f, 1.f, 1.f ); + mBakedTextureDatas[BAKED_HAIR].mMeshes[i]->setColor( LLColor4::white ); } } } -- 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/llvoavatar.cpp | 68 +------------------------------------------- 1 file changed, 1 insertion(+), 67 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index b86c5d5e8f..2309ea3488 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -644,7 +644,7 @@ static F32 calc_bouncy_animation(F32 x); LLVOAvatar::LLVOAvatar(const LLUUID& id, const LLPCode pcode, LLViewerRegion* regionp) : - LLAvatarAppearance(), + LLAvatarAppearance(&gAgentWearables), LLViewerObject(id, pcode, regionp), mSpecialRenderMode(0), mAttachmentGeometryBytes(0), @@ -5860,30 +5860,6 @@ void LLVOAvatar::updateVisualParams() updateHeadOffset(); } -// virtual -U32 LLVOAvatar::getWearableCount(const LLWearableType::EType type) const -{ - return gAgentWearables.getWearableCount(type); -} - -// virtual -U32 LLVOAvatar::getWearableCount(const U32 tex_index) const -{ - return gAgentWearables.getWearableCount(tex_index); -} - -// virtual -LLWearable* LLVOAvatar::getWearable(const LLWearableType::EType type, U32 index /*= 0*/) -{ - return gAgentWearables.getWearable(type, index); -} - -// virtual -const LLWearable* LLVOAvatar::getWearable(const LLWearableType::EType type, U32 index /*= 0*/) const -{ - return gAgentWearables.getWearable(type, index); -} - //----------------------------------------------------------------------------- // isActive() //----------------------------------------------------------------------------- @@ -7008,48 +6984,6 @@ void LLVOAvatar::dumpAvatarTEs( const std::string& context ) const } } -// Unlike most wearable functions, this works for both self and other. -BOOL LLVOAvatar::isWearingWearableType(LLWearableType::EType type) const -{ - if (mIsDummy) return TRUE; - - switch(type) - { - case LLWearableType::WT_SHAPE: - case LLWearableType::WT_SKIN: - case LLWearableType::WT_HAIR: - case LLWearableType::WT_EYES: - return TRUE; // everyone has all bodyparts - default: - break; // Do nothing - } - - /* switch(type) - case LLWearableType::WT_SHIRT: - indicator_te = TEX_UPPER_SHIRT; */ - for (LLAvatarAppearanceDictionary::Textures::const_iterator tex_iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin(); - tex_iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end(); - ++tex_iter) - { - const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = tex_iter->second; - if (texture_dict->mWearableType == type) - { - // If you're checking another avatar's clothing, you don't have component textures. - // Thus, you must check to see if the corresponding baked texture is defined. - // NOTE: this is a poor substitute if you actually want to know about individual pieces of clothing - // this works for detecting a skirt (most important), but is ineffective at any piece of clothing that - // gets baked into a texture that always exists (upper or lower). - if (texture_dict->mIsUsedByBakedTexture) - { - const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex; - return isTextureDefined(LLAvatarAppearanceDictionary::getInstance()->getBakedTexture(baked_index)->mTextureIndex); - } - return FALSE; - } - } - return FALSE; -} - //----------------------------------------------------------------------------- // clampAttachmentPositions() //----------------------------------------------------------------------------- -- cgit v1.2.3 From 2b2fd9e97526d10b0b4d34154cc0a46f957acba7 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 7 Sep 2012 17:48:09 -0400 Subject: enhanced XML archetype dumping, added to per-avatar menus --- indra/newview/llvoavatar.cpp | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index d92caf1edb..39ad8fc8d6 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -36,6 +36,7 @@ #include #include +#include #include "llaudioengine.h" #include "noise.h" @@ -7762,11 +7763,35 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) dirtyMesh(); } -// static -void LLVOAvatar::dumpArchetypeXML( void* ) +void LLVOAvatar::dumpArchetypeXML(const std::string& filename ) { + std::string outfilename(filename); + if (outfilename.empty()) + { + std::string fullname = getFullname(); + if (!fullname.empty()) + { + typedef std::map file_num_type; + static file_num_type file_nums; + file_num_type::iterator it = file_nums.find(fullname); + S32 num = 0; + if (it != file_nums.end()) + { + num = it->second; + } + std::ostringstream temp; + temp << std::setw(4) << std::setfill('0') << num; + file_nums[fullname] = num+1; + outfilename = fullname + " " + temp.str() + ".xml"; + } + } + if (outfilename.empty()) + { + outfilename = std::string("new archetype.xml"); + } + LLAPRFile outfile; - outfile.open(gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,"new archetype.xml"), LL_APR_WB ); + outfile.open(gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,outfilename), LL_APR_WB ); apr_file_t* file = outfile.getFileHandle(); if (!file) { @@ -7782,12 +7807,12 @@ void LLVOAvatar::dumpArchetypeXML( void* ) apr_file_printf( file, "\n\t\n" ); // only body parts, not clothing. - for (S32 type = LLWearableType::WT_SHAPE; type <= LLWearableType::WT_EYES; type++) + for (S32 type = LLWearableType::WT_SHAPE; type <= LLWearableType::WT_COUNT; type++) { const std::string& wearable_name = LLWearableType::getTypeName((LLWearableType::EType)type); apr_file_printf( file, "\n\t\t\n", wearable_name.c_str() ); - for (LLVisualParam* param = gAgentAvatarp->getFirstVisualParam(); param; param = gAgentAvatarp->getNextVisualParam()) + for (LLVisualParam* param = getFirstVisualParam(); param; param = getNextVisualParam()) { LLViewerVisualParam* viewer_param = (LLViewerVisualParam*)param; if( (viewer_param->getWearableType() == type) && @@ -7803,7 +7828,7 @@ void LLVOAvatar::dumpArchetypeXML( void* ) if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex)te) == type) { // MULTIPLE_WEARABLES: extend to multiple wearables? - LLViewerTexture* te_image = ((LLVOAvatar *)(gAgentAvatarp))->getImage((ETextureIndex)te, 0); + LLViewerTexture* te_image = getImage((ETextureIndex)te, 0); if( te_image ) { std::string uuid_str; -- cgit v1.2.3 From 77b33d9623c08152932282048fe847d79fcf43cd Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Fri, 7 Sep 2012 23:17:34 -0400 Subject: SH-3264 Porting over the XML loading of the avatar structure to llappearance Moved over the necessary classes to llappearance to support the loading of the avatar's structure & params from file. --- indra/newview/llvoavatar.cpp | 1548 +++++------------------------------------- 1 file changed, 154 insertions(+), 1394 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index f6cac6d2d6..f0f469e959 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -139,7 +139,6 @@ const LLUUID ANIM_AGENT_PHYSICS_MOTION = LLUUID("7360e029-3cb8-ebc4-863e-212df44 //----------------------------------------------------------------------------- // Constants //----------------------------------------------------------------------------- -const std::string AVATAR_DEFAULT_CHAR = "avatar"; const S32 MIN_PIXEL_AREA_FOR_COMPOSITE = 1024; const F32 SHADOW_OFFSET_AMT = 0.03f; @@ -220,58 +219,6 @@ struct LLTextureMaskData ** **/ -//------------------------------------------------------------------------ -// LLVOBoneInfo -// Trans/Scale/Rot etc. info about each avatar bone. Used by LLVOAvatarSkeleton. -//------------------------------------------------------------------------ -class LLVOAvatarBoneInfo -{ - friend class LLVOAvatar; - friend class LLVOAvatarSkeletonInfo; -public: - LLVOAvatarBoneInfo() : mIsJoint(FALSE) {} - ~LLVOAvatarBoneInfo() - { - std::for_each(mChildList.begin(), mChildList.end(), DeletePointer()); - } - BOOL parseXml(LLXmlTreeNode* node); - -private: - std::string mName; - BOOL mIsJoint; - LLVector3 mPos; - LLVector3 mRot; - LLVector3 mScale; - LLVector3 mPivot; - typedef std::vector child_list_t; - child_list_t mChildList; -}; - -//------------------------------------------------------------------------ -// LLVOAvatarSkeletonInfo -// Overall avatar skeleton -//------------------------------------------------------------------------ -class LLVOAvatarSkeletonInfo -{ - friend class LLVOAvatar; -public: - LLVOAvatarSkeletonInfo() : - mNumBones(0), mNumCollisionVolumes(0) {} - ~LLVOAvatarSkeletonInfo() - { - std::for_each(mBoneInfoList.begin(), mBoneInfoList.end(), DeletePointer()); - } - BOOL parseXml(LLXmlTreeNode* node); - S32 getNumBones() const { return mNumBones; } - S32 getNumCollisionVolumes() const { return mNumCollisionVolumes; } - -private: - S32 mNumBones; - S32 mNumCollisionVolumes; - typedef std::vector bone_info_list_t; - bone_info_list_t mBoneInfoList; -}; - //----------------------------------------------------------------------------- // class LLBodyNoiseMotion //----------------------------------------------------------------------------- @@ -593,10 +540,6 @@ private: //----------------------------------------------------------------------------- // Static Data //----------------------------------------------------------------------------- -LLXmlTree LLVOAvatar::sXMLTree; -LLXmlTree LLVOAvatar::sSkeletonXMLTree; -LLVOAvatarSkeletonInfo* LLVOAvatar::sAvatarSkeletonInfo = NULL; -LLVOAvatar::LLVOAvatarXmlInfo* LLVOAvatar::sAvatarXmlInfo = NULL; LLAvatarAppearanceDictionary *LLVOAvatar::sAvatarDictionary = NULL; S32 LLVOAvatar::sFreezeCounter = 0; U32 LLVOAvatar::sMaxVisible = 12; @@ -650,9 +593,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mAttachmentGeometryBytes(0), mAttachmentSurfaceArea(0.f), mTurning(FALSE), - mPelvisToFoot(0.f), mLastSkeletonSerialNum( 0 ), - mHeadOffset(), mIsSitting(FALSE), mTimeVisible(), mTyping(FALSE), @@ -707,13 +648,6 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mMeshTexturesDirty = FALSE; mHeadp = NULL; - mIsBuilt = FALSE; - - mNumJoints = 0; - mSkeleton = NULL; - - mNumCollisionVolumes = 0; - mCollisionVolumes = NULL; // set up animation variables mSpeed = 0.f; @@ -802,35 +736,9 @@ LLVOAvatar::~LLVOAvatar() lldebugs << "LLVOAvatar Destructor (0x" << this << ") id:" << mID << llendl; - mRoot.removeAllChildren(); - mJointMap.clear(); - - deleteAndClearArray(mSkeleton); - deleteAndClearArray(mCollisionVolumes); - - mNumJoints = 0; - std::for_each(mAttachmentPoints.begin(), mAttachmentPoints.end(), DeletePairedPointer()); mAttachmentPoints.clear(); - deleteAndClear(mTexSkinColor); - deleteAndClear(mTexHairColor); - deleteAndClear(mTexEyeColor); - - std::for_each(mMeshes.begin(), mMeshes.end(), DeletePairedPointer()); - mMeshes.clear(); - - for (std::vector::iterator jointIter = mMeshLOD.begin(); - jointIter != mMeshLOD.end(); - ++jointIter) - { - LLViewerJoint* joint = (LLViewerJoint *) *jointIter; - std::for_each(joint->mMeshParts.begin(), joint->mMeshParts.end(), DeletePointer()); - joint->mMeshParts.clear(); - } - std::for_each(mMeshLOD.begin(), mMeshLOD.end(), DeletePointer()); - mMeshLOD.clear(); - mDead = TRUE; mAnimationSources.clear(); @@ -1127,109 +1035,6 @@ void LLVOAvatar::deleteCachedImages(bool clearAll) //------------------------------------------------------------------------ void LLVOAvatar::initClass() { - std::string xmlFile; - - xmlFile = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,AVATAR_DEFAULT_CHAR) + "_lad.xml"; - BOOL success = sXMLTree.parseFile( xmlFile, FALSE ); - if (!success) - { - llerrs << "Problem reading avatar configuration file:" << xmlFile << llendl; - } - - // now sanity check xml file - LLXmlTreeNode* root = sXMLTree.getRoot(); - if (!root) - { - llerrs << "No root node found in avatar configuration file: " << xmlFile << llendl; - return; - } - - //------------------------------------------------------------------------- - // (root) - //------------------------------------------------------------------------- - if( !root->hasName( "linden_avatar" ) ) - { - llerrs << "Invalid avatar file header: " << xmlFile << llendl; - } - - std::string version; - static LLStdStringHandle version_string = LLXmlTree::addAttributeString("version"); - if( !root->getFastAttributeString( version_string, version ) || (version != "1.0") ) - { - llerrs << "Invalid avatar file version: " << version << " in file: " << xmlFile << llendl; - } - - S32 wearable_def_version = 1; - static LLStdStringHandle wearable_definition_version_string = LLXmlTree::addAttributeString("wearable_definition_version"); - root->getFastAttributeS32( wearable_definition_version_string, wearable_def_version ); - LLWearable::setCurrentDefinitionVersion( wearable_def_version ); - - std::string mesh_file_name; - - LLXmlTreeNode* skeleton_node = root->getChildByName( "skeleton" ); - if (!skeleton_node) - { - llerrs << "No skeleton in avatar configuration file: " << xmlFile << llendl; - return; - } - - std::string skeleton_file_name; - static LLStdStringHandle file_name_string = LLXmlTree::addAttributeString("file_name"); - if (!skeleton_node->getFastAttributeString(file_name_string, skeleton_file_name)) - { - llerrs << "No file name in skeleton node in avatar config file: " << xmlFile << llendl; - } - - std::string skeleton_path; - skeleton_path = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,skeleton_file_name); - if (!parseSkeletonFile(skeleton_path)) - { - llerrs << "Error parsing skeleton file: " << skeleton_path << llendl; - } - - // Process XML data - - // avatar_skeleton.xml - if (sAvatarSkeletonInfo) - { //this can happen if a login attempt failed - delete sAvatarSkeletonInfo; - } - sAvatarSkeletonInfo = new LLVOAvatarSkeletonInfo; - if (!sAvatarSkeletonInfo->parseXml(sSkeletonXMLTree.getRoot())) - { - llerrs << "Error parsing skeleton XML file: " << skeleton_path << llendl; - } - // parse avatar_lad.xml - if (sAvatarXmlInfo) - { //this can happen if a login attempt failed - deleteAndClear(sAvatarXmlInfo); - } - sAvatarXmlInfo = new LLVOAvatarXmlInfo; - if (!sAvatarXmlInfo->parseXmlSkeletonNode(root)) - { - llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl; - } - if (!sAvatarXmlInfo->parseXmlMeshNodes(root)) - { - llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl; - } - if (!sAvatarXmlInfo->parseXmlColorNodes(root)) - { - llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl; - } - if (!sAvatarXmlInfo->parseXmlLayerNodes(root)) - { - llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl; - } - if (!sAvatarXmlInfo->parseXmlDriverNodes(root)) - { - llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl; - } - if (!sAvatarXmlInfo->parseXmlMorphNodes(root)) - { - llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl; - } - gAnimLibrary.animStateSetString(ANIM_AGENT_BODY_NOISE,"body_noise"); gAnimLibrary.animStateSetString(ANIM_AGENT_BREATHE_ROT,"breathe_rot"); gAnimLibrary.animStateSetString(ANIM_AGENT_PHYSICS_MOTION,"physics_motion"); @@ -1256,7 +1061,12 @@ void LLVOAvatar::initInstance(void) //------------------------------------------------------------------------- // initialize joint, mesh and shape members //------------------------------------------------------------------------- - mRoot.setName( "mRoot" ); + if (mRoot) + { + delete mRoot; + } + mRoot = new LLViewerJoint(); + mRoot->setName( "mRoot" ); for (LLAvatarAppearanceDictionary::Meshes::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getMeshes().begin(); iter != LLAvatarAppearanceDictionary::getInstance()->getMeshes().end(); @@ -1314,7 +1124,7 @@ void LLVOAvatar::initInstance(void) // Skip it if there's no associated baked texture. if (baked_texture_index == BAKED_NUM_INDICES) continue; - for (std::vector::iterator iter = mMeshLOD[mesh_index]->mMeshParts.begin(); + for (std::vector::iterator iter = mMeshLOD[mesh_index]->mMeshParts.begin(); iter != mMeshLOD[mesh_index]->mMeshParts.end(); ++iter) { @@ -1707,160 +1517,6 @@ LLViewerObject* LLVOAvatar::lineSegmentIntersectRiggedAttachments(const LLVector return hit; } -//----------------------------------------------------------------------------- -// parseSkeletonFile() -//----------------------------------------------------------------------------- -BOOL LLVOAvatar::parseSkeletonFile(const std::string& filename) -{ - LLMemType mt(LLMemType::MTYPE_AVATAR); - - //------------------------------------------------------------------------- - // parse the file - //------------------------------------------------------------------------- - BOOL parsesuccess = sSkeletonXMLTree.parseFile( filename, FALSE ); - - if (!parsesuccess) - { - llerrs << "Can't parse skeleton file: " << filename << llendl; - return FALSE; - } - - // now sanity check xml file - LLXmlTreeNode* root = sSkeletonXMLTree.getRoot(); - if (!root) - { - llerrs << "No root node found in avatar skeleton file: " << filename << llendl; - return FALSE; - } - - if( !root->hasName( "linden_skeleton" ) ) - { - llerrs << "Invalid avatar skeleton file header: " << filename << llendl; - return FALSE; - } - - std::string version; - static LLStdStringHandle version_string = LLXmlTree::addAttributeString("version"); - if( !root->getFastAttributeString( version_string, version ) || (version != "1.0") ) - { - llerrs << "Invalid avatar skeleton file version: " << version << " in file: " << filename << llendl; - return FALSE; - } - - return TRUE; -} - -//----------------------------------------------------------------------------- -// setupBone() -//----------------------------------------------------------------------------- -BOOL LLVOAvatar::setupBone(const LLVOAvatarBoneInfo* info, LLViewerJoint* parent, S32 &volume_num, S32 &joint_num) -{ - LLMemType mt(LLMemType::MTYPE_AVATAR); - - LLViewerJoint* joint = NULL; - - if (info->mIsJoint) - { - joint = (LLViewerJoint*)getCharacterJoint(joint_num); - if (!joint) - { - llwarns << "Too many bones" << llendl; - return FALSE; - } - joint->setName( info->mName ); - } - else // collision volume - { - if (volume_num >= (S32)mNumCollisionVolumes) - { - llwarns << "Too many bones" << llendl; - return FALSE; - } - joint = (LLViewerJoint*)(&mCollisionVolumes[volume_num]); - joint->setName( info->mName ); - } - - // add to parent - if (parent) - { - parent->addChild( joint ); - } - - joint->setPosition(info->mPos); - joint->setRotation(mayaQ(info->mRot.mV[VX], info->mRot.mV[VY], - info->mRot.mV[VZ], LLQuaternion::XYZ)); - joint->setScale(info->mScale); - - joint->setDefaultFromCurrentXform(); - - if (info->mIsJoint) - { - joint->setSkinOffset( info->mPivot ); - joint_num++; - } - else // collision volume - { - volume_num++; - } - - // setup children - LLVOAvatarBoneInfo::child_list_t::const_iterator iter; - for (iter = info->mChildList.begin(); iter != info->mChildList.end(); ++iter) - { - LLVOAvatarBoneInfo *child_info = *iter; - if (!setupBone(child_info, joint, volume_num, joint_num)) - { - return FALSE; - } - } - - return TRUE; -} - -//----------------------------------------------------------------------------- -// buildSkeleton() -//----------------------------------------------------------------------------- -BOOL LLVOAvatar::buildSkeleton(const LLVOAvatarSkeletonInfo *info) -{ - LLMemType mt(LLMemType::MTYPE_AVATAR); - - //------------------------------------------------------------------------- - // allocate joints - //------------------------------------------------------------------------- - if (!allocateCharacterJoints(info->mNumBones)) - { - llerrs << "Can't allocate " << info->mNumBones << " joints" << llendl; - return FALSE; - } - - //------------------------------------------------------------------------- - // allocate volumes - //------------------------------------------------------------------------- - if (info->mNumCollisionVolumes) - { - if (!allocateCollisionVolumes(info->mNumCollisionVolumes)) - { - llerrs << "Can't allocate " << info->mNumCollisionVolumes << " collision volumes" << llendl; - return FALSE; - } - } - - S32 current_joint_num = 0; - S32 current_volume_num = 0; - LLVOAvatarSkeletonInfo::bone_info_list_t::const_iterator iter; - for (iter = info->mBoneInfoList.begin(); iter != info->mBoneInfoList.end(); ++iter) - { - LLVOAvatarBoneInfo *info = *iter; - if (!setupBone(info, NULL, current_volume_num, current_joint_num)) - { - llerrs << "Error parsing bone in skeleton file" << llendl; - return FALSE; - } - } - - return TRUE; -} - LLVOAvatar* LLVOAvatar::asAvatar() { return this; @@ -1892,27 +1548,13 @@ void LLVOAvatar::startDefaultMotions() // LLVOAvatar::buildCharacter() // Deferred initialization and rebuild of the avatar. //----------------------------------------------------------------------------- +// virtual void LLVOAvatar::buildCharacter() { - LLMemType mt(LLMemType::MTYPE_AVATAR); - - //------------------------------------------------------------------------- - // remove all references to our existing skeleton - // so we can rebuild it - //------------------------------------------------------------------------- - flushAllMotions(); - - //------------------------------------------------------------------------- - // remove all of mRoot's children - //------------------------------------------------------------------------- - mRoot.removeAllChildren(); - mJointMap.clear(); - mIsBuilt = FALSE; - //------------------------------------------------------------------------- // clear mesh data //------------------------------------------------------------------------- - for (std::vector::iterator jointIter = mMeshLOD.begin(); + for (std::vector::iterator jointIter = mMeshLOD.begin(); jointIter != mMeshLOD.end(); ++jointIter) { LLViewerJoint* joint = (LLViewerJoint*) *jointIter; @@ -1924,83 +1566,8 @@ void LLVOAvatar::buildCharacter() } } - //------------------------------------------------------------------------- - // (re)load our skeleton and meshes - //------------------------------------------------------------------------- - LLTimer timer; - - BOOL status = loadAvatar(); - stop_glerror(); - -// gPrintMessagesThisFrame = TRUE; - lldebugs << "Avatar load took " << timer.getElapsedTimeF32() << " seconds." << llendl; - - if (!status) - { - if (isSelf()) - { - llerrs << "Unable to load user's avatar" << llendl; - } - else - { - llwarns << "Unable to load other's avatar" << llendl; - } - return; - } - - //------------------------------------------------------------------------- - // initialize "well known" joint pointers - //------------------------------------------------------------------------- - mPelvisp = (LLViewerJoint*)mRoot.findJoint("mPelvis"); - mTorsop = (LLViewerJoint*)mRoot.findJoint("mTorso"); - mChestp = (LLViewerJoint*)mRoot.findJoint("mChest"); - mNeckp = (LLViewerJoint*)mRoot.findJoint("mNeck"); - mHeadp = (LLViewerJoint*)mRoot.findJoint("mHead"); - mSkullp = (LLViewerJoint*)mRoot.findJoint("mSkull"); - mHipLeftp = (LLViewerJoint*)mRoot.findJoint("mHipLeft"); - mHipRightp = (LLViewerJoint*)mRoot.findJoint("mHipRight"); - mKneeLeftp = (LLViewerJoint*)mRoot.findJoint("mKneeLeft"); - mKneeRightp = (LLViewerJoint*)mRoot.findJoint("mKneeRight"); - mAnkleLeftp = (LLViewerJoint*)mRoot.findJoint("mAnkleLeft"); - mAnkleRightp = (LLViewerJoint*)mRoot.findJoint("mAnkleRight"); - mFootLeftp = (LLViewerJoint*)mRoot.findJoint("mFootLeft"); - mFootRightp = (LLViewerJoint*)mRoot.findJoint("mFootRight"); - mWristLeftp = (LLViewerJoint*)mRoot.findJoint("mWristLeft"); - mWristRightp = (LLViewerJoint*)mRoot.findJoint("mWristRight"); - mEyeLeftp = (LLViewerJoint*)mRoot.findJoint("mEyeLeft"); - mEyeRightp = (LLViewerJoint*)mRoot.findJoint("mEyeRight"); - - //------------------------------------------------------------------------- - // Make sure "well known" pointers exist - //------------------------------------------------------------------------- - if (!(mPelvisp && - mTorsop && - mChestp && - mNeckp && - mHeadp && - mSkullp && - mHipLeftp && - mHipRightp && - mKneeLeftp && - mKneeRightp && - mAnkleLeftp && - mAnkleRightp && - mFootLeftp && - mFootRightp && - mWristLeftp && - mWristRightp && - mEyeLeftp && - mEyeRightp)) - { - llerrs << "Failed to create avatar." << llendl; - return; - } + LLAvatarAppearance::buildCharacter(); - //------------------------------------------------------------------------- - // initialize the pelvis - //------------------------------------------------------------------------- - mPelvisp->setPosition( LLVector3(0.0f, 0.0f, 0.0f) ); - //------------------------------------------------------------------------- // set head offset from pelvis //------------------------------------------------------------------------- @@ -2033,9 +1600,6 @@ void LLVOAvatar::buildCharacter() //------------------------------------------------------------------------- processAnimationStateChanges(); - mIsBuilt = TRUE; - stop_glerror(); - mMeshValid = TRUE; } @@ -2055,7 +1619,7 @@ void LLVOAvatar::releaseMeshData() //llinfos << "Releasing" << llendl; // cleanup mesh data - for (std::vector::iterator iter = mMeshLOD.begin(); + for (std::vector::iterator iter = mMeshLOD.begin(); iter != mMeshLOD.end(); ++iter) { @@ -2149,7 +1713,11 @@ void LLVOAvatar::updateMeshData() last_v_num = num_vertices ; last_i_num = num_indices ; - mMeshLOD[part_index++]->updateFaceSizes(num_vertices, num_indices, mAdjustedPixelArea); + LLViewerJoint* part_mesh = getViewerJoint(part_index++); + if (part_mesh) + { + part_mesh->updateFaceSizes(num_vertices, num_indices, mAdjustedPixelArea); + } } if(num_vertices < 1)//skip empty meshes { @@ -2223,7 +1791,11 @@ void LLVOAvatar::updateMeshData() rigid = true; } - mMeshLOD[k]->updateFaceData(facep, mAdjustedPixelArea, k == MESH_ID_HAIR, terse_update && !rigid); + LLViewerJoint* mesh = getViewerJoint(k); + if (mesh) + { + mesh->updateFaceData(facep, mAdjustedPixelArea, k == MESH_ID_HAIR, terse_update && !rigid); + } } stop_glerror(); @@ -2243,72 +1815,6 @@ void LLVOAvatar::updateMeshData() //------------------------------------------------------------------------ -//------------------------------------------------------------------------ -// The viewer can only suggest a good size for the agent, -// the simulator will keep it inside a reasonable range. -void LLVOAvatar::computeBodySize() -{ - LLVector3 pelvis_scale = mPelvisp->getScale(); - - // some of the joints have not been cached - LLVector3 skull = mSkullp->getPosition(); - LLVector3 skull_scale = mSkullp->getScale(); - - LLVector3 neck = mNeckp->getPosition(); - LLVector3 neck_scale = mNeckp->getScale(); - - LLVector3 chest = mChestp->getPosition(); - LLVector3 chest_scale = mChestp->getScale(); - - // the rest of the joints have been cached - LLVector3 head = mHeadp->getPosition(); - LLVector3 head_scale = mHeadp->getScale(); - - LLVector3 torso = mTorsop->getPosition(); - LLVector3 torso_scale = mTorsop->getScale(); - - LLVector3 hip = mHipLeftp->getPosition(); - LLVector3 hip_scale = mHipLeftp->getScale(); - - LLVector3 knee = mKneeLeftp->getPosition(); - LLVector3 knee_scale = mKneeLeftp->getScale(); - - LLVector3 ankle = mAnkleLeftp->getPosition(); - LLVector3 ankle_scale = mAnkleLeftp->getScale(); - - LLVector3 foot = mFootLeftp->getPosition(); - - mPelvisToFoot = hip.mV[VZ] * pelvis_scale.mV[VZ] - - knee.mV[VZ] * hip_scale.mV[VZ] - - ankle.mV[VZ] * knee_scale.mV[VZ] - - foot.mV[VZ] * ankle_scale.mV[VZ]; - - LLVector3 new_body_size; - new_body_size.mV[VZ] = mPelvisToFoot + - // the sqrt(2) correction below is an approximate - // correction to get to the top of the head - F_SQRT2 * (skull.mV[VZ] * head_scale.mV[VZ]) + - head.mV[VZ] * neck_scale.mV[VZ] + - neck.mV[VZ] * chest_scale.mV[VZ] + - chest.mV[VZ] * torso_scale.mV[VZ] + - torso.mV[VZ] * pelvis_scale.mV[VZ]; - - // TODO -- measure the real depth and width - new_body_size.mV[VX] = DEFAULT_AGENT_DEPTH; - new_body_size.mV[VY] = DEFAULT_AGENT_WIDTH; - - if (new_body_size != mBodySize) - { - mBodySize = new_body_size; - - if (isSelf() && !LLAppearanceMgr::instance().isInUpdateAppearanceFromCOF()) - { // notify simulator of change in size - // but not if we are in the middle of updating appearance - gAgent.sendAgentSetAppearance(); - } - } -} - //------------------------------------------------------------------------ // LLVOAvatar::processUpdateMessage() //------------------------------------------------------------------------ @@ -2478,7 +1984,7 @@ void LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) // animate the character // store off last frame's root position to be consistent with camera position - LLVector3 root_pos_last = mRoot.getWorldPosition(); + LLVector3 root_pos_last = mRoot->getWorldPosition(); BOOL detailed_update = updateCharacter(agent); static LLUICachedControl visualizers_in_calls("ShowVoiceVisualizersInCalls", false); @@ -2597,11 +2103,11 @@ void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled) if ( mIsSitting ) { LLVector3 headOffset = LLVector3( 0.0f, 0.0f, mHeadOffset.mV[2] ); - mVoiceVisualizer->setVoiceSourceWorldPosition( mRoot.getWorldPosition() + headOffset ); + mVoiceVisualizer->setVoiceSourceWorldPosition( mRoot->getWorldPosition() + headOffset ); } else { - LLVector3 tagPos = mRoot.getWorldPosition(); + LLVector3 tagPos = mRoot->getWorldPosition(); tagPos[VZ] -= mPelvisToFoot; tagPos[VZ] += ( mBodySize[VZ] + 0.125f ); mVoiceVisualizer->setVoiceSourceWorldPosition( tagPos ); @@ -3338,7 +2844,7 @@ void LLVOAvatar::invalidateNameTags() // Compute name tag position during idle update LLVector3 LLVOAvatar::idleUpdateNameTagPosition(const LLVector3& root_pos_last) { - LLQuaternion root_rot = mRoot.getWorldRotation(); + LLQuaternion root_rot = mRoot->getWorldRotation(); LLVector3 pixel_right_vec; LLVector3 pixel_up_vec; LLViewerCamera::getInstance()->getPixelVectors(root_pos_last, pixel_up_vec, pixel_right_vec); @@ -3352,7 +2858,7 @@ LLVector3 LLVOAvatar::idleUpdateNameTagPosition(const LLVector3& root_pos_last) local_camera_up.scaleVec(mBodySize * 0.5f); local_camera_at.scaleVec(mBodySize * 0.5f); - LLVector3 name_position = mRoot.getWorldPosition(); + LLVector3 name_position = mRoot->getWorldPosition(); name_position[VZ] -= mPelvisToFoot; name_position[VZ] += (mBodySize[VZ]* 0.55f); name_position += (local_camera_up * root_rot) - (projected_vec(local_camera_at * root_rot, camera_to_av)); @@ -3417,13 +2923,13 @@ void LLVOAvatar::idleUpdateBelowWater() void LLVOAvatar::slamPosition() { gAgent.setPositionAgent(getPositionAgent()); - mRoot.setWorldPosition(getPositionAgent()); // teleport + mRoot->setWorldPosition(getPositionAgent()); // teleport setChanged(TRANSLATED); if (mDrawable.notNull()) { gPipeline.updateMoveNormalAsync(mDrawable); } - mRoot.updateWorldMatrixChildren(); + mRoot->updateWorldMatrixChildren(); } bool LLVOAvatar::isVisuallyMuted() const @@ -3600,8 +3106,8 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) throttle = FALSE; // put the pelvis at slaved position/mRotation - mRoot.setWorldPosition( getPositionAgent() ); // first frame - mRoot.setWorldRotation( getRotation() ); + mRoot->setWorldPosition( getPositionAgent() ); // first frame + mRoot->setWorldRotation( getRotation() ); } //-------------------------------------------------------------------- @@ -3644,10 +3150,10 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) LLVector3 newPosition = gAgent.getPosAgentFromGlobal(root_pos); - if (newPosition != mRoot.getXform()->getWorldPosition()) + if (newPosition != mRoot->getXform()->getWorldPosition()) { - mRoot.touch(); - mRoot.setWorldPosition( newPosition ); // regular update + mRoot->touch(); + mRoot->setWorldPosition( newPosition ); // regular update } @@ -3708,7 +3214,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) } - LLQuaternion root_rotation = mRoot.getWorldMatrix().quaternion(); + LLQuaternion root_rotation = mRoot->getWorldMatrix().quaternion(); F32 root_roll, root_pitch, root_yaw; root_rotation.getEulerAngles(&root_roll, &root_pitch, &root_yaw); @@ -3717,7 +3223,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) // and head turn. Once in motion, it must conform however. BOOL self_in_mouselook = isSelf() && gAgentCamera.cameraMouselook(); - LLVector3 pelvisDir( mRoot.getWorldMatrix().getFwdRow4().mV ); + LLVector3 pelvisDir( mRoot->getWorldMatrix().getFwdRow4().mV ); static LLCachedControl s_pelvis_rot_threshold_slow(gSavedSettings, "AvatarRotateThresholdSlow"); static LLCachedControl s_pelvis_rot_threshold_fast(gSavedSettings, "AvatarRotateThresholdFast"); @@ -3803,14 +3309,14 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) F32 u = llclamp((deltaTime / pelvis_lag_time), 0.0f, 1.0f); - mRoot.setWorldRotation( slerp(u, mRoot.getWorldRotation(), wQv) ); + mRoot->setWorldRotation( slerp(u, mRoot->getWorldRotation(), wQv) ); } } else if (mDrawable.notNull()) { - mRoot.setPosition(mDrawable->getPosition()); - mRoot.setRotation(mDrawable->getRotation()); + mRoot->setPosition(mDrawable->getPosition()); + mRoot->setRotation(mDrawable->getRotation()); } //------------------------------------------------------------------------- @@ -3910,7 +3416,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) } } - mRoot.updateWorldMatrixChildren(); + mRoot->updateWorldMatrixChildren(); if (!mDebugText.size() && mText.notNull()) { @@ -3934,7 +3440,7 @@ void LLVOAvatar::updateHeadOffset() { // since we only care about Z, just grab one of the eyes LLVector3 midEyePt = mEyeLeftp->getWorldPosition(); - midEyePt -= mDrawable.notNull() ? mDrawable->getWorldPosition() : mRoot.getWorldPosition(); + midEyePt -= mDrawable.notNull() ? mDrawable->getWorldPosition() : mRoot->getWorldPosition(); midEyePt.mV[VZ] = llmax(-mPelvisToFoot + LLViewerCamera::getInstance()->getNear(), midEyePt.mV[VZ]); if (mDrawable.notNull()) @@ -3972,8 +3478,8 @@ void LLVOAvatar::setPelvisOffset( bool hasOffset, const LLVector3& offsetAmount, void LLVOAvatar::postPelvisSetRecalc( void ) { computeBodySize(); - mRoot.touch(); - mRoot.updateWorldMatrixChildren(); + mRoot->touch(); + mRoot->updateWorldMatrixChildren(); dirtyMesh(); updateHeadOffset(); } @@ -4207,19 +3713,44 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass) if (mNeedsSkin) { //generate animated mesh - mMeshLOD[MESH_ID_LOWER_BODY]->updateJointGeometry(); - mMeshLOD[MESH_ID_UPPER_BODY]->updateJointGeometry(); + LLViewerJoint* lower_mesh = getViewerJoint(MESH_ID_LOWER_BODY); + LLViewerJoint* upper_mesh = getViewerJoint(MESH_ID_UPPER_BODY); + LLViewerJoint* skirt_mesh = getViewerJoint(MESH_ID_SKIRT); + LLViewerJoint* eyelash_mesh = getViewerJoint(MESH_ID_EYELASH); + LLViewerJoint* head_mesh = getViewerJoint(MESH_ID_HEAD); + LLViewerJoint* hair_mesh = getViewerJoint(MESH_ID_HAIR); + + if(upper_mesh) + { + upper_mesh->updateJointGeometry(); + } + if (lower_mesh) + { + lower_mesh->updateJointGeometry(); + } if( isWearingWearableType( LLWearableType::WT_SKIRT ) ) { - mMeshLOD[MESH_ID_SKIRT]->updateJointGeometry(); + if(skirt_mesh) + { + skirt_mesh->updateJointGeometry(); + } } if (!isSelf() || gAgent.needsRenderHead() || LLPipeline::sShadowRender) { - mMeshLOD[MESH_ID_EYELASH]->updateJointGeometry(); - mMeshLOD[MESH_ID_HEAD]->updateJointGeometry(); - mMeshLOD[MESH_ID_HAIR]->updateJointGeometry(); + if(eyelash_mesh) + { + eyelash_mesh->updateJointGeometry(); + } + if(head_mesh) + { + head_mesh->updateJointGeometry(); + } + if(hair_mesh) + { + hair_mesh->updateJointGeometry(); + } } mNeedsSkin = FALSE; mLastSkinTime = gFrameTimeSeconds; @@ -4336,19 +3867,31 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass) { if (isTextureVisible(TEX_HEAD_BAKED) || mIsDummy) { - num_indices += mMeshLOD[MESH_ID_HEAD]->render(mAdjustedPixelArea, TRUE, mIsDummy); + LLViewerJoint* head_mesh = getViewerJoint(MESH_ID_HEAD); + if (head_mesh) + { + num_indices += head_mesh->render(mAdjustedPixelArea, TRUE, mIsDummy); + } first_pass = FALSE; } } if (isTextureVisible(TEX_UPPER_BAKED) || mIsDummy) { - num_indices += mMeshLOD[MESH_ID_UPPER_BODY]->render(mAdjustedPixelArea, first_pass, mIsDummy); + LLViewerJoint* upper_mesh = getViewerJoint(MESH_ID_UPPER_BODY); + if (upper_mesh) + { + num_indices += upper_mesh->render(mAdjustedPixelArea, first_pass, mIsDummy); + } first_pass = FALSE; } if (isTextureVisible(TEX_LOWER_BAKED) || mIsDummy) { - num_indices += mMeshLOD[MESH_ID_LOWER_BODY]->render(mAdjustedPixelArea, first_pass, mIsDummy); + LLViewerJoint* lower_mesh = getViewerJoint(MESH_ID_LOWER_BODY); + if (lower_mesh) + { + num_indices += lower_mesh->render(mAdjustedPixelArea, first_pass, mIsDummy); + } first_pass = FALSE; } } @@ -4381,7 +3924,11 @@ U32 LLVOAvatar::renderTransparent(BOOL first_pass) if( isWearingWearableType( LLWearableType::WT_SKIRT ) && (mIsDummy || isTextureVisible(TEX_SKIRT_BAKED)) ) { gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.25f); - num_indices += mMeshLOD[MESH_ID_SKIRT]->render(mAdjustedPixelArea, FALSE); + LLViewerJoint* skirt_mesh = getViewerJoint(MESH_ID_SKIRT); + if (skirt_mesh) + { + num_indices += skirt_mesh->render(mAdjustedPixelArea, FALSE); + } first_pass = FALSE; gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); } @@ -4395,14 +3942,22 @@ U32 LLVOAvatar::renderTransparent(BOOL first_pass) if (isTextureVisible(TEX_HEAD_BAKED)) { - num_indices += mMeshLOD[MESH_ID_EYELASH]->render(mAdjustedPixelArea, first_pass, mIsDummy); + LLViewerJoint* eyelash_mesh = getViewerJoint(MESH_ID_EYELASH); + if (eyelash_mesh) + { + num_indices += eyelash_mesh->render(mAdjustedPixelArea, first_pass, mIsDummy); + } first_pass = FALSE; } // Can't test for baked hair being defined, since that won't always be the case (not all viewers send baked hair) // TODO: 1.25 will be able to switch this logic back to calling isTextureVisible(); if (getImage(TEX_HAIR_BAKED, 0)->getID() != IMG_INVISIBLE || LLDrawPoolAlpha::sShowDebugAlpha) { - num_indices += mMeshLOD[MESH_ID_HAIR]->render(mAdjustedPixelArea, first_pass, mIsDummy); + LLViewerJoint* hair_mesh = getViewerJoint(MESH_ID_HAIR); + if (hair_mesh) + { + num_indices += hair_mesh->render(mAdjustedPixelArea, first_pass, mIsDummy); + } first_pass = FALSE; } if (LLPipeline::sImpostorRender) @@ -4446,8 +4001,16 @@ U32 LLVOAvatar::renderRigid() if (isTextureVisible(TEX_EYES_BAKED) || mIsDummy) { - num_indices += mMeshLOD[MESH_ID_EYEBALL_LEFT]->render(mAdjustedPixelArea, TRUE, mIsDummy); - num_indices += mMeshLOD[MESH_ID_EYEBALL_RIGHT]->render(mAdjustedPixelArea, TRUE, mIsDummy); + LLViewerJoint* eyeball_left = getViewerJoint(MESH_ID_EYEBALL_LEFT); + LLViewerJoint* eyeball_right = getViewerJoint(MESH_ID_EYEBALL_RIGHT); + if (eyeball_left) + { + num_indices += eyeball_left->render(mAdjustedPixelArea, TRUE, mIsDummy); + } + if(eyeball_right) + { + num_indices += eyeball_right->render(mAdjustedPixelArea, TRUE, mIsDummy); + } } if (should_alpha_mask && !LLGLSLShader::sNoFixedFunction) @@ -5139,7 +4702,7 @@ LLJoint *LLVOAvatar::getJoint( const std::string &name ) if (iter == mJointMap.end() || iter->second == NULL) { //search for joint and cache found joint in lookup table - jointp = mRoot.findJoint(name); + jointp = mRoot->findJoint(name); mJointMap[name] = jointp; } else @@ -5168,7 +4731,7 @@ void LLVOAvatar::resetJointPositions( void ) //----------------------------------------------------------------------------- void LLVOAvatar::resetSpecificJointPosition( const std::string& name ) { - LLJoint* pJoint = mRoot.findJoint( name ); + LLJoint* pJoint = mRoot->findJoint( name ); if ( pJoint && pJoint->doesJointNeedToBeReset() ) { @@ -5356,23 +4919,6 @@ BOOL LLVOAvatar::allocateCharacterJoints( U32 num ) return TRUE; } -//----------------------------------------------------------------------------- -// allocateCollisionVolumes() -//----------------------------------------------------------------------------- -BOOL LLVOAvatar::allocateCollisionVolumes( U32 num ) -{ - deleteAndClearArray(mCollisionVolumes); - mNumCollisionVolumes = 0; - - mCollisionVolumes = new LLViewerJointCollisionVolume[num]; - if (!mCollisionVolumes) - { - return FALSE; - } - - mNumCollisionVolumes = num; - return TRUE; -} //----------------------------------------------------------------------------- @@ -5397,154 +4943,14 @@ void LLVOAvatar::requestStopMotion( LLMotion* motion ) // Only agent avatars should handle the stop motion notifications. } -//----------------------------------------------------------------------------- -// loadAvatar() -//----------------------------------------------------------------------------- -static LLFastTimer::DeclareTimer FTM_LOAD_AVATAR("Load Avatar"); - -BOOL LLVOAvatar::loadAvatar() -{ -// LLFastTimer t(FTM_LOAD_AVATAR); - - // avatar_skeleton.xml - if( !buildSkeleton(sAvatarSkeletonInfo) ) - { - llwarns << "avatar file: buildSkeleton() failed" << llendl; - return FALSE; - } - - // avatar_lad.xml : - if( !loadSkeletonNode() ) - { - llwarns << "avatar file: loadNodeSkeleton() failed" << llendl; - return FALSE; - } - - // avatar_lad.xml : - if( !loadMeshNodes() ) - { - llwarns << "avatar file: loadNodeMesh() failed" << llendl; - return FALSE; - } - - // avatar_lad.xml : - if( sAvatarXmlInfo->mTexSkinColorInfo ) - { - mTexSkinColor = new LLTexGlobalColor( this ); - if( !mTexSkinColor->setInfo( sAvatarXmlInfo->mTexSkinColorInfo ) ) - { - llwarns << "avatar file: mTexSkinColor->setInfo() failed" << llendl; - return FALSE; - } - } - else - { - llwarns << " name=\"skin_color\" not found" << llendl; - return FALSE; - } - if( sAvatarXmlInfo->mTexHairColorInfo ) - { - mTexHairColor = new LLTexGlobalColor( this ); - if( !mTexHairColor->setInfo( sAvatarXmlInfo->mTexHairColorInfo ) ) - { - llwarns << "avatar file: mTexHairColor->setInfo() failed" << llendl; - return FALSE; - } - } - else - { - llwarns << " name=\"hair_color\" not found" << llendl; - return FALSE; - } - if( sAvatarXmlInfo->mTexEyeColorInfo ) - { - mTexEyeColor = new LLTexGlobalColor( this ); - if( !mTexEyeColor->setInfo( sAvatarXmlInfo->mTexEyeColorInfo ) ) - { - llwarns << "avatar file: mTexEyeColor->setInfo() failed" << llendl; - return FALSE; - } - } - else - { - llwarns << " name=\"eye_color\" not found" << llendl; - return FALSE; - } - - // avatar_lad.xml : - if (sAvatarXmlInfo->mLayerInfoList.empty()) - { - llwarns << "avatar file: missing node" << llendl; - return FALSE; - } - - if (sAvatarXmlInfo->mMorphMaskInfoList.empty()) - { - llwarns << "avatar file: missing node" << llendl; - return FALSE; - } - - // avatar_lad.xml : - for (LLVOAvatarXmlInfo::morph_info_list_t::iterator iter = sAvatarXmlInfo->mMorphMaskInfoList.begin(); - iter != sAvatarXmlInfo->mMorphMaskInfoList.end(); - ++iter) - { - LLVOAvatarXmlInfo::LLVOAvatarMorphInfo *info = *iter; - - EBakedTextureIndex baked = LLAvatarAppearanceDictionary::findBakedByRegionName(info->mRegion); - if (baked != BAKED_NUM_INDICES) - { - LLVisualParam* morph_param; - const std::string *name = &info->mName; - morph_param = getVisualParam(name->c_str()); - if (morph_param) - { - BOOL invert = info->mInvert; - addMaskedMorph(baked, morph_param, invert, info->mLayer); - } - } - - } - - loadLayersets(); - - // avatar_lad.xml : - for (LLVOAvatarXmlInfo::driver_info_list_t::iterator iter = sAvatarXmlInfo->mDriverInfoList.begin(); - iter != sAvatarXmlInfo->mDriverInfoList.end(); - ++iter) - { - LLDriverParamInfo *info = *iter; - LLDriverParam* driver_param = new LLDriverParam( this ); - if (driver_param->setInfo(info)) - { - addVisualParam( driver_param ); - LLVisualParam*(LLVOAvatar::*avatar_function)(S32)const = &LLVOAvatar::getVisualParam; - if( !driver_param->linkDrivenParams(boost::bind(avatar_function,(LLVOAvatar*)this,_1 ), false)) - { - llwarns << "could not link driven params for avatar " << this->getFullname() << " id: " << driver_param->getID() << llendl; - continue; - } - } - else - { - delete driver_param; - llwarns << "avatar file: driver_param->parseData() failed" << llendl; - return FALSE; - } - } - - - return TRUE; -} - //----------------------------------------------------------------------------- // loadSkeletonNode(): loads node from XML tree //----------------------------------------------------------------------------- +//virtual BOOL LLVOAvatar::loadSkeletonNode () { - mRoot.addChild( &mSkeleton[0] ); - - for (std::vector::iterator iter = mMeshLOD.begin(); + // make meshes children before calling parent version of the function + for (std::vector::iterator iter = mMeshLOD.begin(); iter != mMeshLOD.end(); ++iter) { @@ -5553,60 +4959,19 @@ BOOL LLVOAvatar::loadSkeletonNode () joint->setMeshesToChildren(); } - mRoot.addChild(mMeshLOD[MESH_ID_HEAD]); - mRoot.addChild(mMeshLOD[MESH_ID_EYELASH]); - mRoot.addChild(mMeshLOD[MESH_ID_UPPER_BODY]); - mRoot.addChild(mMeshLOD[MESH_ID_LOWER_BODY]); - mRoot.addChild(mMeshLOD[MESH_ID_SKIRT]); - mRoot.addChild(mMeshLOD[MESH_ID_HEAD]); - - LLViewerJoint *skull = (LLViewerJoint*)mRoot.findJoint("mSkull"); - if (skull) - { - skull->addChild(mMeshLOD[MESH_ID_HAIR] ); - } - - LLViewerJoint *eyeL = (LLViewerJoint*)mRoot.findJoint("mEyeLeft"); - if (eyeL) + if (!LLAvatarAppearance::loadSkeletonNode()) { - eyeL->addChild( mMeshLOD[MESH_ID_EYEBALL_LEFT] ); - } - - LLViewerJoint *eyeR = (LLViewerJoint*)mRoot.findJoint("mEyeRight"); - if (eyeR) - { - eyeR->addChild( mMeshLOD[MESH_ID_EYEBALL_RIGHT] ); + return FALSE; } - // SKELETAL DISTORTIONS - { - LLVOAvatarXmlInfo::skeletal_distortion_info_list_t::iterator iter; - for (iter = sAvatarXmlInfo->mSkeletalDistortionInfoList.begin(); - iter != sAvatarXmlInfo->mSkeletalDistortionInfoList.end(); - ++iter) - { - LLPolySkeletalDistortionInfo *info = *iter; - LLPolySkeletalDistortion *param = new LLPolySkeletalDistortion(this); - if (!param->setInfo(info)) - { - delete param; - return FALSE; - } - else - { - addVisualParam(param); - } - } - } - // ATTACHMENTS { - LLVOAvatarXmlInfo::attachment_info_list_t::iterator iter; + LLAvatarXmlInfo::attachment_info_list_t::iterator iter; for (iter = sAvatarXmlInfo->mAttachmentInfoList.begin(); iter != sAvatarXmlInfo->mAttachmentInfoList.end(); ++iter) { - LLVOAvatarXmlInfo::LLVOAvatarAttachmentInfo *info = *iter; + LLAvatarXmlInfo::LLAvatarAttachmentInfo *info = *iter; if (!isSelf() && info->mJointName == "mScreen") { //don't process screen joint for other avatars continue; @@ -5678,144 +5043,6 @@ BOOL LLVOAvatar::loadSkeletonNode () return TRUE; } -//----------------------------------------------------------------------------- -// loadMeshNodes(): loads nodes from XML tree -//----------------------------------------------------------------------------- -BOOL LLVOAvatar::loadMeshNodes() -{ - for (LLVOAvatarXmlInfo::mesh_info_list_t::const_iterator meshinfo_iter = sAvatarXmlInfo->mMeshInfoList.begin(); - meshinfo_iter != sAvatarXmlInfo->mMeshInfoList.end(); - ++meshinfo_iter) - { - const LLVOAvatarXmlInfo::LLVOAvatarMeshInfo *info = *meshinfo_iter; - const std::string &type = info->mType; - S32 lod = info->mLOD; - - LLViewerJointMesh* mesh = NULL; - U8 mesh_id = 0; - BOOL found_mesh_id = FALSE; - - /* if (type == "hairMesh") - switch(lod) - case 0: - mesh = &mHairMesh0; */ - for (LLAvatarAppearanceDictionary::Meshes::const_iterator mesh_iter = LLAvatarAppearanceDictionary::getInstance()->getMeshes().begin(); - mesh_iter != LLAvatarAppearanceDictionary::getInstance()->getMeshes().end(); - ++mesh_iter) - { - const EMeshIndex mesh_index = mesh_iter->first; - const LLAvatarAppearanceDictionary::MeshEntry *mesh_dict = mesh_iter->second; - if (type.compare(mesh_dict->mName) == 0) - { - mesh_id = mesh_index; - found_mesh_id = TRUE; - break; - } - } - - if (found_mesh_id) - { - if (lod < (S32)mMeshLOD[mesh_id]->mMeshParts.size()) - { - mesh = mMeshLOD[mesh_id]->mMeshParts[lod]; - } - else - { - llwarns << "Avatar file: has invalid lod setting " << lod << llendl; - return FALSE; - } - } - else - { - llwarns << "Ignoring unrecognized mesh type: " << type << llendl; - return FALSE; - } - - // llinfos << "Parsing mesh data for " << type << "..." << llendl; - - // If this isn't set to white (1.0), avatars will *ALWAYS* be darker than their surroundings. - // Do not touch!!! - mesh->setColor( 1.0f, 1.0f, 1.0f, 1.0f ); - - LLPolyMesh *poly_mesh = NULL; - - if (!info->mReferenceMeshName.empty()) - { - polymesh_map_t::const_iterator polymesh_iter = mMeshes.find(info->mReferenceMeshName); - if (polymesh_iter != mMeshes.end()) - { - poly_mesh = LLPolyMesh::getMesh(info->mMeshFileName, polymesh_iter->second); - poly_mesh->setAvatar(this); - } - else - { - // This should never happen - LL_WARNS("Avatar") << "Could not find avatar mesh: " << info->mReferenceMeshName << LL_ENDL; - } - } - else - { - poly_mesh = LLPolyMesh::getMesh(info->mMeshFileName); - poly_mesh->setAvatar(this); - } - - if( !poly_mesh ) - { - llwarns << "Failed to load mesh of type " << type << llendl; - return FALSE; - } - - // Multimap insert - mMeshes.insert(std::make_pair(info->mMeshFileName, poly_mesh)); - - mesh->setMesh( poly_mesh ); - mesh->setLOD( info->mMinPixelArea ); - - for (LLVOAvatarXmlInfo::LLVOAvatarMeshInfo::morph_info_list_t::const_iterator xmlinfo_iter = info->mPolyMorphTargetInfoList.begin(); - xmlinfo_iter != info->mPolyMorphTargetInfoList.end(); - ++xmlinfo_iter) - { - const LLVOAvatarXmlInfo::LLVOAvatarMeshInfo::morph_info_pair_t *info_pair = &(*xmlinfo_iter); - LLPolyMorphTarget *param = new LLPolyMorphTarget(mesh->getMesh()); - if (!param->setInfo(info_pair->first)) - { - delete param; - return FALSE; - } - else - { - if (info_pair->second) - { - addSharedVisualParam(param); - } - else - { - addVisualParam(param); - } - } - } - } - - return TRUE; -} - -//----------------------------------------------------------------------------- -// loadLayerSets() -//----------------------------------------------------------------------------- -BOOL LLVOAvatar::loadLayersets() -{ - BOOL success = TRUE; - for (LLVOAvatarXmlInfo::layer_info_list_t::const_iterator layerset_iter = sAvatarXmlInfo->mLayerInfoList.begin(); - layerset_iter != sAvatarXmlInfo->mLayerInfoList.end(); - ++layerset_iter) - { - // Construct a layerset for each one specified in avatar_lad.xml and initialize it as such. - LLTexLayerSetInfo *layerset_info = *layerset_iter; - layerset_info->createVisualParams(this); - } - return success; -} - //----------------------------------------------------------------------------- // updateVisualParams() //----------------------------------------------------------------------------- @@ -5829,7 +5056,7 @@ void LLVOAvatar::updateVisualParams() { computeBodySize(); mLastSkeletonSerialNum = mSkeletonSerialNum; - mRoot.updateWorldMatrixChildren(); + mRoot->updateWorldMatrixChildren(); } dirtyMesh(); @@ -5919,7 +5146,12 @@ BOOL LLVOAvatar::updateJointLODs() } // now select meshes to render based on adjusted pixel area - BOOL res = mRoot.updateLOD(mAdjustedPixelArea, TRUE); + LLViewerJoint* root = dynamic_cast(mRoot); + BOOL res = FALSE; + if (root) + { + res = root->updateLOD(mAdjustedPixelArea, TRUE); + } if (res) { sNumLODChangesThisFrame++; @@ -6009,6 +5241,15 @@ void LLVOAvatar::dirtyMesh(S32 priority) { mDirtyMesh = llmax(mDirtyMesh, priority); } + +//----------------------------------------------------------------------------- +// getViewerJoint() +//----------------------------------------------------------------------------- +LLViewerJoint* LLVOAvatar::getViewerJoint(S32 idx) +{ + return dynamic_cast(mMeshLOD[idx]); +} + //----------------------------------------------------------------------------- // hideSkirt() //----------------------------------------------------------------------------- @@ -6322,9 +5563,9 @@ void LLVOAvatar::sitOnObject(LLViewerObject *sit_object) // Notice that removing sitDown() from here causes avatars sitting on // objects to be not rendered for new arrivals. See EXT-6835 and EXT-1655. sitDown(TRUE); - mRoot.getXform()->setParent(&sit_object->mDrawable->mXform); // LLVOAvatar::sitOnObject - mRoot.setPosition(getPosition()); - mRoot.updateWorldMatrixChildren(); + mRoot->getXform()->setParent(&sit_object->mDrawable->mXform); // LLVOAvatar::sitOnObject + mRoot->setPosition(getPosition()); + mRoot->updateWorldMatrixChildren(); stopMotion(ANIM_AGENT_BODY_NOISE); @@ -6370,10 +5611,10 @@ void LLVOAvatar::getOffObject() sitDown(FALSE); - mRoot.getXform()->setParent(NULL); // LLVOAvatar::getOffObject - mRoot.setPosition(cur_position_world); - mRoot.setRotation(cur_rotation_world); - mRoot.getXform()->update(); + mRoot->getXform()->setParent(NULL); // LLVOAvatar::getOffObject + mRoot->setPosition(cur_position_world); + mRoot->setRotation(cur_rotation_world); + mRoot->getXform()->update(); startMotion(ANIM_AGENT_BODY_NOISE); @@ -7752,501 +6993,20 @@ void LLVOAvatar::startAppearanceAnimation() } } -// virtual -void LLVOAvatar::removeMissingBakedTextures() -{ -} - -//----------------------------------------------------------------------------- -// LLVOAvatarXmlInfo -//----------------------------------------------------------------------------- - -LLVOAvatar::LLVOAvatarXmlInfo::LLVOAvatarXmlInfo() - : mTexSkinColorInfo(0), mTexHairColorInfo(0), mTexEyeColorInfo(0) -{ -} - -LLVOAvatar::LLVOAvatarXmlInfo::~LLVOAvatarXmlInfo() -{ - std::for_each(mMeshInfoList.begin(), mMeshInfoList.end(), DeletePointer()); - std::for_each(mSkeletalDistortionInfoList.begin(), mSkeletalDistortionInfoList.end(), DeletePointer()); - std::for_each(mAttachmentInfoList.begin(), mAttachmentInfoList.end(), DeletePointer()); - deleteAndClear(mTexSkinColorInfo); - deleteAndClear(mTexHairColorInfo); - deleteAndClear(mTexEyeColorInfo); - std::for_each(mLayerInfoList.begin(), mLayerInfoList.end(), DeletePointer()); - std::for_each(mDriverInfoList.begin(), mDriverInfoList.end(), DeletePointer()); - std::for_each(mMorphMaskInfoList.begin(), mMorphMaskInfoList.end(), DeletePointer()); -} - -//----------------------------------------------------------------------------- -// LLVOAvatarBoneInfo::parseXml() -//----------------------------------------------------------------------------- -BOOL LLVOAvatarBoneInfo::parseXml(LLXmlTreeNode* node) -{ - if (node->hasName("bone")) - { - mIsJoint = TRUE; - static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); - if (!node->getFastAttributeString(name_string, mName)) - { - llwarns << "Bone without name" << llendl; - return FALSE; - } - } - else if (node->hasName("collision_volume")) - { - mIsJoint = FALSE; - static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); - if (!node->getFastAttributeString(name_string, mName)) - { - mName = "Collision Volume"; - } - } - else - { - llwarns << "Invalid node " << node->getName() << llendl; - return FALSE; - } - - static LLStdStringHandle pos_string = LLXmlTree::addAttributeString("pos"); - if (!node->getFastAttributeVector3(pos_string, mPos)) - { - llwarns << "Bone without position" << llendl; - return FALSE; - } - - static LLStdStringHandle rot_string = LLXmlTree::addAttributeString("rot"); - if (!node->getFastAttributeVector3(rot_string, mRot)) - { - llwarns << "Bone without rotation" << llendl; - return FALSE; - } - - static LLStdStringHandle scale_string = LLXmlTree::addAttributeString("scale"); - if (!node->getFastAttributeVector3(scale_string, mScale)) - { - llwarns << "Bone without scale" << llendl; - return FALSE; - } - - if (mIsJoint) - { - static LLStdStringHandle pivot_string = LLXmlTree::addAttributeString("pivot"); - if (!node->getFastAttributeVector3(pivot_string, mPivot)) - { - llwarns << "Bone without pivot" << llendl; - return FALSE; - } - } - - // parse children - LLXmlTreeNode* child; - for( child = node->getFirstChild(); child; child = node->getNextChild() ) - { - LLVOAvatarBoneInfo *child_info = new LLVOAvatarBoneInfo; - if (!child_info->parseXml(child)) - { - delete child_info; - return FALSE; - } - mChildList.push_back(child_info); - } - return TRUE; -} - -//----------------------------------------------------------------------------- -// LLVOAvatarSkeletonInfo::parseXml() -//----------------------------------------------------------------------------- -BOOL LLVOAvatarSkeletonInfo::parseXml(LLXmlTreeNode* node) -{ - static LLStdStringHandle num_bones_string = LLXmlTree::addAttributeString("num_bones"); - if (!node->getFastAttributeS32(num_bones_string, mNumBones)) - { - llwarns << "Couldn't find number of bones." << llendl; - return FALSE; - } - - static LLStdStringHandle num_collision_volumes_string = LLXmlTree::addAttributeString("num_collision_volumes"); - node->getFastAttributeS32(num_collision_volumes_string, mNumCollisionVolumes); - - LLXmlTreeNode* child; - for( child = node->getFirstChild(); child; child = node->getNextChild() ) - { - LLVOAvatarBoneInfo *info = new LLVOAvatarBoneInfo; - if (!info->parseXml(child)) - { - delete info; - llwarns << "Error parsing bone in skeleton file" << llendl; - return FALSE; - } - mBoneInfoList.push_back(info); - } - return TRUE; -} - -//----------------------------------------------------------------------------- -// parseXmlSkeletonNode(): parses nodes from XML tree -//----------------------------------------------------------------------------- -BOOL LLVOAvatar::LLVOAvatarXmlInfo::parseXmlSkeletonNode(LLXmlTreeNode* root) -{ - LLXmlTreeNode* node = root->getChildByName( "skeleton" ); - if( !node ) - { - llwarns << "avatar file: missing " << llendl; - return FALSE; - } - - LLXmlTreeNode* child; - - // SKELETON DISTORTIONS - for (child = node->getChildByName( "param" ); - child; - child = node->getNextNamedChild()) - { - if (!child->getChildByName("param_skeleton")) - { - if (child->getChildByName("param_morph")) - { - llwarns << "Can't specify morph param in skeleton definition." << llendl; - } - else - { - llwarns << "Unknown param type." << llendl; - } - continue; - } - - LLPolySkeletalDistortionInfo *info = new LLPolySkeletalDistortionInfo; - if (!info->parseXml(child)) - { - delete info; - return FALSE; - } - - mSkeletalDistortionInfoList.push_back(info); - } - - // ATTACHMENT POINTS - for (child = node->getChildByName( "attachment_point" ); - child; - child = node->getNextNamedChild()) - { - LLVOAvatarAttachmentInfo* info = new LLVOAvatarAttachmentInfo(); - - static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); - if (!child->getFastAttributeString(name_string, info->mName)) - { - llwarns << "No name supplied for attachment point." << llendl; - delete info; - continue; - } - - static LLStdStringHandle joint_string = LLXmlTree::addAttributeString("joint"); - if (!child->getFastAttributeString(joint_string, info->mJointName)) - { - llwarns << "No bone declared in attachment point " << info->mName << llendl; - delete info; - continue; - } - - static LLStdStringHandle position_string = LLXmlTree::addAttributeString("position"); - if (child->getFastAttributeVector3(position_string, info->mPosition)) - { - info->mHasPosition = TRUE; - } - - static LLStdStringHandle rotation_string = LLXmlTree::addAttributeString("rotation"); - if (child->getFastAttributeVector3(rotation_string, info->mRotationEuler)) - { - info->mHasRotation = TRUE; - } - static LLStdStringHandle group_string = LLXmlTree::addAttributeString("group"); - if (child->getFastAttributeS32(group_string, info->mGroup)) - { - if (info->mGroup == -1) - info->mGroup = -1111; // -1 = none parsed, < -1 = bad value - } - - static LLStdStringHandle id_string = LLXmlTree::addAttributeString("id"); - if (!child->getFastAttributeS32(id_string, info->mAttachmentID)) - { - llwarns << "No id supplied for attachment point " << info->mName << llendl; - delete info; - continue; - } - - static LLStdStringHandle slot_string = LLXmlTree::addAttributeString("pie_slice"); - child->getFastAttributeS32(slot_string, info->mPieMenuSlice); - - static LLStdStringHandle visible_in_first_person_string = LLXmlTree::addAttributeString("visible_in_first_person"); - child->getFastAttributeBOOL(visible_in_first_person_string, info->mVisibleFirstPerson); - - static LLStdStringHandle hud_attachment_string = LLXmlTree::addAttributeString("hud"); - child->getFastAttributeBOOL(hud_attachment_string, info->mIsHUDAttachment); - - mAttachmentInfoList.push_back(info); - } - - return TRUE; -} - -//----------------------------------------------------------------------------- -// parseXmlMeshNodes(): parses nodes from XML tree -//----------------------------------------------------------------------------- -BOOL LLVOAvatar::LLVOAvatarXmlInfo::parseXmlMeshNodes(LLXmlTreeNode* root) -{ - for (LLXmlTreeNode* node = root->getChildByName( "mesh" ); - node; - node = root->getNextNamedChild()) - { - LLVOAvatarMeshInfo *info = new LLVOAvatarMeshInfo; - - // attribute: type - static LLStdStringHandle type_string = LLXmlTree::addAttributeString("type"); - if( !node->getFastAttributeString( type_string, info->mType ) ) - { - llwarns << "Avatar file: is missing type attribute. Ignoring element. " << llendl; - delete info; - return FALSE; // Ignore this element - } - - static LLStdStringHandle lod_string = LLXmlTree::addAttributeString("lod"); - if (!node->getFastAttributeS32( lod_string, info->mLOD )) - { - llwarns << "Avatar file: is missing lod attribute. Ignoring element. " << llendl; - delete info; - return FALSE; // Ignore this element - } - - static LLStdStringHandle file_name_string = LLXmlTree::addAttributeString("file_name"); - if( !node->getFastAttributeString( file_name_string, info->mMeshFileName ) ) - { - llwarns << "Avatar file: is missing file_name attribute. Ignoring: " << info->mType << llendl; - delete info; - return FALSE; // Ignore this element - } - - static LLStdStringHandle reference_string = LLXmlTree::addAttributeString("reference"); - node->getFastAttributeString( reference_string, info->mReferenceMeshName ); - - // attribute: min_pixel_area - static LLStdStringHandle min_pixel_area_string = LLXmlTree::addAttributeString("min_pixel_area"); - static LLStdStringHandle min_pixel_width_string = LLXmlTree::addAttributeString("min_pixel_width"); - if (!node->getFastAttributeF32( min_pixel_area_string, info->mMinPixelArea )) - { - F32 min_pixel_area = 0.1f; - if (node->getFastAttributeF32( min_pixel_width_string, min_pixel_area )) - { - // this is square root of pixel area (sensible to use linear space in defining lods) - min_pixel_area = min_pixel_area * min_pixel_area; - } - info->mMinPixelArea = min_pixel_area; - } - - // Parse visual params for this node only if we haven't already - for (LLXmlTreeNode* child = node->getChildByName( "param" ); - child; - child = node->getNextNamedChild()) - { - if (!child->getChildByName("param_morph")) - { - if (child->getChildByName("param_skeleton")) - { - llwarns << "Can't specify skeleton param in a mesh definition." << llendl; - } - else - { - llwarns << "Unknown param type." << llendl; - } - continue; - } - - LLPolyMorphTargetInfo *morphinfo = new LLPolyMorphTargetInfo(); - if (!morphinfo->parseXml(child)) - { - delete morphinfo; - delete info; - return -1; - } - BOOL shared = FALSE; - static LLStdStringHandle shared_string = LLXmlTree::addAttributeString("shared"); - child->getFastAttributeBOOL(shared_string, shared); - - info->mPolyMorphTargetInfoList.push_back(LLVOAvatarMeshInfo::morph_info_pair_t(morphinfo, shared)); - } - - mMeshInfoList.push_back(info); - } - return TRUE; -} - -//----------------------------------------------------------------------------- -// parseXmlColorNodes(): parses nodes from XML tree -//----------------------------------------------------------------------------- -BOOL LLVOAvatar::LLVOAvatarXmlInfo::parseXmlColorNodes(LLXmlTreeNode* root) -{ - for (LLXmlTreeNode* color_node = root->getChildByName( "global_color" ); - color_node; - color_node = root->getNextNamedChild()) - { - std::string global_color_name; - static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); - if (color_node->getFastAttributeString( name_string, global_color_name ) ) - { - if( global_color_name == "skin_color" ) - { - if (mTexSkinColorInfo) - { - llwarns << "avatar file: multiple instances of skin_color" << llendl; - return FALSE; - } - mTexSkinColorInfo = new LLTexGlobalColorInfo; - if( !mTexSkinColorInfo->parseXml( color_node ) ) - { - deleteAndClear(mTexSkinColorInfo); - llwarns << "avatar file: mTexSkinColor->parseXml() failed" << llendl; - return FALSE; - } - } - else if( global_color_name == "hair_color" ) - { - if (mTexHairColorInfo) - { - llwarns << "avatar file: multiple instances of hair_color" << llendl; - return FALSE; - } - mTexHairColorInfo = new LLTexGlobalColorInfo; - if( !mTexHairColorInfo->parseXml( color_node ) ) - { - deleteAndClear(mTexHairColorInfo); - llwarns << "avatar file: mTexHairColor->parseXml() failed" << llendl; - return FALSE; - } - } - else if( global_color_name == "eye_color" ) - { - if (mTexEyeColorInfo) - { - llwarns << "avatar file: multiple instances of eye_color" << llendl; - return FALSE; - } - mTexEyeColorInfo = new LLTexGlobalColorInfo; - if( !mTexEyeColorInfo->parseXml( color_node ) ) - { - llwarns << "avatar file: mTexEyeColor->parseXml() failed" << llendl; - return FALSE; - } - } - } - } - return TRUE; -} - -//----------------------------------------------------------------------------- -// parseXmlLayerNodes(): parses nodes from XML tree -//----------------------------------------------------------------------------- -BOOL LLVOAvatar::LLVOAvatarXmlInfo::parseXmlLayerNodes(LLXmlTreeNode* root) +//virtual +void LLVOAvatar::bodySizeChanged() { - for (LLXmlTreeNode* layer_node = root->getChildByName( "layer_set" ); - layer_node; - layer_node = root->getNextNamedChild()) - { - LLTexLayerSetInfo* layer_info = new LLTexLayerSetInfo(); - if( layer_info->parseXml( layer_node ) ) - { - mLayerInfoList.push_back(layer_info); - } - else - { - delete layer_info; - llwarns << "avatar file: layer_set->parseXml() failed" << llendl; - return FALSE; - } + if (isSelf() && !LLAppearanceMgr::instance().isInUpdateAppearanceFromCOF()) + { // notify simulator of change in size + // but not if we are in the middle of updating appearance + gAgent.sendAgentSetAppearance(); } - return TRUE; } -//----------------------------------------------------------------------------- -// parseXmlDriverNodes(): parses nodes from XML tree -//----------------------------------------------------------------------------- -BOOL LLVOAvatar::LLVOAvatarXmlInfo::parseXmlDriverNodes(LLXmlTreeNode* root) -{ - LLXmlTreeNode* driver = root->getChildByName( "driver_parameters" ); - if( driver ) - { - for (LLXmlTreeNode* grand_child = driver->getChildByName( "param" ); - grand_child; - grand_child = driver->getNextNamedChild()) - { - if( grand_child->getChildByName( "param_driver" ) ) - { - LLDriverParamInfo* driver_info = new LLDriverParamInfo(); - if( driver_info->parseXml( grand_child ) ) - { - mDriverInfoList.push_back(driver_info); - } - else - { - delete driver_info; - llwarns << "avatar file: driver_param->parseXml() failed" << llendl; - return FALSE; - } - } - } - } - return TRUE; -} -//----------------------------------------------------------------------------- -// parseXmlDriverNodes(): parses nodes from XML tree -//----------------------------------------------------------------------------- -BOOL LLVOAvatar::LLVOAvatarXmlInfo::parseXmlMorphNodes(LLXmlTreeNode* root) -{ - LLXmlTreeNode* masks = root->getChildByName( "morph_masks" ); - if( !masks ) - { - return FALSE; - } - - for (LLXmlTreeNode* grand_child = masks->getChildByName( "mask" ); - grand_child; - grand_child = masks->getNextNamedChild()) - { - LLVOAvatarMorphInfo* info = new LLVOAvatarMorphInfo(); - - static LLStdStringHandle name_string = LLXmlTree::addAttributeString("morph_name"); - if (!grand_child->getFastAttributeString(name_string, info->mName)) - { - llwarns << "No name supplied for morph mask." << llendl; - delete info; - continue; - } - - static LLStdStringHandle region_string = LLXmlTree::addAttributeString("body_region"); - if (!grand_child->getFastAttributeString(region_string, info->mRegion)) - { - llwarns << "No region supplied for morph mask." << llendl; - delete info; - continue; - } - - static LLStdStringHandle layer_string = LLXmlTree::addAttributeString("layer"); - if (!grand_child->getFastAttributeString(layer_string, info->mLayer)) - { - llwarns << "No layer supplied for morph mask." << llendl; - delete info; - continue; - } - - // optional parameter. don't throw a warning if not present. - static LLStdStringHandle invert_string = LLXmlTree::addAttributeString("invert"); - grand_child->getFastAttributeBOOL(invert_string, info->mInvert); - - mMorphMaskInfoList.push_back(info); - } - - return TRUE; +// virtual +void LLVOAvatar::removeMissingBakedTextures() +{ } //virtual -- cgit v1.2.3 From e1580128ab2a42ecd4019ef35069f9e939dc4ff2 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Sun, 9 Sep 2012 12:12:19 +0000 Subject: Fixed crashes on login. Moved most of the remaining character/skeleton generation code into llappearance. Moved non-rendering related LLViewerJoint functionality into LLAvatarJoint. --- indra/newview/llvoavatar.cpp | 246 +++++++++++++------------------------------ 1 file changed, 76 insertions(+), 170 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index f0f469e959..081f1d62ca 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -24,12 +24,6 @@ * $/LicenseInfo$ */ -#if LL_MSVC -// disable warning about boost::lexical_cast returning uninitialized data -// when it fails to parse the string -#pragma warning (disable:4701) -#endif - #include "llviewerprecompiledheaders.h" #include "llvoavatar.h" @@ -109,12 +103,6 @@ extern F32 SPEED_ADJUST_MAX_SEC; extern F32 ANIM_SPEED_MAX; extern F32 ANIM_SPEED_MIN; -#if LL_MSVC -// disable boost::lexical_cast warning -#pragma warning (disable:4702) -#endif - -#include // #define OUTPUT_BREAST_DATA @@ -783,7 +771,7 @@ BOOL LLVOAvatar::isFullyTextured() const { for (S32 i = 0; i < mMeshLOD.size(); i++) { - LLViewerJoint* joint = (LLViewerJoint*) mMeshLOD[i]; + LLAvatarJoint* joint = mMeshLOD[i]; if (i==MESH_ID_SKIRT && !isWearingWearableType(LLWearableType::WT_SKIRT)) { continue; // don't care about skirt textures if we're not wearing one. @@ -792,19 +780,19 @@ BOOL LLVOAvatar::isFullyTextured() const { continue; // nonexistent LOD OK. } - std::vector::iterator meshIter = joint->mMeshParts.begin(); + avatar_joint_mesh_list_t::iterator meshIter = joint->mMeshParts.begin(); if (meshIter != joint->mMeshParts.end()) { - LLViewerJointMesh *mesh = (LLViewerJointMesh *) *meshIter; + LLAvatarJointMesh *mesh = (*meshIter); if (!mesh) { continue; // nonexistent mesh OK } - if (mesh->mTexture.notNull() && mesh->mTexture->hasGLTexture()) + if (mesh->hasGLTexture()) { continue; // Mesh exists and has a baked texture. } - if (mesh->mLayerSet && mesh->mLayerSet->hasComposite()) + if (mesh->hasComposite()) { continue; // Mesh exists and has a composite texture. } @@ -1056,84 +1044,9 @@ void LLVOAvatar::cleanupClass() sXMLTree.cleanup(); } +// virtual void LLVOAvatar::initInstance(void) { - //------------------------------------------------------------------------- - // initialize joint, mesh and shape members - //------------------------------------------------------------------------- - if (mRoot) - { - delete mRoot; - } - mRoot = new LLViewerJoint(); - mRoot->setName( "mRoot" ); - - for (LLAvatarAppearanceDictionary::Meshes::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getMeshes().begin(); - iter != LLAvatarAppearanceDictionary::getInstance()->getMeshes().end(); - ++iter) - { - const EMeshIndex mesh_index = iter->first; - const LLAvatarAppearanceDictionary::MeshEntry *mesh_dict = iter->second; - LLViewerJoint* joint = new LLViewerJoint(); - joint->setName(mesh_dict->mName); - joint->setMeshID(mesh_index); - mMeshLOD.push_back(joint); - - /* mHairLOD.setName("mHairLOD"); - mHairMesh0.setName("mHairMesh0"); - mHairMesh0.setMeshID(MESH_ID_HAIR); - mHairMesh1.setName("mHairMesh1"); */ - for (U32 lod = 0; lod < mesh_dict->mLOD; lod++) - { - LLViewerJointMesh* mesh = new LLViewerJointMesh(); - std::string mesh_name = "m" + mesh_dict->mName + boost::lexical_cast(lod); - // We pre-pended an m - need to capitalize first character for camelCase - mesh_name[1] = toupper(mesh_name[1]); - mesh->setName(mesh_name); - mesh->setMeshID(mesh_index); - mesh->setPickName(mesh_dict->mPickName); - mesh->setIsTransparent(FALSE); - switch((int)mesh_index) - { - case MESH_ID_HAIR: - mesh->setIsTransparent(TRUE); - break; - case MESH_ID_SKIRT: - mesh->setIsTransparent(TRUE); - break; - case MESH_ID_EYEBALL_LEFT: - case MESH_ID_EYEBALL_RIGHT: - mesh->setSpecular( LLColor4( 1.0f, 1.0f, 1.0f, 1.0f ), 1.f ); - break; - } - - joint->mMeshParts.push_back(mesh); - } - } - - //------------------------------------------------------------------------- - // associate baked textures with meshes - //------------------------------------------------------------------------- - for (LLAvatarAppearanceDictionary::Meshes::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getMeshes().begin(); - iter != LLAvatarAppearanceDictionary::getInstance()->getMeshes().end(); - ++iter) - { - const EMeshIndex mesh_index = iter->first; - const LLAvatarAppearanceDictionary::MeshEntry *mesh_dict = iter->second; - const EBakedTextureIndex baked_texture_index = mesh_dict->mBakedID; - // Skip it if there's no associated baked texture. - if (baked_texture_index == BAKED_NUM_INDICES) continue; - - for (std::vector::iterator iter = mMeshLOD[mesh_index]->mMeshParts.begin(); - iter != mMeshLOD[mesh_index]->mMeshParts.end(); - ++iter) - { - LLViewerJointMesh* mesh = (LLViewerJointMesh*) *iter; - mBakedTextureDatas[(int)baked_texture_index].mMeshes.push_back(mesh); - } - } - - //------------------------------------------------------------------------- // register motions //------------------------------------------------------------------------- @@ -1192,10 +1105,9 @@ void LLVOAvatar::initInstance(void) registerMotion( ANIM_AGENT_SIT_FEMALE, LLKeyframeMotion::create ); registerMotion( ANIM_AGENT_TARGET, LLTargetingMotion::create ); registerMotion( ANIM_AGENT_WALK_ADJUST, LLWalkAdjustMotion::create ); - } - - buildCharacter(); + + LLAvatarAppearance::initInstance(); // preload specific motions here createMotion( ANIM_AGENT_CUSTOMIZE); @@ -1204,7 +1116,30 @@ void LLVOAvatar::initInstance(void) //VTPause(); // VTune mVoiceVisualizer->setVoiceEnabled( LLVoiceClient::getInstance()->getVoiceEnabled( mID ) ); +} + +// virtual +LLAvatarJoint* LLVOAvatar::createAvatarJoint() +{ + return new LLViewerJoint(); +} +// virtual +LLAvatarJoint* LLVOAvatar::createAvatarJoint(S32 joint_num) +{ + return new LLViewerJoint(joint_num); +} + +// virtual +LLAvatarJointMesh* LLVOAvatar::createAvatarJointMesh() +{ + return new LLViewerJointMesh(); +} + +// virtual +LLTexLayerSet* LLVOAvatar::createTexLayerSet() +{ + return new LLViewerTexLayerSet(this); } const LLVector3 LLVOAvatar::getRenderPosition() const @@ -1279,7 +1214,7 @@ void LLVOAvatar::getSpatialExtents(LLVector4a& newMin, LLVector4a& newMax) float max_attachment_span = get_default_max_prim_scale() * 5.0f; //stretch bounding box by joint positions - for (polymesh_map_t::iterator i = mMeshes.begin(); i != mMeshes.end(); ++i) + for (polymesh_map_t::iterator i = mPolyMeshes.begin(); i != mPolyMeshes.end(); ++i) { LLPolyMesh* mesh = i->second; for (S32 joint_num = 0; joint_num < mesh->mJointRenderData.count(); joint_num++) @@ -1551,23 +1486,11 @@ void LLVOAvatar::startDefaultMotions() // virtual void LLVOAvatar::buildCharacter() { - //------------------------------------------------------------------------- - // clear mesh data - //------------------------------------------------------------------------- - for (std::vector::iterator jointIter = mMeshLOD.begin(); - jointIter != mMeshLOD.end(); ++jointIter) - { - LLViewerJoint* joint = (LLViewerJoint*) *jointIter; - for (std::vector::iterator meshIter = joint->mMeshParts.begin(); - meshIter != joint->mMeshParts.end(); ++meshIter) - { - LLViewerJointMesh * mesh = (LLViewerJointMesh *) *meshIter; - mesh->setMesh(NULL); - } - } - LLAvatarAppearance::buildCharacter(); + // Not done building yet; more to do. + mIsBuilt = FALSE; + //------------------------------------------------------------------------- // set head offset from pelvis //------------------------------------------------------------------------- @@ -1600,6 +1523,9 @@ void LLVOAvatar::buildCharacter() //------------------------------------------------------------------------- processAnimationStateChanges(); + mIsBuilt = TRUE; + stop_glerror(); + mMeshValid = TRUE; } @@ -1619,11 +1545,11 @@ void LLVOAvatar::releaseMeshData() //llinfos << "Releasing" << llendl; // cleanup mesh data - for (std::vector::iterator iter = mMeshLOD.begin(); + for (avatar_joint_list_t::iterator iter = mMeshLOD.begin(); iter != mMeshLOD.end(); ++iter) { - LLViewerJoint* joint = (LLViewerJoint*) *iter; + LLAvatarJoint* joint = (*iter); joint->setValid(FALSE, TRUE); } @@ -4718,10 +4644,12 @@ LLJoint *LLVOAvatar::getJoint( const std::string &name ) //----------------------------------------------------------------------------- void LLVOAvatar::resetJointPositions( void ) { - for(S32 i = 0; i < (S32)mNumJoints; ++i) + avatar_joint_list_t::iterator iter = mSkeleton.begin(); + avatar_joint_list_t::iterator end = mSkeleton.end(); + for (; iter != end; ++iter) { - mSkeleton[i].restoreOldXform(); - mSkeleton[i].setId( LLUUID::null ); + (*iter)->restoreOldXform(); + (*iter)->setId( LLUUID::null ); } mHasPelvisOffset = false; mPelvisFixup = mLastPelvisFixup; @@ -4753,16 +4681,17 @@ void LLVOAvatar::resetSpecificJointPosition( const std::string& name ) //----------------------------------------------------------------------------- void LLVOAvatar::resetJointPositionsToDefault( void ) { - //Subsequent joints are relative to pelvis - for( S32 i = 0; i < (S32)mNumJoints; ++i ) + avatar_joint_list_t::iterator iter = mSkeleton.begin(); + avatar_joint_list_t::iterator end = mSkeleton.end(); + for (; iter != end; ++iter) { - LLJoint* pJoint = (LLJoint*)&mSkeleton[i]; + LLJoint* pJoint = (*iter); if ( pJoint->doesJointNeedToBeReset() ) { - pJoint->setId( LLUUID::null ); //restore joints to default positions, however skip over the pelvis + // *TODO: How does this pointer check skip over pelvis? if ( pJoint ) { pJoint->restoreOldXform(); @@ -4895,43 +4824,18 @@ LLVector3 LLVOAvatar::getPosAgentFromGlobal(const LLVector3d &position) return gAgent.getPosAgentFromGlobal(position); } -//----------------------------------------------------------------------------- -// allocateCharacterJoints() -//----------------------------------------------------------------------------- -BOOL LLVOAvatar::allocateCharacterJoints( U32 num ) -{ - deleteAndClearArray(mSkeleton); - mNumJoints = 0; - - mSkeleton = new LLViewerJoint[num]; - - for(S32 joint_num = 0; joint_num < (S32)num; joint_num++) - { - mSkeleton[joint_num].setJointNum(joint_num); - } - - if (!mSkeleton) - { - return FALSE; - } - - mNumJoints = num; - return TRUE; -} - - //----------------------------------------------------------------------------- // getCharacterJoint() //----------------------------------------------------------------------------- LLJoint *LLVOAvatar::getCharacterJoint( U32 num ) { - if ((S32)num >= mNumJoints + if ((S32)num >= mSkeleton.size() || (S32)num < 0) { return NULL; } - return (LLJoint*)&mSkeleton[num]; + return mSkeleton[num]; } //----------------------------------------------------------------------------- @@ -4949,16 +4853,6 @@ void LLVOAvatar::requestStopMotion( LLMotion* motion ) //virtual BOOL LLVOAvatar::loadSkeletonNode () { - // make meshes children before calling parent version of the function - for (std::vector::iterator iter = mMeshLOD.begin(); - iter != mMeshLOD.end(); - ++iter) - { - LLViewerJoint *joint = (LLViewerJoint *) *iter; - joint->mUpdateXform = FALSE; - joint->setMeshesToChildren(); - } - if (!LLAvatarAppearance::loadSkeletonNode()) { return FALSE; @@ -5695,9 +5589,11 @@ void LLVOAvatar::onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL if (!isTextureDefined(mBakedTextureDatas[BAKED_HAIR].mTextureIndex)) { LLColor4 color = mTexHairColor->getColor(); - for (U32 i = 0; i < mBakedTextureDatas[BAKED_HAIR].mMeshes.size(); i++) + avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[BAKED_HAIR].mJointMeshes.begin(); + avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[BAKED_HAIR].mJointMeshes.end(); + for (; iter != end; ++iter) { - LLViewerJointMesh* mesh = dynamic_cast(mBakedTextureDatas[BAKED_HAIR].mMeshes[i]); + LLAvatarJointMesh* mesh = (*iter); if (mesh) { mesh->setColor( color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW] ); @@ -5962,9 +5858,11 @@ void LLVOAvatar::updateMeshTextures() } mBakedTextureDatas[i].mIsUsed = TRUE; - for (U32 k=0; k < mBakedTextureDatas[i].mMeshes.size(); k++) + avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin(); + avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end(); + for (; iter != end; ++iter) { - LLViewerJointMesh* mesh = dynamic_cast(mBakedTextureDatas[i].mMeshes[k]); + LLAvatarJointMesh* mesh = (*iter); if (mesh) { mesh->setTexture( baked_img ); @@ -5996,9 +5894,11 @@ void LLVOAvatar::updateMeshTextures() layerset->createComposite(); layerset->setUpdatesEnabled( TRUE ); mBakedTextureDatas[i].mIsUsed = FALSE; - for (U32 k=0; k < mBakedTextureDatas[i].mMeshes.size(); k++) + avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin(); + avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end(); + for (; iter != end; ++iter) { - LLViewerJointMesh* mesh = dynamic_cast(mBakedTextureDatas[i].mMeshes[k]); + LLAvatarJointMesh* mesh = (*iter); if (mesh) { mesh->setLayerSet( layerset ); @@ -6014,9 +5914,11 @@ void LLVOAvatar::updateMeshTextures() { const LLColor4 color = mTexHairColor ? mTexHairColor->getColor() : LLColor4(1,1,1,1); LLViewerTexture* hair_img = getImage( TEX_HAIR, 0 ); - for (U32 i = 0; i < mBakedTextureDatas[BAKED_HAIR].mMeshes.size(); i++) + avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[BAKED_HAIR].mJointMeshes.begin(); + avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[BAKED_HAIR].mJointMeshes.end(); + for (; iter != end; ++iter) { - LLViewerJointMesh* mesh = dynamic_cast(mBakedTextureDatas[BAKED_HAIR].mMeshes[i]); + LLAvatarJointMesh* mesh = (*iter); if (mesh) { mesh->setColor( color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW] ); @@ -6778,9 +6680,11 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) mBakedTextureDatas[i].mIsLoaded = true; mBakedTextureDatas[i].mLastTextureIndex = id; mBakedTextureDatas[i].mIsUsed = true; - for (U32 k = 0; k < mBakedTextureDatas[i].mMeshes.size(); k++) + avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin(); + avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end(); + for (; iter != end; ++iter) { - LLViewerJointMesh* mesh = dynamic_cast(mBakedTextureDatas[i].mMeshes[k]); + LLAvatarJointMesh* mesh = (*iter); if (mesh) { mesh->setTexture( image_baked ); @@ -6803,9 +6707,11 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) // This is paired with similar code in updateMeshTextures that sets hair mesh color. if (i == BAKED_HAIR) { - for (U32 i = 0; i < mBakedTextureDatas[BAKED_HAIR].mMeshes.size(); i++) + avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin(); + avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end(); + for (; iter != end; ++iter) { - LLViewerJointMesh* mesh = dynamic_cast(mBakedTextureDatas[BAKED_HAIR].mMeshes[i]); + LLAvatarJointMesh* mesh = (*iter); if (mesh) { mesh->setColor( 1.f, 1.f, 1.f, 1.f ); -- cgit v1.2.3 From 6504894be60134a66c938ffba64b57ea198c7264 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 10 Sep 2012 11:17:27 -0400 Subject: more baked texture debugging under DebugAvatarCompositeBaked --- indra/newview/llvoavatar.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index d92caf1edb..3b98a55360 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6804,6 +6804,16 @@ void LLVOAvatar::updateMeshTextures() } } } + else + { + for (U32 k=0; k < mBakedTextureDatas[i].mMeshes.size(); k++) + { + if (gSavedSettings.getBOOL("DebugAvatarCompositeBaked")) + { + mBakedTextureDatas[i].mMeshes[k]->setColor( LLColor4::blue ); + } + } + } } // set texture and color of hair manually if we are not using a baked image. -- cgit v1.2.3 From fc84d684500c2216aa270bffef865ee265927535 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 10 Sep 2012 18:46:52 -0400 Subject: dumpArchetypeXML tweaks, appearance debugging --- indra/newview/llvoavatar.cpp | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index e03c0c3dad..61816c1771 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -7337,6 +7337,7 @@ bool LLVOAvatar::visualParamWeightsAreDefault() //----------------------------------------------------------------------------- void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) { + dumpArchetypeXML("process_start"); if (gSavedSettings.getBOOL("BlockAvatarAppearanceMessages")) { llwarns << "Blocking AvatarAppearance message" << llendl; @@ -7773,32 +7774,30 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) dirtyMesh(); } -void LLVOAvatar::dumpArchetypeXML(const std::string& filename ) +void LLVOAvatar::dumpArchetypeXML(const std::string& prefix ) { - std::string outfilename(filename); - if (outfilename.empty()) + std::string outprefix(prefix); + if (outprefix.empty()) { - std::string fullname = getFullname(); - if (!fullname.empty()) - { - typedef std::map file_num_type; - static file_num_type file_nums; - file_num_type::iterator it = file_nums.find(fullname); - S32 num = 0; - if (it != file_nums.end()) - { - num = it->second; - } - std::ostringstream temp; - temp << std::setw(4) << std::setfill('0') << num; - file_nums[fullname] = num+1; - outfilename = fullname + " " + temp.str() + ".xml"; - } + outprefix = getFullname(); + } + if (outprefix.empty()) + { + outprefix = std::string("new_archetype"); } - if (outfilename.empty()) + typedef std::map file_num_type; + static file_num_type file_nums; + file_num_type::iterator it = file_nums.find(outprefix); + S32 num = 0; + if (it != file_nums.end()) { - outfilename = std::string("new archetype.xml"); + num = it->second; } + std::ostringstream temp; + temp << std::setw(4) << std::setfill('0') << num; + file_nums[outprefix] = num+1; + std::string outfilename = outprefix + " " + temp.str() + ".xml"; + std::replace(outfilename.begin(),outfilename.end(),' ','_'); LLAPRFile outfile; outfile.open(gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,outfilename), LL_APR_WB ); -- 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/llvoavatar.cpp | 47 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 081f1d62ca..7772ae25a1 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5560,6 +5560,53 @@ S32 LLVOAvatar::getAttachmentCount() return count; } +BOOL LLVOAvatar::isWearingWearableType(LLWearableType::EType type) const +{ + if (mIsDummy) return TRUE; + + if (isSelf()) + { + return LLAvatarAppearance::isWearingWearableType(type); + } + + switch(type) + { + case LLWearableType::WT_SHAPE: + case LLWearableType::WT_SKIN: + case LLWearableType::WT_HAIR: + case LLWearableType::WT_EYES: + return TRUE; // everyone has all bodyparts + default: + break; // Do nothing + } + + /* switch(type) + case LLWearableType::WT_SHIRT: + indicator_te = TEX_UPPER_SHIRT; */ + for (LLAvatarAppearanceDictionary::Textures::const_iterator tex_iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin(); + tex_iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end(); + ++tex_iter) + { + const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = tex_iter->second; + if (texture_dict->mWearableType == type) + { + // If you're checking another avatar's clothing, you don't have component textures. + // Thus, you must check to see if the corresponding baked texture is defined. + // NOTE: this is a poor substitute if you actually want to know about individual pieces of clothing + // this works for detecting a skirt (most important), but is ineffective at any piece of clothing that + // gets baked into a texture that always exists (upper or lower). + if (texture_dict->mIsUsedByBakedTexture) + { + const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex; + return isTextureDefined(LLAvatarAppearanceDictionary::getInstance()->getBakedTexture(baked_index)->mTextureIndex); + } + return FALSE; + } + } + return FALSE; +} + + // virtual void LLVOAvatar::invalidateComposite( LLTexLayerSet* layerset, BOOL upload_result ) -- cgit v1.2.3 From b4866775a2acc98ebcb3986d7779eea479028ff9 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 11 Sep 2012 20:57:04 -0400 Subject: Dump XML tweaks, suppress wearable updates when bakes should dominate --- indra/newview/llvoavatar.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 61816c1771..96e59dd9eb 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -7361,7 +7361,9 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) // llinfos << "processAvatarAppearance end " << mID << llendl; return; } + clearVisualParamWeights(); } + dumpArchetypeXML("process_post_clear"); ESex old_sex = getSex(); @@ -7481,6 +7483,8 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) } } + dumpArchetypeXML("process_post_set_weights"); + const S32 expected_tweakable_count = getVisualParamCountInGroup(VISUAL_PARAM_GROUP_TWEAKABLE); // don't worry about VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT if (num_blocks != expected_tweakable_count) { @@ -7545,6 +7549,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) updateMeshTextures(); + dumpArchetypeXML("process_end"); // llinfos << "processAvatarAppearance end " << mID << llendl; } -- cgit v1.2.3 From c34329fa4c8cc5adbad15d8e8f00296c71016a02 Mon Sep 17 00:00:00 2001 From: Nyx Linden Date: Wed, 12 Sep 2012 21:35:25 +0000 Subject: SH-3347 create demo of back end texture baking service First link of the back-end service with some LLAppearance code. --- indra/newview/llvoavatar.cpp | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 7772ae25a1..8ac39fe5ef 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -7333,17 +7333,5 @@ BOOL LLVOAvatar::isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, return FALSE; } -//virtual -LLAvatarAppearance::LLMaskedMorph::LLMaskedMorph(LLVisualParam *morph_target, BOOL invert, std::string layer) : - mMorphTarget(morph_target), - mInvert(invert), - mLayer(layer) -{ - LLPolyMorphTarget *target = dynamic_cast(morph_target); - if (target) - { - target->addPendingMorphMask(); - } -} -- cgit v1.2.3 From 929b7e029513ecbb08c415e945c83ea09dc1b3eb Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Thu, 13 Sep 2012 03:30:17 +0000 Subject: Instantiated bare-bones LLBakingAvatar concrete class (derived from LLAvatarAppearance). Moved some LLCharacter funcionality from LLVOAvatar to LLAvatarAppearance. --- indra/newview/llvoavatar.cpp | 72 -------------------------------------------- 1 file changed, 72 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 8ac39fe5ef..fa1f9c95ab 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4557,48 +4557,6 @@ void LLVOAvatar::stopMotionFromSource(const LLUUID& source_id) { } -//----------------------------------------------------------------------------- -// getVolumePos() -//----------------------------------------------------------------------------- -LLVector3 LLVOAvatar::getVolumePos(S32 joint_index, LLVector3& volume_offset) -{ - if (joint_index > mNumCollisionVolumes) - { - return LLVector3::zero; - } - - return mCollisionVolumes[joint_index].getVolumePos(volume_offset); -} - -//----------------------------------------------------------------------------- -// findCollisionVolume() -//----------------------------------------------------------------------------- -LLJoint* LLVOAvatar::findCollisionVolume(U32 volume_id) -{ - if ((S32)volume_id > mNumCollisionVolumes) - { - return NULL; - } - - return &mCollisionVolumes[volume_id]; -} - -//----------------------------------------------------------------------------- -// findCollisionVolume() -//----------------------------------------------------------------------------- -S32 LLVOAvatar::getCollisionVolumeID(std::string &name) -{ - for (S32 i = 0; i < mNumCollisionVolumes; i++) - { - if (mCollisionVolumes[i].getName() == name) - { - return i; - } - } - - return -1; -} - //----------------------------------------------------------------------------- // addDebugText() //----------------------------------------------------------------------------- @@ -4790,23 +4748,6 @@ F32 LLVOAvatar::getPixelArea() const } -//----------------------------------------------------------------------------- -// LLVOAvatar::getHeadMesh() -//----------------------------------------------------------------------------- -LLPolyMesh* LLVOAvatar::getHeadMesh() -{ - return mMeshLOD[MESH_ID_HEAD]->mMeshParts[0]->getMesh(); -} - - -//----------------------------------------------------------------------------- -// LLVOAvatar::getUpperBodyMesh() -//----------------------------------------------------------------------------- -LLPolyMesh* LLVOAvatar::getUpperBodyMesh() -{ - return mMeshLOD[MESH_ID_UPPER_BODY]->mMeshParts[0]->getMesh(); -} - //----------------------------------------------------------------------------- // LLVOAvatar::getPosGlobalFromAgent() @@ -4825,19 +4766,6 @@ LLVector3 LLVOAvatar::getPosAgentFromGlobal(const LLVector3d &position) } -//----------------------------------------------------------------------------- -// getCharacterJoint() -//----------------------------------------------------------------------------- -LLJoint *LLVOAvatar::getCharacterJoint( U32 num ) -{ - if ((S32)num >= mSkeleton.size() - || (S32)num < 0) - { - return NULL; - } - return mSkeleton[num]; -} - //----------------------------------------------------------------------------- // requestStopMotion() //----------------------------------------------------------------------------- -- cgit v1.2.3 From 8ba2b388769e245ec1b49b7d6d4b0372d684ff86 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Thu, 13 Sep 2012 10:25:48 +0000 Subject: Fleshed out target_link_libraries dependencies between libraries. Appearance utility now reads avatar_lad.xml during stubbed out params processing. --- indra/newview/llvoavatar.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index fa1f9c95ab..0d16d039da 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1039,9 +1039,6 @@ void LLVOAvatar::initClass() void LLVOAvatar::cleanupClass() { - deleteAndClear(sAvatarXmlInfo); - sSkeletonXMLTree.cleanup(); - sXMLTree.cleanup(); } // virtual -- cgit v1.2.3 From 97ee3003ffddb7cd2f8a8a2768101a8065ae1fe3 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 13 Sep 2012 17:22:15 -0400 Subject: more dump capabilities for visual params and textures in avatar and appearance messages --- indra/newview/llvoavatar.cpp | 153 +++++++++++++++++++++++++++++++++---------- 1 file changed, 120 insertions(+), 33 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 96e59dd9eb..bcaf355dd8 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -202,6 +202,12 @@ enum ERenderName RENDER_NAME_FADE }; + +// Utility func - FIXME move out of avatar. +std::string get_sequential_numbered_file_name(const std::string& prefix, + const std::string& suffix, + const S32 width = 4); + //----------------------------------------------------------------------------- // Callback data //----------------------------------------------------------------------------- @@ -7331,13 +7337,54 @@ bool LLVOAvatar::visualParamWeightsAreDefault() return rtn; } +void LLVOAvatar::dumpAppearanceMsgParams( const std::string& dump_prefix, + const std::vector& params_for_dump, + const LLTEContents& tec) +{ + std::string outfilename = get_sequential_numbered_file_name(dump_prefix,".xml"); + + LLAPRFile outfile; + std::string fullpath = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,outfilename); + outfile.open(fullpath, LL_APR_WB ); + apr_file_t* file = outfile.getFileHandle(); + if (!file) + { + return; + } + else + { + llinfos << "xmlfile write handle obtained : " << fullpath << llendl; + } + + + LLVisualParam* param = getFirstVisualParam(); + for (S32 i = 0; i < params_for_dump.size(); i++) + { + while( param && (param->getGroup() != VISUAL_PARAM_GROUP_TWEAKABLE) ) // should not be any of group VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT + { + param = getNextVisualParam(); + } + LLViewerVisualParam* viewer_param = (LLViewerVisualParam*)param; + F32 value = params_for_dump[i]; + apr_file_printf(file, "\t\t\n", + viewer_param->getID(), viewer_param->getName().c_str(), value); + param = getNextVisualParam(); + } + for (U32 i = 0; i < tec.face_count; i++) + { + std::string uuid_str; + ((LLUUID*)tec.image_data)[i].toString(uuid_str); + apr_file_printf( file, "\t\t\n", i, uuid_str.c_str()); + } +} //----------------------------------------------------------------------------- // processAvatarAppearance() //----------------------------------------------------------------------------- void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) { - dumpArchetypeXML("process_start"); + //std::string dump_prefix = getFullname() + " "; + //dumpArchetypeXML(dump_prefix + "process_start"); if (gSavedSettings.getBOOL("BlockAvatarAppearanceMessages")) { llwarns << "Blocking AvatarAppearance message" << llendl; @@ -7361,9 +7408,9 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) // llinfos << "processAvatarAppearance end " << mID << llendl; return; } - clearVisualParamWeights(); } - dumpArchetypeXML("process_post_clear"); + clearVisualParamWeights(); + //dumpArchetypeXML(dump_prefix + "process_post_clear"); ESex old_sex = getSex(); @@ -7448,6 +7495,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) } else { + std::vector params_for_dump; for( S32 i = 0; i < num_blocks; i++ ) { while( param && (param->getGroup() != VISUAL_PARAM_GROUP_TWEAKABLE) ) // should not be any of group VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT @@ -7464,6 +7512,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) U8 value; mesgsys->getU8Fast(_PREHASH_VisualParam, _PREHASH_ParamValue, value, i); F32 newWeight = U8_to_F32(value, param->getMinWeight(), param->getMaxWeight()); + params_for_dump.push_back(newWeight); if (is_first_appearance_message || (param->getWeight() != newWeight)) { @@ -7481,9 +7530,12 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) } param = getNextVisualParam(); } + //dumpAppearanceMsgParams(dump_prefix + "appearance_msg", + // params_for_dump, + // tec); } - dumpArchetypeXML("process_post_set_weights"); + //dumpArchetypeXML(dump_prefix + "process_post_set_weights"); const S32 expected_tweakable_count = getVisualParamCountInGroup(VISUAL_PARAM_GROUP_TWEAKABLE); // don't worry about VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT if (num_blocks != expected_tweakable_count) @@ -7549,7 +7601,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) updateMeshTextures(); - dumpArchetypeXML("process_end"); + //dumpArchetypeXML(dump_prefix + "process_end"); // llinfos << "processAvatarAppearance end " << mID << llendl; } @@ -7779,33 +7831,42 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) dirtyMesh(); } -void LLVOAvatar::dumpArchetypeXML(const std::string& prefix ) +std::string get_sequential_numbered_file_name(const std::string& prefix, + const std::string& suffix, + const S32 width) { - std::string outprefix(prefix); - if (outprefix.empty()) - { - outprefix = getFullname(); - } - if (outprefix.empty()) - { - outprefix = std::string("new_archetype"); - } typedef std::map file_num_type; static file_num_type file_nums; - file_num_type::iterator it = file_nums.find(outprefix); + file_num_type::iterator it = file_nums.find(prefix); S32 num = 0; if (it != file_nums.end()) { num = it->second; } std::ostringstream temp; - temp << std::setw(4) << std::setfill('0') << num; - file_nums[outprefix] = num+1; - std::string outfilename = outprefix + " " + temp.str() + ".xml"; + temp << std::setw(width) << std::setfill('0') << num; + file_nums[prefix] = num+1; + std::string outfilename = prefix + " " + temp.str() + ".xml"; std::replace(outfilename.begin(),outfilename.end(),' ','_'); + return outfilename; +} + +void LLVOAvatar::dumpArchetypeXML(const std::string& prefix, bool group_by_wearables ) +{ + std::string outprefix(prefix); + if (outprefix.empty()) + { + outprefix = getFullname(); + } + if (outprefix.empty()) + { + outprefix = std::string("new_archetype"); + } + std::string outfilename = get_sequential_numbered_file_name(outprefix,".xml"); LLAPRFile outfile; - outfile.open(gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,outfilename), LL_APR_WB ); + std::string fullpath = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,outfilename); + outfile.open(fullpath, LL_APR_WB ); apr_file_t* file = outfile.getFileHandle(); if (!file) { @@ -7813,24 +7874,53 @@ void LLVOAvatar::dumpArchetypeXML(const std::string& prefix ) } else { - llinfos << "xmlfile write handle obtained : " << gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,"new archetype.xml") << llendl; + llinfos << "xmlfile write handle obtained : " << fullpath << llendl; } apr_file_printf( file, "\n" ); apr_file_printf( file, "\n" ); apr_file_printf( file, "\n\t\n" ); - // only body parts, not clothing. - for (S32 type = LLWearableType::WT_SHAPE; type <= LLWearableType::WT_COUNT; type++) + if (group_by_wearables) { - const std::string& wearable_name = LLWearableType::getTypeName((LLWearableType::EType)type); - apr_file_printf( file, "\n\t\t\n", wearable_name.c_str() ); + for (S32 type = LLWearableType::WT_SHAPE; type < LLWearableType::WT_COUNT; type++) + { + const std::string& wearable_name = LLWearableType::getTypeName((LLWearableType::EType)type); + apr_file_printf( file, "\n\t\t\n", wearable_name.c_str() ); + for (LLVisualParam* param = getFirstVisualParam(); param; param = getNextVisualParam()) + { + LLViewerVisualParam* viewer_param = (LLViewerVisualParam*)param; + if( (viewer_param->getWearableType() == type) && + (viewer_param->isTweakable() ) ) + { + apr_file_printf(file, "\t\t\n", + viewer_param->getID(), viewer_param->getName().c_str(), viewer_param->getWeight()); + } + } + + for (U8 te = 0; te < TEX_NUM_INDICES; te++) + { + if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex)te) == type) + { + // MULTIPLE_WEARABLES: extend to multiple wearables? + LLViewerTexture* te_image = getImage((ETextureIndex)te, 0); + if( te_image ) + { + std::string uuid_str; + te_image->getID().toString( uuid_str ); + apr_file_printf( file, "\t\t\n", te, uuid_str.c_str()); + } + } + } + } + } + else + { + // Just dump all params sequentially. for (LLVisualParam* param = getFirstVisualParam(); param; param = getNextVisualParam()) { LLViewerVisualParam* viewer_param = (LLViewerVisualParam*)param; - if( (viewer_param->getWearableType() == type) && - (viewer_param->isTweakable() ) ) { apr_file_printf(file, "\t\t\n", viewer_param->getID(), viewer_param->getName().c_str(), viewer_param->getWeight()); @@ -7839,7 +7929,6 @@ void LLVOAvatar::dumpArchetypeXML(const std::string& prefix ) for (U8 te = 0; te < TEX_NUM_INDICES; te++) { - if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex)te) == type) { // MULTIPLE_WEARABLES: extend to multiple wearables? LLViewerTexture* te_image = getImage((ETextureIndex)te, 0); @@ -7851,14 +7940,12 @@ void LLVOAvatar::dumpArchetypeXML(const std::string& prefix ) } } } + } apr_file_printf( file, "\t\n" ); apr_file_printf( file, "\n\n" ); - //explictly close the file if it is still open which it should be - if (file) - { - outfile.close(); - } + + // File will close when handle goes out of scope } -- cgit v1.2.3 From 9307810e7e8edcf18f7c27abda5d0b94ed13bcf7 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Thu, 13 Sep 2012 22:53:16 +0000 Subject: Fix for merge build error. Attempt to cleanup cmake warnings regarding incorrect target_link_libraries --- indra/newview/llvoavatar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index bec67c1695..1b185ed508 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6853,7 +6853,7 @@ void LLVOAvatar::dumpArchetypeXML(const std::string& prefix, bool group_by_weara for (U8 te = 0; te < TEX_NUM_INDICES; te++) { - if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex)te) == type) + if (LLAvatarAppearanceDictionary::getTEWearableType((ETextureIndex)te) == type) { // MULTIPLE_WEARABLES: extend to multiple wearables? LLViewerTexture* te_image = getImage((ETextureIndex)te, 0); -- 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/llvoavatar.cpp | 59 +++++++++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 26 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 1b185ed508..5ccd2d206d 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -48,6 +48,7 @@ #include "llcallingcard.h" // IDEVO for LLAvatarTracker #include "lldrawpoolavatar.h" #include "lldriverparam.h" +#include "llpolyskeletaldistortion.h" #include "lleditingmotion.h" #include "llemote.h" //#include "llfirstuse.h" @@ -191,8 +192,7 @@ enum ERenderName // Utility func - FIXME move out of avatar. std::string get_sequential_numbered_file_name(const std::string& prefix, - const std::string& suffix, - const S32 width = 4); + const std::string& suffix); //----------------------------------------------------------------------------- // Callback data @@ -6277,6 +6277,24 @@ bool LLVOAvatar::visualParamWeightsAreDefault() return rtn; } +void dump_visual_param(apr_file_t* file, LLVisualParam* viewer_param, F32 value) +{ + std::string type_string = "unknown"; + if (dynamic_cast(viewer_param)) + type_string = "param_alpha"; + if (dynamic_cast(viewer_param)) + type_string = "param_color"; + if (dynamic_cast(viewer_param)) + type_string = "param_driver"; + if (dynamic_cast(viewer_param)) + type_string = "param_morph"; + if (dynamic_cast(viewer_param)) + type_string = "param_skeleton"; + apr_file_printf(file, "\t\t\n", + viewer_param->getID(), viewer_param->getName().c_str(), value, type_string.c_str()); +} + + void LLVOAvatar::dumpAppearanceMsgParams( const std::string& dump_prefix, const std::vector& params_for_dump, const LLTEContents& tec) @@ -6306,8 +6324,7 @@ void LLVOAvatar::dumpAppearanceMsgParams( const std::string& dump_prefix, } LLViewerVisualParam* viewer_param = (LLViewerVisualParam*)param; F32 value = params_for_dump[i]; - apr_file_printf(file, "\t\t\n", - viewer_param->getID(), viewer_param->getName().c_str(), value); + dump_visual_param(file, viewer_param, value); param = getNextVisualParam(); } for (U32 i = 0; i < tec.face_count; i++) @@ -6323,14 +6340,14 @@ void LLVOAvatar::dumpAppearanceMsgParams( const std::string& dump_prefix, //----------------------------------------------------------------------------- void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) { - //std::string dump_prefix = getFullname() + " "; - //dumpArchetypeXML(dump_prefix + "process_start"); + bool enable_verbose_dumps = gSavedSettings.getBOOL("DebugAvatarAppearanceMessage"); + std::string dump_prefix = getFullname() + "_" + (isSelf()?"s":"o") + "_"; + if (enable_verbose_dumps) { dumpArchetypeXML(dump_prefix + "process_start"); } if (gSavedSettings.getBOOL("BlockAvatarAppearanceMessages")) { llwarns << "Blocking AvatarAppearance message" << llendl; return; } - LLMemType mt(LLMemType::MTYPE_AVATAR); BOOL is_first_appearance_message = !mFirstAppearanceMessageReceived; @@ -6349,8 +6366,6 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) return; } } - clearVisualParamWeights(); - //dumpArchetypeXML(dump_prefix + "process_post_clear"); ESex old_sex = getSex(); @@ -6470,12 +6485,11 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) } param = getNextVisualParam(); } - //dumpAppearanceMsgParams(dump_prefix + "appearance_msg", - // params_for_dump, - // tec); + if (enable_verbose_dumps) + dumpAppearanceMsgParams(dump_prefix + "appearance_msg", params_for_dump, tec); } - //dumpArchetypeXML(dump_prefix + "process_post_set_weights"); + if (enable_verbose_dumps) { dumpArchetypeXML(dump_prefix + "process_post_set_weights"); } const S32 expected_tweakable_count = getVisualParamCountInGroup(VISUAL_PARAM_GROUP_TWEAKABLE); // don't worry about VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT if (num_blocks != expected_tweakable_count) @@ -6541,7 +6555,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) updateMeshTextures(); - //dumpArchetypeXML(dump_prefix + "process_end"); + if (enable_verbose_dumps) dumpArchetypeXML(dump_prefix + "process_end"); // llinfos << "processAvatarAppearance end " << mID << llendl; } @@ -6784,8 +6798,7 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) } std::string get_sequential_numbered_file_name(const std::string& prefix, - const std::string& suffix, - const S32 width) + const std::string& suffix) { typedef std::map file_num_type; static file_num_type file_nums; @@ -6795,10 +6808,8 @@ std::string get_sequential_numbered_file_name(const std::string& prefix, { num = it->second; } - std::ostringstream temp; - temp << std::setw(width) << std::setfill('0') << num; file_nums[prefix] = num+1; - std::string outfilename = prefix + " " + temp.str() + ".xml"; + std::string outfilename = prefix + " " + llformat("%04d",num) + ".xml"; std::replace(outfilename.begin(),outfilename.end(),' ','_'); return outfilename; } @@ -6808,7 +6819,7 @@ void LLVOAvatar::dumpArchetypeXML(const std::string& prefix, bool group_by_weara std::string outprefix(prefix); if (outprefix.empty()) { - outprefix = getFullname(); + outprefix = getFullname() + (isSelf()?"_s":"_o"); } if (outprefix.empty()) { @@ -6846,8 +6857,7 @@ void LLVOAvatar::dumpArchetypeXML(const std::string& prefix, bool group_by_weara if( (viewer_param->getWearableType() == type) && (viewer_param->isTweakable() ) ) { - apr_file_printf(file, "\t\t\n", - viewer_param->getID(), viewer_param->getName().c_str(), viewer_param->getWeight()); + dump_visual_param(file, viewer_param, viewer_param->getWeight()); } } @@ -6873,10 +6883,7 @@ void LLVOAvatar::dumpArchetypeXML(const std::string& prefix, bool group_by_weara for (LLVisualParam* param = getFirstVisualParam(); param; param = getNextVisualParam()) { LLViewerVisualParam* viewer_param = (LLViewerVisualParam*)param; - { - apr_file_printf(file, "\t\t\n", - viewer_param->getID(), viewer_param->getName().c_str(), viewer_param->getWeight()); - } + dump_visual_param(file, viewer_param, viewer_param->getWeight()); } for (U8 te = 0; te < TEX_NUM_INDICES; te++) -- cgit v1.2.3 From 04b0862b3b53ef57801b779c51e6b8fe1c442008 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 26 Sep 2012 11:27:13 -0400 Subject: use accessors for mUseLocalAppearance, mIsEditingAppearance, mUseServerBakes --- indra/newview/llvoavatar.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 5ccd2d206d..1676f656d3 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4060,7 +4060,7 @@ void LLVOAvatar::updateTextures() if (isIndexBakedTexture((ETextureIndex)texture_index) && imagep->getID() != IMG_DEFAULT_AVATAR && imagep->getID() != IMG_INVISIBLE - && !mUseServerBakes + && !isUsingServerBakes() && !imagep->getTargetHost().isOk()) { LL_WARNS_ONCE("Texture") << "LLVOAvatar::updateTextures No host for texture " @@ -4203,7 +4203,7 @@ void LLVOAvatar::setTexEntry(const U8 index, const LLTextureEntry &te) const std::string LLVOAvatar::getImageURL(const U8 te, const LLUUID &uuid) { std::string url = ""; - if (mUseServerBakes && !gSavedSettings.getString("AgentAppearanceServiceURL").empty()) + if (isUsingServerBakes() && !gSavedSettings.getString("AgentAppearanceServiceURL").empty()) { const LLAvatarAppearanceDictionary::TextureEntry* texture_entry = LLAvatarAppearanceDictionary::getInstance()->getTexture((ETextureIndex)te); if (texture_entry != NULL) @@ -5816,7 +5816,7 @@ void LLVOAvatar::updateMeshTextures() for (U32 i=0; i < mBakedTextureDatas.size(); i++) { LLViewerTexLayerSet* layerset = getTexLayerSet(i); - if (use_lkg_baked_layer[i] && !mUseLocalAppearance ) + if (use_lkg_baked_layer[i] && !isUsingLocalAppearance() ) { LLViewerFetchedTexture* baked_img; const std::string url = getImageURL(i, mBakedTextureDatas[i].mLastTextureIndex); @@ -5852,7 +5852,7 @@ void LLVOAvatar::updateMeshTextures() } } } - else if (!mUseLocalAppearance && is_layer_baked[i]) + else if (!isUsingLocalAppearance() && is_layer_baked[i]) { LLViewerFetchedTexture* baked_img = LLViewerTextureManager::staticCastToFetchedTexture(getImage( mBakedTextureDatas[i].mTextureIndex, 0 ), TRUE) ; if( baked_img->getID() == mBakedTextureDatas[i].mLastTextureIndex ) @@ -5872,7 +5872,7 @@ void LLVOAvatar::updateMeshTextures() src_callback_list, paused ); } } - else if (layerset && mUseLocalAppearance) + else if (layerset && isUsingLocalAppearance()) { layerset->createComposite(); layerset->setUpdatesEnabled( TRUE ); @@ -5913,7 +5913,7 @@ void LLVOAvatar::updateMeshTextures() // set texture and color of hair manually if we are not using a baked image. // This can happen while loading hair for yourself, or for clients that did not // bake a hair texture. Still needed for yourself after 1.22 is depricated. - if (!is_layer_baked[BAKED_HAIR] || mIsEditingAppearance) + if (!is_layer_baked[BAKED_HAIR] || isEditingAppearance()) { const LLColor4 color = mTexHairColor ? mTexHairColor->getColor() : LLColor4(1,1,1,1); LLViewerTexture* hair_img = getImage( TEX_HAIR, 0 ); @@ -6360,7 +6360,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) if( isSelf() ) { llwarns << avString() << "Received AvatarAppearance for self" << llendl; - if( mFirstTEMessageReceived && !mUseServerBakes) + if( mFirstTEMessageReceived && !isUsingServerBakes()) { // llinfos << "processAvatarAppearance end " << mID << llendl; return; @@ -6399,7 +6399,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) } // Check for stale update. - if (mUseServerBakes && isSelf() + if (isUsingServerBakes() && isSelf() && this_update_cof_version >= LLViewerInventoryCategory::VERSION_INITIAL && this_update_cof_version < last_update_request_cof_version) { -- cgit v1.2.3 From ab83fab72c66e753917001a9030aa55e69a3c496 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 26 Sep 2012 11:52:19 -0400 Subject: error checking, comments for areas needing fix/check in appearance --- indra/newview/llvoavatar.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 1676f656d3..0f18aa358c 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4203,8 +4203,15 @@ void LLVOAvatar::setTexEntry(const U8 index, const LLTextureEntry &te) const std::string LLVOAvatar::getImageURL(const U8 te, const LLUUID &uuid) { std::string url = ""; - if (isUsingServerBakes() && !gSavedSettings.getString("AgentAppearanceServiceURL").empty()) + if (isUsingServerBakes()) { + if (gSavedSettings.getString("AgentAppearanceServiceURL").empty()) + { + // 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) { -- 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/llvoavatar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 0f18aa358c..a7a08208d4 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -626,7 +626,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mLastRezzedStatus(-1), mIsEditingAppearance(FALSE), mUseLocalAppearance(FALSE), - mUseServerBakes(TRUE) + mUseServerBakes(FALSE) { LLMemType mt(LLMemType::MTYPE_AVATAR); //VTResume(); // VTune -- cgit v1.2.3 From 05ee87af14c4d20e754aa525e4a3f78eb736a96b Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 26 Sep 2012 17:02:46 -0400 Subject: Fixed problems caused by defaulting mUseServerBakes to false --- indra/newview/llvoavatar.cpp | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index a7a08208d4..f5299f0fa3 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6364,23 +6364,10 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) << " first? " << is_first_appearance_message << " self? " << isSelf() << LL_ENDL; - if( isSelf() ) - { - llwarns << avString() << "Received AvatarAppearance for self" << llendl; - if( mFirstTEMessageReceived && !isUsingServerBakes()) - { -// llinfos << "processAvatarAppearance end " << mID << llendl; - return; - } - } - ESex old_sex = getSex(); -// llinfos << "LLVOAvatar::processAvatarAppearance()" << llendl; -// dumpAvatarTEs( "PRE processAvatarAppearance()" ); LLTEContents tec; parseTEMessage(mesgsys, _PREHASH_ObjectData, -1, tec); -// dumpAvatarTEs( "POST processAvatarAppearance()" ); U8 appearance_version = 0; S32 this_update_cof_version = LLViewerInventoryCategory::VERSION_UNKNOWN; @@ -6405,6 +6392,18 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) mUseServerBakes = false; } + // Only now that we have result of appearance_version can we decide whether to bail out. + // Don't expect this case to occur. + if( isSelf() ) + { + llwarns << avString() << "Received AvatarAppearance for self" << llendl; + if( mFirstTEMessageReceived && !isUsingServerBakes()) + { + return; + } + } + + // Check for stale update. if (isUsingServerBakes() && isSelf() && this_update_cof_version >= LLViewerInventoryCategory::VERSION_INITIAL -- cgit v1.2.3 From 0bb1324a27d4dd94d6f8a9d445ab892127f48c5f Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 26 Sep 2012 18:11:57 -0400 Subject: Debug text for avatar appearance state related to server-side baking project --- indra/newview/llvoavatar.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index f5299f0fa3..fb06eb24c1 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2882,6 +2882,20 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) // clear debug text mDebugText.clear(); + + if (gSavedSettings.getBOOL("DebugAvatarAppearanceMessage")) + { + S32 central_bake_version = -1; + if (getRegion()) + { + central_bake_version = getRegion()->getCentralBakeVersion(); + } + addDebugText(llformat("mUseLocalAppearance: %d,\nmIsEditingAppearance: %d\n" + "mUseServerBakes %d,\ncentralBakeVersion %d", + mUseLocalAppearance, mIsEditingAppearance, + mUseServerBakes, central_bake_version)); + } + if (LLVOAvatar::sShowAnimationDebug) { for (LLMotionController::motion_list_t::iterator iter = mMotionController.getActiveMotions().begin(); -- 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/llvoavatar.cpp | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index fb06eb24c1..50c2659563 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -626,7 +626,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mLastRezzedStatus(-1), mIsEditingAppearance(FALSE), mUseLocalAppearance(FALSE), - mUseServerBakes(FALSE) + mUseServerBakes(FALSE) // FIXME DRANO consider using boost::optional, defaulting to unknown. { LLMemType mt(LLMemType::MTYPE_AVATAR); //VTResume(); // VTune @@ -2890,8 +2890,8 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) { central_bake_version = getRegion()->getCentralBakeVersion(); } - addDebugText(llformat("mUseLocalAppearance: %d,\nmIsEditingAppearance: %d\n" - "mUseServerBakes %d,\ncentralBakeVersion %d", + addDebugText(llformat("mUseLocalAppearance: %d\nmIsEditingAppearance: %d\n" + "mUseServerBakes %d\ncentralBakeVersion %d", mUseLocalAppearance, mIsEditingAppearance, mUseServerBakes, central_bake_version)); } @@ -6397,20 +6397,15 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) //mesgsys->getU32Fast(_PREHASH_AppearanceData, _PREHASH_Flags, appearance_flags, 0); } - if (appearance_version > 0) - { - mUseServerBakes = true; - } - else - { - mUseServerBakes = false; - } + mUseServerBakes = (appearance_version > 0); // Only now that we have result of appearance_version can we decide whether to bail out. - // Don't expect this case to occur. if( isSelf() ) { - llwarns << avString() << "Received AvatarAppearance for self" << llendl; + if (getRegion() && (getRegion()->getCentralBakeVersion()==0)) + { + llwarns << avString() << "Received AvatarAppearance message for self in non-server-bake region" << llendl; + } if( mFirstTEMessageReceived && !isUsingServerBakes()) { return; @@ -7052,6 +7047,10 @@ void LLVOAvatar::bodySizeChanged() } } +void LLVOAvatar::setIsUsingServerBakes(BOOL newval) +{ + mUseServerBakes = newval; +} // virtual void LLVOAvatar::removeMissingBakedTextures() -- cgit v1.2.3 From c06c35609c6683731eaea283468f6b32af18fea2 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Thu, 11 Oct 2012 00:09:04 +0000 Subject: Updating linux build to gcc4.6 --- indra/newview/llvoavatar.cpp | 6 ------ 1 file changed, 6 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 50c2659563..3d4573903f 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1755,7 +1755,6 @@ U32 LLVOAvatar::processUpdateMessage(LLMessageSystem *mesgsys, { LLMemType mt(LLMemType::MTYPE_AVATAR); - LLVector3 old_vel = getVelocity(); const BOOL has_name = !getNVPair("FirstName"); // Do base class updates... @@ -2645,8 +2644,6 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) mNameText->setTextAlignment(LLHUDNameTag::ALIGN_TEXT_LEFT); mNameText->setFadeDistance(CHAT_NORMAL_RADIUS * 2.f, 5.f); - char line[MAX_STRING]; /* Flawfinder: ignore */ - line[0] = '\0'; std::deque::iterator chat_iter = mChats.begin(); mNameText->clearString(); @@ -3035,8 +3032,6 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) xyVel.mV[VZ] = 0.0f; speed = xyVel.length(); - BOOL throttle = TRUE; - if (!(mIsSitting && getParent())) { //-------------------------------------------------------------------- @@ -3047,7 +3042,6 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) if (mTimeLast == 0.0f) { mTimeLast = animation_time; - throttle = FALSE; // put the pelvis at slaved position/mRotation mRoot->setWorldPosition( getPositionAgent() ); // first frame -- cgit v1.2.3 From 22f53c85588912582f33d840d106b10f54f2c62d Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 15 Oct 2012 18:41:55 -0400 Subject: additional debugging info, including tracking where visual params live --- indra/newview/llvoavatar.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 3d4573903f..a2ace15f2d 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1792,6 +1792,7 @@ S32 LLVOAvatar::setTETexture(const U8 te, const LLUUID& uuid) const std::string url = getImageURL(te,uuid); if (!url.empty()) { + llinfos << "texture URL " << url << llendl; return setTETextureCore(te, uuid, url); } -- cgit v1.2.3 From 7d6da2ebe8db7aa73113659c709d03e16eca5094 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 17 Oct 2012 13:43:19 -0400 Subject: more param location logging, added wearable type info to dumpArchetypeXML --- indra/newview/llvoavatar.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index a2ace15f2d..fa6e572064 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6306,8 +6306,15 @@ void dump_visual_param(apr_file_t* file, LLVisualParam* viewer_param, F32 value) type_string = "param_morph"; if (dynamic_cast(viewer_param)) type_string = "param_skeleton"; - apr_file_printf(file, "\t\t\n", - viewer_param->getID(), viewer_param->getName().c_str(), value, type_string.c_str()); + S32 wtype = -1; + LLViewerVisualParam *vparam = dynamic_cast(viewer_param); + if (vparam) + { + wtype = vparam->getWearableType(); + } + apr_file_printf(file, "\t\t\n", + viewer_param->getID(), viewer_param->getName().c_str(), value, type_string.c_str(), + LLWearableType::getTypeName(LLWearableType::EType(wtype)).c_str()); } -- 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/llvoavatar.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index fa6e572064..a49ecc0127 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6312,8 +6312,9 @@ void dump_visual_param(apr_file_t* file, LLVisualParam* viewer_param, F32 value) { wtype = vparam->getWearableType(); } - apr_file_printf(file, "\t\t\n", - viewer_param->getID(), viewer_param->getName().c_str(), value, type_string.c_str(), + S32 u8_value = F32_to_U8(value,viewer_param->getMinWeight(),viewer_param->getMaxWeight()); + apr_file_printf(file, "\t\t\n", + viewer_param->getID(), viewer_param->getName().c_str(), value, u8_value, type_string.c_str(), LLWearableType::getTypeName(LLWearableType::EType(wtype)).c_str()); } -- cgit v1.2.3 From c961b5f6571cc6147410f9e7620e5aa44c009f3f Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 22 Oct 2012 11:09:32 -0400 Subject: handling for crossing from non-server-bake to server-bake regions --- indra/newview/llvoavatar.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index a49ecc0127..b08226fe94 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6400,8 +6400,6 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) //mesgsys->getU32Fast(_PREHASH_AppearanceData, _PREHASH_Flags, appearance_flags, 0); } - mUseServerBakes = (appearance_version > 0); - // Only now that we have result of appearance_version can we decide whether to bail out. if( isSelf() ) { @@ -6409,7 +6407,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) { llwarns << avString() << "Received AvatarAppearance message for self in non-server-bake region" << llendl; } - if( mFirstTEMessageReceived && !isUsingServerBakes()) + if( mFirstTEMessageReceived && (appearance_version == 0)) { return; } @@ -6417,7 +6415,8 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) // Check for stale update. - if (isUsingServerBakes() && isSelf() + if (isSelf() + && isUsingServerBakes() && this_update_cof_version >= LLViewerInventoryCategory::VERSION_INITIAL && this_update_cof_version < last_update_request_cof_version) { @@ -6425,6 +6424,9 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) << ", got " << this_update_cof_version << llendl; return; } + + mUseServerBakes = (appearance_version > 0); + applyParsedTEMessage(tec); // prevent the overwriting of valid baked textures with invalid baked textures -- cgit v1.2.3 From e5c38b3b61f55674f602bb0e7d43baa3e04d541f Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 25 Oct 2012 16:44:01 -0400 Subject: SH-3469 FIX - discard new-style updates for self with cof version = 0. This removes a race condition that was causing us to mis-handle region crossing logic --- indra/newview/llvoavatar.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index b08226fe94..168a116b95 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6416,9 +6416,8 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) // Check for stale update. if (isSelf() - && isUsingServerBakes() - && this_update_cof_version >= LLViewerInventoryCategory::VERSION_INITIAL - && this_update_cof_version < last_update_request_cof_version) + && (appearance_version>0) + && (this_update_cof_version < last_update_request_cof_version)) { llwarns << "Stale appearance update, wanted version " << last_update_request_cof_version << ", got " << this_update_cof_version << llendl; -- cgit v1.2.3 From d4dc41dbd5b54501fcb3c94e07e4753ed4196eac Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 1 Nov 2012 14:19:00 -0400 Subject: misc error detection, debug coloration for avatar meshes --- indra/newview/llvoavatar.cpp | 56 ++++++++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 25 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 168a116b95..ed5b332e26 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5767,6 +5767,25 @@ LLMotion* LLVOAvatar::findMotion(const LLUUID& id) const return mMotionController.findMotion(id); } +void LLVOAvatar::debugColorizeSubMeshes(U32 i, const LLColor4& color) +{ + if (gSavedSettings.getBOOL("DebugAvatarCompositeBaked")) + { + avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin(); + avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end(); + for (; iter != end; ++iter) + { + LLAvatarJointMesh* mesh = (*iter); + if (mesh) + { + { + mesh->setColor(color); + } + } + } + } +} + //----------------------------------------------------------------------------- // updateMeshTextures() // Uses the current TE values to set the meshes' and layersets' textures. @@ -5831,6 +5850,8 @@ void LLVOAvatar::updateMeshTextures() for (U32 i=0; i < mBakedTextureDatas.size(); i++) { + debugColorizeSubMeshes(i, LLColor4::white); + LLViewerTexLayerSet* layerset = getTexLayerSet(i); if (use_lkg_baked_layer[i] && !isUsingLocalAppearance() ) { @@ -5853,6 +5874,9 @@ void LLVOAvatar::updateMeshTextures() } mBakedTextureDatas[i].mIsUsed = TRUE; + + debugColorizeSubMeshes(i,LLColor4::red); + avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin(); avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end(); for (; iter != end; ++iter) @@ -5861,10 +5885,6 @@ void LLVOAvatar::updateMeshTextures() if (mesh) { mesh->setTexture( baked_img ); - if (gSavedSettings.getBOOL("DebugAvatarCompositeBaked")) - { - mesh->setColor(LLColor4::red); - } } } } @@ -5890,9 +5910,12 @@ void LLVOAvatar::updateMeshTextures() } else if (layerset && isUsingLocalAppearance()) { + debugColorizeSubMeshes(i,LLColor4::yellow ); + layerset->createComposite(); layerset->setUpdatesEnabled( TRUE ); mBakedTextureDatas[i].mIsUsed = FALSE; + avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin(); avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end(); for (; iter != end; ++iter) @@ -5901,28 +5924,12 @@ void LLVOAvatar::updateMeshTextures() if (mesh) { mesh->setLayerSet( layerset ); - if (gSavedSettings.getBOOL("DebugAvatarCompositeBaked")) - { - mesh->setColor( LLColor4::yellow ); - } } } } else { - if (gSavedSettings.getBOOL("DebugAvatarCompositeBaked")) - { - avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin(); - avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end(); - for (; iter != end; ++iter) - { - LLAvatarJointMesh* mesh = (*iter); - if (mesh) - { - mesh->setColor( LLColor4::blue ); - } - } - } + debugColorizeSubMeshes(i,LLColor4::blue); } } @@ -6768,6 +6775,9 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) mBakedTextureDatas[i].mIsLoaded = true; mBakedTextureDatas[i].mLastTextureIndex = id; mBakedTextureDatas[i].mIsUsed = true; + + debugColorizeSubMeshes(i,LLColor4::green); + avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin(); avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end(); for (; iter != end; ++iter) @@ -6776,10 +6786,6 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) if (mesh) { mesh->setTexture( image_baked ); - if (gSavedSettings.getBOOL("DebugAvatarCompositeBaked")) - { - mesh->setColor( LLColor4::green ); - } } } if (mBakedTextureDatas[i].mTexLayerSet) -- cgit v1.2.3 From ee2bc008ea8f04ffd1271787382a2b756e6293aa Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 5 Nov 2012 18:02:03 -0500 Subject: renamed a confusingly-named field --- indra/newview/llvoavatar.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index ed5b332e26..75e71a7613 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5833,7 +5833,7 @@ void LLVOAvatar::updateMeshTextures() && ( !layerset->getViewerComposite()->isInitialized() || !layerset->isLocalTextureDataAvailable() ); use_lkg_baked_layer[i] = (!is_layer_baked[i] - && (mBakedTextureDatas[i].mLastTextureIndex != IMG_DEFAULT_AVATAR) + && (mBakedTextureDatas[i].mLastTextureID != IMG_DEFAULT_AVATAR) && layerset_invalid); if (use_lkg_baked_layer[i]) { @@ -5843,7 +5843,7 @@ void LLVOAvatar::updateMeshTextures() else { use_lkg_baked_layer[i] = (!is_layer_baked[i] - && mBakedTextureDatas[i].mLastTextureIndex != IMG_DEFAULT_AVATAR); + && mBakedTextureDatas[i].mLastTextureID != IMG_DEFAULT_AVATAR); } } @@ -5856,10 +5856,10 @@ void LLVOAvatar::updateMeshTextures() if (use_lkg_baked_layer[i] && !isUsingLocalAppearance() ) { LLViewerFetchedTexture* baked_img; - const std::string url = getImageURL(i, mBakedTextureDatas[i].mLastTextureIndex); + const std::string url = getImageURL(i, mBakedTextureDatas[i].mLastTextureID); if (!url.empty()) { - baked_img = LLViewerTextureManager::getFetchedTextureFromUrl(url, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, mBakedTextureDatas[i].mLastTextureIndex); + baked_img = LLViewerTextureManager::getFetchedTextureFromUrl(url, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, mBakedTextureDatas[i].mLastTextureID); } else { @@ -5870,7 +5870,7 @@ void LLVOAvatar::updateMeshTextures() llwarns << "updateMeshTextures: invalid host for object: " << getID() << llendl; } - baked_img = LLViewerTextureManager::getFetchedTextureFromHost( mBakedTextureDatas[i].mLastTextureIndex, target_host ); + baked_img = LLViewerTextureManager::getFetchedTextureFromHost( mBakedTextureDatas[i].mLastTextureID, target_host ); } mBakedTextureDatas[i].mIsUsed = TRUE; @@ -5891,7 +5891,7 @@ void LLVOAvatar::updateMeshTextures() else if (!isUsingLocalAppearance() && is_layer_baked[i]) { LLViewerFetchedTexture* baked_img = LLViewerTextureManager::staticCastToFetchedTexture(getImage( mBakedTextureDatas[i].mTextureIndex, 0 ), TRUE) ; - if( baked_img->getID() == mBakedTextureDatas[i].mLastTextureIndex ) + if( baked_img->getID() == mBakedTextureDatas[i].mLastTextureID ) { // Even though the file may not be finished loading, we'll consider it loaded and use it (rather than doing compositing). useBakedTexture( baked_img->getID() ); @@ -6248,7 +6248,7 @@ void LLVOAvatar::onFirstTEMessageReceived() if (layer_baked) { LLViewerFetchedTexture* image = LLViewerTextureManager::staticCastToFetchedTexture(getImage( mBakedTextureDatas[i].mTextureIndex, 0 ), TRUE) ; - mBakedTextureDatas[i].mLastTextureIndex = image->getID(); + mBakedTextureDatas[i].mLastTextureID = image->getID(); // If we have more than one texture for the other baked layers, we'll want to call this for them too. if ( (image->getID() != IMG_INVISIBLE) && ((i == BAKED_HEAD) || (i == BAKED_UPPER) || (i == BAKED_LOWER)) ) { @@ -6439,11 +6439,11 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) for (U8 baked_index = 0; baked_index < mBakedTextureDatas.size(); baked_index++) { if (!isTextureDefined(mBakedTextureDatas[baked_index].mTextureIndex) - && mBakedTextureDatas[baked_index].mLastTextureIndex != IMG_DEFAULT + && mBakedTextureDatas[baked_index].mLastTextureID != IMG_DEFAULT && baked_index != BAKED_SKIRT) { setTEImage(mBakedTextureDatas[baked_index].mTextureIndex, - LLViewerTextureManager::getFetchedTexture(mBakedTextureDatas[baked_index].mLastTextureIndex, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); + LLViewerTextureManager::getFetchedTexture(mBakedTextureDatas[baked_index].mLastTextureID, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); } } @@ -6773,7 +6773,7 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) { LL_DEBUGS("Avatar") << avString() << " i " << i << " id " << id << LL_ENDL; mBakedTextureDatas[i].mIsLoaded = true; - mBakedTextureDatas[i].mLastTextureIndex = id; + mBakedTextureDatas[i].mLastTextureID = id; mBakedTextureDatas[i].mIsUsed = true; debugColorizeSubMeshes(i,LLColor4::green); -- cgit v1.2.3 From f5a4c277cbf83d6adbb5f2040f3a9e2bfaa02277 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 7 Nov 2012 15:28:38 -0500 Subject: SH-3500 FIX - added additional logging to allow params in various locations to be distinguished --- indra/newview/llvoavatar.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 75e71a7613..ae6af96d4a 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6320,9 +6320,11 @@ void dump_visual_param(apr_file_t* file, LLVisualParam* viewer_param, F32 value) wtype = vparam->getWearableType(); } S32 u8_value = F32_to_U8(value,viewer_param->getMinWeight(),viewer_param->getMaxWeight()); - apr_file_printf(file, "\t\t\n", + apr_file_printf(file, "\t\t\n", viewer_param->getID(), viewer_param->getName().c_str(), value, u8_value, type_string.c_str(), - LLWearableType::getTypeName(LLWearableType::EType(wtype)).c_str()); + LLWearableType::getTypeName(LLWearableType::EType(wtype)).c_str(), + param_location_name(vparam->getParamLocation()).c_str() + ); } @@ -6929,6 +6931,12 @@ void LLVOAvatar::dumpArchetypeXML(const std::string& prefix, bool group_by_weara apr_file_printf( file, "\t\n" ); apr_file_printf( file, "\n\n" ); + bool ultra_verbose = false; + if (isSelf() && ultra_verbose) + { + // show the cloned params inside the wearables as well. + gAgentAvatarp->dumpWearableInfo(outfile); + } // File will close when handle goes out of scope } -- cgit v1.2.3 From 0c834deb97bfa26714c7e20912d9cac12429d0f2 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 7 Nov 2012 17:12:09 -0500 Subject: SH-3493 FIX - removed a large number of completely unnecessary image cache clears, each of which then forced re-reading the same data from disk --- indra/newview/llvoavatar.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index ae6af96d4a..fe471d515c 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -7019,15 +7019,9 @@ void LLVOAvatar::cullAvatarsByPixelArea() } } - // runway - this doesn't detect gray/grey state. - // think we just need to be checking self av since it's the only - // one with lltexlayer stuff. + // runway - this doesn't really detect gray/grey state. S32 grey_avatars = 0; - if (LLVOAvatar::areAllNearbyInstancesBaked(grey_avatars)) - { - LLVOAvatar::deleteCachedImages(false); - } - else + if (!LLVOAvatar::areAllNearbyInstancesBaked(grey_avatars)) { if (gFrameTimeSeconds != sUnbakedUpdateTime) // only update once per frame { -- cgit v1.2.3 From 2234ed87e4da21a9da257d99d410355306c99171 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 9 Nov 2012 17:44:50 -0500 Subject: SH-3484 WIP - added additional logging under DebugAvatarCompositeBaked to try to track down baked texture issues --- indra/newview/llvoavatar.cpp | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index fe471d515c..47cb31ae18 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2888,11 +2888,15 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) { central_bake_version = getRegion()->getCentralBakeVersion(); } - addDebugText(llformat("mUseLocalAppearance: %d\nmIsEditingAppearance: %d\n" - "mUseServerBakes %d\ncentralBakeVersion %d", + addDebugText(llformat("mLocal: %d, mEdit: %d, mUSB: %d, CBV: %d", mUseLocalAppearance, mIsEditingAppearance, mUseServerBakes, central_bake_version)); } + if (gSavedSettings.getBOOL("DebugAvatarCompositeBaked")) + { + if (!mBakedTextureDebugText.empty()) + addDebugText(mBakedTextureDebugText); + } if (LLVOAvatar::sShowAnimationDebug) { @@ -5793,7 +5797,8 @@ void LLVOAvatar::debugColorizeSubMeshes(U32 i, const LLColor4& color) // virtual void LLVOAvatar::updateMeshTextures() { - // llinfos << "updateMeshTextures" << llendl; + mBakedTextureDebugText.clear(); + // if user has never specified a texture, assign the default for (U32 i=0; i < getNumTEs(); i++) { @@ -5819,17 +5824,19 @@ void LLVOAvatar::updateMeshTextures() std::vector use_lkg_baked_layer; // lkg = "last known good" use_lkg_baked_layer.resize(mBakedTextureDatas.size(), false); + mBakedTextureDebugText += "indx layerset linvld ltda ilb ulkg ltid\n"; for (U32 i=0; i < mBakedTextureDatas.size(); i++) { is_layer_baked[i] = isTextureDefined(mBakedTextureDatas[i].mTextureIndex); - + LLViewerTexLayerSet* layerset = NULL; + bool layerset_invalid = false; if (!other_culled) { // When an avatar is changing clothes and not in Appearance mode, // use the last-known good baked texture until it finish the first // render of the new layerset. - LLViewerTexLayerSet* layerset = getTexLayerSet(i); - const BOOL layerset_invalid = layerset + layerset = getTexLayerSet(i); + layerset_invalid = layerset && ( !layerset->getViewerComposite()->isInitialized() || !layerset->isLocalTextureDataAvailable() ); use_lkg_baked_layer[i] = (!is_layer_baked[i] @@ -5846,6 +5853,24 @@ void LLVOAvatar::updateMeshTextures() && mBakedTextureDatas[i].mLastTextureID != IMG_DEFAULT_AVATAR); } + std::string last_id_string; + if (mBakedTextureDatas[i].mLastTextureID == IMG_DEFAULT_AVATAR) + last_id_string = "A"; + else if (mBakedTextureDatas[i].mLastTextureID == IMG_DEFAULT) + last_id_string = "D"; + else + last_id_string = "*"; + bool is_ltda = layerset + && layerset->getViewerComposite()->isInitialized() + && layerset->isLocalTextureDataAvailable(); + mBakedTextureDebugText += llformat("%4d %4s %4d %4d %4d %4d %4s\n", + i, + (layerset?"*":"0"), + layerset_invalid, + is_ltda, + is_layer_baked[i], + use_lkg_baked_layer[i], + last_id_string.c_str()); } for (U32 i=0; i < mBakedTextureDatas.size(); i++) @@ -5856,6 +5881,7 @@ void LLVOAvatar::updateMeshTextures() if (use_lkg_baked_layer[i] && !isUsingLocalAppearance() ) { LLViewerFetchedTexture* baked_img; + LLViewerFetchedTexture* existing_baked_img = LLViewerTextureManager::getFetchedTexture(mBakedTextureDatas[i].mLastTextureID); const std::string url = getImageURL(i, mBakedTextureDatas[i].mLastTextureID); if (!url.empty()) { @@ -5872,6 +5898,7 @@ void LLVOAvatar::updateMeshTextures() baked_img = LLViewerTextureManager::getFetchedTextureFromHost( mBakedTextureDatas[i].mLastTextureID, target_host ); } + llassert(baked_img == existing_baked_img); mBakedTextureDatas[i].mIsUsed = TRUE; -- cgit v1.2.3 From 284e1b44d7bcc463b0d3ca56eae76b19e8fea03f Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 14 Nov 2012 13:54:48 -0500 Subject: Fix for build failures --- indra/newview/llvoavatar.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 47cb31ae18..6f4dfdbe2a 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5881,7 +5881,9 @@ void LLVOAvatar::updateMeshTextures() if (use_lkg_baked_layer[i] && !isUsingLocalAppearance() ) { LLViewerFetchedTexture* baked_img; +#ifndef LL_RELEASE_FOR_DOWNLOAD LLViewerFetchedTexture* existing_baked_img = LLViewerTextureManager::getFetchedTexture(mBakedTextureDatas[i].mLastTextureID); +#endif const std::string url = getImageURL(i, mBakedTextureDatas[i].mLastTextureID); if (!url.empty()) { -- cgit v1.2.3 From dccfd66d94ad813b55d6dc1667f94288079893e9 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 14 Nov 2012 18:30:14 -0500 Subject: block appearance messages while editing --- indra/newview/llvoavatar.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 6f4dfdbe2a..3a5cc9fc14 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6462,6 +6462,12 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) return; } + if (isSelf() && isEditingAppearance()) + { + llinfos << "ignoring appearance message while in appearance edit" << llendl; + return; + } + mUseServerBakes = (appearance_version > 0); applyParsedTEMessage(tec); -- cgit v1.2.3 From ebce476bd6e4b4b8a6404fa83e8fa0d8b1e64dc5 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 15 Nov 2012 11:13:45 -0500 Subject: SH-3484 WIP, SH-3546 WIP, SH-3541 WIP - restrict useBakedTexture when in local update, minor readability tweaks --- indra/newview/llvoavatar.cpp | 64 ++++++++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 29 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 3a5cc9fc14..160f498443 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5805,7 +5805,9 @@ void LLVOAvatar::updateMeshTextures() const LLViewerTexture* te_image = getImage(i, 0); if(!te_image || te_image->getID().isNull() || (te_image->getID() == IMG_DEFAULT)) { - setImage(i, LLViewerTextureManager::getFetchedTexture(i == TEX_HAIR ? IMG_DEFAULT : IMG_DEFAULT_AVATAR), 0); // IMG_DEFAULT_AVATAR = a special texture that's never rendered. + // IMG_DEFAULT_AVATAR = a special texture that's never rendered. + const LLUUID& image_id = (i == TEX_HAIR ? IMG_DEFAULT : IMG_DEFAULT_AVATAR); + setImage(i, LLViewerTextureManager::getFetchedTexture(image_id), 0); } } @@ -5833,12 +5835,11 @@ void LLVOAvatar::updateMeshTextures() if (!other_culled) { // When an avatar is changing clothes and not in Appearance mode, - // use the last-known good baked texture until it finish the first + // use the last-known good baked texture until it finishes the first // render of the new layerset. layerset = getTexLayerSet(i); - layerset_invalid = layerset - && ( !layerset->getViewerComposite()->isInitialized() - || !layerset->isLocalTextureDataAvailable() ); + layerset_invalid = layerset && ( !layerset->getViewerComposite()->isInitialized() + || !layerset->isLocalTextureDataAvailable() ); use_lkg_baked_layer[i] = (!is_layer_baked[i] && (mBakedTextureDatas[i].mLastTextureID != IMG_DEFAULT_AVATAR) && layerset_invalid); @@ -5919,16 +5920,21 @@ void LLVOAvatar::updateMeshTextures() } else if (!isUsingLocalAppearance() && is_layer_baked[i]) { - LLViewerFetchedTexture* baked_img = LLViewerTextureManager::staticCastToFetchedTexture(getImage( mBakedTextureDatas[i].mTextureIndex, 0 ), TRUE) ; + LLViewerFetchedTexture* baked_img = + LLViewerTextureManager::staticCastToFetchedTexture( + getImage( mBakedTextureDatas[i].mTextureIndex, 0 ), TRUE) ; if( baked_img->getID() == mBakedTextureDatas[i].mLastTextureID ) { - // Even though the file may not be finished loading, we'll consider it loaded and use it (rather than doing compositing). + // Even though the file may not be finished loading, + // we'll consider it loaded and use it (rather than + // doing compositing). useBakedTexture( baked_img->getID() ); } else { mBakedTextureDatas[i].mIsLoaded = FALSE; - if ( (baked_img->getID() != IMG_INVISIBLE) && ((i == BAKED_HEAD) || (i == BAKED_UPPER) || (i == BAKED_LOWER)) ) + if ( (baked_img->getID() != IMG_INVISIBLE) && + ((i == BAKED_HEAD) || (i == BAKED_UPPER) || (i == BAKED_LOWER)) ) { baked_img->setLoadedCallback(onBakedTextureMasksLoaded, MORPH_MASK_REQUESTED_DISCARD, TRUE, TRUE, new LLTextureMaskData( mID ), src_callback_list, paused); @@ -5983,7 +5989,8 @@ void LLVOAvatar::updateMeshTextures() } - for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().begin(); + for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = + LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().begin(); baked_iter != LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().end(); ++baked_iter) { @@ -6766,7 +6773,7 @@ void LLVOAvatar::onBakedTextureLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata) { - //llinfos << "onBakedTextureLoaded: " << src_vi->getID() << llendl; + // llinfos << "onBakedTextureLoaded: " << src_vi->getID() << llendl; LLUUID id = src_vi->getID(); LLUUID *avatar_idp = (LLUUID *)userdata; @@ -6797,12 +6804,6 @@ void LLVOAvatar::onBakedTextureLoaded(BOOL success, void LLVOAvatar::useBakedTexture( const LLUUID& id ) { - - /* if(id == head_baked->getID()) - mHeadBakedLoaded = TRUE; - mLastHeadBakedID = id; - mHeadMesh0.setTexture( head_baked ); - mHeadMesh1.setTexture( head_baked ); */ for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { LLViewerTexture* image_baked = getImage( mBakedTextureDatas[i].mTextureIndex, 0 ); @@ -6813,23 +6814,28 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) mBakedTextureDatas[i].mLastTextureID = id; mBakedTextureDatas[i].mIsUsed = true; - debugColorizeSubMeshes(i,LLColor4::green); - - avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin(); - avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end(); - for (; iter != end; ++iter) + if (isUsingLocalAppearance()) { - LLAvatarJointMesh* mesh = (*iter); - if (mesh) - { - mesh->setTexture( image_baked ); - } + llinfos << "not changing to baked texture while isUsingLocalAppearance" << llendl; } - if (mBakedTextureDatas[i].mTexLayerSet) + else { - //mBakedTextureDatas[i].mTexLayerSet->destroyComposite(); + debugColorizeSubMeshes(i,LLColor4::green); + + avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin(); + avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end(); + for (; iter != end; ++iter) + { + LLAvatarJointMesh* mesh = (*iter); + if (mesh) + { + mesh->setTexture( image_baked ); + } + } } - const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i); + + const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = + LLAvatarAppearanceDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i); for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin(); local_tex_iter != baked_dict->mLocalTextures.end(); ++local_tex_iter) -- cgit v1.2.3 From a3ad89dd3535e2621b9f100fe45a2a3814b4045a Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 15 Nov 2012 13:54:22 -0500 Subject: removed param location from archetype dump - not currently used --- indra/newview/llvoavatar.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 160f498443..94a59253c4 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6356,10 +6356,10 @@ void dump_visual_param(apr_file_t* file, LLVisualParam* viewer_param, F32 value) wtype = vparam->getWearableType(); } S32 u8_value = F32_to_U8(value,viewer_param->getMinWeight(),viewer_param->getMaxWeight()); - apr_file_printf(file, "\t\t\n", + apr_file_printf(file, "\t\t\n", viewer_param->getID(), viewer_param->getName().c_str(), value, u8_value, type_string.c_str(), - LLWearableType::getTypeName(LLWearableType::EType(wtype)).c_str(), - param_location_name(vparam->getParamLocation()).c_str() + LLWearableType::getTypeName(LLWearableType::EType(wtype)).c_str() +// param_location_name(vparam->getParamLocation()).c_str() ); } -- cgit v1.2.3 From 8657da24cd206af87cb32d095b347f7aa07596b5 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 11 Dec 2012 18:21:09 -0500 Subject: SH-3604 WIP - added base outfit link creation to retryable copy/link operations. Resolves race condition with cof version and server texture bakes --- indra/newview/llvoavatar.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 18d3ea7a47..117f28cc36 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6462,6 +6462,10 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) // 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; -- cgit v1.2.3 From cbf24c55d511b2390fdc4c12698682531f26f41b Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 20 Dec 2012 10:27:18 -0500 Subject: SH-3344 WIP - additional debugging output for avatar local textures --- indra/newview/llvoavatar.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 117f28cc36..086e4306f8 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5811,6 +5811,7 @@ void LLVOAvatar::debugColorizeSubMeshes(U32 i, const LLColor4& color) // virtual void LLVOAvatar::updateMeshTextures() { + static S32 update_counter = 0; mBakedTextureDebugText.clear(); // if user has never specified a texture, assign the default @@ -5840,7 +5841,8 @@ void LLVOAvatar::updateMeshTextures() std::vector use_lkg_baked_layer; // lkg = "last known good" use_lkg_baked_layer.resize(mBakedTextureDatas.size(), false); - mBakedTextureDebugText += "indx layerset linvld ltda ilb ulkg ltid\n"; + mBakedTextureDebugText += llformat("%06d\n",update_counter++); + mBakedTextureDebugText += "indx layerset linvld ltda ilb ulkg ltid\n"; for (U32 i=0; i < mBakedTextureDatas.size(); i++) { is_layer_baked[i] = isTextureDefined(mBakedTextureDatas[i].mTextureIndex); -- cgit v1.2.3 From 4e1eda1c3bc898ae8481b8dfcff4b29196ac835e Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 7 Jan 2013 18:31:28 -0500 Subject: SH-3344 WIP - keep avatar local textures flagged no-delete while in use --- indra/newview/llvoavatar.cpp | 73 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 086e4306f8..df0b8171a6 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4004,8 +4004,81 @@ U32 LLVOAvatar::renderImpostor(LLColor4U color, S32 diffuse_channel) //------------------------------------------------------------------------ // LLVOAvatar::updateTextures() //------------------------------------------------------------------------ +void LLVOAvatar::collectTextureUUIDs(std::set& ids, S32& local_mem, S32& baked_mem) +{ + for (U32 texture_index = 0; texture_index < getNumTEs(); texture_index++) + { + LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getTEWearableType((ETextureIndex)texture_index); + U32 num_wearables = gAgentWearables.getWearableCount(wearable_type); + + LLViewerFetchedTexture *imagep = NULL; + for (U32 wearable_index = 0; wearable_index < num_wearables; wearable_index++) + { + imagep = LLViewerTextureManager::staticCastToFetchedTexture(getImage(texture_index, wearable_index), TRUE); + if (imagep) + { + const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearanceDictionary::getInstance()->getTexture((ETextureIndex)texture_index); + if (texture_dict->mIsLocalTexture) + { + local_mem += imagep->getTextureMemory(); + ids.insert(imagep->getID()); + } + } + } + if (isIndexBakedTexture((ETextureIndex) texture_index)) + { + imagep = LLViewerTextureManager::staticCastToFetchedTexture(getImage(texture_index,0), TRUE); + if (imagep) + { + baked_mem += imagep->getTextureMemory(); + ids.insert(imagep->getID()); + } + } + } + ids.erase(IMG_DEFAULT); + ids.erase(IMG_DEFAULT_AVATAR); + ids.erase(IMG_INVISIBLE); +} + +void LLVOAvatar::releaseOldTextures() +{ + S32 current_texture_mem = 0; + + // Any textures that we used to be using but are no longer using should no longer be flagged as "NO_DELETE" + std::set new_texture_ids; + S32 local_mem = 0, baked_mem = 0; + collectTextureUUIDs(new_texture_ids, local_mem, baked_mem); + LL_DEBUGS("Avatar") << getFullname() << " local_mem: " << local_mem << " baked_mem: " << baked_mem << llendl; + for (std::set::iterator it = mTextureIDs.begin(); it != mTextureIDs.end(); ++it) + { + if (new_texture_ids.find(*it) == new_texture_ids.end()) + { + LLViewerFetchedTexture *imagep = gTextureList.findImage(*it); + if (imagep) + { + current_texture_mem += imagep->getTextureMemory(); + if (imagep->getTextureState() == LLGLTexture::NO_DELETE) + { + // This will allow the texture to be deleted if not in use. + imagep->forceActive(); + + // This resets the clock to being flagged as + // unused, preventing the texture from being + // deleted immediately. If other avatars or + // objects are using it, it can still be flagged + // no-delete by them. + imagep->forceUpdateBindStats(); + } + } + } + } + mTextureIDs = new_texture_ids; +} + void LLVOAvatar::updateTextures() { + releaseOldTextures(); + BOOL render_avatar = TRUE; if (mIsDummy) -- cgit v1.2.3 From b3cbe35532b365e223df14921532a6e587695dec Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 18 Jan 2013 16:51:03 -0500 Subject: SH-3344 WIP - more texture load monitoring --- indra/newview/llvoavatar.cpp | 96 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 84 insertions(+), 12 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index df0b8171a6..54bb755ad5 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2888,7 +2888,11 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) { central_bake_version = getRegion()->getCentralBakeVersion(); } - addDebugText(llformat("mLocal: %d, mEdit: %d, mUSB: %d, CBV: %d", + bool all_baked_downloaded = allBakedTexturesCompletelyDownloaded(); + bool all_local_downloaded = allLocalTexturesCompletelyDownloaded(); + addDebugText(llformat("%s%s - mLocal: %d, mEdit: %d, mUSB: %d, CBV: %d", + all_local_downloaded ? "L" : "l", + all_baked_downloaded ? "B" : "b", mUseLocalAppearance, mIsEditingAppearance, mUseServerBakes, central_bake_version)); } @@ -4001,10 +4005,48 @@ U32 LLVOAvatar::renderImpostor(LLColor4U color, S32 diffuse_channel) return 6; } -//------------------------------------------------------------------------ -// LLVOAvatar::updateTextures() -//------------------------------------------------------------------------ -void LLVOAvatar::collectTextureUUIDs(std::set& ids, S32& local_mem, S32& baked_mem) +bool LLVOAvatar::allTexturesCompletelyDownloaded(std::set& ids) +{ + for (std::set::const_iterator it = ids.begin(); it != ids.end(); ++it) + { + LLViewerFetchedTexture *imagep = gTextureList.findImage(*it); + if (imagep && imagep->getDiscardLevel()!=0) + { + return false; + } + } + return true; +} + +bool LLVOAvatar::allLocalTexturesCompletelyDownloaded() +{ + std::set local_ids; + collectLocalTextureUUIDs(local_ids); + return allTexturesCompletelyDownloaded(local_ids); +} + +bool LLVOAvatar::allBakedTexturesCompletelyDownloaded() +{ + std::set baked_ids; + collectLocalTextureUUIDs(baked_ids); + return allTexturesCompletelyDownloaded(baked_ids); +} + +S32 LLVOAvatar::totalTextureMemForUUIDS(std::set& ids) +{ + S32 result = 0; + for (std::set::const_iterator it = ids.begin(); it != ids.end(); ++it) + { + LLViewerFetchedTexture *imagep = gTextureList.findImage(*it); + if (imagep) + { + result += imagep->getTextureMemory(); + } + } + return result; +} + +void LLVOAvatar::collectLocalTextureUUIDs(std::set& ids) { for (U32 texture_index = 0; texture_index < getNumTEs(); texture_index++) { @@ -4020,17 +4062,26 @@ void LLVOAvatar::collectTextureUUIDs(std::set& ids, S32& local_mem, S32& const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearanceDictionary::getInstance()->getTexture((ETextureIndex)texture_index); if (texture_dict->mIsLocalTexture) { - local_mem += imagep->getTextureMemory(); ids.insert(imagep->getID()); } } } + } + ids.erase(IMG_DEFAULT); + ids.erase(IMG_DEFAULT_AVATAR); + ids.erase(IMG_INVISIBLE); +} + +void LLVOAvatar::collectBakedTextureUUIDs(std::set& ids) +{ + for (U32 texture_index = 0; texture_index < getNumTEs(); texture_index++) + { + LLViewerFetchedTexture *imagep = NULL; if (isIndexBakedTexture((ETextureIndex) texture_index)) { imagep = LLViewerTextureManager::staticCastToFetchedTexture(getImage(texture_index,0), TRUE); if (imagep) { - baked_mem += imagep->getTextureMemory(); ids.insert(imagep->getID()); } } @@ -4040,15 +4091,36 @@ void LLVOAvatar::collectTextureUUIDs(std::set& ids, S32& local_mem, S32& ids.erase(IMG_INVISIBLE); } +void LLVOAvatar::collectTextureUUIDs(std::set& ids) +{ + collectLocalTextureUUIDs(ids); + collectBakedTextureUUIDs(ids); +} + void LLVOAvatar::releaseOldTextures() { S32 current_texture_mem = 0; // Any textures that we used to be using but are no longer using should no longer be flagged as "NO_DELETE" + std::set baked_texture_ids; + collectBakedTextureUUIDs(baked_texture_ids); + S32 new_baked_mem = totalTextureMemForUUIDS(baked_texture_ids); + + std::set local_texture_ids; + collectLocalTextureUUIDs(local_texture_ids); + S32 new_local_mem = totalTextureMemForUUIDS(local_texture_ids); + std::set new_texture_ids; - S32 local_mem = 0, baked_mem = 0; - collectTextureUUIDs(new_texture_ids, local_mem, baked_mem); - LL_DEBUGS("Avatar") << getFullname() << " local_mem: " << local_mem << " baked_mem: " << baked_mem << llendl; + new_texture_ids.insert(baked_texture_ids.begin(),baked_texture_ids.end()); + new_texture_ids.insert(local_texture_ids.begin(),local_texture_ids.end()); + S32 new_total_mem = totalTextureMemForUUIDS(new_texture_ids); + + S32 old_total_mem = totalTextureMemForUUIDS(mTextureIDs); + LL_DEBUGS("Avatar") << getFullname() << " old_total_mem: " << old_total_mem << " new_total_mem (L/B): " << new_total_mem << " (" << new_local_mem <<", " << new_baked_mem << ")" << llendl; + if (!isSelf() && new_total_mem > new_baked_mem) + { + llwarns << "extra local textures stored for non-self av" << llendl; + } for (std::set::iterator it = mTextureIDs.begin(); it != mTextureIDs.end(); ++it) { if (new_texture_ids.find(*it) == new_texture_ids.end()) @@ -4062,8 +4134,8 @@ void LLVOAvatar::releaseOldTextures() // This will allow the texture to be deleted if not in use. imagep->forceActive(); - // This resets the clock to being flagged as - // unused, preventing the texture from being + // This resets the clock to texture being flagged + // as unused, preventing the texture from being // deleted immediately. If other avatars or // objects are using it, it can still be flagged // no-delete by them. -- cgit v1.2.3 From e378effca36a0a6efd6036586c3259ba5367b012 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 22 Jan 2013 21:47:35 -0500 Subject: Added cof version information to DebugAvatarAppearanceMessage output --- indra/newview/llvoavatar.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 54bb755ad5..83667c8c55 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2890,11 +2890,23 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) } bool all_baked_downloaded = allBakedTexturesCompletelyDownloaded(); bool all_local_downloaded = allLocalTexturesCompletelyDownloaded(); - addDebugText(llformat("%s%s - mLocal: %d, mEdit: %d, mUSB: %d, CBV: %d", + S32 curr_cof_version = -1; + S32 last_request_cof_version = -1; + S32 last_received_cof_version = -1; + if (isSelf()) + { + curr_cof_version = LLAppearanceMgr::instance().getCOFVersion(); + last_request_cof_version = LLAppearanceMgr::instance().getLastUpdateRequestCOFVersion(); + last_received_cof_version = LLAppearanceMgr::instance().getLastAppearanceUpdateCOFVersion(); + } + + addDebugText(llformat("%s%s - mLocal: %d, mEdit: %d, mUSB: %d, CBV: %d - cof: %d req: %d rcv:%d", all_local_downloaded ? "L" : "l", all_baked_downloaded ? "B" : "b", mUseLocalAppearance, mIsEditingAppearance, - mUseServerBakes, central_bake_version)); + mUseServerBakes, central_bake_version, + curr_cof_version, last_request_cof_version, last_received_cof_version + )); } if (gSavedSettings.getBOOL("DebugAvatarCompositeBaked")) { @@ -6613,6 +6625,8 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) << " last_update_request_cof_version " << last_update_request_cof_version << " my_cof_version " << LLAppearanceMgr::instance().getCOFVersion() << llendl; + LLAppearanceMgr::instance().setLastAppearanceUpdateCOFVersion(this_update_cof_version); + if (getRegion() && (getRegion()->getCentralBakeVersion()==0)) { llwarns << avString() << "Received AvatarAppearance message for self in non-server-bake region" << llendl; -- cgit v1.2.3 From d56009af85cd3807dbaaf23e4f4ce9539a637602 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 23 Jan 2013 11:04:23 -0500 Subject: fixes and updates to DebugAvatarAppearanceMessage status line --- indra/newview/llvoavatar.cpp | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 83667c8c55..6aad3c8918 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2890,23 +2890,20 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) } bool all_baked_downloaded = allBakedTexturesCompletelyDownloaded(); bool all_local_downloaded = allLocalTexturesCompletelyDownloaded(); - S32 curr_cof_version = -1; - S32 last_request_cof_version = -1; - S32 last_received_cof_version = -1; + std::string debug_line = llformat("%s%s - mLocal: %d, mEdit: %d, mUSB: %d, CBV: %d", + all_local_downloaded ? "L" : "l", + all_baked_downloaded ? "B" : "b", + mUseLocalAppearance, mIsEditingAppearance, + mUseServerBakes, central_bake_version); if (isSelf()) { - curr_cof_version = LLAppearanceMgr::instance().getCOFVersion(); - last_request_cof_version = LLAppearanceMgr::instance().getLastUpdateRequestCOFVersion(); - last_received_cof_version = LLAppearanceMgr::instance().getLastAppearanceUpdateCOFVersion(); + S32 curr_cof_version = LLAppearanceMgr::instance().getCOFVersion(); + S32 last_request_cof_version = LLAppearanceMgr::instance().getLastUpdateRequestCOFVersion(); + S32 last_received_cof_version = LLAppearanceMgr::instance().getLastAppearanceUpdateCOFVersion(); + debug_line += llformat(" - cof: %d req: %d rcv:%d", + curr_cof_version, last_request_cof_version, last_received_cof_version); } - - addDebugText(llformat("%s%s - mLocal: %d, mEdit: %d, mUSB: %d, CBV: %d - cof: %d req: %d rcv:%d", - all_local_downloaded ? "L" : "l", - all_baked_downloaded ? "B" : "b", - mUseLocalAppearance, mIsEditingAppearance, - mUseServerBakes, central_bake_version, - curr_cof_version, last_request_cof_version, last_received_cof_version - )); + addDebugText(debug_line); } if (gSavedSettings.getBOOL("DebugAvatarCompositeBaked")) { @@ -4040,7 +4037,7 @@ bool LLVOAvatar::allLocalTexturesCompletelyDownloaded() bool LLVOAvatar::allBakedTexturesCompletelyDownloaded() { std::set baked_ids; - collectLocalTextureUUIDs(baked_ids); + collectBakedTextureUUIDs(baked_ids); return allTexturesCompletelyDownloaded(baked_ids); } -- cgit v1.2.3 From 878e31dce2483cea0a1a38f076d4558c04ec9642 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 23 Jan 2013 16:04:08 -0500 Subject: SH-3534 WIP - better encapsulation of mUseServerBakes --- indra/newview/llvoavatar.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 6aad3c8918..3d58c50eba 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6651,7 +6651,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) return; } - mUseServerBakes = (appearance_version > 0); + setIsUsingServerBakes(appearance_version > 0); applyParsedTEMessage(tec); @@ -7276,6 +7276,11 @@ void LLVOAvatar::bodySizeChanged() } } +BOOL LLVOAvatar::isUsingServerBakes() const +{ + return mUseServerBakes; +} + void LLVOAvatar::setIsUsingServerBakes(BOOL newval) { mUseServerBakes = newval; -- cgit v1.2.3 From 9f5e1d601c86e7036d3ecbae063ea637f0cdc7ca Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 23 Jan 2013 18:31:21 -0500 Subject: SH-3779 WIP - fully parse appearance message before trying to do anything with it --- indra/newview/llvoavatar.cpp | 130 +++++++++++++++++++++++++++++++------------ 1 file changed, 94 insertions(+), 36 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 3d58c50eba..cb9b1aa5cc 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6574,6 +6574,91 @@ void LLVOAvatar::dumpAppearanceMsgParams( const std::string& dump_prefix, } } +struct LLAppearanceMessageContents +{ + LLAppearanceMessageContents(): + mAppearanceVersion(0), + mCOFVersion(LLViewerInventoryCategory::VERSION_UNKNOWN) + { + } + + LLTEContents mTEContents; + U8 mAppearanceVersion; + S32 mCOFVersion; + // For future use: + //U32 appearance_flags = 0; + std::vector mParams; +}; + +void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMessageContents& contents) +{ + parseTEMessage(mesgsys, _PREHASH_ObjectData, -1, contents.mTEContents); + + // Parse the AppearanceData field, if any. + if (mesgsys->has(_PREHASH_AppearanceData)) + { + mesgsys->getU8Fast(_PREHASH_AppearanceData, _PREHASH_AppearanceVersion, contents.mAppearanceVersion, 0); + mesgsys->getS32Fast(_PREHASH_AppearanceData, _PREHASH_CofVersion, contents.mCOFVersion, 0); + // For future use: + //mesgsys->getU32Fast(_PREHASH_AppearanceData, _PREHASH_Flags, appearance_flags, 0); + } + + // Parse visual params, if any. + S32 num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_VisualParam); + bool drop_visual_params_debug = gSavedSettings.getBOOL("BlockSomeAvatarAppearanceVisualParams") && (ll_rand(2) == 0); // pretend that ~12% of AvatarAppearance messages arrived without a VisualParam block, for testing + if( num_blocks > 1 && !drop_visual_params_debug) + { + LL_DEBUGS("Avatar") << avString() << " handle visual params, num_blocks " << num_blocks << LL_ENDL; + + LLVisualParam* param = getFirstVisualParam(); + llassert(param); // if this ever fires, we should do the same as when num_blocks<=1 + if (!param) + { + llwarns << "No visual params!" << llendl; + } + else + { + for( S32 i = 0; i < num_blocks; i++ ) + { + while( param && (param->getGroup() != VISUAL_PARAM_GROUP_TWEAKABLE) ) // should not be any of group VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT + { + param = getNextVisualParam(); + } + + if( !param ) + { + // more visual params supplied than expected - just process what we know about + break; + } + + U8 value; + mesgsys->getU8Fast(_PREHASH_VisualParam, _PREHASH_ParamValue, value, i); + F32 newWeight = U8_to_F32(value, param->getMinWeight(), param->getMaxWeight()); + contents.mParams.push_back(newWeight); + + param = getNextVisualParam(); + } + } + + const S32 expected_tweakable_count = getVisualParamCountInGroup(VISUAL_PARAM_GROUP_TWEAKABLE); // don't worry about VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT + if (num_blocks != expected_tweakable_count) + { + llinfos << "Number of params in AvatarAppearance msg (" << num_blocks << ") does not match number of tweakable params in avatar xml file (" << expected_tweakable_count << "). Processing what we can. object: " << getID() << llendl; + } + } + else + { + if (drop_visual_params_debug) + { + llinfos << "Debug-faked lack of parameters on AvatarAppearance for object: " << getID() << llendl; + } + else + { + llinfos << "AvatarAppearance msg received without any parameters, object: " << getID() << llendl; + } + } +} + //----------------------------------------------------------------------------- // processAvatarAppearance() //----------------------------------------------------------------------------- @@ -6598,22 +6683,12 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) ESex old_sex = getSex(); - LLTEContents tec; - parseTEMessage(mesgsys, _PREHASH_ObjectData, -1, tec); + LLAppearanceMessageContents contents; + parseAppearanceMessage(mesgsys, contents); - U8 appearance_version = 0; - S32 this_update_cof_version = LLViewerInventoryCategory::VERSION_UNKNOWN; + U8 appearance_version = contents.mAppearanceVersion; + S32 this_update_cof_version = contents.mCOFVersion; S32 last_update_request_cof_version = LLAppearanceMgr::instance().mLastUpdateRequestCOFVersion; - // For future use: - //U32 appearance_flags = 0; - - if (mesgsys->has(_PREHASH_AppearanceData)) - { - mesgsys->getU8Fast(_PREHASH_AppearanceData, _PREHASH_AppearanceVersion, appearance_version, 0); - mesgsys->getS32Fast(_PREHASH_AppearanceData, _PREHASH_CofVersion, this_update_cof_version, 0); - // For future use: - //mesgsys->getU32Fast(_PREHASH_AppearanceData, _PREHASH_Flags, appearance_flags, 0); - } // Only now that we have result of appearance_version can we decide whether to bail out. if( isSelf() ) @@ -6634,7 +6709,6 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) } } - // Check for stale update. if (isSelf() && (appearance_version>0) @@ -6653,7 +6727,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) setIsUsingServerBakes(appearance_version > 0); - applyParsedTEMessage(tec); + applyParsedTEMessage(contents.mTEContents); // prevent the overwriting of valid baked textures with invalid baked textures for (U8 baked_index = 0; baked_index < mBakedTextureDatas.size(); baked_index++) @@ -6667,7 +6741,6 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) } } - // runway - was // if (!is_first_appearance_message ) // which means it would be called on second appearance message - probably wrong. @@ -6680,9 +6753,8 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) gPipeline.markGLRebuild(this); // parse visual params - S32 num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_VisualParam); - bool drop_visual_params_debug = gSavedSettings.getBOOL("BlockSomeAvatarAppearanceVisualParams") && (ll_rand(2) == 0); // pretend that ~12% of AvatarAppearance messages arrived without a VisualParam block, for testing - if( num_blocks > 1 && !drop_visual_params_debug) + S32 num_blocks = contents.mParams.size(); + if( num_blocks > 1) { LL_DEBUGS("Avatar") << avString() << " handle visual params, num_blocks " << num_blocks << LL_ENDL; BOOL params_changed = FALSE; @@ -6696,7 +6768,6 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) } else { - std::vector params_for_dump; for( S32 i = 0; i < num_blocks; i++ ) { while( param && (param->getGroup() != VISUAL_PARAM_GROUP_TWEAKABLE) ) // should not be any of group VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT @@ -6710,14 +6781,10 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) break; } - U8 value; - mesgsys->getU8Fast(_PREHASH_VisualParam, _PREHASH_ParamValue, value, i); - F32 newWeight = U8_to_F32(value, param->getMinWeight(), param->getMaxWeight()); - params_for_dump.push_back(newWeight); + F32 newWeight = contents.mParams[i]; if (is_first_appearance_message || (param->getWeight() != newWeight)) { - //llinfos << "Received update for param " << param->getDisplayName() << " at value " << newWeight << llendl; params_changed = TRUE; if(is_first_appearance_message) { @@ -6732,7 +6799,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) param = getNextVisualParam(); } if (enable_verbose_dumps) - dumpAppearanceMsgParams(dump_prefix + "appearance_msg", params_for_dump, tec); + dumpAppearanceMsgParams(dump_prefix + "appearance_msg", contents.mParams, contents.mTEContents); } if (enable_verbose_dumps) { dumpArchetypeXML(dump_prefix + "process_post_set_weights"); } @@ -6764,14 +6831,6 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) { // AvatarAppearance message arrived without visual params LL_DEBUGS("Avatar") << avString() << "no visual params" << LL_ENDL; - if (drop_visual_params_debug) - { - llinfos << "Debug-faked lack of parameters on AvatarAppearance for object: " << getID() << llendl; - } - else - { - llinfos << "AvatarAppearance msg received without any parameters, object: " << getID() << llendl; - } const F32 LOADING_TIMEOUT_SECONDS = 60.f; // this isn't really a problem if we already have a non-default shape @@ -6802,7 +6861,6 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) updateMeshTextures(); if (enable_verbose_dumps) dumpArchetypeXML(dump_prefix + "process_end"); -// llinfos << "processAvatarAppearance end " << mID << llendl; } // static -- cgit v1.2.3 From 67c5d567932fd825dfcf8931af595c5df6dcdeb1 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 24 Jan 2013 17:28:15 -0500 Subject: SH-3779 WIP - handling of appearance version param --- indra/newview/llvoavatar.cpp | 107 +++++++++++++++++++++++++------------------ 1 file changed, 63 insertions(+), 44 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index cb9b1aa5cc..a76a15671c 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1796,11 +1796,13 @@ S32 LLVOAvatar::setTETexture(const U8 te, const LLUUID& uuid) return setTETextureCore(te, uuid, url); } + llinfos << "get texture from host " << uuid << llendl; LLHost target_host = getObjectHost(); return setTETextureCore(te, uuid, target_host); } else { + llinfos << "get texture from other " << uuid << llendl; return setTETextureCore(te, uuid, LLHost::invalid); } } @@ -6577,17 +6579,18 @@ void LLVOAvatar::dumpAppearanceMsgParams( const std::string& dump_prefix, struct LLAppearanceMessageContents { LLAppearanceMessageContents(): - mAppearanceVersion(0), + mAppearanceVersion(-1), mCOFVersion(LLViewerInventoryCategory::VERSION_UNKNOWN) { } LLTEContents mTEContents; - U8 mAppearanceVersion; + S32 mAppearanceVersion; S32 mCOFVersion; // For future use: //U32 appearance_flags = 0; - std::vector mParams; + std::vector mParamWeights; + std::vector mParams; }; void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMessageContents& contents) @@ -6597,7 +6600,10 @@ void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMe // Parse the AppearanceData field, if any. if (mesgsys->has(_PREHASH_AppearanceData)) { - mesgsys->getU8Fast(_PREHASH_AppearanceData, _PREHASH_AppearanceVersion, contents.mAppearanceVersion, 0); + U8 av_u8; + mesgsys->getU8Fast(_PREHASH_AppearanceData, _PREHASH_AppearanceVersion, av_u8, 0); + contents.mAppearanceVersion = av_u8; + llinfos << "appversion set by AppearanceData field: " << contents.mAppearanceVersion << llendl; mesgsys->getS32Fast(_PREHASH_AppearanceData, _PREHASH_CofVersion, contents.mCOFVersion, 0); // For future use: //mesgsys->getU32Fast(_PREHASH_AppearanceData, _PREHASH_Flags, appearance_flags, 0); @@ -6634,7 +6640,8 @@ void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMe U8 value; mesgsys->getU8Fast(_PREHASH_VisualParam, _PREHASH_ParamValue, value, i); F32 newWeight = U8_to_F32(value, param->getMinWeight(), param->getMaxWeight()); - contents.mParams.push_back(newWeight); + contents.mParamWeights.push_back(newWeight); + contents.mParams.push_back(param); param = getNextVisualParam(); } @@ -6657,6 +6664,28 @@ void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMe llinfos << "AvatarAppearance msg received without any parameters, object: " << getID() << llendl; } } + + if (contents.mAppearanceVersion < 0) // not set explicitly, try to get from visual param. + { + LLVisualParam* appearance_version_param = getVisualParam(11000); + if (appearance_version_param) + { + std::vector::iterator it = std::find(contents.mParams.begin(), contents.mParams.end(),appearance_version_param); + if (it != contents.mParams.end()) + { + S32 index = it - contents.mParams.begin(); + llinfos << "index: " << index << llendl; + S32 appearance_version = llround(contents.mParamWeights[index]); + contents.mAppearanceVersion = appearance_version; + llinfos << "appversion set by appearance_version param: " << contents.mAppearanceVersion << llendl; + } + } + } + if (contents.mAppearanceVersion < 0) // still not set, go with 0. + { + contents.mAppearanceVersion = 0; + llinfos << "appversion set by default: " << contents.mAppearanceVersion << llendl; + } } //----------------------------------------------------------------------------- @@ -6725,6 +6754,17 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) return; } + S32 num_params = contents.mParamWeights.size(); + if (num_params <= 1) + { + // In this case, we have no reliable basis for knowing + // appearance version, which may cause us to look for baked + // textures in the wrong place and flag them as missing + // assets. + llinfos << "ignoring appearance message due to lack of params" << llendl; + return; + } + setIsUsingServerBakes(appearance_version > 0); applyParsedTEMessage(contents.mTEContents); @@ -6752,62 +6792,41 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) setCompositeUpdatesEnabled( FALSE ); gPipeline.markGLRebuild(this); - // parse visual params - S32 num_blocks = contents.mParams.size(); - if( num_blocks > 1) + // Apply visual params + if( num_params > 1) { - LL_DEBUGS("Avatar") << avString() << " handle visual params, num_blocks " << num_blocks << LL_ENDL; + LL_DEBUGS("Avatar") << avString() << " handle visual params, num_params " << num_params << LL_ENDL; BOOL params_changed = FALSE; BOOL interp_params = FALSE; - LLVisualParam* param = getFirstVisualParam(); - llassert(param); // if this ever fires, we should do the same as when num_blocks<=1 - if (!param) - { - llwarns << "No visual params!" << llendl; - } - else + for( S32 i = 0; i < num_params; i++ ) { - for( S32 i = 0; i < num_blocks; i++ ) + LLVisualParam* param = contents.mParams[i]; + F32 newWeight = contents.mParamWeights[i]; + + if (is_first_appearance_message || (param->getWeight() != newWeight)) { - while( param && (param->getGroup() != VISUAL_PARAM_GROUP_TWEAKABLE) ) // should not be any of group VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT + params_changed = TRUE; + if(is_first_appearance_message) { - param = getNextVisualParam(); + param->setWeight(newWeight, FALSE); } - - if( !param ) - { - // more visual params supplied than expected - just process what we know about - break; - } - - F32 newWeight = contents.mParams[i]; - - if (is_first_appearance_message || (param->getWeight() != newWeight)) + else { - params_changed = TRUE; - if(is_first_appearance_message) - { - param->setWeight(newWeight, FALSE); - } - else - { - interp_params = TRUE; - param->setAnimationTarget(newWeight, FALSE); - } + interp_params = TRUE; + param->setAnimationTarget(newWeight, FALSE); } - param = getNextVisualParam(); } - if (enable_verbose_dumps) - dumpAppearanceMsgParams(dump_prefix + "appearance_msg", contents.mParams, contents.mTEContents); } + if (enable_verbose_dumps) + dumpAppearanceMsgParams(dump_prefix + "appearance_msg", contents.mParamWeights, contents.mTEContents); if (enable_verbose_dumps) { dumpArchetypeXML(dump_prefix + "process_post_set_weights"); } const S32 expected_tweakable_count = getVisualParamCountInGroup(VISUAL_PARAM_GROUP_TWEAKABLE); // don't worry about VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT - if (num_blocks != expected_tweakable_count) + if (num_params != expected_tweakable_count) { - llinfos << "Number of params in AvatarAppearance msg (" << num_blocks << ") does not match number of tweakable params in avatar xml file (" << expected_tweakable_count << "). Processing what we can. object: " << getID() << llendl; + llinfos << "Number of params in AvatarAppearance msg (" << num_params << ") does not match number of tweakable params in avatar xml file (" << expected_tweakable_count << "). Processing what we can. object: " << getID() << llendl; } if (params_changed) -- cgit v1.2.3 From d2c3ee9624eed458320600860b9f84cca8b80607 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 25 Jan 2013 09:31:20 -0500 Subject: SH-3779 WIP - less verbose appearance dumps, keep appearance version visual param in sync with mUseServerBakes --- indra/newview/llvoavatar.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index a76a15671c..dbc80c0217 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6695,7 +6695,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) { bool enable_verbose_dumps = gSavedSettings.getBOOL("DebugAvatarAppearanceMessage"); std::string dump_prefix = getFullname() + "_" + (isSelf()?"s":"o") + "_"; - if (enable_verbose_dumps) { dumpArchetypeXML(dump_prefix + "process_start"); } + //if (enable_verbose_dumps) { dumpArchetypeXML(dump_prefix + "process_start"); } if (gSavedSettings.getBOOL("BlockAvatarAppearanceMessages")) { llwarns << "Blocking AvatarAppearance message" << llendl; @@ -6819,9 +6819,11 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) } } if (enable_verbose_dumps) + { dumpAppearanceMsgParams(dump_prefix + "appearance_msg", contents.mParamWeights, contents.mTEContents); + } - if (enable_verbose_dumps) { dumpArchetypeXML(dump_prefix + "process_post_set_weights"); } + //if (enable_verbose_dumps) { dumpArchetypeXML(dump_prefix + "process_post_set_weights"); } const S32 expected_tweakable_count = getVisualParamCountInGroup(VISUAL_PARAM_GROUP_TWEAKABLE); // don't worry about VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT if (num_params != expected_tweakable_count) @@ -6879,7 +6881,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) updateMeshTextures(); - if (enable_verbose_dumps) dumpArchetypeXML(dump_prefix + "process_end"); + //if (enable_verbose_dumps) dumpArchetypeXML(dump_prefix + "process_end"); } // static @@ -7355,12 +7357,24 @@ void LLVOAvatar::bodySizeChanged() 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; + llassert(is_approx_equal(wt,expect_wt)); +#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 -- cgit v1.2.3 From cbf7de453869749abd9fead08897d1e154bb0f5e Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 28 Jan 2013 13:47:00 -0500 Subject: SH-3779 WIP, SH-3534 WIP - more bake-status tracking --- indra/newview/llvoavatar.cpp | 61 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index dbc80c0217..6efd1a27eb 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2897,6 +2897,8 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) all_baked_downloaded ? "B" : "b", mUseLocalAppearance, mIsEditingAppearance, mUseServerBakes, central_bake_version); + std::string origin_string = bakedTextureOriginInfo(); + debug_line += " [" + origin_string + "]"; if (isSelf()) { S32 curr_cof_version = LLAppearanceMgr::instance().getCOFVersion(); @@ -4043,6 +4045,60 @@ bool LLVOAvatar::allBakedTexturesCompletelyDownloaded() 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 baked_ids; + collectBakedTextureUUIDs(baked_ids); + for (std::set::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; + + std::set baked_ids; + collectBakedTextureUUIDs(baked_ids); + for (std::set::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) result += "u"; // server-bake texture with url + else if (has_host && !has_url) result += "h"; // old-style texture on sim + else if (has_host && has_url) result += "?"; // both origins? + else if (!has_host && !has_url) result += "n"; // no origin? + } + return result; +} + S32 LLVOAvatar::totalTextureMemForUUIDS(std::set& ids) { S32 result = 0; @@ -7363,7 +7419,10 @@ BOOL LLVOAvatar::isUsingServerBakes() const llassert(appearance_version_param); F32 wt = appearance_version_param->getWeight(); F32 expect_wt = mUseServerBakes ? 1.0 : 0.0; - llassert(is_approx_equal(wt,expect_wt)); + if (!is_approx_equal(wt,expect_wt)) + { + llwarns << "wt " << wt << " differs from expected " << expect_wt << llendl; + } #endif return mUseServerBakes; -- cgit v1.2.3 From 2f638300cd7e2c3ae675125ade037205403b5c54 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 30 Jan 2013 10:14:16 -0500 Subject: SH-3780 WIP - more checking on appearance param values --- indra/newview/llvoavatar.cpp | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 90887b5861..8f5d2a6aad 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6703,26 +6703,36 @@ void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMe } } - if (contents.mAppearanceVersion < 0) // not set explicitly, try to get from visual param. + LLVisualParam* appearance_version_param = getVisualParam(11000); + S32 param_appearance_version = -1; + if (appearance_version_param) { - LLVisualParam* appearance_version_param = getVisualParam(11000); - if (appearance_version_param) + std::vector::iterator it = std::find(contents.mParams.begin(), contents.mParams.end(),appearance_version_param); + if (it != contents.mParams.end()) { - std::vector::iterator it = std::find(contents.mParams.begin(), contents.mParams.end(),appearance_version_param); - if (it != contents.mParams.end()) - { - S32 index = it - contents.mParams.begin(); - llinfos << "index: " << index << llendl; - S32 appearance_version = llround(contents.mParamWeights[index]); - contents.mAppearanceVersion = appearance_version; - llinfos << "appversion set by appearance_version param: " << contents.mAppearanceVersion << llendl; - } + S32 index = it - contents.mParams.begin(); + llinfos << "index: " << index << llendl; + param_appearance_version = llround(contents.mParamWeights[index]); + LL_DEBUGS("Avatar") << "appversion req by appearance_version param: " << contents.mAppearanceVersion << llendl; } } + if ((contents.mAppearanceVersion) >= 0 && + (param_appearance_version >= 0) && + (contents.mAppearanceVersion != param_appearance_version)) + { + llwarns << "inconsistent appearance_version settings - field: " << + contents.mAppearanceVersion << ", param: " << param_appearance_version << llendl; + } + if (contents.mAppearanceVersion < 0 && + param_appearance_version >= 0) // not set explicitly, try to get from visual param. + { + contents.mAppearanceVersion = param_appearance_version; + LL_DEBUGS("Avatar") << "appversion set by appearance_version param: " << contents.mAppearanceVersion << llendl; + } if (contents.mAppearanceVersion < 0) // still not set, go with 0. { contents.mAppearanceVersion = 0; - llinfos << "appversion set by default: " << contents.mAppearanceVersion << llendl; + LL_DEBUGS("Avatar") << "appversion set by default: " << contents.mAppearanceVersion << llendl; } } -- cgit v1.2.3 From 3a7e3eacb86989c936cd6960cfa7434f3b8232fc Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 30 Jan 2013 13:56:05 -0500 Subject: SH-3800 WIP - flag mismatched expectations for baked texture origins --- indra/newview/llvoavatar.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 8f5d2a6aad..c512837632 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1796,8 +1796,8 @@ S32 LLVOAvatar::setTETexture(const U8 te, const LLUUID& uuid) } else { - llinfos << "get texture from other " << uuid << llendl; - return setTETextureCore(te, uuid, LLHost::invalid); + llinfos << "ignoring texture in non-baked slot " << uuid << " - will use null " << LLUUID::null << llendl; + return setTETextureCore(te, LLUUID::null, LLHost::invalid); } } -- cgit v1.2.3 From c24c974cc6a7df3a1df7f7a24ad52275430b18dd Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 30 Jan 2013 18:23:31 -0500 Subject: SH-3800 WIP - logic to detect baked textures being sought in the wrong place, avoid querying textures for which we have no authoritative data where they live --- indra/newview/llvoavatar.cpp | 59 +++++++++++++++++++++++++++----------------- 1 file changed, 37 insertions(+), 22 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index c512837632..f0986ac223 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1776,29 +1776,42 @@ U32 LLVOAvatar::processUpdateMessage(LLMessageSystem *mesgsys, return retval; } +LLViewerFetchedTexture *LLVOAvatar::getBakedTextureImage(const U8 te, const LLUUID& uuid) +{ + LLViewerFetchedTexture *result; + + const std::string url = getImageURL(te,uuid); + if (!url.empty()) + { + llinfos << "texture URL " << url << llendl; + result = LLViewerTextureManager::getFetchedTextureFromUrl( + url, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, uuid); + } + else + { + llinfos << "get texture from host " << uuid << llendl; + LLHost host = getObjectHost(); + result = LLViewerTextureManager::getFetchedTexture( + uuid, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, host); + } + return result; +} + // virtual S32 LLVOAvatar::setTETexture(const U8 te, const LLUUID& uuid) { - // The core setTETexture() method requests images, so we need - // to redirect certain avatar texture requests to different sims. - if (isIndexBakedTexture((ETextureIndex)te)) + if (!isIndexBakedTexture((ETextureIndex)te)) { - const std::string url = getImageURL(te,uuid); - if (!url.empty()) + if (!uuid.isNull()) { - llinfos << "texture URL " << url << llendl; - return setTETextureCore(te, uuid, url); + llinfos << "ignoring texture " << uuid << " in non-baked slot " << (S32)te << " - will use null " << llendl; } - - llinfos << "get texture from host " << uuid << llendl; - LLHost target_host = getObjectHost(); - return setTETextureCore(te, uuid, target_host); - } - else - { - llinfos << "ignoring texture in non-baked slot " << uuid << " - will use null " << LLUUID::null << llendl; - return setTETextureCore(te, LLUUID::null, LLHost::invalid); + return LLViewerObject::setTETexture(te, LLUUID::null); } + + LLViewerFetchedTexture *image = getBakedTextureImage(te,uuid); + llassert(image); + return setTETextureCore(te, image); } static LLFastTimer::DeclareTimer FTM_AVATAR_UPDATE("Avatar Update"); @@ -6070,6 +6083,8 @@ void LLVOAvatar::updateMeshTextures() last_id_string = "A"; else if (mBakedTextureDatas[i].mLastTextureID == IMG_DEFAULT) last_id_string = "D"; + else if (mBakedTextureDatas[i].mLastTextureID == IMG_INVISIBLE) + last_id_string = "I"; else last_id_string = "*"; bool is_ltda = layerset @@ -6750,12 +6765,6 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) return; } - BOOL is_first_appearance_message = !mFirstAppearanceMessageReceived; - mFirstAppearanceMessageReceived = TRUE; - - LL_INFOS("Avatar") << avString() << "processAvatarAppearance start " << mID - << " first? " << is_first_appearance_message << " self? " << isSelf() << LL_ENDL; - ESex old_sex = getSex(); @@ -6831,6 +6840,12 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) // runway - was // if (!is_first_appearance_message ) // which means it would be called on second appearance message - probably wrong. + BOOL is_first_appearance_message = !mFirstAppearanceMessageReceived; + mFirstAppearanceMessageReceived = TRUE; + + LL_INFOS("Avatar") << avString() << "processAvatarAppearance start " << mID + << " first? " << is_first_appearance_message << " self? " << isSelf() << LL_ENDL; + if (is_first_appearance_message ) { onFirstTEMessageReceived(); -- cgit v1.2.3 From 1518bc9f9add7812f0fa1f60d58c6b8f0ee462ca Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 30 Jan 2013 18:43:30 -0500 Subject: SH-3800 WIP - avoid complaints about source of various standard textures - IMG_DEFAULT_AVATAR etc --- indra/newview/llvoavatar.cpp | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index f0986ac223..5b4f31f91a 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1778,21 +1778,32 @@ U32 LLVOAvatar::processUpdateMessage(LLMessageSystem *mesgsys, LLViewerFetchedTexture *LLVOAvatar::getBakedTextureImage(const U8 te, const LLUUID& uuid) { - LLViewerFetchedTexture *result; - - const std::string url = getImageURL(te,uuid); - if (!url.empty()) + LLViewerFetchedTexture *result = NULL; + + if (uuid == IMG_DEFAULT_AVATAR || + uuid == IMG_DEFAULT || + uuid == IMG_INVISIBLE) { - llinfos << "texture URL " << url << llendl; - result = LLViewerTextureManager::getFetchedTextureFromUrl( - url, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, uuid); + // Should already exist, don't need to find it on sim or baked-texture host. + result = gTextureList.findImage(uuid); } - else + + if (!result) { - llinfos << "get texture from host " << uuid << llendl; - LLHost host = getObjectHost(); - result = LLViewerTextureManager::getFetchedTexture( - uuid, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, host); + const std::string url = getImageURL(te,uuid); + if (!url.empty()) + { + llinfos << "texture URL " << url << llendl; + result = LLViewerTextureManager::getFetchedTextureFromUrl( + url, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, uuid); + } + else + { + llinfos << "get texture from host " << uuid << llendl; + LLHost host = getObjectHost(); + result = LLViewerTextureManager::getFetchedTexture( + uuid, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, host); + } } return result; } -- cgit v1.2.3 From 235f77b8c6194d7e6ab55a73dda4a31d19948323 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 1 Feb 2013 09:13:31 -0500 Subject: SH-3800 WIP - reject appearance messages with contradictory appearance version info --- indra/newview/llvoavatar.cpp | 54 +++++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 21 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 5b4f31f91a..537bb70579 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6645,11 +6645,13 @@ struct LLAppearanceMessageContents { LLAppearanceMessageContents(): mAppearanceVersion(-1), + mParamAppearanceVersion(-1), mCOFVersion(LLViewerInventoryCategory::VERSION_UNKNOWN) { } LLTEContents mTEContents; S32 mAppearanceVersion; + S32 mParamAppearanceVersion; S32 mCOFVersion; // For future use: //U32 appearance_flags = 0; @@ -6730,7 +6732,6 @@ void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMe } LLVisualParam* appearance_version_param = getVisualParam(11000); - S32 param_appearance_version = -1; if (appearance_version_param) { std::vector::iterator it = std::find(contents.mParams.begin(), contents.mParams.end(),appearance_version_param); @@ -6738,28 +6739,38 @@ void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMe { S32 index = it - contents.mParams.begin(); llinfos << "index: " << index << llendl; - param_appearance_version = llround(contents.mParamWeights[index]); - LL_DEBUGS("Avatar") << "appversion req by appearance_version param: " << contents.mAppearanceVersion << llendl; + contents.mParamAppearanceVersion = llround(contents.mParamWeights[index]); + LL_DEBUGS("Avatar") << "appversion req by appearance_version param: " << contents.mParamAppearanceVersion << llendl; } } +} + +bool resolve_appearance_version(const LLAppearanceMessageContents& contents, S32& appearance_version) +{ if ((contents.mAppearanceVersion) >= 0 && - (param_appearance_version >= 0) && - (contents.mAppearanceVersion != param_appearance_version)) + (contents.mParamAppearanceVersion >= 0) && + (contents.mAppearanceVersion != contents.mParamAppearanceVersion)) { llwarns << "inconsistent appearance_version settings - field: " << - contents.mAppearanceVersion << ", param: " << param_appearance_version << llendl; + contents.mAppearanceVersion << ", param: " << contents.mParamAppearanceVersion << llendl; + return false; + } + if (contents.mParamAppearanceVersion >= 0) // use visual param if available. + { + appearance_version = contents.mParamAppearanceVersion; + LL_DEBUGS("Avatar") << "appversion set by appearance_version param: " << appearance_version << llendl; } - if (contents.mAppearanceVersion < 0 && - param_appearance_version >= 0) // not set explicitly, try to get from visual param. + if (contents.mAppearanceVersion >= 0) { - contents.mAppearanceVersion = param_appearance_version; - LL_DEBUGS("Avatar") << "appversion set by appearance_version param: " << contents.mAppearanceVersion << llendl; + appearance_version = contents.mAppearanceVersion; + LL_DEBUGS("Avatar") << "appversion set by appearance_version field: " << appearance_version << llendl; } if (contents.mAppearanceVersion < 0) // still not set, go with 0. { - contents.mAppearanceVersion = 0; - LL_DEBUGS("Avatar") << "appversion set by default: " << contents.mAppearanceVersion << llendl; + appearance_version = 0; + LL_DEBUGS("Avatar") << "appversion set by default: " << appearance_version << llendl; } + return true; } //----------------------------------------------------------------------------- @@ -6776,13 +6787,21 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) return; } - ESex old_sex = getSex(); LLAppearanceMessageContents contents; parseAppearanceMessage(mesgsys, contents); + if (enable_verbose_dumps) + { + dumpAppearanceMsgParams(dump_prefix + "appearance_msg", contents.mParamWeights, contents.mTEContents); + } - U8 appearance_version = contents.mAppearanceVersion; + S32 appearance_version; + if (!resolve_appearance_version(contents, appearance_version)) + { + llwarns << "bad appearance version info, discarding" << llendl; + return; + } S32 this_update_cof_version = contents.mCOFVersion; S32 last_update_request_cof_version = LLAppearanceMgr::instance().mLastUpdateRequestCOFVersion; @@ -6891,13 +6910,6 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) } } } - if (enable_verbose_dumps) - { - dumpAppearanceMsgParams(dump_prefix + "appearance_msg", contents.mParamWeights, contents.mTEContents); - } - - //if (enable_verbose_dumps) { dumpArchetypeXML(dump_prefix + "process_post_set_weights"); } - const S32 expected_tweakable_count = getVisualParamCountInGroup(VISUAL_PARAM_GROUP_TWEAKABLE); // don't worry about VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT if (num_params != expected_tweakable_count) { -- cgit v1.2.3 From 3f45d5472c603e9f034161b382ce42baa3a5b3c0 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 1 Feb 2013 10:53:02 -0500 Subject: SH-3800 WIP - log some of sent appearance msg info as well as received --- indra/newview/llvoavatar.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 537bb70579..1ea1b027f0 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6617,7 +6617,7 @@ void LLVOAvatar::dumpAppearanceMsgParams( const std::string& dump_prefix, } else { - llinfos << "xmlfile write handle obtained : " << fullpath << llendl; + LL_DEBUGS("Avatar") << "dumping appearance message to " << fullpath << llendl; } @@ -6758,18 +6758,18 @@ bool resolve_appearance_version(const LLAppearanceMessageContents& contents, S32 if (contents.mParamAppearanceVersion >= 0) // use visual param if available. { appearance_version = contents.mParamAppearanceVersion; - LL_DEBUGS("Avatar") << "appversion set by appearance_version param: " << appearance_version << llendl; } if (contents.mAppearanceVersion >= 0) { appearance_version = contents.mAppearanceVersion; - LL_DEBUGS("Avatar") << "appversion set by appearance_version field: " << appearance_version << llendl; } if (contents.mAppearanceVersion < 0) // still not set, go with 0. { appearance_version = 0; - LL_DEBUGS("Avatar") << "appversion set by default: " << appearance_version << llendl; } + LL_DEBUGS("Avatar") << "appearance version info - field " << contents.mAppearanceVersion + << " param: " << contents.mParamAppearanceVersion + << " final: " << appearance_version << llendl; return true; } -- cgit v1.2.3 From 44308c110f0ed4323767493c409de5d0cf4f4c4f Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 1 Feb 2013 16:14:37 -0500 Subject: SH-3800 WIP - fixed bad case in appearance version computation --- indra/newview/llvoavatar.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 1ea1b027f0..cc1993fe40 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6747,6 +6747,8 @@ void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMe bool resolve_appearance_version(const LLAppearanceMessageContents& contents, S32& appearance_version) { + appearance_version = -1; + if ((contents.mAppearanceVersion) >= 0 && (contents.mParamAppearanceVersion >= 0) && (contents.mAppearanceVersion != contents.mParamAppearanceVersion)) @@ -6763,7 +6765,7 @@ bool resolve_appearance_version(const LLAppearanceMessageContents& contents, S32 { appearance_version = contents.mAppearanceVersion; } - if (contents.mAppearanceVersion < 0) // still not set, go with 0. + if (appearance_version < 0) // still not set, go with 0. { appearance_version = 0; } @@ -6823,6 +6825,10 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) return; } } + else + { + LL_DEBUGS("Avatar") << "appearance message received" << llendl; + } // Check for stale update. if (isSelf() -- cgit v1.2.3 From 8095292585088d277805e04d24d0d1450c5a3289 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 1 Feb 2013 17:21:59 -0500 Subject: SH-3800 WIP - additional log line --- indra/newview/llvoavatar.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index cc1993fe40..24dd0623ef 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6780,6 +6780,8 @@ bool resolve_appearance_version(const LLAppearanceMessageContents& contents, S32 //----------------------------------------------------------------------------- void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) { + LL_DEBUGS("Avatar") << starts << llendl; + bool enable_verbose_dumps = gSavedSettings.getBOOL("DebugAvatarAppearanceMessage"); std::string dump_prefix = getFullname() + "_" + (isSelf()?"s":"o") + "_"; //if (enable_verbose_dumps) { dumpArchetypeXML(dump_prefix + "process_start"); } -- cgit v1.2.3 From 197b12d93b01efaa545d80b6cb36989b825e029c Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 1 Feb 2013 17:22:50 -0500 Subject: SH-3800 WIP - additional log line --- indra/newview/llvoavatar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 24dd0623ef..483bc25b33 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6780,7 +6780,7 @@ bool resolve_appearance_version(const LLAppearanceMessageContents& contents, S32 //----------------------------------------------------------------------------- void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) { - LL_DEBUGS("Avatar") << starts << llendl; + LL_DEBUGS("Avatar") << "starts" << llendl; bool enable_verbose_dumps = gSavedSettings.getBOOL("DebugAvatarAppearanceMessage"); std::string dump_prefix = getFullname() + "_" + (isSelf()?"s":"o") + "_"; -- cgit v1.2.3 From 99d197d021482ab29ca518d2f2a40462f75fe5a3 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 7 Feb 2013 19:14:00 -0500 Subject: SH-3852 WIP - track per-timer stats --- indra/newview/llvoavatar.cpp | 101 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 97 insertions(+), 4 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 483bc25b33..f7e1944660 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5887,30 +5887,123 @@ void LLVOAvatar::updateRezzedStatusTimers() if (is_cloud && !was_cloud) { // start cloud timer. - getPhases().startPhase("cloud"); + startPhase("cloud"); } else if (was_cloud && !is_cloud) { // stop cloud timer, which will capture stats. - getPhases().stopPhase("cloud"); + stopPhase("cloud"); } // Non-cloud-or-gray to cloud-or-gray if (is_cloud_or_gray && !was_cloud_or_gray) { // start cloud-or-gray timer. - getPhases().startPhase("cloud-or-gray"); + startPhase("cloud-or-gray"); } else if (was_cloud_or_gray && !is_cloud_or_gray) { // stop cloud-or-gray timer, which will capture stats. - getPhases().stopPhase("cloud-or-gray"); + stopPhase("cloud-or-gray"); } mLastRezzedStatus = rez_status; } } +void LLVOAvatar::clearPhases() +{ + getPhases().clearPhases(); +} + +void LLVOAvatar::startPhase(const std::string& phase_name) +{ + getPhases().startPhase(phase_name); +} + +void LLVOAvatar::logPendingPhases() +{ + for (LLViewerStats::phase_map_t::iterator it = getPhases().begin(); + it != getPhases().end(); + ++it) + { + const std::string& phase_name = it->first; + F32 elapsed; + bool completed; + if (getPhases().getPhaseValues(phase_name, elapsed, completed)) + { + if (!completed) + { + logMetricsTimerRecord(phase_name, elapsed, completed); + } + else + { + llwarns << "ignoring " << phase_name << llendl; + } + } + } +} + +//static +void LLVOAvatar::logPendingPhasesAllAvatars() +{ + for (std::vector::iterator iter = LLCharacter::sInstances.begin(); + iter != LLCharacter::sInstances.end(); ++iter) + { + LLVOAvatar* inst = (LLVOAvatar*) *iter; + if( inst->isDead() ) + { + continue; + } + inst->logPendingPhases(); + } +} + +void LLVOAvatar::logMetricsTimerRecord(const std::string& phase_name, F32 elapsed, bool completed) +{ + LLSD record; + record["timer_name"] = phase_name; + record["agent_id"] = gAgent.getID(); + record["elapsed"] = elapsed; + record["completed"] = completed; + U32 grid_x(0), grid_y(0); + if (getRegion()) + { + record["cbv"] = getRegion()->getCentralBakeVersion(); + grid_from_region_handle(getRegion()->getHandle(), &grid_x, &grid_y); + } + record["grid_x"] = LLSD::Integer(grid_x); + record["grid_y"] = LLSD::Integer(grid_y); + record["is_using_server_bake"] = isUsingServerBakes(); + record["is_self"] = isSelf(); + + LL_DEBUGS("Avatar") << "record\n" << ll_pretty_print_sd(record) << llendl; +} + +void LLVOAvatar::stopPhase(const std::string& phase_name) +{ + F32 elapsed; + bool completed; + if (getPhases().getPhaseValues(phase_name, elapsed, completed)) + { + if (!completed) + { + getPhases().stopPhase(phase_name); + completed = true; + + } + else + { + llwarns << "stop when stopped already for " << phase_name << llendl; + } + logMetricsTimerRecord(phase_name, elapsed, completed); + } + else + { + llwarns << "stop when not started for " << phase_name << llendl; + } +} + // call periodically to keep isFullyLoaded up to date. // returns true if the value has changed. BOOL LLVOAvatar::updateIsFullyLoaded() -- cgit v1.2.3 From 3bab0b6153b77c2b428e5f7d2a767b77a55fef68 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 8 Feb 2013 15:51:01 -0500 Subject: SH-3852 WIP - bucketize stats by agent_id, grid coordinates and various other criteria --- indra/newview/llvoavatar.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index f7e1944660..e911e01420 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -99,6 +99,7 @@ #include "lldebugmessagebox.h" #include "llsdutil.h" +#include "llsdserialize.h" extern F32 SPEED_ADJUST_MAX; extern F32 SPEED_ADJUST_MAX_SEC; @@ -5964,12 +5965,13 @@ void LLVOAvatar::logMetricsTimerRecord(const std::string& phase_name, F32 elapse LLSD record; record["timer_name"] = phase_name; record["agent_id"] = gAgent.getID(); + record["avatar_id"] = getID(); record["elapsed"] = elapsed; record["completed"] = completed; U32 grid_x(0), grid_y(0); if (getRegion()) { - record["cbv"] = getRegion()->getCentralBakeVersion(); + record["central_bake_version"] = getRegion()->getCentralBakeVersion(); grid_from_region_handle(getRegion()->getHandle(), &grid_x, &grid_y); } record["grid_x"] = LLSD::Integer(grid_x); @@ -5977,7 +5979,15 @@ void LLVOAvatar::logMetricsTimerRecord(const std::string& phase_name, F32 elapse record["is_using_server_bake"] = isUsingServerBakes(); record["is_self"] = isSelf(); - LL_DEBUGS("Avatar") << "record\n" << ll_pretty_print_sd(record) << llendl; + + std::ostringstream ostr; + ostr << LLSDNotationStreamer(record); + LL_DEBUGS("Avatar") << "record\n" << ostr.str() << llendl; + + if (isAgentAvatarValid()) + { + gAgentAvatarp->addMetricsTimerRecord(record); + } } void LLVOAvatar::stopPhase(const std::string& phase_name) -- cgit v1.2.3 From f3e407ae3f05e897de0b0d7daea4d31f09e73048 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 11 Feb 2013 13:50:26 -0500 Subject: SH-3852 WIP - removed avatar metrics from ViewerAssetMetrics --- indra/newview/llvoavatar.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index e911e01420..e298ccdb9c 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5971,12 +5971,12 @@ void LLVOAvatar::logMetricsTimerRecord(const std::string& phase_name, F32 elapse U32 grid_x(0), grid_y(0); if (getRegion()) { - record["central_bake_version"] = getRegion()->getCentralBakeVersion(); + record["central_bake_version"] = LLSD::Integer(getRegion()->getCentralBakeVersion()); grid_from_region_handle(getRegion()->getHandle(), &grid_x, &grid_y); } record["grid_x"] = LLSD::Integer(grid_x); record["grid_y"] = LLSD::Integer(grid_y); - record["is_using_server_bake"] = isUsingServerBakes(); + record["is_using_server_bakes"] = ((bool) isUsingServerBakes()); record["is_self"] = isSelf(); -- cgit v1.2.3 From e11fd0a7eb9e5aa39aa719f6d349506348a06d18 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 12 Feb 2013 10:58:04 -0500 Subject: SH-3852 WIP - added more specific logging of completenesss of texture loading --- indra/newview/llvoavatar.cpp | 112 +++++++++++++++++++++++++++---------------- 1 file changed, 72 insertions(+), 40 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index e298ccdb9c..0cd97283e9 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -818,6 +818,7 @@ BOOL LLVOAvatar::hasGray() const S32 LLVOAvatar::getRezzedStatus() const { if (getIsCloud()) return 0; + if (isFullyTextured() && allBakedTexturesCompletelyDownloaded()) return 3; if (isFullyTextured()) return 2; llassert(hasGray()); return 1; // gray @@ -873,7 +874,7 @@ BOOL LLVOAvatar::areAllNearbyInstancesBaked(S32& grey_avatars) void LLVOAvatar::getNearbyRezzedStats(std::vector& counts) { counts.clear(); - counts.resize(3); + counts.resize(4); for (std::vector::iterator iter = LLCharacter::sInstances.begin(); iter != LLCharacter::sInstances.end(); ++iter) { @@ -891,6 +892,7 @@ std::string LLVOAvatar::rezStatusToString(S32 rez_status) if (rez_status==0) return "cloud"; if (rez_status==1) return "gray"; if (rez_status==2) return "textured"; + if (rez_status==3) return "textured_and_downloaded"; return "unknown"; } @@ -1814,10 +1816,7 @@ S32 LLVOAvatar::setTETexture(const U8 te, const LLUUID& uuid) { if (!isIndexBakedTexture((ETextureIndex)te)) { - if (!uuid.isNull()) - { - llinfos << "ignoring texture " << uuid << " in non-baked slot " << (S32)te << " - will use null " << llendl; - } + // Sim still sends some uuids for non-baked slots sometimes - ignore. return LLViewerObject::setTETexture(te, LLUUID::null); } @@ -4034,7 +4033,7 @@ U32 LLVOAvatar::renderImpostor(LLColor4U color, S32 diffuse_channel) return 6; } -bool LLVOAvatar::allTexturesCompletelyDownloaded(std::set& ids) +bool LLVOAvatar::allTexturesCompletelyDownloaded(std::set& ids) const { for (std::set::const_iterator it = ids.begin(); it != ids.end(); ++it) { @@ -4047,14 +4046,14 @@ bool LLVOAvatar::allTexturesCompletelyDownloaded(std::set& ids) return true; } -bool LLVOAvatar::allLocalTexturesCompletelyDownloaded() +bool LLVOAvatar::allLocalTexturesCompletelyDownloaded() const { std::set local_ids; collectLocalTextureUUIDs(local_ids); return allTexturesCompletelyDownloaded(local_ids); } -bool LLVOAvatar::allBakedTexturesCompletelyDownloaded() +bool LLVOAvatar::allBakedTexturesCompletelyDownloaded() const { std::set baked_ids; collectBakedTextureUUIDs(baked_ids); @@ -4129,7 +4128,7 @@ S32 LLVOAvatar::totalTextureMemForUUIDS(std::set& ids) return result; } -void LLVOAvatar::collectLocalTextureUUIDs(std::set& ids) +void LLVOAvatar::collectLocalTextureUUIDs(std::set& ids) const { for (U32 texture_index = 0; texture_index < getNumTEs(); texture_index++) { @@ -4155,7 +4154,7 @@ void LLVOAvatar::collectLocalTextureUUIDs(std::set& ids) ids.erase(IMG_INVISIBLE); } -void LLVOAvatar::collectBakedTextureUUIDs(std::set& ids) +void LLVOAvatar::collectBakedTextureUUIDs(std::set& ids) const { for (U32 texture_index = 0; texture_index < getNumTEs(); texture_index++) { @@ -5873,8 +5872,9 @@ BOOL LLVOAvatar::getIsCloud() const void LLVOAvatar::updateRezzedStatusTimers() { - // State machine for rezzed status. Statuses are 0 = cloud, 1 = gray, 2 = textured. + // State machine for rezzed status. Statuses are -1 on startup, 0 = cloud, 1 = gray, 2 = textured, 3 = textured_and_downloaded. // Purpose is to collect time data for each period of cloud or cloud+gray. + S32 rez_status = getRezzedStatus(); if (rez_status != mLastRezzedStatus) { @@ -5907,7 +5907,32 @@ void LLVOAvatar::updateRezzedStatusTimers() // stop cloud-or-gray timer, which will capture stats. stopPhase("cloud-or-gray"); } - + + if (mLastRezzedStatus == -1 && rez_status != -1) + { + // First time initialization, start all timers. + for (S32 i = 1; i < 4; i++) + { + startPhase("load_" + LLVOAvatar::rezStatusToString(i)); + } + } + if (rez_status < mLastRezzedStatus) + { + // load level has decreased. start phase timers for higher load levels. + for (S32 i = rez_status+1; i <= mLastRezzedStatus; i++) + { + startPhase("load_" + LLVOAvatar::rezStatusToString(i)); + } + } + else if (rez_status > mLastRezzedStatus) + { + // load level has increased. stop phase timers for lower and equal load levels. + for (S32 i = llmax(mLastRezzedStatus+1,1); i <= rez_status; i++) + { + stopPhase("load_" + LLVOAvatar::rezStatusToString(i)); + } + } + mLastRezzedStatus = rez_status; } } @@ -5919,9 +5944,44 @@ void LLVOAvatar::clearPhases() void LLVOAvatar::startPhase(const std::string& phase_name) { + F32 elapsed; + bool completed; + if (getPhases().getPhaseValues(phase_name, elapsed, completed)) + { + if (!completed) + { + LL_DEBUGS("Avatar") << "start when started already for " << phase_name << llendl; + return; + } + } + LL_DEBUGS("Avatar") << "started phase " << phase_name << llendl; getPhases().startPhase(phase_name); } +void LLVOAvatar::stopPhase(const std::string& phase_name) +{ + F32 elapsed; + bool completed; + if (getPhases().getPhaseValues(phase_name, elapsed, completed)) + { + if (!completed) + { + LL_DEBUGS("Avatar") << "stopped phase " << phase_name << llendl; + getPhases().stopPhase(phase_name); + completed = true; + logMetricsTimerRecord(phase_name, elapsed, completed); + } + else + { + LL_DEBUGS("Avatar") << "stop when stopped already for " << phase_name << llendl; + } + } + else + { + LL_DEBUGS("Avatar") << "stop when not started for " << phase_name << llendl; + } +} + void LLVOAvatar::logPendingPhases() { for (LLViewerStats::phase_map_t::iterator it = getPhases().begin(); @@ -5937,10 +5997,6 @@ void LLVOAvatar::logPendingPhases() { logMetricsTimerRecord(phase_name, elapsed, completed); } - else - { - llwarns << "ignoring " << phase_name << llendl; - } } } } @@ -5990,30 +6046,6 @@ void LLVOAvatar::logMetricsTimerRecord(const std::string& phase_name, F32 elapse } } -void LLVOAvatar::stopPhase(const std::string& phase_name) -{ - F32 elapsed; - bool completed; - if (getPhases().getPhaseValues(phase_name, elapsed, completed)) - { - if (!completed) - { - getPhases().stopPhase(phase_name); - completed = true; - - } - else - { - llwarns << "stop when stopped already for " << phase_name << llendl; - } - logMetricsTimerRecord(phase_name, elapsed, completed); - } - else - { - llwarns << "stop when not started for " << phase_name << llendl; - } -} - // call periodically to keep isFullyLoaded up to date. // returns true if the value has changed. BOOL LLVOAvatar::updateIsFullyLoaded() -- cgit v1.2.3 From 02e9afd0e5d727ea0729fb2242b3a89247ae5b1a Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 12 Feb 2013 14:26:48 -0500 Subject: SH-2852 WIP - track avatar loading via load_ timers, added distinction between partially and fully loaded textures --- indra/newview/llvoavatar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 0cd97283e9..e2f455258d 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2908,7 +2908,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) bool all_baked_downloaded = allBakedTexturesCompletelyDownloaded(); bool all_local_downloaded = allLocalTexturesCompletelyDownloaded(); std::string debug_line = llformat("%s%s - mLocal: %d, mEdit: %d, mUSB: %d, CBV: %d", - all_local_downloaded ? "L" : "l", + isSelf() ? (all_local_downloaded ? "L" : "l") : "-", all_baked_downloaded ? "B" : "b", mUseLocalAppearance, mIsEditingAppearance, mUseServerBakes, central_bake_version); -- cgit v1.2.3 From 550ff94d6a30367c3ea3d2c597b9fea2911039c8 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 12 Feb 2013 16:49:50 -0500 Subject: removed some redundant or deprecated timers --- indra/newview/llvoavatar.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index e2f455258d..346c55e589 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5879,6 +5879,7 @@ void LLVOAvatar::updateRezzedStatusTimers() if (rez_status != mLastRezzedStatus) { LL_DEBUGS("Avatar") << avString() << "rez state change: " << mLastRezzedStatus << " -> " << rez_status << LL_ENDL; +#if 0 bool is_cloud_or_gray = (rez_status==0 || rez_status==1); bool was_cloud_or_gray = (mLastRezzedStatus==0 || mLastRezzedStatus==1); bool is_cloud = (rez_status==0); @@ -5907,6 +5908,7 @@ void LLVOAvatar::updateRezzedStatusTimers() // stop cloud-or-gray timer, which will capture stats. stopPhase("cloud-or-gray"); } +#endif if (mLastRezzedStatus == -1 && rez_status != -1) { @@ -6020,7 +6022,6 @@ void LLVOAvatar::logMetricsTimerRecord(const std::string& phase_name, F32 elapse { LLSD record; record["timer_name"] = phase_name; - record["agent_id"] = gAgent.getID(); record["avatar_id"] = getID(); record["elapsed"] = elapsed; record["completed"] = completed; -- cgit v1.2.3 From 9ef4c33772b3d358fd90125ea82a05ae70c01643 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 13 Feb 2013 07:47:24 -0500 Subject: SH-3852 WIP - modified metrics for update_appearance_from_cof and wear_inventory_category, end when bakes are fully loaded --- indra/newview/llvoavatar.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 346c55e589..20d598d35b 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5933,6 +5933,12 @@ void LLVOAvatar::updateRezzedStatusTimers() { stopPhase("load_" + LLVOAvatar::rezStatusToString(i)); } + if (rez_status == 3) + { + // "fully loaded", mark any pending appearance change complete. + selfStopPhase("update_appearance_from_cof"); + selfStopPhase("wear_inventory_category"); + } } mLastRezzedStatus = rez_status; -- cgit v1.2.3 From 72dfb2abce5d5635e7f81436d65c8689d161eb37 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 13 Feb 2013 17:28:05 -0500 Subject: SH-3812 WIP, SH-3852 WIP - some metrics cleanup, added rebake when needed and sb system is unavailable, to avoid stale appearance problems --- indra/newview/llvoavatar.cpp | 61 ++++++++++++++++---------------------------- 1 file changed, 22 insertions(+), 39 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 20d598d35b..5b4d57986b 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4456,6 +4456,7 @@ void LLVOAvatar::setTexEntry(const U8 index, const LLTextureEntry &te) const std::string LLVOAvatar::getImageURL(const U8 te, const LLUUID &uuid) { + llassert(isIndexBakedTexture(ETextureIndex(te))); std::string url = ""; if (isUsingServerBakes()) { @@ -5872,43 +5873,15 @@ BOOL LLVOAvatar::getIsCloud() const void LLVOAvatar::updateRezzedStatusTimers() { - // State machine for rezzed status. Statuses are -1 on startup, 0 = cloud, 1 = gray, 2 = textured, 3 = textured_and_downloaded. - // Purpose is to collect time data for each period of cloud or cloud+gray. + // State machine for rezzed status. Statuses are -1 on startup, 0 + // = cloud, 1 = gray, 2 = textured, 3 = textured_and_downloaded. + // Purpose is to collect time data for each it takes avatar to reach + // various loading landmarks: gray, textured (partial), textured fully. S32 rez_status = getRezzedStatus(); if (rez_status != mLastRezzedStatus) { LL_DEBUGS("Avatar") << avString() << "rez state change: " << mLastRezzedStatus << " -> " << rez_status << LL_ENDL; -#if 0 - bool is_cloud_or_gray = (rez_status==0 || rez_status==1); - bool was_cloud_or_gray = (mLastRezzedStatus==0 || mLastRezzedStatus==1); - bool is_cloud = (rez_status==0); - bool was_cloud = (mLastRezzedStatus==0); - - // Non-cloud to cloud - if (is_cloud && !was_cloud) - { - // start cloud timer. - startPhase("cloud"); - } - else if (was_cloud && !is_cloud) - { - // stop cloud timer, which will capture stats. - stopPhase("cloud"); - } - - // Non-cloud-or-gray to cloud-or-gray - if (is_cloud_or_gray && !was_cloud_or_gray) - { - // start cloud-or-gray timer. - startPhase("cloud-or-gray"); - } - else if (was_cloud_or_gray && !is_cloud_or_gray) - { - // stop cloud-or-gray timer, which will capture stats. - stopPhase("cloud-or-gray"); - } -#endif if (mLastRezzedStatus == -1 && rez_status != -1) { @@ -5937,7 +5910,8 @@ void LLVOAvatar::updateRezzedStatusTimers() { // "fully loaded", mark any pending appearance change complete. selfStopPhase("update_appearance_from_cof"); - selfStopPhase("wear_inventory_category"); + selfStopPhase("wear_inventory_category", false); + selfStopPhase("process_initial_wearables_update", false); } } @@ -5958,7 +5932,7 @@ void LLVOAvatar::startPhase(const std::string& phase_name) { if (!completed) { - LL_DEBUGS("Avatar") << "start when started already for " << phase_name << llendl; + LL_DEBUGS("Avatar") << "no-op, start when started already for " << phase_name << llendl; return; } } @@ -5966,7 +5940,7 @@ void LLVOAvatar::startPhase(const std::string& phase_name) getPhases().startPhase(phase_name); } -void LLVOAvatar::stopPhase(const std::string& phase_name) +void LLVOAvatar::stopPhase(const std::string& phase_name, bool err_check) { F32 elapsed; bool completed; @@ -5974,19 +5948,25 @@ void LLVOAvatar::stopPhase(const std::string& phase_name) { if (!completed) { - LL_DEBUGS("Avatar") << "stopped phase " << phase_name << llendl; getPhases().stopPhase(phase_name); completed = true; logMetricsTimerRecord(phase_name, elapsed, completed); + LL_DEBUGS("Avatar") << "stopped phase " << phase_name << " elapsed " << elapsed << llendl; } else { - LL_DEBUGS("Avatar") << "stop when stopped already for " << phase_name << llendl; + if (err_check) + { + LL_DEBUGS("Avatar") << "no-op, stop when stopped already for " << phase_name << llendl; + } } } else { - LL_DEBUGS("Avatar") << "stop when not started for " << phase_name << llendl; + if (err_check) + { + LL_DEBUGS("Avatar") << "no-op, stop when not started for " << phase_name << llendl; + } } } @@ -6043,9 +6023,11 @@ void LLVOAvatar::logMetricsTimerRecord(const std::string& phase_name, F32 elapse record["is_self"] = isSelf(); +#if 0 // verbose logging std::ostringstream ostr; ostr << LLSDNotationStreamer(record); LL_DEBUGS("Avatar") << "record\n" << ostr.str() << llendl; +#endif if (isAgentAvatarValid()) { @@ -6264,7 +6246,8 @@ void LLVOAvatar::updateMeshTextures() #ifndef LL_RELEASE_FOR_DOWNLOAD LLViewerFetchedTexture* existing_baked_img = LLViewerTextureManager::getFetchedTexture(mBakedTextureDatas[i].mLastTextureID); #endif - const std::string url = getImageURL(i, mBakedTextureDatas[i].mLastTextureID); + ETextureIndex te = ETextureIndex(mBakedTextureDatas[i].mTextureIndex); + const std::string url = getImageURL(te, mBakedTextureDatas[i].mLastTextureID); if (!url.empty()) { baked_img = LLViewerTextureManager::getFetchedTextureFromUrl(url, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, mBakedTextureDatas[i].mLastTextureID); -- cgit v1.2.3 From c99e206374f6afdcc038a97934314dec1a742b2e Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 13 Feb 2013 18:37:15 -0500 Subject: SH-3852 WIP - send non-complete timers only on av destruction or last message, so they don't get multiply counted --- indra/newview/llvoavatar.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 5b4d57986b..735589414d 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -729,6 +729,8 @@ LLVOAvatar::~LLVOAvatar() debugAvatarRezTime("AvatarRezLeftNotification","left sometime after declouding"); } + logPendingPhases(); + lldebugs << "LLVOAvatar Destructor (0x" << this << ") id:" << mID << llendl; std::for_each(mAttachmentPoints.begin(), mAttachmentPoints.end(), DeletePairedPointer()); @@ -1796,13 +1798,13 @@ LLViewerFetchedTexture *LLVOAvatar::getBakedTextureImage(const U8 te, const LLUU const std::string url = getImageURL(te,uuid); if (!url.empty()) { - llinfos << "texture URL " << url << llendl; + LL_DEBUGS("Avatar") << avString() << "from URL " << url << llendl; result = LLViewerTextureManager::getFetchedTextureFromUrl( url, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, uuid); } else { - llinfos << "get texture from host " << uuid << llendl; + LL_DEBUGS("Avatar") << avString() << "from host " << uuid << llendl; LLHost host = getObjectHost(); result = LLViewerTextureManager::getFetchedTexture( uuid, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, host); @@ -4190,15 +4192,15 @@ void LLVOAvatar::releaseOldTextures() std::set local_texture_ids; collectLocalTextureUUIDs(local_texture_ids); - S32 new_local_mem = totalTextureMemForUUIDS(local_texture_ids); + //S32 new_local_mem = totalTextureMemForUUIDS(local_texture_ids); std::set new_texture_ids; new_texture_ids.insert(baked_texture_ids.begin(),baked_texture_ids.end()); new_texture_ids.insert(local_texture_ids.begin(),local_texture_ids.end()); S32 new_total_mem = totalTextureMemForUUIDS(new_texture_ids); - S32 old_total_mem = totalTextureMemForUUIDS(mTextureIDs); - LL_DEBUGS("Avatar") << getFullname() << " old_total_mem: " << old_total_mem << " new_total_mem (L/B): " << new_total_mem << " (" << new_local_mem <<", " << new_baked_mem << ")" << llendl; + //S32 old_total_mem = totalTextureMemForUUIDS(mTextureIDs); + //LL_DEBUGS("Avatar") << getFullname() << " old_total_mem: " << old_total_mem << " new_total_mem (L/B): " << new_total_mem << " (" << new_local_mem <<", " << new_baked_mem << ")" << llendl; if (!isSelf() && new_total_mem > new_baked_mem) { llwarns << "extra local textures stored for non-self av" << llendl; @@ -5932,7 +5934,7 @@ void LLVOAvatar::startPhase(const std::string& phase_name) { if (!completed) { - LL_DEBUGS("Avatar") << "no-op, start when started already for " << phase_name << llendl; + LL_DEBUGS("Avatar") << avString() << "no-op, start when started already for " << phase_name << llendl; return; } } @@ -5951,7 +5953,7 @@ void LLVOAvatar::stopPhase(const std::string& phase_name, bool err_check) getPhases().stopPhase(phase_name); completed = true; logMetricsTimerRecord(phase_name, elapsed, completed); - LL_DEBUGS("Avatar") << "stopped phase " << phase_name << " elapsed " << elapsed << llendl; + LL_DEBUGS("Avatar") << avString() << "stopped phase " << phase_name << " elapsed " << elapsed << llendl; } else { -- cgit v1.2.3 From 97fd1cc7d75a065ea7f852820e32fcad91201281 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 14 Feb 2013 13:46:24 -0500 Subject: removed some no-op code, enhanced display of DebugAvatarAppearanceMessage status line --- indra/newview/llvoavatar.cpp | 43 +++++++++++++++---------------------------- 1 file changed, 15 insertions(+), 28 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 735589414d..ce39bee42f 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4108,10 +4108,16 @@ std::string LLVOAvatar::bakedTextureOriginInfo() { has_host = true; } - if (has_url && !has_host) result += "u"; // server-bake texture with url - else if (has_host && !has_url) result += "h"; // old-style texture on sim - else if (has_host && has_url) result += "?"; // both origins? - else if (!has_host && !has_url) result += "n"; // no origin? + S32 discard = imagep->getDiscardLevel(); + if (has_url && !has_host) result += discard ? "u" : "U"; // server-bake texture with url + else if (has_host && !has_url) result += discard ? "h" : "H"; // old-style texture on sim + else if (has_host && has_url) result += discard ? "ERRx" : "ERRX"; // both origins? + else if (!has_host && !has_url) result += discard ? "ERRn" : "ERRN"; // no origin? + if (discard != 0) + { + result += llformat("(%d/%d)",discard,imagep->getDesiredDiscardLevel()); + } + } return result; } @@ -6130,6 +6136,8 @@ LLMotion* LLVOAvatar::findMotion(const LLUUID& id) const return mMotionController.findMotion(id); } +// This is a semi-deprecated debugging tool - meshes will not show as +// colorized if using deferred rendering. void LLVOAvatar::debugColorizeSubMeshes(U32 i, const LLColor4& color) { if (gSavedSettings.getBOOL("DebugAvatarCompositeBaked")) @@ -6244,29 +6252,7 @@ void LLVOAvatar::updateMeshTextures() LLViewerTexLayerSet* layerset = getTexLayerSet(i); if (use_lkg_baked_layer[i] && !isUsingLocalAppearance() ) { - LLViewerFetchedTexture* baked_img; -#ifndef LL_RELEASE_FOR_DOWNLOAD - LLViewerFetchedTexture* existing_baked_img = LLViewerTextureManager::getFetchedTexture(mBakedTextureDatas[i].mLastTextureID); -#endif - ETextureIndex te = ETextureIndex(mBakedTextureDatas[i].mTextureIndex); - const std::string url = getImageURL(te, mBakedTextureDatas[i].mLastTextureID); - if (!url.empty()) - { - baked_img = LLViewerTextureManager::getFetchedTextureFromUrl(url, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, mBakedTextureDatas[i].mLastTextureID); - } - else - { - // Baked textures should be requested from the sim this avatar is on. JC - const LLHost target_host = getObjectHost(); - if (!target_host.isOk()) - { - llwarns << "updateMeshTextures: invalid host for object: " << getID() << llendl; - } - - baked_img = LLViewerTextureManager::getFetchedTextureFromHost( mBakedTextureDatas[i].mLastTextureID, target_host ); - } - llassert(baked_img == existing_baked_img); - + LLViewerFetchedTexture* baked_img = LLViewerTextureManager::getFetchedTexture(mBakedTextureDatas[i].mLastTextureID); mBakedTextureDatas[i].mIsUsed = TRUE; debugColorizeSubMeshes(i,LLColor4::red); @@ -7131,6 +7117,7 @@ void LLVOAvatar::getAnimNames( LLDynamicArray* names ) names->put( "enter_away_from_keyboard_state" ); } +// static void LLVOAvatar::onBakedTextureMasksLoaded( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata ) { if (!userdata) return; @@ -7149,7 +7136,7 @@ void LLVOAvatar::onBakedTextureMasksLoaded( BOOL success, LLViewerFetchedTexture { if (!aux_src->getData()) { - llerrs << "No auxiliary source data for onBakedTextureMasksLoaded" << llendl; + llerrs << "No auxiliary source (morph mask) data for image id " << id << llendl; return; } -- cgit v1.2.3 From 852211e2c154763d9d86cc30b07c9f319e25df95 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 14 Feb 2013 17:52:50 -0500 Subject: tweaked and added some log messages, including more detail when an image is flagged as missing --- indra/newview/llvoavatar.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index ce39bee42f..c654d9ea64 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -7188,7 +7188,7 @@ void LLVOAvatar::onBakedTextureMasksLoaded( BOOL success, LLViewerFetchedTexture } if (!found_texture_id) { - llinfos << "onBakedTextureMasksLoaded(): unexpected image id: " << id << llendl; + llinfos << "unexpected image id: " << id << llendl; } self->dirtyMesh(); } @@ -7196,7 +7196,7 @@ void LLVOAvatar::onBakedTextureMasksLoaded( BOOL success, LLViewerFetchedTexture { // this can happen when someone uses an old baked texture possibly provided by // viewer-side baked texture caching - llwarns << "Masks loaded callback but NO aux source!" << llendl; + llwarns << "Masks loaded callback but NO aux source, id " << id << llendl; } } -- cgit v1.2.3 From e34d93e29eee07843476aed7db46b178a3462e95 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Fri, 15 Feb 2013 21:30:56 +0000 Subject: Fix to allow horde bots to render other avatars in the area --- indra/newview/llvoavatar.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index c654d9ea64..3681040acc 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1870,7 +1870,8 @@ void LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) return; } - if (!(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_AVATAR))) + if (!(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_AVATAR)) + && !(gSavedSettings.getBOOL("DisableAllRenderTypes"))) { return; } -- cgit v1.2.3 From ce9a15bf989224ccda03d2d8461a3c619ae4339d Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 19 Feb 2013 10:09:38 -0500 Subject: SH-3792 WIP - changed local texture loading to be consistent with viewer_development - this fixes the gray head issue. There is still some remaining issue with bakes not uploading at full resolution, probably due to a bad image asset. --- indra/newview/llvoavatar.cpp | 44 ++++++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 16 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index c654d9ea64..58c0a412ed 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4096,26 +4096,38 @@ std::string LLVOAvatar::bakedTextureOriginInfo() std::set baked_ids; collectBakedTextureUUIDs(baked_ids); - for (std::set::const_iterator it = baked_ids.begin(); it != baked_ids.end(); ++it) + for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { - LLViewerFetchedTexture *imagep = gTextureList.findImage(*it); - bool has_url = false, has_host = false; - if (!imagep->getUrl().empty()) - { - has_url = true; - } - if (imagep->getTargetHost().isOk()) + ETextureIndex texture_index = mBakedTextureDatas[i].mTextureIndex; + LLViewerFetchedTexture *imagep = + LLViewerTextureManager::staticCastToFetchedTexture(getImage(texture_index,0), TRUE); + if (!imagep || + imagep->getID() == IMG_DEFAULT || + imagep->getID() == IMG_DEFAULT_AVATAR) + { - has_host = true; + result += "-"; } - S32 discard = imagep->getDiscardLevel(); - if (has_url && !has_host) result += discard ? "u" : "U"; // server-bake texture with url - else if (has_host && !has_url) result += discard ? "h" : "H"; // old-style texture on sim - else if (has_host && has_url) result += discard ? "ERRx" : "ERRX"; // both origins? - else if (!has_host && !has_url) result += discard ? "ERRn" : "ERRN"; // no origin? - if (discard != 0) + else { - result += llformat("(%d/%d)",discard,imagep->getDesiredDiscardLevel()); + bool has_url = false, has_host = false; + if (!imagep->getUrl().empty()) + { + has_url = true; + } + if (imagep->getTargetHost().isOk()) + { + has_host = true; + } + S32 discard = imagep->getDiscardLevel(); + if (has_url && !has_host) result += discard ? "u" : "U"; // server-bake texture with url + else if (has_host && !has_url) result += discard ? "h" : "H"; // old-style texture on sim + else if (has_host && has_url) result += discard ? "x" : "X"; // both origins? + else if (!has_host && !has_url) result += discard ? "n" : "N"; // no origin? + if (discard != 0) + { + result += llformat("(%d/%d)",discard,imagep->getDesiredDiscardLevel()); + } } } -- cgit v1.2.3 From b6f814af25a957e71dc8d9dd314ac15e3cbe6cd9 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 20 Feb 2013 13:24:58 -0500 Subject: SH-3891 WIP - separate first-time rezzing stats from subsequent state changes --- indra/newview/llvoavatar.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 95d4be17b5..266b9fecd5 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5910,6 +5910,7 @@ void LLVOAvatar::updateRezzedStatusTimers() for (S32 i = 1; i < 4; i++) { startPhase("load_" + LLVOAvatar::rezStatusToString(i)); + startPhase("first_load_" + LLVOAvatar::rezStatusToString(i)); } } if (rez_status < mLastRezzedStatus) @@ -5926,6 +5927,7 @@ void LLVOAvatar::updateRezzedStatusTimers() for (S32 i = llmax(mLastRezzedStatus+1,1); i <= rez_status; i++) { stopPhase("load_" + LLVOAvatar::rezStatusToString(i)); + stopPhase("first_load_" + LLVOAvatar::rezStatusToString(i), false); } if (rez_status == 3) { -- cgit v1.2.3 From b16dcda6a387774a446c04f63e1a55bd35ec7afe Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 25 Feb 2013 19:12:36 -0500 Subject: SH-3860 WIP, SH-3899 WIP - make folder version management more debuggable, log appearance request results --- indra/newview/llvoavatar.cpp | 5 ----- 1 file changed, 5 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 266b9fecd5..04458da529 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -190,11 +190,6 @@ enum ERenderName RENDER_NAME_FADE }; - -// Utility func - FIXME move out of avatar. -std::string get_sequential_numbered_file_name(const std::string& prefix, - const std::string& suffix); - //----------------------------------------------------------------------------- // Callback data //----------------------------------------------------------------------------- -- cgit v1.2.3 From 26ac1097729ce801e61523e3e42d7a868ddcde13 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 26 Feb 2013 22:00:50 -0500 Subject: SH-3899 WIP - more logging of appearance message info --- indra/newview/llvoavatar.cpp | 52 ++++++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 21 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 04458da529..afe8a037b7 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -210,6 +210,24 @@ struct LLTextureMaskData ** **/ +struct LLAppearanceMessageContents +{ + LLAppearanceMessageContents(): + mAppearanceVersion(-1), + mParamAppearanceVersion(-1), + mCOFVersion(LLViewerInventoryCategory::VERSION_UNKNOWN) + { + } + LLTEContents mTEContents; + S32 mAppearanceVersion; + S32 mParamAppearanceVersion; + S32 mCOFVersion; + // For future use: + //U32 appearance_flags = 0; + std::vector mParamWeights; + std::vector mParams; +}; + //----------------------------------------------------------------------------- // class LLBodyNoiseMotion //----------------------------------------------------------------------------- @@ -6725,10 +6743,11 @@ void dump_visual_param(apr_file_t* file, LLVisualParam* viewer_param, F32 value) void LLVOAvatar::dumpAppearanceMsgParams( const std::string& dump_prefix, - const std::vector& params_for_dump, - const LLTEContents& tec) + const LLAppearanceMessageContents& contents) { std::string outfilename = get_sequential_numbered_file_name(dump_prefix,".xml"); + const std::vector& params_for_dump = contents.mParamWeights; + const LLTEContents& tec = contents.mTEContents; LLAPRFile outfile; std::string fullpath = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,outfilename); @@ -6743,7 +6762,12 @@ void LLVOAvatar::dumpAppearanceMsgParams( const std::string& dump_prefix, LL_DEBUGS("Avatar") << "dumping appearance message to " << fullpath << llendl; } + apr_file_printf(file, "
\n"); + apr_file_printf(file, "\t\t\n", contents.mCOFVersion); + apr_file_printf(file, "\t\t\n", contents.mAppearanceVersion); + apr_file_printf(file, "
\n"); + apr_file_printf(file, "\n\n"); LLVisualParam* param = getFirstVisualParam(); for (S32 i = 0; i < params_for_dump.size(); i++) { @@ -6756,32 +6780,18 @@ void LLVOAvatar::dumpAppearanceMsgParams( const std::string& dump_prefix, dump_visual_param(file, viewer_param, value); param = getNextVisualParam(); } + apr_file_printf(file, "\n"); + + apr_file_printf(file, "\n\n"); for (U32 i = 0; i < tec.face_count; i++) { std::string uuid_str; ((LLUUID*)tec.image_data)[i].toString(uuid_str); apr_file_printf( file, "\t\t\n", i, uuid_str.c_str()); } + apr_file_printf(file, "\n"); } -struct LLAppearanceMessageContents -{ - LLAppearanceMessageContents(): - mAppearanceVersion(-1), - mParamAppearanceVersion(-1), - mCOFVersion(LLViewerInventoryCategory::VERSION_UNKNOWN) - { - } - LLTEContents mTEContents; - S32 mAppearanceVersion; - S32 mParamAppearanceVersion; - S32 mCOFVersion; - // For future use: - //U32 appearance_flags = 0; - std::vector mParamWeights; - std::vector mParams; -}; - void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMessageContents& contents) { parseTEMessage(mesgsys, _PREHASH_ObjectData, -1, contents.mTEContents); @@ -6920,7 +6930,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) parseAppearanceMessage(mesgsys, contents); if (enable_verbose_dumps) { - dumpAppearanceMsgParams(dump_prefix + "appearance_msg", contents.mParamWeights, contents.mTEContents); + dumpAppearanceMsgParams(dump_prefix + "appearance_msg", contents); } S32 appearance_version; -- cgit v1.2.3 From d1c144519306cae7eff7f781417482c85068988c Mon Sep 17 00:00:00 2001 From: Nyx Linden Date: Thu, 28 Feb 2013 17:25:37 -0500 Subject: SH-3909 Support avatar height offset Adding a new visual param that allows users to manually adjust an offset for how far off the ground (+ or -) their avatar's root bone is. Supports the +-2m range people are used to adjusting in their viewers, but new implementation should support server-generated appearances. --- indra/newview/llvoavatar.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 266b9fecd5..aa90cbc5d2 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2061,7 +2061,7 @@ void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled) { LLVector3 tagPos = mRoot->getWorldPosition(); tagPos[VZ] -= mPelvisToFoot; - tagPos[VZ] += ( mBodySize[VZ] + 0.125f ); + tagPos[VZ] += ( mBodySize[VZ] + mAvatarOffset[VZ] + 0.125f ); mVoiceVisualizer->setVoiceSourceWorldPosition( tagPos ); } }//if ( voiceEnabled ) @@ -2805,12 +2805,12 @@ LLVector3 LLVOAvatar::idleUpdateNameTagPosition(const LLVector3& root_pos_last) local_camera_up.normalize(); local_camera_up = local_camera_up * ~root_rot; - local_camera_up.scaleVec(mBodySize * 0.5f); - local_camera_at.scaleVec(mBodySize * 0.5f); + local_camera_up.scaleVec((mBodySize + mAvatarOffset) * 0.5f); + local_camera_at.scaleVec((mBodySize + mAvatarOffset) * 0.5f); LLVector3 name_position = mRoot->getWorldPosition(); name_position[VZ] -= mPelvisToFoot; - name_position[VZ] += (mBodySize[VZ]* 0.55f); + name_position[VZ] += ((mBodySize[VZ] + mAvatarOffset[VZ])* 0.55f); name_position += (local_camera_up * root_rot) - (projected_vec(local_camera_at * root_rot, camera_to_av)); name_position += pixel_up_vec * 15.f; @@ -3110,6 +3110,8 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) } root_pos = gAgent.getPosGlobalFromAgent(getRenderPosition()); + root_pos.mdV[VZ] += getVisualParamWeight(11001); + resolveHeightGlobal(root_pos, ground_under_pelvis, normal); F32 foot_to_ground = (F32) (root_pos.mdV[VZ] - mPelvisToFoot - ground_under_pelvis.mdV[VZ]); -- cgit v1.2.3 From 9a0c52a247ecbd79f5f872ceb97a6be3e0499bea Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Tue, 5 Mar 2013 11:28:06 -0800 Subject: Adding debug setting to allow overriding appearance service url --- indra/newview/llvoavatar.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index f6fd8b2409..df44251c32 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4496,7 +4496,8 @@ const std::string LLVOAvatar::getImageURL(const U8 te, const LLUUID &uuid) std::string url = ""; if (isUsingServerBakes()) { - if (gSavedSettings.getString("AgentAppearanceServiceURL").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; @@ -4506,7 +4507,7 @@ const std::string LLVOAvatar::getImageURL(const U8 te, const LLUUID &uuid) const LLAvatarAppearanceDictionary::TextureEntry* texture_entry = LLAvatarAppearanceDictionary::getInstance()->getTexture((ETextureIndex)te); if (texture_entry != NULL) { - url = gSavedSettings.getString("AgentAppearanceServiceURL") + "texture/" + getID().asString() + "/" + texture_entry->mDefaultImageName + "/" + uuid.asString(); + url = appearance_service_url + "texture/" + getID().asString() + "/" + texture_entry->mDefaultImageName + "/" + uuid.asString(); //llinfos << "baked texture url: " << url << llendl; } } @@ -7256,7 +7257,7 @@ void LLVOAvatar::onBakedTextureLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata) { - // llinfos << "onBakedTextureLoaded: " << src_vi->getID() << llendl; + LL_DEBUGS("Avatar") << "onBakedTextureLoaded: " << src_vi->getID() << LL_ENDL; LLUUID id = src_vi->getID(); LLUUID *avatar_idp = (LLUUID *)userdata; -- cgit v1.2.3 From 7b0b5726dd2fcf5b79ed1b112891655fad0f96eb Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 6 Mar 2013 09:53:11 -0500 Subject: make it clearer when DebugForceAppearanceRequestFailure is on --- indra/newview/llvoavatar.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index f6fd8b2409..1bc26a7133 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2937,6 +2937,10 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) S32 last_received_cof_version = LLAppearanceMgr::instance().getLastAppearanceUpdateCOFVersion(); debug_line += llformat(" - cof: %d req: %d rcv:%d", curr_cof_version, last_request_cof_version, last_received_cof_version); + if (gSavedSettings.getBOOL("DebugForceAppearanceRequestFailure")) + { + debug_line += " FORCING ERRS"; + } } addDebugText(debug_line); } -- 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/llvoavatar.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index cec1dc677f..8cc3416d0e 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1813,14 +1813,14 @@ LLViewerFetchedTexture *LLVOAvatar::getBakedTextureImage(const U8 te, const LLUU { LL_DEBUGS("Avatar") << avString() << "from URL " << url << llendl; result = LLViewerTextureManager::getFetchedTextureFromUrl( - url, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, uuid); + url, FTT_SERVER_BAKE, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, uuid); } else { LL_DEBUGS("Avatar") << avString() << "from host " << uuid << llendl; LLHost host = getObjectHost(); result = LLViewerTextureManager::getFetchedTexture( - uuid, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, host); + uuid, FTT_HOST_BAKE, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, host); } } return result; @@ -7011,7 +7011,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) && baked_index != BAKED_SKIRT) { setTEImage(mBakedTextureDatas[baked_index].mTextureIndex, - LLViewerTextureManager::getFetchedTexture(mBakedTextureDatas[baked_index].mLastTextureID, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); + LLViewerTextureManager::getFetchedTexture(mBakedTextureDatas[baked_index].mLastTextureID, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); } } -- cgit v1.2.3 From 7e967ce2fd78078fb4284f2d61171bc90a669375 Mon Sep 17 00:00:00 2001 From: Nyx Linden Date: Fri, 8 Mar 2013 18:45:33 -0500 Subject: SH-3941 SH-3954 FIX local appearance does not update properly We were using an indicator of whether there *was* a baked texture to whether we were *using* a baked texture. Switched to one of the (several) proper indicators of whether a baked texture was in use. This should allow local texture data to get marked for download when we enter appearance mode. Local testing confirms that old apperances linger for a second or two, but are soon replaced by the correct local renders. --- indra/newview/llvoavatar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index cec1dc677f..5bc45b3551 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4342,7 +4342,7 @@ void LLVOAvatar::updateTextures() const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex; if (texture_dict->mIsLocalTexture) { - addLocalTextureStats((ETextureIndex)texture_index, imagep, texel_area_ratio, render_avatar, layer_baked[baked_index]); + addLocalTextureStats((ETextureIndex)texture_index, imagep, texel_area_ratio, render_avatar, mBakedTextureDatas[baked_index].mIsUsed); } } } -- cgit v1.2.3 From 6550f739cad56c8ff04eb0d334b34b20201124b5 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 21 Mar 2013 18:32:03 -0700 Subject: CHUI-871, CHUI-738 : Fixed! Name tags existence was using a bogus test. Using a boolean for existence and straight logic, no intermediate string --- indra/newview/llvoavatar.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index d295fc60cd..a3093f069d 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -675,7 +675,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mBelowWater(FALSE), mLastAppearanceBlendTime(0.f), mAppearanceAnimating(FALSE), - mNameString(), + mNameIsSet(false), mTitle(), mNameAway(false), mNameDoNotDisturb(false), @@ -3096,8 +3096,7 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) } // Rebuild name tag if state change detected - if (mNameString.empty() - || (mNameString.size() == 2 && mNameString[0] == 10 && mNameString[1] == 10) // *TODO : find out why mNameString is sometimes "" + if (!mNameIsSet || new_name || (!title && !mTitle.empty()) || (title && mTitle != title->getString()) @@ -3292,17 +3291,16 @@ void LLVOAvatar::addNameTagLine(const std::string& line, const LLColor4& color, { mNameText->addLine(line, color, (LLFontGL::StyleFlags)style, font); } - mNameString += line; - mNameString += '\n'; + mNameIsSet |= !line.empty(); } void LLVOAvatar::clearNameTag() { - mNameString.clear(); + mNameIsSet = false; if (mNameText) { mNameText->setLabel(""); - mNameText->setString( "" ); + mNameText->setString(""); } mTimeVisible.reset(); } -- cgit v1.2.3 From de2c88ca4334886ab48b3c3d474c6585036edb21 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 22 Mar 2013 12:17:06 -0400 Subject: Moved LastUpdateCOF stuff to avatar, so we can track last received for non-self avs --- indra/newview/llvoavatar.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) mode change 100644 => 100755 indra/newview/llvoavatar.cpp (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp old mode 100644 new mode 100755 index bc86bfd0a1..d492524789 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -707,7 +707,9 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mLastRezzedStatus(-1), mIsEditingAppearance(FALSE), mUseLocalAppearance(FALSE), - mUseServerBakes(FALSE) // FIXME DRANO consider using boost::optional, defaulting to unknown. + mUseServerBakes(FALSE), // FIXME DRANO consider using boost::optional, defaulting to unknown. + mLastUpdateRequestCOFVersion(-1), + mLastUpdateReceivedCOFVersion(-1) { //VTResume(); // VTune @@ -3006,11 +3008,11 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) mUseServerBakes, central_bake_version); std::string origin_string = bakedTextureOriginInfo(); debug_line += " [" + origin_string + "]"; + S32 curr_cof_version = LLAppearanceMgr::instance().getCOFVersion(); + S32 last_request_cof_version = mLastUpdateRequestCOFVersion; + S32 last_received_cof_version = mLastUpdateReceivedCOFVersion; if (isSelf()) { - S32 curr_cof_version = LLAppearanceMgr::instance().getCOFVersion(); - S32 last_request_cof_version = LLAppearanceMgr::instance().getLastUpdateRequestCOFVersion(); - S32 last_received_cof_version = LLAppearanceMgr::instance().getLastAppearanceUpdateCOFVersion(); debug_line += llformat(" - cof: %d req: %d rcv:%d", curr_cof_version, last_request_cof_version, last_received_cof_version); if (gSavedSettings.getBOOL("DebugForceAppearanceRequestFailure")) @@ -3018,6 +3020,10 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) debug_line += " FORCING ERRS"; } } + else + { + debug_line += llformat(" - cof rcv:%d", last_received_cof_version); + } addDebugText(debug_line); } if (gSavedSettings.getBOOL("DebugAvatarCompositeBaked")) @@ -6951,7 +6957,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) return; } S32 this_update_cof_version = contents.mCOFVersion; - S32 last_update_request_cof_version = LLAppearanceMgr::instance().mLastUpdateRequestCOFVersion; + 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() ) @@ -6960,8 +6966,6 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) << " last_update_request_cof_version " << last_update_request_cof_version << " my_cof_version " << LLAppearanceMgr::instance().getCOFVersion() << llendl; - LLAppearanceMgr::instance().setLastAppearanceUpdateCOFVersion(this_update_cof_version); - if (getRegion() && (getRegion()->getCentralBakeVersion()==0)) { llwarns << avString() << "Received AvatarAppearance message for self in non-server-bake region" << llendl; @@ -7003,6 +7007,8 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) return; } + mLastUpdateReceivedCOFVersion = this_update_cof_version; + setIsUsingServerBakes(appearance_version > 0); applyParsedTEMessage(contents.mTEContents); -- cgit v1.2.3 From 8e7c04f1d0ef6a7be800a7f3539f301aaededd14 Mon Sep 17 00:00:00 2001 From: Nyx Linden Date: Fri, 29 Mar 2013 18:05:36 -0400 Subject: SUN-57 SH-4039 FIX bake fail on non-ssb regions We were getting the texture ID from the type,index couple, but were not passing in index, which defaulted to 0. texture ID is available from the texture object itself, so using that and removing the index parameter to prevent future confusion. --- indra/newview/llvoavatar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index d492524789..ea0a30d580 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4403,7 +4403,7 @@ void LLVOAvatar::updateTextures() void LLVOAvatar::addLocalTextureStats( ETextureIndex idx, LLViewerFetchedTexture* imagep, - F32 texel_area_ratio, BOOL render_avatar, BOOL covered_by_baked, U32 index ) + F32 texel_area_ratio, BOOL render_avatar, BOOL covered_by_baked) { // No local texture stats for non-self avatars return; -- cgit v1.2.3 From 15b91b9149a5cdcfd52c33f1dd41f4e0e757e270 Mon Sep 17 00:00:00 2001 From: Nyx Linden Date: Tue, 2 Apr 2013 12:46:41 -0400 Subject: SH-4044 FIX voice dot is offset vertically if using avatar height offset Added the height offset in one too many places. fixing. --- indra/newview/llvoavatar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 0ec6ef3d14..725939dd3e 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2144,7 +2144,7 @@ void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled) { LLVector3 tagPos = mRoot->getWorldPosition(); tagPos[VZ] -= mPelvisToFoot; - tagPos[VZ] += ( mBodySize[VZ] + mAvatarOffset[VZ] + 0.125f ); + tagPos[VZ] += ( mBodySize[VZ] + 0.125f ); mVoiceVisualizer->setVoiceSourceWorldPosition( tagPos ); } }//if ( voiceEnabled ) -- cgit v1.2.3 From 3eae5ba0d006b2f73af6bcfc2b57429f99913eff Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 2 Apr 2013 18:02:59 -0400 Subject: Removed setCanUseHTTP override in llvoavatar --- indra/newview/llvoavatar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 725939dd3e..638906cc6d 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4478,7 +4478,7 @@ void LLVOAvatar::addBakedTextureStats( LLViewerFetchedTexture* imagep, F32 pixel // TODO: currently default to HTTP texture and fall back to UDP if cannot be found there. // Once server messaging is in place, we should call setCanUseHTTP(false) for old style // appearance requests - imagep->setCanUseHTTP(true); + //imagep->setCanUseHTTP(true); imagep->setMaxVirtualSizeResetInterval(MAX_TEXTURE_VIRTURE_SIZE_RESET_INTERVAL); imagep->resetMaxVirtualSizeResetCounter() ; -- cgit v1.2.3 From 72d0d81c7ede9de5ab30e95e8657b6a464e1986b Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 2 Apr 2013 20:40:19 -0400 Subject: SH-4057 FIX - cleaned up old canUseHTTP logic, now lives in llviewertexture.cpp --- indra/newview/llvoavatar.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 638906cc6d..5695fc04b9 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4475,10 +4475,6 @@ void LLVOAvatar::addBakedTextureStats( LLViewerFetchedTexture* imagep, F32 pixel //the texture pipeline will stop fetching this texture. imagep->resetTextureStats(); - // TODO: currently default to HTTP texture and fall back to UDP if cannot be found there. - // Once server messaging is in place, we should call setCanUseHTTP(false) for old style - // appearance requests - //imagep->setCanUseHTTP(true); imagep->setMaxVirtualSizeResetInterval(MAX_TEXTURE_VIRTURE_SIZE_RESET_INTERVAL); imagep->resetMaxVirtualSizeResetCounter() ; -- cgit v1.2.3 From d1d0a2cf67e3ddd7bd187c63b9ce79e0c19988d6 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 3 Apr 2013 14:58:33 -0400 Subject: SH-4058 - log spam reduction initiative. --- indra/newview/llvoavatar.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 5695fc04b9..ebd859f310 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6651,7 +6651,7 @@ LLBBox LLVOAvatar::getHUDBBox() const //----------------------------------------------------------------------------- void LLVOAvatar::onFirstTEMessageReceived() { - LL_INFOS("Avatar") << avString() << LL_ENDL; + LL_DEBUGS("Avatar") << avString() << LL_ENDL; if( !mFirstTEMessageReceived ) { mFirstTEMessageReceived = TRUE; @@ -6813,7 +6813,7 @@ void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMe U8 av_u8; mesgsys->getU8Fast(_PREHASH_AppearanceData, _PREHASH_AppearanceVersion, av_u8, 0); contents.mAppearanceVersion = av_u8; - llinfos << "appversion set by AppearanceData field: " << contents.mAppearanceVersion << llendl; + LL_DEBUGS("Avatar") << "appversion set by AppearanceData field: " << contents.mAppearanceVersion << llendl; mesgsys->getS32Fast(_PREHASH_AppearanceData, _PREHASH_CofVersion, contents.mCOFVersion, 0); // For future use: //mesgsys->getU32Fast(_PREHASH_AppearanceData, _PREHASH_Flags, appearance_flags, 0); @@ -6860,7 +6860,7 @@ void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMe const S32 expected_tweakable_count = getVisualParamCountInGroup(VISUAL_PARAM_GROUP_TWEAKABLE); // don't worry about VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT if (num_blocks != expected_tweakable_count) { - llinfos << "Number of params in AvatarAppearance msg (" << num_blocks << ") does not match number of tweakable params in avatar xml file (" << expected_tweakable_count << "). Processing what we can. object: " << getID() << llendl; + LL_DEBUGS("Avatar") << "Number of params in AvatarAppearance msg (" << num_blocks << ") does not match number of tweakable params in avatar xml file (" << expected_tweakable_count << "). Processing what we can. object: " << getID() << llendl; } } else @@ -6871,7 +6871,7 @@ void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMe } else { - llinfos << "AvatarAppearance msg received without any parameters, object: " << getID() << llendl; + LL_DEBUGS("Avatar") << "AvatarAppearance msg received without any parameters, object: " << getID() << llendl; } } @@ -6882,7 +6882,6 @@ void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMe if (it != contents.mParams.end()) { S32 index = it - contents.mParams.begin(); - llinfos << "index: " << index << llendl; contents.mParamAppearanceVersion = llround(contents.mParamWeights[index]); LL_DEBUGS("Avatar") << "appversion req by appearance_version param: " << contents.mParamAppearanceVersion << llendl; } @@ -6928,7 +6927,6 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) bool enable_verbose_dumps = gSavedSettings.getBOOL("DebugAvatarAppearanceMessage"); std::string dump_prefix = getFullname() + "_" + (isSelf()?"s":"o") + "_"; - //if (enable_verbose_dumps) { dumpArchetypeXML(dump_prefix + "process_start"); } if (gSavedSettings.getBOOL("BlockAvatarAppearanceMessages")) { llwarns << "Blocking AvatarAppearance message" << llendl; @@ -6986,7 +6984,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) if (isSelf() && isEditingAppearance()) { - llinfos << "ignoring appearance message while in appearance edit" << llendl; + LL_DEBUGS("Avatar") << "ignoring appearance message while in appearance edit" << llendl; return; } @@ -6997,7 +6995,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) // appearance version, which may cause us to look for baked // textures in the wrong place and flag them as missing // assets. - llinfos << "ignoring appearance message due to lack of params" << llendl; + LL_DEBUGS("Avatar") << "ignoring appearance message due to lack of params" << llendl; return; } @@ -7025,7 +7023,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) BOOL is_first_appearance_message = !mFirstAppearanceMessageReceived; mFirstAppearanceMessageReceived = TRUE; - LL_INFOS("Avatar") << avString() << "processAvatarAppearance start " << mID + LL_DEBUGS("Avatar") << avString() << "processAvatarAppearance start " << mID << " first? " << is_first_appearance_message << " self? " << isSelf() << LL_ENDL; if (is_first_appearance_message ) @@ -7065,7 +7063,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) const S32 expected_tweakable_count = getVisualParamCountInGroup(VISUAL_PARAM_GROUP_TWEAKABLE); // don't worry about VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT if (num_params != expected_tweakable_count) { - llinfos << "Number of params in AvatarAppearance msg (" << num_params << ") does not match number of tweakable params in avatar xml file (" << expected_tweakable_count << "). Processing what we can. object: " << getID() << llendl; + LL_DEBUGS("Avatar") << "Number of params in AvatarAppearance msg (" << num_params << ") does not match number of tweakable params in avatar xml file (" << expected_tweakable_count << "). Processing what we can. object: " << getID() << llendl; } if (params_changed) -- cgit v1.2.3 From b724791c2adb3e63c00547c40de2ae1b6ce45b9b Mon Sep 17 00:00:00 2001 From: Nyx Linden Date: Wed, 3 Apr 2013 18:59:50 -0400 Subject: SH-4050 FIX camera goes below ground when avatar offset set to 0 Added a constraint to ensure that the avatar's height (with offset) does not go below 0.1 meters. Camera was getting confused since the avatar's effective height was negative. Note the avatar is mostly underground/contorted even at 0.1 meters, but most users setting values this low will be making ultra-tinies and would be hiding the avatar mesh. Camera stays above ground when height is at 0.1. --- indra/newview/llvoavatar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 725939dd3e..6d9c150c43 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -3204,7 +3204,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) } root_pos = gAgent.getPosGlobalFromAgent(getRenderPosition()); - root_pos.mdV[VZ] += getVisualParamWeight(11001); + root_pos.mdV[VZ] += getVisualParamWeight(AVATAR_HOVER); resolveHeightGlobal(root_pos, ground_under_pelvis, normal); -- cgit v1.2.3 From 73aa45d1058724460aa89b14a48ec87ce53a85f4 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Sat, 6 Apr 2013 05:20:07 -0700 Subject: Add hack around norspec 59 crash --- indra/newview/llvoavatar.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index a3093f069d..9d16c28e2f 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4336,6 +4336,7 @@ U32 LLVOAvatar::renderTransparent(BOOL first_pass) gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); } +#if !LL_DARWIN if (!isSelf() || gAgent.needsRenderHead() || LLPipeline::sShadowRender) { if (LLPipeline::sImpostorRender) @@ -4362,7 +4363,8 @@ U32 LLVOAvatar::renderTransparent(BOOL first_pass) gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); } } - +#endif + return num_indices; } -- cgit v1.2.3 From 6a417acd63d576271a8b752e42a79156dd8bdc27 Mon Sep 17 00:00:00 2001 From: "Graham Madarasz (Graham Linden)" Date: Wed, 10 Apr 2013 10:23:03 -0700 Subject: NORSPEC-92 More UI fixes --- indra/newview/llvoavatar.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 9d16c28e2f..f861f49296 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4336,7 +4336,6 @@ U32 LLVOAvatar::renderTransparent(BOOL first_pass) gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); } -#if !LL_DARWIN if (!isSelf() || gAgent.needsRenderHead() || LLPipeline::sShadowRender) { if (LLPipeline::sImpostorRender) @@ -4363,7 +4362,6 @@ U32 LLVOAvatar::renderTransparent(BOOL first_pass) gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); } } -#endif return num_indices; } -- cgit v1.2.3 From d091644bccb012e5e4a10de7c1f03583d798d07d Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 17 Apr 2013 16:06:27 -0400 Subject: SH-4125 FIX - problem was unpredictable ordering of avatar and llviewerregion deletion. Avoid trying to send metrics when we're shutting down and it's too late anyway. Reviewed by Nyx --- indra/newview/llvoavatar.cpp | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 0475e9fc89..06fb23b84b 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -802,14 +802,14 @@ void LLVOAvatar::debugAvatarRezTime(std::string notification_name, std::string c //------------------------------------------------------------------------ LLVOAvatar::~LLVOAvatar() { - if (!mFullyLoaded) - { + if (!mFullyLoaded) + { debugAvatarRezTime("AvatarRezLeftCloudNotification","left after ruth seconds as cloud"); - } - else - { + } + else + { debugAvatarRezTime("AvatarRezLeftNotification","left sometime after declouding"); - } + } logPendingPhases(); @@ -6023,6 +6023,11 @@ void LLVOAvatar::stopPhase(const std::string& phase_name, bool err_check) void LLVOAvatar::logPendingPhases() { + if (!isAgentAvatarValid()) + { + return; + } + for (LLViewerStats::phase_map_t::iterator it = getPhases().begin(); it != getPhases().end(); ++it) @@ -6057,6 +6062,11 @@ void LLVOAvatar::logPendingPhasesAllAvatars() void LLVOAvatar::logMetricsTimerRecord(const std::string& phase_name, F32 elapsed, bool completed) { + if (!isAgentAvatarValid()) + { + return; + } + LLSD record; record["timer_name"] = phase_name; record["avatar_id"] = getID(); @@ -6073,13 +6083,6 @@ void LLVOAvatar::logMetricsTimerRecord(const std::string& phase_name, F32 elapse record["is_using_server_bakes"] = ((bool) isUsingServerBakes()); record["is_self"] = isSelf(); - -#if 0 // verbose logging - std::ostringstream ostr; - ostr << LLSDNotationStreamer(record); - LL_DEBUGS("Avatar") << "record\n" << ostr.str() << llendl; -#endif - if (isAgentAvatarValid()) { gAgentAvatarp->addMetricsTimerRecord(record); -- cgit v1.2.3 From 8bccedd163f1eb25c631e8501bdd468c24e6bf40 Mon Sep 17 00:00:00 2001 From: "Graham Madarasz (Graham Linden)" Date: Thu, 18 Apr 2013 09:43:26 -0700 Subject: NORSPEC-59 NORSPEC-98 NORSPEC-125 avoid rendering mesh LODs which crash driver on mac 9400/9600 GT only --- indra/newview/llvoavatar.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index f861f49296..f5b8244509 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4336,6 +4336,15 @@ U32 LLVOAvatar::renderTransparent(BOOL first_pass) gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); } +#if LL_DARWIN + // blatant hack to avoid driver crash on rendering mMeshLODs for eyelashes and baked hair below + // NORSPEC-59 + if (gGLManager.mIsMobileGF) + { + return num_indices; + } +#endif + if (!isSelf() || gAgent.needsRenderHead() || LLPipeline::sShadowRender) { if (LLPipeline::sImpostorRender) -- cgit v1.2.3 From 79318043218a9ec6cb6e52eca936487177554903 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Wed, 24 Apr 2013 06:24:21 -0700 Subject: NORSPEC-59 NORSPEC-125 make materials and alpha shaders work on Mac laptops with nV mobile graphics cards --- indra/newview/llvoavatar.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index f861f49296..f5b8244509 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4336,6 +4336,15 @@ U32 LLVOAvatar::renderTransparent(BOOL first_pass) gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); } +#if LL_DARWIN + // blatant hack to avoid driver crash on rendering mMeshLODs for eyelashes and baked hair below + // NORSPEC-59 + if (gGLManager.mIsMobileGF) + { + return num_indices; + } +#endif + if (!isSelf() || gAgent.needsRenderHead() || LLPipeline::sShadowRender) { if (LLPipeline::sImpostorRender) -- cgit v1.2.3 From 806d09b1143894ad66cea2c228f467e8c39a8adf Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Tue, 30 Apr 2013 19:50:05 -0700 Subject: Merge 3.5.1 into Materials --- indra/newview/llvoavatar.cpp | 3315 +++++++++++++++++------------------------- 1 file changed, 1334 insertions(+), 1981 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index f5b8244509..55dd574f25 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -36,6 +36,7 @@ #include #include +#include #include "llaudioengine.h" #include "noise.h" @@ -53,6 +54,7 @@ #include "llcallingcard.h" // IDEVO for LLAvatarTracker #include "lldrawpoolavatar.h" #include "lldriverparam.h" +#include "llpolyskeletaldistortion.h" #include "lleditingmotion.h" #include "llemote.h" //#include "llfirstuse.h" @@ -78,15 +80,16 @@ #include "llselectmgr.h" #include "llsprite.h" #include "lltargetingmotion.h" -#include "lltexlayer.h" #include "lltoolmorph.h" #include "llviewercamera.h" +#include "llviewertexlayer.h" #include "llviewertexturelist.h" #include "llviewermenu.h" #include "llviewerobjectlist.h" #include "llviewerparcelmgr.h" #include "llviewershadermgr.h" #include "llviewerstats.h" +#include "llviewerwearable.h" #include "llvoavatarself.h" #include "llvovolume.h" #include "llworld.h" @@ -103,6 +106,7 @@ #include "lldebugmessagebox.h" #include "llsdutil.h" +#include "llsdserialize.h" extern F32 SPEED_ADJUST_MAX; extern F32 SPEED_ADJUST_MAX_SEC; @@ -118,7 +122,7 @@ extern F32 ANIM_SPEED_MIN; // #define OUTPUT_BREAST_DATA -using namespace LLVOAvatarDefines; +using namespace LLAvatarAppearanceDefines; //----------------------------------------------------------------------------- // Global constants @@ -139,7 +143,6 @@ const LLUUID ANIM_AGENT_PHYSICS_MOTION = LLUUID("7360e029-3cb8-ebc4-863e-212df44 //----------------------------------------------------------------------------- // Constants //----------------------------------------------------------------------------- -const std::string AVATAR_DEFAULT_CHAR = "avatar"; const S32 MIN_PIXEL_AREA_FOR_COMPOSITE = 1024; const F32 SHADOW_OFFSET_AMT = 0.03f; @@ -244,6 +247,24 @@ struct LLVOAvatarCollisionVolumeInfo : public LLInitParam::Block mParamWeights; + std::vector mParams; +}; + struct LLVOAvatarChildJoint : public LLInitParam::ChoiceBlock { Alternative > bone; @@ -605,11 +626,7 @@ private: //----------------------------------------------------------------------------- // Static Data //----------------------------------------------------------------------------- -LLXmlTree LLVOAvatar::sXMLTree; -LLXMLNodePtr LLVOAvatar::sSkeletonXMLTree; -LLVOAvatarSkeletonInfo* LLVOAvatar::sAvatarSkeletonInfo = NULL; -LLVOAvatar::LLVOAvatarXmlInfo* LLVOAvatar::sAvatarXmlInfo = NULL; -LLVOAvatarDictionary *LLVOAvatar::sAvatarDictionary = NULL; +LLAvatarAppearanceDictionary *LLVOAvatar::sAvatarDictionary = NULL; S32 LLVOAvatar::sFreezeCounter = 0; U32 LLVOAvatar::sMaxVisible = 12; F32 LLVOAvatar::sRenderDistance = 256.f; @@ -656,15 +673,13 @@ static F32 calc_bouncy_animation(F32 x); LLVOAvatar::LLVOAvatar(const LLUUID& id, const LLPCode pcode, LLViewerRegion* regionp) : + LLAvatarAppearance(&gAgentWearables), LLViewerObject(id, pcode, regionp), - mIsDummy(FALSE), mSpecialRenderMode(0), mAttachmentGeometryBytes(0), mAttachmentSurfaceArea(0.f), mTurning(FALSE), - mPelvisToFoot(0.f), mLastSkeletonSerialNum( 0 ), - mHeadOffset(), mIsSitting(FALSE), mTimeVisible(), mTyping(FALSE), @@ -689,9 +704,6 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mFirstAppearanceMessageReceived( FALSE ), mCulled( FALSE ), mVisibilityRank(0), - mTexSkinColor( NULL ), - mTexHairColor( NULL ), - mTexEyeColor( NULL ), mNeedsSkin(FALSE), mLastSkinTime(0.f), mUpdatePeriod(1), @@ -699,12 +711,15 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mFullyLoaded(FALSE), mPreviousFullyLoaded(FALSE), mFullyLoadedInitialized(FALSE), - mSupportsAlphaLayers(FALSE), mLoadedCallbacksPaused(FALSE), mHasPelvisOffset( FALSE ), mRenderUnloadedAvatar(LLCachedControl(gSavedSettings, "RenderUnloadedAvatar")), - mLastRezzedStatus(-1) - + mLastRezzedStatus(-1), + mIsEditingAppearance(FALSE), + mUseLocalAppearance(FALSE), + mUseServerBakes(FALSE), // FIXME DRANO consider using boost::optional, defaulting to unknown. + mLastUpdateRequestCOFVersion(-1), + mLastUpdateReceivedCOFVersion(-1) { //VTResume(); // VTune @@ -716,28 +731,10 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mPelvisp = NULL; - mBakedTextureDatas.resize(BAKED_NUM_INDICES); - for (U32 i = 0; i < mBakedTextureDatas.size(); i++ ) - { - mBakedTextureDatas[i].mLastTextureIndex = IMG_DEFAULT_AVATAR; - mBakedTextureDatas[i].mTexLayerSet = NULL; - mBakedTextureDatas[i].mIsLoaded = false; - mBakedTextureDatas[i].mIsUsed = false; - mBakedTextureDatas[i].mMaskTexName = 0; - mBakedTextureDatas[i].mTextureIndex = LLVOAvatarDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)i); - } - mDirtyMesh = 2; // Dirty geometry, need to regenerate. mMeshTexturesDirty = FALSE; mHeadp = NULL; - mIsBuilt = FALSE; - - mNumJoints = 0; - mSkeleton = NULL; - - mNumCollisionVolumes = 0; - mCollisionVolumes = NULL; // set up animation variables mSpeed = 0.f; @@ -824,50 +821,13 @@ LLVOAvatar::~LLVOAvatar() debugAvatarRezTime("AvatarRezLeftNotification","left sometime after declouding"); } - lldebugs << "LLVOAvatar Destructor (0x" << this << ") id:" << mID << llendl; - - mRoot.removeAllChildren(); - mJointMap.clear(); - - deleteAndClearArray(mSkeleton); - deleteAndClearArray(mCollisionVolumes); - - mNumJoints = 0; + logPendingPhases(); - for (U32 i = 0; i < mBakedTextureDatas.size(); i++) - { - deleteAndClear(mBakedTextureDatas[i].mTexLayerSet); - mBakedTextureDatas[i].mMeshes.clear(); - - for (morph_list_t::iterator iter2 = mBakedTextureDatas[i].mMaskedMorphs.begin(); - iter2 != mBakedTextureDatas[i].mMaskedMorphs.end(); iter2++) - { - LLMaskedMorph* masked_morph = (*iter2); - delete masked_morph; - } - } + lldebugs << "LLVOAvatar Destructor (0x" << this << ") id:" << mID << llendl; std::for_each(mAttachmentPoints.begin(), mAttachmentPoints.end(), DeletePairedPointer()); mAttachmentPoints.clear(); - deleteAndClear(mTexSkinColor); - deleteAndClear(mTexHairColor); - deleteAndClear(mTexEyeColor); - - std::for_each(mMeshes.begin(), mMeshes.end(), DeletePairedPointer()); - mMeshes.clear(); - - for (std::vector::iterator jointIter = mMeshLOD.begin(); - jointIter != mMeshLOD.end(); - ++jointIter) - { - LLViewerJoint* joint = (LLViewerJoint *) *jointIter; - std::for_each(joint->mMeshParts.begin(), joint->mMeshParts.end(), DeletePointer()); - joint->mMeshParts.clear(); - } - std::for_each(mMeshLOD.begin(), mMeshLOD.end(), DeletePointer()); - mMeshLOD.clear(); - mDead = TRUE; mAnimationSources.clear(); @@ -912,7 +872,7 @@ BOOL LLVOAvatar::isFullyTextured() const { for (S32 i = 0; i < mMeshLOD.size(); i++) { - LLViewerJoint* joint = (LLViewerJoint*) mMeshLOD[i]; + LLAvatarJoint* joint = mMeshLOD[i]; if (i==MESH_ID_SKIRT && !isWearingWearableType(LLWearableType::WT_SKIRT)) { continue; // don't care about skirt textures if we're not wearing one. @@ -921,19 +881,19 @@ BOOL LLVOAvatar::isFullyTextured() const { continue; // nonexistent LOD OK. } - std::vector::iterator meshIter = joint->mMeshParts.begin(); + avatar_joint_mesh_list_t::iterator meshIter = joint->mMeshParts.begin(); if (meshIter != joint->mMeshParts.end()) { - LLViewerJointMesh *mesh = (LLViewerJointMesh *) *meshIter; + LLAvatarJointMesh *mesh = (*meshIter); if (!mesh) { continue; // nonexistent mesh OK } - if (mesh->mTexture.notNull() && mesh->mTexture->hasGLTexture()) + if (mesh->hasGLTexture()) { continue; // Mesh exists and has a baked texture. } - if (mesh->mLayerSet && mesh->mLayerSet->hasComposite()) + if (mesh->hasComposite()) { continue; // Mesh exists and has a composite texture. } @@ -952,6 +912,7 @@ BOOL LLVOAvatar::hasGray() const S32 LLVOAvatar::getRezzedStatus() const { if (getIsCloud()) return 0; + if (isFullyTextured() && allBakedTexturesCompletelyDownloaded()) return 3; if (isFullyTextured()) return 2; llassert(hasGray()); return 1; // gray @@ -1007,7 +968,7 @@ BOOL LLVOAvatar::areAllNearbyInstancesBaked(S32& grey_avatars) void LLVOAvatar::getNearbyRezzedStats(std::vector& counts) { counts.clear(); - counts.resize(3); + counts.resize(4); for (std::vector::iterator iter = LLCharacter::sInstances.begin(); iter != LLCharacter::sInstances.end(); ++iter) { @@ -1025,6 +986,7 @@ std::string LLVOAvatar::rezStatusToString(S32 rez_status) if (rez_status==0) return "cloud"; if (rez_status==1) return "gray"; if (rez_status==2) return "textured"; + if (rez_status==3) return "textured_and_downloaded"; return "unknown"; } @@ -1086,15 +1048,15 @@ void LLVOAvatar::dumpBakedStatus() { llcont << " Unbaked ("; - for (LLVOAvatarDictionary::BakedTextures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin(); - iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end(); + for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().begin(); + iter != LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().end(); ++iter) { - const LLVOAvatarDictionary::BakedEntry *baked_dict = iter->second; + const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = iter->second; const ETextureIndex index = baked_dict->mTextureIndex; if (!inst->isTextureDefined(index)) { - llcont << " " << LLVOAvatarDictionary::getInstance()->getTexture(index)->mName; + llcont << " " << LLAvatarAppearanceDictionary::getInstance()->getTexture(index)->mName; } } llcont << " ) " << inst->getUnbakedPixelAreaRank(); @@ -1115,7 +1077,7 @@ void LLVOAvatar::restoreGL() gAgentAvatarp->setCompositeUpdatesEnabled(TRUE); for (U32 i = 0; i < gAgentAvatarp->mBakedTextureDatas.size(); i++) { - gAgentAvatarp->invalidateComposite(gAgentAvatarp->mBakedTextureDatas[i].mTexLayerSet, FALSE); + gAgentAvatarp->invalidateComposite(gAgentAvatarp->getTexLayerSet(i), FALSE); } gAgentAvatarp->updateMeshTextures(); } @@ -1142,7 +1104,7 @@ void LLVOAvatar::resetImpostors() // static void LLVOAvatar::deleteCachedImages(bool clearAll) { - if (LLTexLayerSet::sHasCaches) + if (LLViewerTexLayerSet::sHasCaches) { lldebugs << "Deleting layer set caches" << llendl; for (std::vector::iterator iter = LLCharacter::sInstances.begin(); @@ -1151,7 +1113,7 @@ void LLVOAvatar::deleteCachedImages(bool clearAll) LLVOAvatar* inst = (LLVOAvatar*) *iter; inst->deleteLayerSetCaches(clearAll); } - LLTexLayerSet::sHasCaches = FALSE; + LLViewerTexLayerSet::sHasCaches = FALSE; } LLVOAvatarSelf::deleteScratchTextures(); LLTexLayerStaticImageList::getInstance()->deleteCachedImages(); @@ -1164,97 +1126,6 @@ void LLVOAvatar::deleteCachedImages(bool clearAll) //------------------------------------------------------------------------ void LLVOAvatar::initClass() { - std::string xmlFile; - - xmlFile = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,AVATAR_DEFAULT_CHAR) + "_lad.xml"; - BOOL success = sXMLTree.parseFile( xmlFile, FALSE ); - if (!success) - { - llerrs << "Problem reading avatar configuration file:" << xmlFile << llendl; - } - - // now sanity check xml file - LLXmlTreeNode* root = sXMLTree.getRoot(); - if (!root) - { - llerrs << "No root node found in avatar configuration file: " << xmlFile << llendl; - return; - } - - //------------------------------------------------------------------------- - // (root) - //------------------------------------------------------------------------- - if( !root->hasName( "linden_avatar" ) ) - { - llerrs << "Invalid avatar file header: " << xmlFile << llendl; - } - - std::string version; - static LLStdStringHandle version_string = LLXmlTree::addAttributeString("version"); - if( !root->getFastAttributeString( version_string, version ) || (version != "1.0") ) - { - llerrs << "Invalid avatar file version: " << version << " in file: " << xmlFile << llendl; - } - - S32 wearable_def_version = 1; - static LLStdStringHandle wearable_definition_version_string = LLXmlTree::addAttributeString("wearable_definition_version"); - root->getFastAttributeS32( wearable_definition_version_string, wearable_def_version ); - LLWearable::setCurrentDefinitionVersion( wearable_def_version ); - - std::string mesh_file_name; - - LLXmlTreeNode* skeleton_node = root->getChildByName( "skeleton" ); - if (!skeleton_node) - { - llerrs << "No skeleton in avatar configuration file: " << xmlFile << llendl; - return; - } - - std::string skeleton_file_name; - static LLStdStringHandle file_name_string = LLXmlTree::addAttributeString("file_name"); - if (!skeleton_node->getFastAttributeString(file_name_string, skeleton_file_name)) - { - llerrs << "No file name in skeleton node in avatar config file: " << xmlFile << llendl; - } - - std::string skeleton_path; - skeleton_path = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,skeleton_file_name); - if (!parseSkeletonFile(skeleton_path)) - { - llerrs << "Error parsing skeleton file: " << skeleton_path << llendl; - } - - // parse avatar_lad.xml - if (sAvatarXmlInfo) - { //this can happen if a login attempt failed - deleteAndClear(sAvatarXmlInfo); - } - sAvatarXmlInfo = new LLVOAvatarXmlInfo; - if (!sAvatarXmlInfo->parseXmlSkeletonNode(root)) - { - llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl; - } - if (!sAvatarXmlInfo->parseXmlMeshNodes(root)) - { - llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl; - } - if (!sAvatarXmlInfo->parseXmlColorNodes(root)) - { - llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl; - } - if (!sAvatarXmlInfo->parseXmlLayerNodes(root)) - { - llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl; - } - if (!sAvatarXmlInfo->parseXmlDriverNodes(root)) - { - llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl; - } - if (!sAvatarXmlInfo->parseXmlMorphNodes(root)) - { - llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl; - } - gAnimLibrary.animStateSetString(ANIM_AGENT_BODY_NOISE,"body_noise"); gAnimLibrary.animStateSetString(ANIM_AGENT_BREATHE_ROT,"breathe_rot"); gAnimLibrary.animStateSetString(ANIM_AGENT_PHYSICS_MOTION,"physics_motion"); @@ -1271,84 +1142,11 @@ void LLVOAvatar::initClass() void LLVOAvatar::cleanupClass() { - deleteAndClear(sAvatarXmlInfo); - sSkeletonXMLTree = NULL; - sXMLTree.cleanup(); } +// virtual void LLVOAvatar::initInstance(void) { - //------------------------------------------------------------------------- - // initialize joint, mesh and shape members - //------------------------------------------------------------------------- - mRoot.setName( "mRoot" ); - - for (LLVOAvatarDictionary::Meshes::const_iterator iter = LLVOAvatarDictionary::getInstance()->getMeshes().begin(); - iter != LLVOAvatarDictionary::getInstance()->getMeshes().end(); - ++iter) - { - const EMeshIndex mesh_index = iter->first; - const LLVOAvatarDictionary::MeshEntry *mesh_dict = iter->second; - LLViewerJoint* joint = new LLViewerJoint(); - joint->setName(mesh_dict->mName); - joint->setMeshID(mesh_index); - mMeshLOD.push_back(joint); - - /* mHairLOD.setName("mHairLOD"); - mHairMesh0.setName("mHairMesh0"); - mHairMesh0.setMeshID(MESH_ID_HAIR); - mHairMesh1.setName("mHairMesh1"); */ - for (U32 lod = 0; lod < mesh_dict->mLOD; lod++) - { - LLViewerJointMesh* mesh = new LLViewerJointMesh(); - std::string mesh_name = "m" + mesh_dict->mName + boost::lexical_cast(lod); - // We pre-pended an m - need to capitalize first character for camelCase - mesh_name[1] = toupper(mesh_name[1]); - mesh->setName(mesh_name); - mesh->setMeshID(mesh_index); - mesh->setPickName(mesh_dict->mPickName); - mesh->setIsTransparent(FALSE); - switch((int)mesh_index) - { - case MESH_ID_HAIR: - mesh->setIsTransparent(TRUE); - break; - case MESH_ID_SKIRT: - mesh->setIsTransparent(TRUE); - break; - case MESH_ID_EYEBALL_LEFT: - case MESH_ID_EYEBALL_RIGHT: - mesh->setSpecular( LLColor4( 1.0f, 1.0f, 1.0f, 1.0f ), 1.f ); - break; - } - - joint->mMeshParts.push_back(mesh); - } - } - - //------------------------------------------------------------------------- - // associate baked textures with meshes - //------------------------------------------------------------------------- - for (LLVOAvatarDictionary::Meshes::const_iterator iter = LLVOAvatarDictionary::getInstance()->getMeshes().begin(); - iter != LLVOAvatarDictionary::getInstance()->getMeshes().end(); - ++iter) - { - const EMeshIndex mesh_index = iter->first; - const LLVOAvatarDictionary::MeshEntry *mesh_dict = iter->second; - const EBakedTextureIndex baked_texture_index = mesh_dict->mBakedID; - // Skip it if there's no associated baked texture. - if (baked_texture_index == BAKED_NUM_INDICES) continue; - - for (std::vector::iterator iter = mMeshLOD[mesh_index]->mMeshParts.begin(); - iter != mMeshLOD[mesh_index]->mMeshParts.end(); - ++iter) - { - LLViewerJointMesh* mesh = (LLViewerJointMesh*) *iter; - mBakedTextureDatas[(int)baked_texture_index].mMeshes.push_back(mesh); - } - } - - //------------------------------------------------------------------------- // register motions //------------------------------------------------------------------------- @@ -1407,10 +1205,9 @@ void LLVOAvatar::initInstance(void) registerMotion( ANIM_AGENT_SIT_FEMALE, LLKeyframeMotion::create ); registerMotion( ANIM_AGENT_TARGET, LLTargetingMotion::create ); registerMotion( ANIM_AGENT_WALK_ADJUST, LLWalkAdjustMotion::create ); - } - buildCharacter(); + LLAvatarAppearance::initInstance(); // preload specific motions here createMotion( ANIM_AGENT_CUSTOMIZE); @@ -1419,7 +1216,30 @@ void LLVOAvatar::initInstance(void) //VTPause(); // VTune mVoiceVisualizer->setVoiceEnabled( LLVoiceClient::getInstance()->getVoiceEnabled( mID ) ); +} + +// virtual +LLAvatarJoint* LLVOAvatar::createAvatarJoint() +{ + return new LLViewerJoint(); +} + +// virtual +LLAvatarJoint* LLVOAvatar::createAvatarJoint(S32 joint_num) +{ + return new LLViewerJoint(joint_num); +} + +// virtual +LLAvatarJointMesh* LLVOAvatar::createAvatarJointMesh() +{ + return new LLViewerJointMesh(); +} +// virtual +LLTexLayerSet* LLVOAvatar::createTexLayerSet() +{ + return new LLViewerTexLayerSet(this); } const LLVector3 LLVOAvatar::getRenderPosition() const @@ -1494,7 +1314,7 @@ void LLVOAvatar::getSpatialExtents(LLVector4a& newMin, LLVector4a& newMax) float max_attachment_span = get_default_max_prim_scale() * 5.0f; //stretch bounding box by joint positions - for (polymesh_map_t::iterator i = mMeshes.begin(); i != mMeshes.end(); ++i) + for (polymesh_map_t::iterator i = mPolyMeshes.begin(); i != mPolyMeshes.end(); ++i) { LLPolyMesh* mesh = i->second; for (S32 joint_num = 0; joint_num < mesh->mJointRenderData.count(); joint_num++) @@ -1732,148 +1552,6 @@ LLViewerObject* LLVOAvatar::lineSegmentIntersectRiggedAttachments(const LLVector return hit; } -//----------------------------------------------------------------------------- -// parseSkeletonFile() -//----------------------------------------------------------------------------- -BOOL LLVOAvatar::parseSkeletonFile(const std::string& filename) -{ - //------------------------------------------------------------------------- - // parse the file - //------------------------------------------------------------------------- - - LLXMLNodePtr skeleton_xml; - BOOL parsesuccess = LLXMLNode::parseFile(filename, skeleton_xml, NULL); - - if (!parsesuccess || skeleton_xml.isNull()) - { - llerrs << "Can't parse skeleton file: " << filename << llendl; - return FALSE; - } - - // Process XML data - if (sAvatarSkeletonInfo) - { //this can happen if a login attempt failed - delete sAvatarSkeletonInfo; - } - sAvatarSkeletonInfo = new LLVOAvatarSkeletonInfo; - - LLXUIParser parser; - parser.readXUI(skeleton_xml, *sAvatarSkeletonInfo, filename); - if (!sAvatarSkeletonInfo->validateBlock()) - { - llerrs << "Error parsing skeleton XML file: " << filename << llendl; - } - - if( !skeleton_xml->hasName( "linden_skeleton" ) ) - { - llerrs << "Invalid avatar skeleton file header: " << filename << llendl; - return FALSE; - } - - if (sAvatarSkeletonInfo->version() != "1.0") - { - llerrs << "Invalid avatar skeleton file version: " << sAvatarSkeletonInfo->version() << " in file: " << filename << llendl; - return FALSE; - } - - return TRUE; -} - -//----------------------------------------------------------------------------- -// setupBone() -//----------------------------------------------------------- -BOOL LLVOAvatar::setupBone(const LLVOAvatarChildJoint& info, LLViewerJoint* parent, S32 &volume_num, S32 &joint_num) -{ - LLViewerJoint* joint = NULL; - if (info.bone.isChosen()) - { - joint = (LLViewerJoint*)getCharacterJoint(joint_num); - if (!joint) - { - llwarns << "Too many bones" << llendl; - return FALSE; - } - joint->setName( info.bone().name ); - joint->setPosition(info.bone().pos); - joint->setRotation(mayaQ(info.bone().rot().mV[VX], info.bone().rot().mV[VY], info.bone().rot().mV[VZ], LLQuaternion::XYZ)); - joint->setScale(info.bone().scale); - joint->setSkinOffset( info.bone().pivot ); - joint_num++; - - for (LLInitParam::ParamIterator::const_iterator child_it = info.bone().children.begin(), - end_it = info.bone().children.end(); - child_it != end_it; - ++child_it) - { - if (!setupBone(*child_it, joint, volume_num, joint_num)) - { - return FALSE; - } - } - } - else // collision volume - { - if (volume_num >= (S32)mNumCollisionVolumes) - { - llwarns << "Too many bones" << llendl; - return FALSE; - } - joint = (LLViewerJoint*)(&mCollisionVolumes[volume_num]); - joint->setName( info.collision_volume.name); - joint->setPosition(info.collision_volume.pos); - joint->setRotation(mayaQ(info.collision_volume.rot().mV[VX], info.collision_volume.rot().mV[VY], info.collision_volume.rot().mV[VZ], LLQuaternion::XYZ)); - joint->setScale(info.collision_volume.scale); - volume_num++; - } - - // add to parent - if (parent) - { - parent->addChild( joint ); - } - - joint->setDefaultFromCurrentXform(); - - return TRUE; -} - -//----------------------------------------------------------------------------- -// buildSkeleton() -//----------------------------------------------------------------------------- -BOOL LLVOAvatar::buildSkeleton(const LLVOAvatarSkeletonInfo *info) -{ - //------------------------------------------------------------------------- - // allocate joints - //------------------------------------------------------------------------- - if (!allocateCharacterJoints(info->num_bones)) - { - llerrs << "Can't allocate " << info->num_bones() << " joints" << llendl; - return FALSE; - } - - //------------------------------------------------------------------------- - // allocate volumes - //------------------------------------------------------------------------- - if (info->num_collision_volumes) - { - if (!allocateCollisionVolumes(info->num_collision_volumes)) - { - llerrs << "Can't allocate " << info->num_collision_volumes() << " collision volumes" << llendl; - return FALSE; - } - } - - S32 current_joint_num = 0; - S32 current_volume_num = 0; - - if (!setupBone(info->skeleton_root, NULL, current_volume_num, current_joint_num)) - { - llerrs << "Error parsing bone in skeleton file" << llendl; - return FALSE; - } - - return TRUE; -} LLVOAvatar* LLVOAvatar::asAvatar() { @@ -1906,113 +1584,14 @@ void LLVOAvatar::startDefaultMotions() // LLVOAvatar::buildCharacter() // Deferred initialization and rebuild of the avatar. //----------------------------------------------------------------------------- +// virtual void LLVOAvatar::buildCharacter() { - //------------------------------------------------------------------------- - // remove all references to our existing skeleton - // so we can rebuild it - //------------------------------------------------------------------------- - flushAllMotions(); + LLAvatarAppearance::buildCharacter(); - //------------------------------------------------------------------------- - // remove all of mRoot's children - //------------------------------------------------------------------------- - mRoot.removeAllChildren(); - mJointMap.clear(); + // Not done building yet; more to do. mIsBuilt = FALSE; - //------------------------------------------------------------------------- - // clear mesh data - //------------------------------------------------------------------------- - for (std::vector::iterator jointIter = mMeshLOD.begin(); - jointIter != mMeshLOD.end(); ++jointIter) - { - LLViewerJoint* joint = (LLViewerJoint*) *jointIter; - for (std::vector::iterator meshIter = joint->mMeshParts.begin(); - meshIter != joint->mMeshParts.end(); ++meshIter) - { - LLViewerJointMesh * mesh = (LLViewerJointMesh *) *meshIter; - mesh->setMesh(NULL); - } - } - - //------------------------------------------------------------------------- - // (re)load our skeleton and meshes - //------------------------------------------------------------------------- - LLTimer timer; - - BOOL status = loadAvatar(); - stop_glerror(); - -// gPrintMessagesThisFrame = TRUE; - lldebugs << "Avatar load took " << timer.getElapsedTimeF32() << " seconds." << llendl; - - if (!status) - { - if (isSelf()) - { - llerrs << "Unable to load user's avatar" << llendl; - } - else - { - llwarns << "Unable to load other's avatar" << llendl; - } - return; - } - - //------------------------------------------------------------------------- - // initialize "well known" joint pointers - //------------------------------------------------------------------------- - mPelvisp = (LLViewerJoint*)mRoot.findJoint("mPelvis"); - mTorsop = (LLViewerJoint*)mRoot.findJoint("mTorso"); - mChestp = (LLViewerJoint*)mRoot.findJoint("mChest"); - mNeckp = (LLViewerJoint*)mRoot.findJoint("mNeck"); - mHeadp = (LLViewerJoint*)mRoot.findJoint("mHead"); - mSkullp = (LLViewerJoint*)mRoot.findJoint("mSkull"); - mHipLeftp = (LLViewerJoint*)mRoot.findJoint("mHipLeft"); - mHipRightp = (LLViewerJoint*)mRoot.findJoint("mHipRight"); - mKneeLeftp = (LLViewerJoint*)mRoot.findJoint("mKneeLeft"); - mKneeRightp = (LLViewerJoint*)mRoot.findJoint("mKneeRight"); - mAnkleLeftp = (LLViewerJoint*)mRoot.findJoint("mAnkleLeft"); - mAnkleRightp = (LLViewerJoint*)mRoot.findJoint("mAnkleRight"); - mFootLeftp = (LLViewerJoint*)mRoot.findJoint("mFootLeft"); - mFootRightp = (LLViewerJoint*)mRoot.findJoint("mFootRight"); - mWristLeftp = (LLViewerJoint*)mRoot.findJoint("mWristLeft"); - mWristRightp = (LLViewerJoint*)mRoot.findJoint("mWristRight"); - mEyeLeftp = (LLViewerJoint*)mRoot.findJoint("mEyeLeft"); - mEyeRightp = (LLViewerJoint*)mRoot.findJoint("mEyeRight"); - - //------------------------------------------------------------------------- - // Make sure "well known" pointers exist - //------------------------------------------------------------------------- - if (!(mPelvisp && - mTorsop && - mChestp && - mNeckp && - mHeadp && - mSkullp && - mHipLeftp && - mHipRightp && - mKneeLeftp && - mKneeRightp && - mAnkleLeftp && - mAnkleRightp && - mFootLeftp && - mFootRightp && - mWristLeftp && - mWristRightp && - mEyeLeftp && - mEyeRightp)) - { - llerrs << "Failed to create avatar." << llendl; - return; - } - - //------------------------------------------------------------------------- - // initialize the pelvis - //------------------------------------------------------------------------- - mPelvisp->setPosition( LLVector3(0.0f, 0.0f, 0.0f) ); - //------------------------------------------------------------------------- // set head offset from pelvis //------------------------------------------------------------------------- @@ -2065,11 +1644,11 @@ void LLVOAvatar::releaseMeshData() //llinfos << "Releasing" << llendl; // cleanup mesh data - for (std::vector::iterator iter = mMeshLOD.begin(); + for (avatar_joint_list_t::iterator iter = mMeshLOD.begin(); iter != mMeshLOD.end(); ++iter) { - LLViewerJoint* joint = (LLViewerJoint*) *iter; + LLAvatarJoint* joint = (*iter); joint->setValid(FALSE, TRUE); } @@ -2158,7 +1737,11 @@ void LLVOAvatar::updateMeshData() last_v_num = num_vertices ; last_i_num = num_indices ; - mMeshLOD[part_index++]->updateFaceSizes(num_vertices, num_indices, mAdjustedPixelArea); + LLViewerJoint* part_mesh = getViewerJoint(part_index++); + if (part_mesh) + { + part_mesh->updateFaceSizes(num_vertices, num_indices, mAdjustedPixelArea); + } } if(num_vertices < 1)//skip empty meshes { @@ -2232,7 +1815,11 @@ void LLVOAvatar::updateMeshData() rigid = true; } - mMeshLOD[k]->updateFaceData(facep, mAdjustedPixelArea, k == MESH_ID_HAIR, terse_update && !rigid); + LLViewerJoint* mesh = getViewerJoint(k); + if (mesh) + { + mesh->updateFaceData(facep, mAdjustedPixelArea, k == MESH_ID_HAIR, terse_update && !rigid); + } } stop_glerror(); @@ -2252,72 +1839,6 @@ void LLVOAvatar::updateMeshData() //------------------------------------------------------------------------ -//------------------------------------------------------------------------ -// The viewer can only suggest a good size for the agent, -// the simulator will keep it inside a reasonable range. -void LLVOAvatar::computeBodySize() -{ - LLVector3 pelvis_scale = mPelvisp->getScale(); - - // some of the joints have not been cached - LLVector3 skull = mSkullp->getPosition(); - LLVector3 skull_scale = mSkullp->getScale(); - - LLVector3 neck = mNeckp->getPosition(); - LLVector3 neck_scale = mNeckp->getScale(); - - LLVector3 chest = mChestp->getPosition(); - LLVector3 chest_scale = mChestp->getScale(); - - // the rest of the joints have been cached - LLVector3 head = mHeadp->getPosition(); - LLVector3 head_scale = mHeadp->getScale(); - - LLVector3 torso = mTorsop->getPosition(); - LLVector3 torso_scale = mTorsop->getScale(); - - LLVector3 hip = mHipLeftp->getPosition(); - LLVector3 hip_scale = mHipLeftp->getScale(); - - LLVector3 knee = mKneeLeftp->getPosition(); - LLVector3 knee_scale = mKneeLeftp->getScale(); - - LLVector3 ankle = mAnkleLeftp->getPosition(); - LLVector3 ankle_scale = mAnkleLeftp->getScale(); - - LLVector3 foot = mFootLeftp->getPosition(); - - mPelvisToFoot = hip.mV[VZ] * pelvis_scale.mV[VZ] - - knee.mV[VZ] * hip_scale.mV[VZ] - - ankle.mV[VZ] * knee_scale.mV[VZ] - - foot.mV[VZ] * ankle_scale.mV[VZ]; - - LLVector3 new_body_size; - new_body_size.mV[VZ] = mPelvisToFoot + - // the sqrt(2) correction below is an approximate - // correction to get to the top of the head - F_SQRT2 * (skull.mV[VZ] * head_scale.mV[VZ]) + - head.mV[VZ] * neck_scale.mV[VZ] + - neck.mV[VZ] * chest_scale.mV[VZ] + - chest.mV[VZ] * torso_scale.mV[VZ] + - torso.mV[VZ] * pelvis_scale.mV[VZ]; - - // TODO -- measure the real depth and width - new_body_size.mV[VX] = DEFAULT_AGENT_DEPTH; - new_body_size.mV[VY] = DEFAULT_AGENT_WIDTH; - - if (new_body_size != mBodySize) - { - mBodySize = new_body_size; - - if (isSelf() && !LLAppearanceMgr::instance().isInUpdateAppearanceFromCOF()) - { // notify simulator of change in size - // but not if we are in the middle of updating appearance - gAgent.sendAgentSetAppearance(); - } - } -} - //------------------------------------------------------------------------ // LLVOAvatar::processUpdateMessage() //------------------------------------------------------------------------ @@ -2326,7 +1847,6 @@ U32 LLVOAvatar::processUpdateMessage(LLMessageSystem *mesgsys, U32 block_num, const EObjectUpdateType update_type, LLDataPacker *dp) { - LLVector3 old_vel = getVelocity(); const BOOL has_name = !getNVPair("FirstName"); // Do base class updates... @@ -2354,20 +1874,50 @@ U32 LLVOAvatar::processUpdateMessage(LLMessageSystem *mesgsys, return retval; } -// virtual -S32 LLVOAvatar::setTETexture(const U8 te, const LLUUID& uuid) +LLViewerFetchedTexture *LLVOAvatar::getBakedTextureImage(const U8 te, const LLUUID& uuid) +{ + LLViewerFetchedTexture *result = NULL; + + if (uuid == IMG_DEFAULT_AVATAR || + uuid == IMG_DEFAULT || + uuid == IMG_INVISIBLE) + { + // Should already exist, don't need to find it on sim or baked-texture host. + result = gTextureList.findImage(uuid); + } + + if (!result) { - // The core setTETexture() method requests images, so we need - // to redirect certain avatar texture requests to different sims. - if (isIndexBakedTexture((ETextureIndex)te)) + const std::string url = getImageURL(te,uuid); + if (!url.empty()) { - LLHost target_host = getObjectHost(); - return setTETextureCore(te, uuid, target_host); + LL_DEBUGS("Avatar") << avString() << "from URL " << url << llendl; + result = LLViewerTextureManager::getFetchedTextureFromUrl( + url, FTT_SERVER_BAKE, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, uuid); } else { - return setTETextureCore(te, uuid, LLHost::invalid); + LL_DEBUGS("Avatar") << avString() << "from host " << uuid << llendl; + LLHost host = getObjectHost(); + result = LLViewerTextureManager::getFetchedTexture( + uuid, FTT_HOST_BAKE, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, host); + } +} + return result; +} + +// virtual +S32 LLVOAvatar::setTETexture(const U8 te, const LLUUID& uuid) +{ + if (!isIndexBakedTexture((ETextureIndex)te)) + { + // Sim still sends some uuids for non-baked slots sometimes - ignore. + return LLViewerObject::setTETexture(te, LLUUID::null); } + + LLViewerFetchedTexture *image = getBakedTextureImage(te,uuid); + llassert(image); + return setTETextureCore(te, image); } static LLFastTimer::DeclareTimer FTM_AVATAR_UPDATE("Avatar Update"); @@ -2413,7 +1963,8 @@ void LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) return; } - if (!(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_AVATAR))) + if (!(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_AVATAR)) + && !(gSavedSettings.getBOOL("DisableAllRenderTypes"))) { return; } @@ -2478,7 +2029,7 @@ void LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) // animate the character // store off last frame's root position to be consistent with camera position - LLVector3 root_pos_last = mRoot.getWorldPosition(); + LLVector3 root_pos_last = mRoot->getWorldPosition(); BOOL detailed_update = updateCharacter(agent); static LLUICachedControl visualizers_in_calls("ShowVoiceVisualizersInCalls", false); @@ -2597,11 +2148,11 @@ void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled) if ( mIsSitting ) { LLVector3 headOffset = LLVector3( 0.0f, 0.0f, mHeadOffset.mV[2] ); - mVoiceVisualizer->setVoiceSourceWorldPosition( mRoot.getWorldPosition() + headOffset ); + mVoiceVisualizer->setVoiceSourceWorldPosition( mRoot->getWorldPosition() + headOffset ); } else { - LLVector3 tagPos = mRoot.getWorldPosition(); + LLVector3 tagPos = mRoot->getWorldPosition(); tagPos[VZ] -= mPelvisToFoot; tagPos[VZ] += ( mBodySize[VZ] + 0.125f ); mVoiceVisualizer->setVoiceSourceWorldPosition( tagPos ); @@ -3206,8 +2757,6 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) mNameText->setTextAlignment(LLHUDNameTag::ALIGN_TEXT_LEFT); mNameText->setFadeDistance(CHAT_NORMAL_RADIUS * 2.f, 5.f); - char line[MAX_STRING]; /* Flawfinder: ignore */ - line[0] = '\0'; std::deque::iterator chat_iter = mChats.begin(); mNameText->clearString(); @@ -3334,7 +2883,7 @@ void LLVOAvatar::invalidateNameTags() // Compute name tag position during idle update void LLVOAvatar::idleUpdateNameTagPosition(const LLVector3& root_pos_last) { - LLQuaternion root_rot = mRoot.getWorldRotation(); + LLQuaternion root_rot = mRoot->getWorldRotation(); LLQuaternion inv_root_rot = ~root_rot; LLVector3 pixel_right_vec; LLVector3 pixel_up_vec; @@ -3353,7 +2902,7 @@ void LLVOAvatar::idleUpdateNameTagPosition(const LLVector3& root_pos_last) local_camera_up.scaleVec(avatar_ellipsoid); local_camera_at.scaleVec(avatar_ellipsoid); - LLVector3 head_offset = (mHeadp->getLastWorldPosition() - mRoot.getLastWorldPosition()) * inv_root_rot; + LLVector3 head_offset = (mHeadp->getLastWorldPosition() - mRoot->getLastWorldPosition()) * inv_root_rot; if (dist_vec(head_offset, mTargetRootToHeadOffset) > NAMETAG_UPDATE_THRESHOLD) { @@ -3362,7 +2911,7 @@ void LLVOAvatar::idleUpdateNameTagPosition(const LLVector3& root_pos_last) mCurRootToHeadOffset = lerp(mCurRootToHeadOffset, mTargetRootToHeadOffset, LLCriticalDamp::getInterpolant(0.2f)); - LLVector3 name_position = mRoot.getLastWorldPosition() + (mCurRootToHeadOffset * root_rot); + LLVector3 name_position = mRoot->getLastWorldPosition() + (mCurRootToHeadOffset * root_rot); name_position += (local_camera_up * root_rot) - (projected_vec(local_camera_at * root_rot, camera_to_av)); name_position += pixel_up_vec * NAMETAG_VERTICAL_SCREEN_OFFSET; @@ -3423,13 +2972,13 @@ void LLVOAvatar::idleUpdateBelowWater() void LLVOAvatar::slamPosition() { gAgent.setPositionAgent(getPositionAgent()); - mRoot.setWorldPosition(getPositionAgent()); // teleport + mRoot->setWorldPosition(getPositionAgent()); // teleport setChanged(TRANSLATED); if (mDrawable.notNull()) { gPipeline.updateMoveNormalAsync(mDrawable); } - mRoot.updateWorldMatrixChildren(); + mRoot->updateWorldMatrixChildren(); } bool LLVOAvatar::isVisuallyMuted() const @@ -3450,6 +2999,47 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) { // clear debug text mDebugText.clear(); + + if (gSavedSettings.getBOOL("DebugAvatarAppearanceMessage")) + { + S32 central_bake_version = -1; + if (getRegion()) + { + central_bake_version = getRegion()->getCentralBakeVersion(); + } + bool all_baked_downloaded = allBakedTexturesCompletelyDownloaded(); + bool all_local_downloaded = allLocalTexturesCompletelyDownloaded(); + std::string debug_line = llformat("%s%s - mLocal: %d, mEdit: %d, mUSB: %d, CBV: %d", + isSelf() ? (all_local_downloaded ? "L" : "l") : "-", + all_baked_downloaded ? "B" : "b", + mUseLocalAppearance, mIsEditingAppearance, + mUseServerBakes, central_bake_version); + std::string origin_string = bakedTextureOriginInfo(); + debug_line += " [" + origin_string + "]"; + S32 curr_cof_version = LLAppearanceMgr::instance().getCOFVersion(); + S32 last_request_cof_version = mLastUpdateRequestCOFVersion; + S32 last_received_cof_version = mLastUpdateReceivedCOFVersion; + if (isSelf()) + { + debug_line += llformat(" - cof: %d req: %d rcv:%d", + curr_cof_version, last_request_cof_version, last_received_cof_version); + if (gSavedSettings.getBOOL("DebugForceAppearanceRequestFailure")) + { + debug_line += " FORCING ERRS"; + } + } + else + { + debug_line += llformat(" - cof rcv:%d", last_received_cof_version); + } + addDebugText(debug_line); + } + if (gSavedSettings.getBOOL("DebugAvatarCompositeBaked")) + { + if (!mBakedTextureDebugText.empty()) + addDebugText(mBakedTextureDebugText); + } + if (LLVOAvatar::sShowAnimationDebug) { for (LLMotionController::motion_list_t::iterator iter = mMotionController.getActiveMotions().begin(); @@ -3586,8 +3176,6 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) xyVel.mV[VZ] = 0.0f; speed = xyVel.length(); - BOOL throttle = TRUE; - if (!(mIsSitting && getParent())) { //-------------------------------------------------------------------- @@ -3598,11 +3186,10 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) if (mTimeLast == 0.0f) { mTimeLast = animation_time; - throttle = FALSE; // put the pelvis at slaved position/mRotation - mRoot.setWorldPosition( getPositionAgent() ); // first frame - mRoot.setWorldRotation( getRotation() ); + mRoot->setWorldPosition( getPositionAgent() ); // first frame + mRoot->setWorldRotation( getRotation() ); } //-------------------------------------------------------------------- @@ -3627,6 +3214,8 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) } root_pos = gAgent.getPosGlobalFromAgent(getRenderPosition()); + root_pos.mdV[VZ] += getVisualParamWeight(AVATAR_HOVER); + resolveHeightGlobal(root_pos, ground_under_pelvis, normal); F32 foot_to_ground = (F32) (root_pos.mdV[VZ] - mPelvisToFoot - ground_under_pelvis.mdV[VZ]); @@ -3645,10 +3234,10 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) LLVector3 newPosition = gAgent.getPosAgentFromGlobal(root_pos); - if (newPosition != mRoot.getXform()->getWorldPosition()) + if (newPosition != mRoot->getXform()->getWorldPosition()) { - mRoot.touch(); - mRoot.setWorldPosition( newPosition ); // regular update + mRoot->touch(); + mRoot->setWorldPosition( newPosition ); // regular update } @@ -3709,7 +3298,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) } - LLQuaternion root_rotation = mRoot.getWorldMatrix().quaternion(); + LLQuaternion root_rotation = mRoot->getWorldMatrix().quaternion(); F32 root_roll, root_pitch, root_yaw; root_rotation.getEulerAngles(&root_roll, &root_pitch, &root_yaw); @@ -3718,7 +3307,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) // and head turn. Once in motion, it must conform however. BOOL self_in_mouselook = isSelf() && gAgentCamera.cameraMouselook(); - LLVector3 pelvisDir( mRoot.getWorldMatrix().getFwdRow4().mV ); + LLVector3 pelvisDir( mRoot->getWorldMatrix().getFwdRow4().mV ); static LLCachedControl s_pelvis_rot_threshold_slow(gSavedSettings, "AvatarRotateThresholdSlow"); static LLCachedControl s_pelvis_rot_threshold_fast(gSavedSettings, "AvatarRotateThresholdFast"); @@ -3804,14 +3393,14 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) F32 u = llclamp((deltaTime / pelvis_lag_time), 0.0f, 1.0f); - mRoot.setWorldRotation( slerp(u, mRoot.getWorldRotation(), wQv) ); + mRoot->setWorldRotation( slerp(u, mRoot->getWorldRotation(), wQv) ); } } else if (mDrawable.notNull()) { - mRoot.setPosition(mDrawable->getPosition()); - mRoot.setRotation(mDrawable->getRotation()); + mRoot->setPosition(mDrawable->getPosition()); + mRoot->setRotation(mDrawable->getRotation()); } //------------------------------------------------------------------------- @@ -3907,7 +3496,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) } } - mRoot.updateWorldMatrixChildren(); + mRoot->updateWorldMatrixChildren(); if (!mDebugText.size() && mText.notNull()) { @@ -3931,7 +3520,7 @@ void LLVOAvatar::updateHeadOffset() { // since we only care about Z, just grab one of the eyes LLVector3 midEyePt = mEyeLeftp->getWorldPosition(); - midEyePt -= mDrawable.notNull() ? mDrawable->getWorldPosition() : mRoot.getWorldPosition(); + midEyePt -= mDrawable.notNull() ? mDrawable->getWorldPosition() : mRoot->getWorldPosition(); midEyePt.mV[VZ] = llmax(-mPelvisToFoot + LLViewerCamera::getInstance()->getNear(), midEyePt.mV[VZ]); if (mDrawable.notNull()) @@ -3969,8 +3558,8 @@ void LLVOAvatar::setPelvisOffset( bool hasOffset, const LLVector3& offsetAmount, void LLVOAvatar::postPelvisSetRecalc( void ) { computeBodySize(); - mRoot.touch(); - mRoot.updateWorldMatrixChildren(); + mRoot->touch(); + mRoot->updateWorldMatrixChildren(); dirtyMesh(); updateHeadOffset(); } @@ -4118,7 +3707,7 @@ void LLVOAvatar::updateVisibility() // private bool LLVOAvatar::shouldAlphaMask() { - const bool should_alpha_mask = mSupportsAlphaLayers && !LLDrawPoolAlpha::sShowDebugAlpha // Don't alpha mask if "Highlight Transparent" checked + const bool should_alpha_mask = !LLDrawPoolAlpha::sShowDebugAlpha // Don't alpha mask if "Highlight Transparent" checked && !LLDrawPoolAvatar::sSkipTransparent; return should_alpha_mask; @@ -4157,19 +3746,44 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass) if (mNeedsSkin) { //generate animated mesh - mMeshLOD[MESH_ID_LOWER_BODY]->updateJointGeometry(); - mMeshLOD[MESH_ID_UPPER_BODY]->updateJointGeometry(); + LLViewerJoint* lower_mesh = getViewerJoint(MESH_ID_LOWER_BODY); + LLViewerJoint* upper_mesh = getViewerJoint(MESH_ID_UPPER_BODY); + LLViewerJoint* skirt_mesh = getViewerJoint(MESH_ID_SKIRT); + LLViewerJoint* eyelash_mesh = getViewerJoint(MESH_ID_EYELASH); + LLViewerJoint* head_mesh = getViewerJoint(MESH_ID_HEAD); + LLViewerJoint* hair_mesh = getViewerJoint(MESH_ID_HAIR); + + if(upper_mesh) + { + upper_mesh->updateJointGeometry(); + } + if (lower_mesh) + { + lower_mesh->updateJointGeometry(); + } if( isWearingWearableType( LLWearableType::WT_SKIRT ) ) { - mMeshLOD[MESH_ID_SKIRT]->updateJointGeometry(); + if(skirt_mesh) + { + skirt_mesh->updateJointGeometry(); + } } if (!isSelf() || gAgent.needsRenderHead() || LLPipeline::sShadowRender) { - mMeshLOD[MESH_ID_EYELASH]->updateJointGeometry(); - mMeshLOD[MESH_ID_HEAD]->updateJointGeometry(); - mMeshLOD[MESH_ID_HAIR]->updateJointGeometry(); + if(eyelash_mesh) + { + eyelash_mesh->updateJointGeometry(); + } + if(head_mesh) + { + head_mesh->updateJointGeometry(); + } + if(hair_mesh) + { + hair_mesh->updateJointGeometry(); + } } mNeedsSkin = FALSE; mLastSkinTime = gFrameTimeSeconds; @@ -4286,19 +3900,31 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass) { if (isTextureVisible(TEX_HEAD_BAKED) || mIsDummy) { - num_indices += mMeshLOD[MESH_ID_HEAD]->render(mAdjustedPixelArea, TRUE, mIsDummy); + LLViewerJoint* head_mesh = getViewerJoint(MESH_ID_HEAD); + if (head_mesh) + { + num_indices += head_mesh->render(mAdjustedPixelArea, TRUE, mIsDummy); + } first_pass = FALSE; } } if (isTextureVisible(TEX_UPPER_BAKED) || mIsDummy) { - num_indices += mMeshLOD[MESH_ID_UPPER_BODY]->render(mAdjustedPixelArea, first_pass, mIsDummy); + LLViewerJoint* upper_mesh = getViewerJoint(MESH_ID_UPPER_BODY); + if (upper_mesh) + { + num_indices += upper_mesh->render(mAdjustedPixelArea, first_pass, mIsDummy); + } first_pass = FALSE; } if (isTextureVisible(TEX_LOWER_BAKED) || mIsDummy) { - num_indices += mMeshLOD[MESH_ID_LOWER_BODY]->render(mAdjustedPixelArea, first_pass, mIsDummy); + LLViewerJoint* lower_mesh = getViewerJoint(MESH_ID_LOWER_BODY); + if (lower_mesh) + { + num_indices += lower_mesh->render(mAdjustedPixelArea, first_pass, mIsDummy); + } first_pass = FALSE; } } @@ -4331,20 +3957,15 @@ U32 LLVOAvatar::renderTransparent(BOOL first_pass) if( isWearingWearableType( LLWearableType::WT_SKIRT ) && (mIsDummy || isTextureVisible(TEX_SKIRT_BAKED)) ) { gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.25f); - num_indices += mMeshLOD[MESH_ID_SKIRT]->render(mAdjustedPixelArea, FALSE); + LLViewerJoint* skirt_mesh = getViewerJoint(MESH_ID_SKIRT); + if (skirt_mesh) + { + num_indices += skirt_mesh->render(mAdjustedPixelArea, FALSE); + } first_pass = FALSE; gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); } -#if LL_DARWIN - // blatant hack to avoid driver crash on rendering mMeshLODs for eyelashes and baked hair below - // NORSPEC-59 - if (gGLManager.mIsMobileGF) - { - return num_indices; - } -#endif - if (!isSelf() || gAgent.needsRenderHead() || LLPipeline::sShadowRender) { if (LLPipeline::sImpostorRender) @@ -4354,16 +3975,23 @@ U32 LLVOAvatar::renderTransparent(BOOL first_pass) if (isTextureVisible(TEX_HEAD_BAKED)) { - num_indices += mMeshLOD[MESH_ID_EYELASH]->render(mAdjustedPixelArea, first_pass, mIsDummy); + LLViewerJoint* eyelash_mesh = getViewerJoint(MESH_ID_EYELASH); + if (eyelash_mesh) + { + num_indices += eyelash_mesh->render(mAdjustedPixelArea, first_pass, mIsDummy); + } first_pass = FALSE; } // Can't test for baked hair being defined, since that won't always be the case (not all viewers send baked hair) // TODO: 1.25 will be able to switch this logic back to calling isTextureVisible(); - - if ( getImage(TEX_HAIR_BAKED, 0) - && getImage(TEX_HAIR_BAKED, 0)->getID() != IMG_INVISIBLE || LLDrawPoolAlpha::sShowDebugAlpha) + if ( getImage(TEX_HAIR_BAKED, 0) && + getImage(TEX_HAIR_BAKED, 0)->getID() != IMG_INVISIBLE || LLDrawPoolAlpha::sShowDebugAlpha) { - num_indices += mMeshLOD[MESH_ID_HAIR]->render(mAdjustedPixelArea, first_pass, mIsDummy); + LLViewerJoint* hair_mesh = getViewerJoint(MESH_ID_HAIR); + if (hair_mesh) + { + num_indices += hair_mesh->render(mAdjustedPixelArea, first_pass, mIsDummy); + } first_pass = FALSE; } if (LLPipeline::sImpostorRender) @@ -4407,8 +4035,16 @@ U32 LLVOAvatar::renderRigid() if (isTextureVisible(TEX_EYES_BAKED) || mIsDummy) { - num_indices += mMeshLOD[MESH_ID_EYEBALL_LEFT]->render(mAdjustedPixelArea, TRUE, mIsDummy); - num_indices += mMeshLOD[MESH_ID_EYEBALL_RIGHT]->render(mAdjustedPixelArea, TRUE, mIsDummy); + LLViewerJoint* eyeball_left = getViewerJoint(MESH_ID_EYEBALL_LEFT); + LLViewerJoint* eyeball_right = getViewerJoint(MESH_ID_EYEBALL_RIGHT); + if (eyeball_left) + { + num_indices += eyeball_left->render(mAdjustedPixelArea, TRUE, mIsDummy); + } + if(eyeball_right) + { + num_indices += eyeball_right->render(mAdjustedPixelArea, TRUE, mIsDummy); + } } if (should_alpha_mask && !LLGLSLShader::sNoFixedFunction) @@ -4455,11 +4091,224 @@ U32 LLVOAvatar::renderImpostor(LLColor4U color, S32 diffuse_channel) return 6; } -//------------------------------------------------------------------------ -// LLVOAvatar::updateTextures() -//------------------------------------------------------------------------ +bool LLVOAvatar::allTexturesCompletelyDownloaded(std::set& ids) const +{ + for (std::set::const_iterator it = ids.begin(); it != ids.end(); ++it) + { + LLViewerFetchedTexture *imagep = gTextureList.findImage(*it); + if (imagep && imagep->getDiscardLevel()!=0) + { + return false; + } + } + return true; +} + +bool LLVOAvatar::allLocalTexturesCompletelyDownloaded() const +{ + std::set local_ids; + collectLocalTextureUUIDs(local_ids); + return allTexturesCompletelyDownloaded(local_ids); +} + +bool LLVOAvatar::allBakedTexturesCompletelyDownloaded() const +{ + std::set baked_ids; + collectBakedTextureUUIDs(baked_ids); + 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 baked_ids; + collectBakedTextureUUIDs(baked_ids); + for (std::set::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; + + std::set baked_ids; + collectBakedTextureUUIDs(baked_ids); + for (U32 i = 0; i < mBakedTextureDatas.size(); i++) + { + ETextureIndex texture_index = mBakedTextureDatas[i].mTextureIndex; + LLViewerFetchedTexture *imagep = + LLViewerTextureManager::staticCastToFetchedTexture(getImage(texture_index,0), TRUE); + if (!imagep || + imagep->getID() == IMG_DEFAULT || + imagep->getID() == IMG_DEFAULT_AVATAR) + + { + result += "-"; + } + else + { + bool has_url = false, has_host = false; + if (!imagep->getUrl().empty()) + { + has_url = true; + } + if (imagep->getTargetHost().isOk()) + { + has_host = true; + } + S32 discard = imagep->getDiscardLevel(); + if (has_url && !has_host) result += discard ? "u" : "U"; // server-bake texture with url + else if (has_host && !has_url) result += discard ? "h" : "H"; // old-style texture on sim + else if (has_host && has_url) result += discard ? "x" : "X"; // both origins? + else if (!has_host && !has_url) result += discard ? "n" : "N"; // no origin? + if (discard != 0) + { + result += llformat("(%d/%d)",discard,imagep->getDesiredDiscardLevel()); + } + } + + } + return result; +} + +S32 LLVOAvatar::totalTextureMemForUUIDS(std::set& ids) +{ + S32 result = 0; + for (std::set::const_iterator it = ids.begin(); it != ids.end(); ++it) + { + LLViewerFetchedTexture *imagep = gTextureList.findImage(*it); + if (imagep) + { + result += imagep->getTextureMemory(); + } + } + return result; +} + +void LLVOAvatar::collectLocalTextureUUIDs(std::set& ids) const +{ + for (U32 texture_index = 0; texture_index < getNumTEs(); texture_index++) + { + LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getTEWearableType((ETextureIndex)texture_index); + U32 num_wearables = gAgentWearables.getWearableCount(wearable_type); + + LLViewerFetchedTexture *imagep = NULL; + for (U32 wearable_index = 0; wearable_index < num_wearables; wearable_index++) + { + imagep = LLViewerTextureManager::staticCastToFetchedTexture(getImage(texture_index, wearable_index), TRUE); + if (imagep) + { + const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearanceDictionary::getInstance()->getTexture((ETextureIndex)texture_index); + if (texture_dict->mIsLocalTexture) + { + ids.insert(imagep->getID()); + } + } + } + } + ids.erase(IMG_DEFAULT); + ids.erase(IMG_DEFAULT_AVATAR); + ids.erase(IMG_INVISIBLE); +} + +void LLVOAvatar::collectBakedTextureUUIDs(std::set& ids) const +{ + for (U32 texture_index = 0; texture_index < getNumTEs(); texture_index++) + { + LLViewerFetchedTexture *imagep = NULL; + if (isIndexBakedTexture((ETextureIndex) texture_index)) + { + imagep = LLViewerTextureManager::staticCastToFetchedTexture(getImage(texture_index,0), TRUE); + if (imagep) + { + ids.insert(imagep->getID()); + } + } + } + ids.erase(IMG_DEFAULT); + ids.erase(IMG_DEFAULT_AVATAR); + ids.erase(IMG_INVISIBLE); +} + +void LLVOAvatar::collectTextureUUIDs(std::set& ids) +{ + collectLocalTextureUUIDs(ids); + collectBakedTextureUUIDs(ids); +} + +void LLVOAvatar::releaseOldTextures() +{ + S32 current_texture_mem = 0; + + // Any textures that we used to be using but are no longer using should no longer be flagged as "NO_DELETE" + std::set baked_texture_ids; + collectBakedTextureUUIDs(baked_texture_ids); + S32 new_baked_mem = totalTextureMemForUUIDS(baked_texture_ids); + + std::set local_texture_ids; + collectLocalTextureUUIDs(local_texture_ids); + //S32 new_local_mem = totalTextureMemForUUIDS(local_texture_ids); + + std::set new_texture_ids; + new_texture_ids.insert(baked_texture_ids.begin(),baked_texture_ids.end()); + new_texture_ids.insert(local_texture_ids.begin(),local_texture_ids.end()); + S32 new_total_mem = totalTextureMemForUUIDS(new_texture_ids); + + //S32 old_total_mem = totalTextureMemForUUIDS(mTextureIDs); + //LL_DEBUGS("Avatar") << getFullname() << " old_total_mem: " << old_total_mem << " new_total_mem (L/B): " << new_total_mem << " (" << new_local_mem <<", " << new_baked_mem << ")" << llendl; + if (!isSelf() && new_total_mem > new_baked_mem) + { + llwarns << "extra local textures stored for non-self av" << llendl; + } + for (std::set::iterator it = mTextureIDs.begin(); it != mTextureIDs.end(); ++it) + { + if (new_texture_ids.find(*it) == new_texture_ids.end()) + { + LLViewerFetchedTexture *imagep = gTextureList.findImage(*it); + if (imagep) + { + current_texture_mem += imagep->getTextureMemory(); + if (imagep->getTextureState() == LLGLTexture::NO_DELETE) + { + // This will allow the texture to be deleted if not in use. + imagep->forceActive(); + + // This resets the clock to texture being flagged + // as unused, preventing the texture from being + // deleted immediately. If other avatars or + // objects are using it, it can still be flagged + // no-delete by them. + imagep->forceUpdateBindStats(); + } + } + } + } + mTextureIDs = new_texture_ids; +} + void LLVOAvatar::updateTextures() { + releaseOldTextures(); + BOOL render_avatar = TRUE; if (mIsDummy) @@ -4502,7 +4351,7 @@ void LLVOAvatar::updateTextures() mHasGrey = FALSE; // debug for (U32 texture_index = 0; texture_index < getNumTEs(); texture_index++) { - LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType((ETextureIndex)texture_index); + LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getTEWearableType((ETextureIndex)texture_index); U32 num_wearables = gAgentWearables.getWearableCount(wearable_type); const LLTextureEntry *te = getTE(texture_index); @@ -4525,11 +4374,11 @@ void LLVOAvatar::updateTextures() imagep = LLViewerTextureManager::staticCastToFetchedTexture(getImage(texture_index, wearable_index), TRUE); if (imagep) { - const LLVOAvatarDictionary::TextureEntry *texture_dict = LLVOAvatarDictionary::getInstance()->getTexture((ETextureIndex)texture_index); + const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearanceDictionary::getInstance()->getTexture((ETextureIndex)texture_index); const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex; if (texture_dict->mIsLocalTexture) { - addLocalTextureStats((ETextureIndex)texture_index, imagep, texel_area_ratio, render_avatar, layer_baked[baked_index]); + addLocalTextureStats((ETextureIndex)texture_index, imagep, texel_area_ratio, render_avatar, mBakedTextureDatas[baked_index].mIsUsed); } } } @@ -4541,6 +4390,7 @@ void LLVOAvatar::updateTextures() 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 " @@ -4561,7 +4411,7 @@ void LLVOAvatar::updateTextures() void LLVOAvatar::addLocalTextureStats( ETextureIndex idx, LLViewerFetchedTexture* imagep, - F32 texel_area_ratio, BOOL render_avatar, BOOL covered_by_baked, U32 index ) + F32 texel_area_ratio, BOOL render_avatar, BOOL covered_by_baked) { // No local texture stats for non-self avatars return; @@ -4635,7 +4485,6 @@ void LLVOAvatar::addBakedTextureStats( LLViewerFetchedTexture* imagep, F32 pixel //the texture pipeline will stop fetching this texture. imagep->resetTextureStats(); - imagep->setCanUseHTTP(false) ; //turn off http fetching for baked textures. imagep->setMaxVirtualSizeResetInterval(MAX_TEXTURE_VIRTURE_SIZE_RESET_INTERVAL); imagep->resetMaxVirtualSizeResetCounter() ; @@ -4644,7 +4493,7 @@ void LLVOAvatar::addBakedTextureStats( LLViewerFetchedTexture* imagep, F32 pixel imagep->addTextureStats(pixel_area / texel_area_ratio); imagep->setBoostLevel(boost_level); - if(boost_level != LLViewerTexture::BOOST_AVATAR_BAKED_SELF) + if(boost_level != LLGLTexture::BOOST_AVATAR_BAKED_SELF) { imagep->setAdditionalDecodePriority(ADDITIONAL_PRI) ; } @@ -4677,6 +4526,30 @@ void LLVOAvatar::setTexEntry(const U8 index, const LLTextureEntry &te) setTE(index, te); } +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()) + { + // 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; + } + } + return url; +} + //----------------------------------------------------------------------------- // resolveHeight() //----------------------------------------------------------------------------- @@ -5017,48 +4890,6 @@ void LLVOAvatar::stopMotionFromSource(const LLUUID& source_id) { } -//----------------------------------------------------------------------------- -// getVolumePos() -//----------------------------------------------------------------------------- -LLVector3 LLVOAvatar::getVolumePos(S32 joint_index, LLVector3& volume_offset) -{ - if (joint_index > mNumCollisionVolumes) - { - return LLVector3::zero; - } - - return mCollisionVolumes[joint_index].getVolumePos(volume_offset); -} - -//----------------------------------------------------------------------------- -// findCollisionVolume() -//----------------------------------------------------------------------------- -LLJoint* LLVOAvatar::findCollisionVolume(U32 volume_id) -{ - if ((S32)volume_id > mNumCollisionVolumes) - { - return NULL; - } - - return &mCollisionVolumes[volume_id]; -} - -//----------------------------------------------------------------------------- -// findCollisionVolume() -//----------------------------------------------------------------------------- -S32 LLVOAvatar::getCollisionVolumeID(std::string &name) -{ - for (S32 i = 0; i < mNumCollisionVolumes; i++) - { - if (mCollisionVolumes[i].getName() == name) - { - return i; - } - } - - return -1; -} - //----------------------------------------------------------------------------- // addDebugText() //----------------------------------------------------------------------------- @@ -5088,7 +4919,7 @@ LLJoint *LLVOAvatar::getJoint( const std::string &name ) if (iter == mJointMap.end() || iter->second == NULL) { //search for joint and cache found joint in lookup table - jointp = mRoot.findJoint(name); + jointp = mRoot->findJoint(name); mJointMap[name] = jointp; } else @@ -5104,10 +4935,12 @@ LLJoint *LLVOAvatar::getJoint( const std::string &name ) //----------------------------------------------------------------------------- void LLVOAvatar::resetJointPositions( void ) { - for(S32 i = 0; i < (S32)mNumJoints; ++i) + avatar_joint_list_t::iterator iter = mSkeleton.begin(); + avatar_joint_list_t::iterator end = mSkeleton.end(); + for (; iter != end; ++iter) { - mSkeleton[i].restoreOldXform(); - mSkeleton[i].setId( LLUUID::null ); + (*iter)->restoreOldXform(); + (*iter)->setId( LLUUID::null ); } mHasPelvisOffset = false; mPelvisFixup = mLastPelvisFixup; @@ -5117,7 +4950,7 @@ void LLVOAvatar::resetJointPositions( void ) //----------------------------------------------------------------------------- void LLVOAvatar::resetSpecificJointPosition( const std::string& name ) { - LLJoint* pJoint = mRoot.findJoint( name ); + LLJoint* pJoint = mRoot->findJoint( name ); if ( pJoint && pJoint->doesJointNeedToBeReset() ) { @@ -5139,16 +4972,17 @@ void LLVOAvatar::resetSpecificJointPosition( const std::string& name ) //----------------------------------------------------------------------------- void LLVOAvatar::resetJointPositionsToDefault( void ) { - //Subsequent joints are relative to pelvis - for( S32 i = 0; i < (S32)mNumJoints; ++i ) + avatar_joint_list_t::iterator iter = mSkeleton.begin(); + avatar_joint_list_t::iterator end = mSkeleton.end(); + for (; iter != end; ++iter) { - LLJoint* pJoint = (LLJoint*)&mSkeleton[i]; + LLJoint* pJoint = (*iter); if ( pJoint->doesJointNeedToBeReset() ) { - pJoint->setId( LLUUID::null ); //restore joints to default positions, however skip over the pelvis + // *TODO: How does this pointer check skip over pelvis? if ( pJoint ) { pJoint->restoreOldXform(); @@ -5247,23 +5081,6 @@ F32 LLVOAvatar::getPixelArea() const } -//----------------------------------------------------------------------------- -// LLVOAvatar::getHeadMesh() -//----------------------------------------------------------------------------- -LLPolyMesh* LLVOAvatar::getHeadMesh() -{ - return mMeshLOD[MESH_ID_HEAD]->mMeshParts[0]->getMesh(); -} - - -//----------------------------------------------------------------------------- -// LLVOAvatar::getUpperBodyMesh() -//----------------------------------------------------------------------------- -LLPolyMesh* LLVOAvatar::getUpperBodyMesh() -{ - return mMeshLOD[MESH_ID_UPPER_BODY]->mMeshParts[0]->getMesh(); -} - //----------------------------------------------------------------------------- // LLVOAvatar::getPosGlobalFromAgent() @@ -5281,281 +5098,35 @@ LLVector3 LLVOAvatar::getPosAgentFromGlobal(const LLVector3d &position) return gAgent.getPosAgentFromGlobal(position); } -//----------------------------------------------------------------------------- -// allocateCharacterJoints() -//----------------------------------------------------------------------------- -BOOL LLVOAvatar::allocateCharacterJoints( U32 num ) -{ - deleteAndClearArray(mSkeleton); - mNumJoints = 0; - - mSkeleton = new LLViewerJoint[num]; - - for(S32 joint_num = 0; joint_num < (S32)num; joint_num++) - { - mSkeleton[joint_num].setJointNum(joint_num); - } - - if (!mSkeleton) - { - return FALSE; - } - - mNumJoints = num; - return TRUE; -} //----------------------------------------------------------------------------- -// allocateCollisionVolumes() +// requestStopMotion() //----------------------------------------------------------------------------- -BOOL LLVOAvatar::allocateCollisionVolumes( U32 num ) +// virtual +void LLVOAvatar::requestStopMotion( LLMotion* motion ) { - deleteAndClearArray(mCollisionVolumes); - mNumCollisionVolumes = 0; - - mCollisionVolumes = new LLViewerJointCollisionVolume[num]; - if (!mCollisionVolumes) - { - return FALSE; - } - - mNumCollisionVolumes = num; - return TRUE; + // Only agent avatars should handle the stop motion notifications. } - //----------------------------------------------------------------------------- -// getCharacterJoint() +// loadSkeletonNode(): loads node from XML tree //----------------------------------------------------------------------------- -LLJoint *LLVOAvatar::getCharacterJoint( U32 num ) +//virtual +BOOL LLVOAvatar::loadSkeletonNode () { - if ((S32)num >= mNumJoints - || (S32)num < 0) + if (!LLAvatarAppearance::loadSkeletonNode()) { - return NULL; - } - return (LLJoint*)&mSkeleton[num]; -} - -//----------------------------------------------------------------------------- -// requestStopMotion() -//----------------------------------------------------------------------------- -// virtual -void LLVOAvatar::requestStopMotion( LLMotion* motion ) -{ - // Only agent avatars should handle the stop motion notifications. -} - -//----------------------------------------------------------------------------- -// loadAvatar() -//----------------------------------------------------------------------------- -static LLFastTimer::DeclareTimer FTM_LOAD_AVATAR("Load Avatar"); - -BOOL LLVOAvatar::loadAvatar() -{ -// LLFastTimer t(FTM_LOAD_AVATAR); - - // avatar_skeleton.xml - if( !buildSkeleton(sAvatarSkeletonInfo) ) - { - llwarns << "avatar file: buildSkeleton() failed" << llendl; - return FALSE; - } - - // avatar_lad.xml : - if( !loadSkeletonNode() ) - { - llwarns << "avatar file: loadNodeSkeleton() failed" << llendl; - return FALSE; - } - - // avatar_lad.xml : - if( !loadMeshNodes() ) - { - llwarns << "avatar file: loadNodeMesh() failed" << llendl; - return FALSE; - } - - // avatar_lad.xml : - if( sAvatarXmlInfo->mTexSkinColorInfo ) - { - mTexSkinColor = new LLTexGlobalColor( this ); - if( !mTexSkinColor->setInfo( sAvatarXmlInfo->mTexSkinColorInfo ) ) - { - llwarns << "avatar file: mTexSkinColor->setInfo() failed" << llendl; - return FALSE; - } - } - else - { - llwarns << " name=\"skin_color\" not found" << llendl; - return FALSE; - } - if( sAvatarXmlInfo->mTexHairColorInfo ) - { - mTexHairColor = new LLTexGlobalColor( this ); - if( !mTexHairColor->setInfo( sAvatarXmlInfo->mTexHairColorInfo ) ) - { - llwarns << "avatar file: mTexHairColor->setInfo() failed" << llendl; - return FALSE; - } - } - else - { - llwarns << " name=\"hair_color\" not found" << llendl; - return FALSE; - } - if( sAvatarXmlInfo->mTexEyeColorInfo ) - { - mTexEyeColor = new LLTexGlobalColor( this ); - if( !mTexEyeColor->setInfo( sAvatarXmlInfo->mTexEyeColorInfo ) ) - { - llwarns << "avatar file: mTexEyeColor->setInfo() failed" << llendl; - return FALSE; - } - } - else - { - llwarns << " name=\"eye_color\" not found" << llendl; - return FALSE; - } - - // avatar_lad.xml : - if (sAvatarXmlInfo->mLayerInfoList.empty()) - { - llwarns << "avatar file: missing node" << llendl; - return FALSE; - } - - if (sAvatarXmlInfo->mMorphMaskInfoList.empty()) - { - llwarns << "avatar file: missing node" << llendl; - return FALSE; - } - - // avatar_lad.xml : - for (LLVOAvatarXmlInfo::morph_info_list_t::iterator iter = sAvatarXmlInfo->mMorphMaskInfoList.begin(); - iter != sAvatarXmlInfo->mMorphMaskInfoList.end(); - ++iter) - { - LLVOAvatarXmlInfo::LLVOAvatarMorphInfo *info = *iter; - - EBakedTextureIndex baked = LLVOAvatarDictionary::findBakedByRegionName(info->mRegion); - if (baked != BAKED_NUM_INDICES) - { - LLPolyMorphTarget *morph_param; - const std::string *name = &info->mName; - morph_param = (LLPolyMorphTarget *)(getVisualParam(name->c_str())); - if (morph_param) - { - BOOL invert = info->mInvert; - addMaskedMorph(baked, morph_param, invert, info->mLayer); - } - } - - } - - loadLayersets(); - - // avatar_lad.xml : - for (LLVOAvatarXmlInfo::driver_info_list_t::iterator iter = sAvatarXmlInfo->mDriverInfoList.begin(); - iter != sAvatarXmlInfo->mDriverInfoList.end(); - ++iter) - { - LLDriverParamInfo *info = *iter; - LLDriverParam* driver_param = new LLDriverParam( this ); - if (driver_param->setInfo(info)) - { - addVisualParam( driver_param ); - LLVisualParam*(LLVOAvatar::*avatar_function)(S32)const = &LLVOAvatar::getVisualParam; - if( !driver_param->linkDrivenParams(boost::bind(avatar_function,(LLVOAvatar*)this,_1 ), false)) - { - llwarns << "could not link driven params for avatar " << this->getFullname() << " id: " << driver_param->getID() << llendl; - continue; - } - } - else - { - delete driver_param; - llwarns << "avatar file: driver_param->parseData() failed" << llendl; - return FALSE; - } - } - - - return TRUE; -} - -//----------------------------------------------------------------------------- -// loadSkeletonNode(): loads node from XML tree -//----------------------------------------------------------------------------- -BOOL LLVOAvatar::loadSkeletonNode () -{ - mRoot.addChild( &mSkeleton[0] ); - - for (std::vector::iterator iter = mMeshLOD.begin(); - iter != mMeshLOD.end(); - ++iter) - { - LLViewerJoint *joint = (LLViewerJoint *) *iter; - joint->mUpdateXform = FALSE; - joint->setMeshesToChildren(); - } - - mRoot.addChild(mMeshLOD[MESH_ID_HEAD]); - mRoot.addChild(mMeshLOD[MESH_ID_EYELASH]); - mRoot.addChild(mMeshLOD[MESH_ID_UPPER_BODY]); - mRoot.addChild(mMeshLOD[MESH_ID_LOWER_BODY]); - mRoot.addChild(mMeshLOD[MESH_ID_SKIRT]); - mRoot.addChild(mMeshLOD[MESH_ID_HEAD]); - - LLViewerJoint *skull = (LLViewerJoint*)mRoot.findJoint("mSkull"); - if (skull) - { - skull->addChild(mMeshLOD[MESH_ID_HAIR] ); - } - - LLViewerJoint *eyeL = (LLViewerJoint*)mRoot.findJoint("mEyeLeft"); - if (eyeL) - { - eyeL->addChild( mMeshLOD[MESH_ID_EYEBALL_LEFT] ); - } - - LLViewerJoint *eyeR = (LLViewerJoint*)mRoot.findJoint("mEyeRight"); - if (eyeR) - { - eyeR->addChild( mMeshLOD[MESH_ID_EYEBALL_RIGHT] ); - } - - // SKELETAL DISTORTIONS - { - LLVOAvatarXmlInfo::skeletal_distortion_info_list_t::iterator iter; - for (iter = sAvatarXmlInfo->mSkeletalDistortionInfoList.begin(); - iter != sAvatarXmlInfo->mSkeletalDistortionInfoList.end(); - ++iter) - { - LLPolySkeletalDistortionInfo *info = *iter; - LLPolySkeletalDistortion *param = new LLPolySkeletalDistortion(this); - if (!param->setInfo(info)) - { - delete param; return FALSE; } - else - { - addVisualParam(param); - } - } - } // ATTACHMENTS { - LLVOAvatarXmlInfo::attachment_info_list_t::iterator iter; + LLAvatarXmlInfo::attachment_info_list_t::iterator iter; for (iter = sAvatarXmlInfo->mAttachmentInfoList.begin(); iter != sAvatarXmlInfo->mAttachmentInfoList.end(); ++iter) { - LLVOAvatarXmlInfo::LLVOAvatarAttachmentInfo *info = *iter; + LLAvatarXmlInfo::LLAvatarAttachmentInfo *info = *iter; if (!isSelf() && info->mJointName == "mScreen") { //don't process screen joint for other avatars continue; @@ -5627,144 +5198,6 @@ BOOL LLVOAvatar::loadSkeletonNode () return TRUE; } -//----------------------------------------------------------------------------- -// loadMeshNodes(): loads nodes from XML tree -//----------------------------------------------------------------------------- -BOOL LLVOAvatar::loadMeshNodes() -{ - for (LLVOAvatarXmlInfo::mesh_info_list_t::const_iterator meshinfo_iter = sAvatarXmlInfo->mMeshInfoList.begin(); - meshinfo_iter != sAvatarXmlInfo->mMeshInfoList.end(); - ++meshinfo_iter) - { - const LLVOAvatarXmlInfo::LLVOAvatarMeshInfo *info = *meshinfo_iter; - const std::string &type = info->mType; - S32 lod = info->mLOD; - - LLViewerJointMesh* mesh = NULL; - U8 mesh_id = 0; - BOOL found_mesh_id = FALSE; - - /* if (type == "hairMesh") - switch(lod) - case 0: - mesh = &mHairMesh0; */ - for (LLVOAvatarDictionary::Meshes::const_iterator mesh_iter = LLVOAvatarDictionary::getInstance()->getMeshes().begin(); - mesh_iter != LLVOAvatarDictionary::getInstance()->getMeshes().end(); - ++mesh_iter) - { - const EMeshIndex mesh_index = mesh_iter->first; - const LLVOAvatarDictionary::MeshEntry *mesh_dict = mesh_iter->second; - if (type.compare(mesh_dict->mName) == 0) - { - mesh_id = mesh_index; - found_mesh_id = TRUE; - break; - } - } - - if (found_mesh_id) - { - if (lod < (S32)mMeshLOD[mesh_id]->mMeshParts.size()) - { - mesh = mMeshLOD[mesh_id]->mMeshParts[lod]; - } - else - { - llwarns << "Avatar file: has invalid lod setting " << lod << llendl; - return FALSE; - } - } - else - { - llwarns << "Ignoring unrecognized mesh type: " << type << llendl; - return FALSE; - } - - // llinfos << "Parsing mesh data for " << type << "..." << llendl; - - // If this isn't set to white (1.0), avatars will *ALWAYS* be darker than their surroundings. - // Do not touch!!! - mesh->setColor( 1.0f, 1.0f, 1.0f, 1.0f ); - - LLPolyMesh *poly_mesh = NULL; - - if (!info->mReferenceMeshName.empty()) - { - polymesh_map_t::const_iterator polymesh_iter = mMeshes.find(info->mReferenceMeshName); - if (polymesh_iter != mMeshes.end()) - { - poly_mesh = LLPolyMesh::getMesh(info->mMeshFileName, polymesh_iter->second); - poly_mesh->setAvatar(this); - } - else - { - // This should never happen - LL_WARNS("Avatar") << "Could not find avatar mesh: " << info->mReferenceMeshName << LL_ENDL; - } - } - else - { - poly_mesh = LLPolyMesh::getMesh(info->mMeshFileName); - poly_mesh->setAvatar(this); - } - - if( !poly_mesh ) - { - llwarns << "Failed to load mesh of type " << type << llendl; - return FALSE; - } - - // Multimap insert - mMeshes.insert(std::make_pair(info->mMeshFileName, poly_mesh)); - - mesh->setMesh( poly_mesh ); - mesh->setLOD( info->mMinPixelArea ); - - for (LLVOAvatarXmlInfo::LLVOAvatarMeshInfo::morph_info_list_t::const_iterator xmlinfo_iter = info->mPolyMorphTargetInfoList.begin(); - xmlinfo_iter != info->mPolyMorphTargetInfoList.end(); - ++xmlinfo_iter) - { - const LLVOAvatarXmlInfo::LLVOAvatarMeshInfo::morph_info_pair_t *info_pair = &(*xmlinfo_iter); - LLPolyMorphTarget *param = new LLPolyMorphTarget(mesh->getMesh()); - if (!param->setInfo(info_pair->first)) - { - delete param; - return FALSE; - } - else - { - if (info_pair->second) - { - addSharedVisualParam(param); - } - else - { - addVisualParam(param); - } - } - } - } - - return TRUE; -} - -//----------------------------------------------------------------------------- -// loadLayerSets() -//----------------------------------------------------------------------------- -BOOL LLVOAvatar::loadLayersets() -{ - BOOL success = TRUE; - for (LLVOAvatarXmlInfo::layer_info_list_t::const_iterator layerset_iter = sAvatarXmlInfo->mLayerInfoList.begin(); - layerset_iter != sAvatarXmlInfo->mLayerInfoList.end(); - ++layerset_iter) - { - // Construct a layerset for each one specified in avatar_lad.xml and initialize it as such. - LLTexLayerSetInfo *layerset_info = *layerset_iter; - layerset_info->createVisualParams(this); - } - return success; -} - //----------------------------------------------------------------------------- // updateVisualParams() //----------------------------------------------------------------------------- @@ -5778,7 +5211,7 @@ void LLVOAvatar::updateVisualParams() { computeBodySize(); mLastSkeletonSerialNum = mSkeletonSerialNum; - mRoot.updateWorldMatrixChildren(); + mRoot->updateWorldMatrixChildren(); } dirtyMesh(); @@ -5865,7 +5298,12 @@ BOOL LLVOAvatar::updateJointLODs() } // now select meshes to render based on adjusted pixel area - BOOL res = mRoot.updateLOD(mAdjustedPixelArea, TRUE); + LLViewerJoint* root = dynamic_cast(mRoot); + BOOL res = FALSE; + if (root) + { + res = root->updateLOD(mAdjustedPixelArea, TRUE); + } if (res) { sNumLODChangesThisFrame++; @@ -5954,6 +5392,15 @@ void LLVOAvatar::dirtyMesh(S32 priority) { mDirtyMesh = llmax(mDirtyMesh, priority); } + +//----------------------------------------------------------------------------- +// getViewerJoint() +//----------------------------------------------------------------------------- +LLViewerJoint* LLVOAvatar::getViewerJoint(S32 idx) +{ + return dynamic_cast(mMeshLOD[idx]); +} + //----------------------------------------------------------------------------- // hideSkirt() //----------------------------------------------------------------------------- @@ -6260,9 +5707,9 @@ void LLVOAvatar::sitOnObject(LLViewerObject *sit_object) // Notice that removing sitDown() from here causes avatars sitting on // objects to be not rendered for new arrivals. See EXT-6835 and EXT-1655. sitDown(TRUE); - mRoot.getXform()->setParent(&sit_object->mDrawable->mXform); // LLVOAvatar::sitOnObject - mRoot.setPosition(getPosition()); - mRoot.updateWorldMatrixChildren(); + mRoot->getXform()->setParent(&sit_object->mDrawable->mXform); // LLVOAvatar::sitOnObject + mRoot->setPosition(getPosition()); + mRoot->updateWorldMatrixChildren(); stopMotion(ANIM_AGENT_BODY_NOISE); @@ -6308,10 +5755,10 @@ void LLVOAvatar::getOffObject() sitDown(FALSE); - mRoot.getXform()->setParent(NULL); // LLVOAvatar::getOffObject - mRoot.setPosition(cur_position_world); - mRoot.setRotation(cur_rotation_world); - mRoot.getXform()->update(); + mRoot->getXform()->setParent(NULL); // LLVOAvatar::getOffObject + mRoot->setPosition(cur_position_world); + mRoot->setRotation(cur_rotation_world); + mRoot->getXform()->update(); startMotion(ANIM_AGENT_BODY_NOISE); @@ -6359,26 +5806,53 @@ S32 LLVOAvatar::getAttachmentCount() return count; } -LLColor4 LLVOAvatar::getGlobalColor( const std::string& color_name ) const +BOOL LLVOAvatar::isWearingWearableType(LLWearableType::EType type) const { - if (color_name=="skin_color" && mTexSkinColor) + if (mIsDummy) return TRUE; + + if (isSelf()) { - return mTexSkinColor->getColor(); + return LLAvatarAppearance::isWearingWearableType(type); } - else if(color_name=="hair_color" && mTexHairColor) + + switch(type) { - return mTexHairColor->getColor(); + case LLWearableType::WT_SHAPE: + case LLWearableType::WT_SKIN: + case LLWearableType::WT_HAIR: + case LLWearableType::WT_EYES: + return TRUE; // everyone has all bodyparts + default: + break; // Do nothing } - if(color_name=="eye_color" && mTexEyeColor) + + /* switch(type) + case LLWearableType::WT_SHIRT: + indicator_te = TEX_UPPER_SHIRT; */ + for (LLAvatarAppearanceDictionary::Textures::const_iterator tex_iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin(); + tex_iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end(); + ++tex_iter) { - return mTexEyeColor->getColor(); - } - else + const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = tex_iter->second; + if (texture_dict->mWearableType == type) { - return LLColor4( 0.f, 1.f, 1.f, 1.f ); // good debugging color + // Thus, you must check to see if the corresponding baked texture is defined. + // NOTE: this is a poor substitute if you actually want to know about individual pieces of clothing + // this works for detecting a skirt (most important), but is ineffective at any piece of clothing that + // gets baked into a texture that always exists (upper or lower). + if (texture_dict->mIsUsedByBakedTexture) + { + const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex; + return isTextureDefined(LLAvatarAppearanceDictionary::getInstance()->getBakedTexture(baked_index)->mTextureIndex); + } + return FALSE; + } } + return FALSE; } + + // virtual void LLVOAvatar::invalidateComposite( LLTexLayerSet* layerset, BOOL upload_result ) { @@ -6388,6 +5862,7 @@ void LLVOAvatar::invalidateAll() { } +// virtual void LLVOAvatar::onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL upload_bake ) { if (global_color == mTexSkinColor) @@ -6406,9 +5881,15 @@ void LLVOAvatar::onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL if (!isTextureDefined(mBakedTextureDatas[BAKED_HAIR].mTextureIndex)) { LLColor4 color = mTexHairColor->getColor(); - for (U32 i = 0; i < mBakedTextureDatas[BAKED_HAIR].mMeshes.size(); i++) + avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[BAKED_HAIR].mJointMeshes.begin(); + avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[BAKED_HAIR].mJointMeshes.end(); + for (; iter != end; ++iter) { - mBakedTextureDatas[BAKED_HAIR].mMeshes[i]->setColor( color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW] ); + LLAvatarJointMesh* mesh = (*iter); + if (mesh) + { + mesh->setColor( color ); + } } } } @@ -6451,60 +5932,188 @@ BOOL LLVOAvatar::getIsCloud() const void LLVOAvatar::updateRezzedStatusTimers() { - // State machine for rezzed status. Statuses are 0 = cloud, 1 = gray, 2 = textured. - // Purpose is to collect time data for each period of cloud or cloud+gray. + // State machine for rezzed status. Statuses are -1 on startup, 0 + // = cloud, 1 = gray, 2 = textured, 3 = textured_and_downloaded. + // Purpose is to collect time data for each it takes avatar to reach + // various loading landmarks: gray, textured (partial), textured fully. + S32 rez_status = getRezzedStatus(); if (rez_status != mLastRezzedStatus) { LL_DEBUGS("Avatar") << avString() << "rez state change: " << mLastRezzedStatus << " -> " << rez_status << LL_ENDL; - bool is_cloud_or_gray = (rez_status==0 || rez_status==1); - bool was_cloud_or_gray = (mLastRezzedStatus==0 || mLastRezzedStatus==1); - bool is_cloud = (rez_status==0); - bool was_cloud = (mLastRezzedStatus==0); - // Non-cloud to cloud - if (is_cloud && !was_cloud) + if (mLastRezzedStatus == -1 && rez_status != -1) { - // start cloud timer. - getPhases().startPhase("cloud"); + // First time initialization, start all timers. + for (S32 i = 1; i < 4; i++) + { + startPhase("load_" + LLVOAvatar::rezStatusToString(i)); + startPhase("first_load_" + LLVOAvatar::rezStatusToString(i)); + } } - else if (was_cloud && !is_cloud) + if (rez_status < mLastRezzedStatus) + { + // load level has decreased. start phase timers for higher load levels. + for (S32 i = rez_status+1; i <= mLastRezzedStatus; i++) { - // stop cloud timer, which will capture stats. - getPhases().stopPhase("cloud"); + startPhase("load_" + LLVOAvatar::rezStatusToString(i)); } - - // Non-cloud-or-gray to cloud-or-gray - if (is_cloud_or_gray && !was_cloud_or_gray) + } + else if (rez_status > mLastRezzedStatus) { - // start cloud-or-gray timer. - getPhases().startPhase("cloud-or-gray"); + // load level has increased. stop phase timers for lower and equal load levels. + for (S32 i = llmax(mLastRezzedStatus+1,1); i <= rez_status; i++) + { + stopPhase("load_" + LLVOAvatar::rezStatusToString(i)); + stopPhase("first_load_" + LLVOAvatar::rezStatusToString(i), false); } - else if (was_cloud_or_gray && !is_cloud_or_gray) + if (rez_status == 3) { - // stop cloud-or-gray timer, which will capture stats. - getPhases().stopPhase("cloud-or-gray"); + // "fully loaded", mark any pending appearance change complete. + selfStopPhase("update_appearance_from_cof"); + selfStopPhase("wear_inventory_category", false); + selfStopPhase("process_initial_wearables_update", false); + } } mLastRezzedStatus = rez_status; } } -// call periodically to keep isFullyLoaded up to date. -// returns true if the value has changed. -BOOL LLVOAvatar::updateIsFullyLoaded() +void LLVOAvatar::clearPhases() { - const BOOL loading = getIsCloud(); - updateRezzedStatusTimers(); - updateRuthTimer(loading); - return processFullyLoadedChange(loading); + getPhases().clearPhases(); } -void LLVOAvatar::updateRuthTimer(bool loading) +void LLVOAvatar::startPhase(const std::string& phase_name) { - if (isSelf() || !loading) + F32 elapsed; + bool completed; + if (getPhases().getPhaseValues(phase_name, elapsed, completed)) { - return; + if (!completed) + { + LL_DEBUGS("Avatar") << avString() << "no-op, start when started already for " << phase_name << llendl; + return; + } + } + LL_DEBUGS("Avatar") << "started phase " << phase_name << llendl; + getPhases().startPhase(phase_name); +} + +void LLVOAvatar::stopPhase(const std::string& phase_name, bool err_check) + { + F32 elapsed; + bool completed; + if (getPhases().getPhaseValues(phase_name, elapsed, completed)) + { + if (!completed) + { + getPhases().stopPhase(phase_name); + completed = true; + logMetricsTimerRecord(phase_name, elapsed, completed); + LL_DEBUGS("Avatar") << avString() << "stopped phase " << phase_name << " elapsed " << elapsed << llendl; + } + else + { + if (err_check) + { + LL_DEBUGS("Avatar") << "no-op, stop when stopped already for " << phase_name << llendl; + } + } + } + else + { + if (err_check) + { + LL_DEBUGS("Avatar") << "no-op, stop when not started for " << phase_name << llendl; + } + } +} + +void LLVOAvatar::logPendingPhases() +{ + if (!isAgentAvatarValid()) + { + return; + } + + for (LLViewerStats::phase_map_t::iterator it = getPhases().begin(); + it != getPhases().end(); + ++it) + { + const std::string& phase_name = it->first; + F32 elapsed; + bool completed; + if (getPhases().getPhaseValues(phase_name, elapsed, completed)) + { + if (!completed) + { + logMetricsTimerRecord(phase_name, elapsed, completed); + } + } + } + } + +//static +void LLVOAvatar::logPendingPhasesAllAvatars() + { + for (std::vector::iterator iter = LLCharacter::sInstances.begin(); + iter != LLCharacter::sInstances.end(); ++iter) + { + LLVOAvatar* inst = (LLVOAvatar*) *iter; + if( inst->isDead() ) + { + continue; + } + inst->logPendingPhases(); + } + } + +void LLVOAvatar::logMetricsTimerRecord(const std::string& phase_name, F32 elapsed, bool completed) +{ + if (!isAgentAvatarValid()) + { + return; + } + + LLSD record; + record["timer_name"] = phase_name; + record["avatar_id"] = getID(); + record["elapsed"] = elapsed; + record["completed"] = completed; + U32 grid_x(0), grid_y(0); + if (getRegion()) + { + record["central_bake_version"] = LLSD::Integer(getRegion()->getCentralBakeVersion()); + grid_from_region_handle(getRegion()->getHandle(), &grid_x, &grid_y); + } + record["grid_x"] = LLSD::Integer(grid_x); + record["grid_y"] = LLSD::Integer(grid_y); + record["is_using_server_bakes"] = ((bool) isUsingServerBakes()); + record["is_self"] = isSelf(); + + if (isAgentAvatarValid()) + { + gAgentAvatarp->addMetricsTimerRecord(record); + } +} + +// call periodically to keep isFullyLoaded up to date. +// returns true if the value has changed. +BOOL LLVOAvatar::updateIsFullyLoaded() +{ + const BOOL loading = getIsCloud(); + updateRezzedStatusTimers(); + updateRuthTimer(loading); + return processFullyLoadedChange(loading); +} + +void LLVOAvatar::updateRuthTimer(bool loading) +{ + if (isSelf() || !loading) + { + return; } if (mPreviousFullyLoaded) @@ -6583,24 +6192,49 @@ LLMotion* LLVOAvatar::findMotion(const LLUUID& id) const return mMotionController.findMotion(id); } +// This is a semi-deprecated debugging tool - meshes will not show as +// colorized if using deferred rendering. +void LLVOAvatar::debugColorizeSubMeshes(U32 i, const LLColor4& color) +{ + if (gSavedSettings.getBOOL("DebugAvatarCompositeBaked")) + { + avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin(); + avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end(); + for (; iter != end; ++iter) + { + LLAvatarJointMesh* mesh = (*iter); + if (mesh) + { + { + mesh->setColor(color); + } + } + } + } +} + //----------------------------------------------------------------------------- // updateMeshTextures() // Uses the current TE values to set the meshes' and layersets' textures. //----------------------------------------------------------------------------- +// virtual void LLVOAvatar::updateMeshTextures() { - // llinfos << "updateMeshTextures" << llendl; + static S32 update_counter = 0; + mBakedTextureDebugText.clear(); + // if user has never specified a texture, assign the default for (U32 i=0; i < getNumTEs(); i++) { const LLViewerTexture* te_image = getImage(i, 0); if(!te_image || te_image->getID().isNull() || (te_image->getID() == IMG_DEFAULT)) { - setImage(i, LLViewerTextureManager::getFetchedTexture(i == TEX_HAIR ? IMG_DEFAULT : IMG_DEFAULT_AVATAR), 0); // IMG_DEFAULT_AVATAR = a special texture that's never rendered. + // IMG_DEFAULT_AVATAR = a special texture that's never rendered. + const LLUUID& image_id = (i == TEX_HAIR ? IMG_DEFAULT : IMG_DEFAULT_AVATAR); + setImage(i, LLViewerTextureManager::getFetchedTexture(image_id), 0); } } - const BOOL self_customizing = isSelf() && gAgentCamera.cameraCustomizeAvatar(); // During face edit mode, we don't use baked textures const BOOL other_culled = !isSelf() && mCulled; LLLoadedCallbackEntry::source_callback_list_t* src_callback_list = NULL ; BOOL paused = FALSE; @@ -6616,71 +6250,97 @@ void LLVOAvatar::updateMeshTextures() std::vector use_lkg_baked_layer; // lkg = "last known good" use_lkg_baked_layer.resize(mBakedTextureDatas.size(), false); + mBakedTextureDebugText += llformat("%06d\n",update_counter++); + mBakedTextureDebugText += "indx layerset linvld ltda ilb ulkg ltid\n"; for (U32 i=0; i < mBakedTextureDatas.size(); i++) { is_layer_baked[i] = isTextureDefined(mBakedTextureDatas[i].mTextureIndex); - + LLViewerTexLayerSet* layerset = NULL; + bool layerset_invalid = false; if (!other_culled) { // When an avatar is changing clothes and not in Appearance mode, - // use the last-known good baked texture until it finish the first + // use the last-known good baked texture until it finishes the first // render of the new layerset. - const BOOL layerset_invalid = mBakedTextureDatas[i].mTexLayerSet - && ( !mBakedTextureDatas[i].mTexLayerSet->getComposite()->isInitialized() - || !mBakedTextureDatas[i].mTexLayerSet->isLocalTextureDataAvailable() ); + layerset = getTexLayerSet(i); + layerset_invalid = layerset && ( !layerset->getViewerComposite()->isInitialized() + || !layerset->isLocalTextureDataAvailable() ); use_lkg_baked_layer[i] = (!is_layer_baked[i] - && (mBakedTextureDatas[i].mLastTextureIndex != IMG_DEFAULT_AVATAR) + && (mBakedTextureDatas[i].mLastTextureID != IMG_DEFAULT_AVATAR) && layerset_invalid); if (use_lkg_baked_layer[i]) { - mBakedTextureDatas[i].mTexLayerSet->setUpdatesEnabled(TRUE); + layerset->setUpdatesEnabled(TRUE); } } else { use_lkg_baked_layer[i] = (!is_layer_baked[i] - && mBakedTextureDatas[i].mLastTextureIndex != IMG_DEFAULT_AVATAR); - if (mBakedTextureDatas[i].mTexLayerSet) - { - mBakedTextureDatas[i].mTexLayerSet->destroyComposite(); - } - } - + && mBakedTextureDatas[i].mLastTextureID != IMG_DEFAULT_AVATAR); } - // Turn on alpha masking correctly for yourself and other avatars on 1.23+ - mSupportsAlphaLayers = isSelf() || is_layer_baked[BAKED_HAIR]; - - // Baked textures should be requested from the sim this avatar is on. JC - const LLHost target_host = getObjectHost(); - if (!target_host.isOk()) - { - llwarns << "updateMeshTextures: invalid host for object: " << getID() << llendl; + std::string last_id_string; + if (mBakedTextureDatas[i].mLastTextureID == IMG_DEFAULT_AVATAR) + last_id_string = "A"; + else if (mBakedTextureDatas[i].mLastTextureID == IMG_DEFAULT) + last_id_string = "D"; + else if (mBakedTextureDatas[i].mLastTextureID == IMG_INVISIBLE) + last_id_string = "I"; + else + last_id_string = "*"; + bool is_ltda = layerset + && layerset->getViewerComposite()->isInitialized() + && layerset->isLocalTextureDataAvailable(); + mBakedTextureDebugText += llformat("%4d %4s %4d %4d %4d %4d %4s\n", + i, + (layerset?"*":"0"), + layerset_invalid, + is_ltda, + is_layer_baked[i], + use_lkg_baked_layer[i], + last_id_string.c_str()); } for (U32 i=0; i < mBakedTextureDatas.size(); i++) { - if (use_lkg_baked_layer[i] && !self_customizing ) + debugColorizeSubMeshes(i, LLColor4::white); + + LLViewerTexLayerSet* layerset = getTexLayerSet(i); + if (use_lkg_baked_layer[i] && !isUsingLocalAppearance() ) { - LLViewerFetchedTexture* baked_img = LLViewerTextureManager::getFetchedTextureFromHost( mBakedTextureDatas[i].mLastTextureIndex, target_host ); + LLViewerFetchedTexture* baked_img = LLViewerTextureManager::getFetchedTexture(mBakedTextureDatas[i].mLastTextureID); mBakedTextureDatas[i].mIsUsed = TRUE; - for (U32 k=0; k < mBakedTextureDatas[i].mMeshes.size(); k++) + + debugColorizeSubMeshes(i,LLColor4::red); + + avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin(); + avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end(); + for (; iter != end; ++iter) { - mBakedTextureDatas[i].mMeshes[k]->setTexture( baked_img ); + LLAvatarJointMesh* mesh = (*iter); + if (mesh) + { + mesh->setTexture( baked_img ); } } - else if (!self_customizing && is_layer_baked[i]) + } + else if (!isUsingLocalAppearance() && is_layer_baked[i]) { - LLViewerFetchedTexture* baked_img = LLViewerTextureManager::staticCastToFetchedTexture(getImage( mBakedTextureDatas[i].mTextureIndex, 0 ), TRUE) ; - if( baked_img->getID() == mBakedTextureDatas[i].mLastTextureIndex ) + LLViewerFetchedTexture* baked_img = + LLViewerTextureManager::staticCastToFetchedTexture( + getImage( mBakedTextureDatas[i].mTextureIndex, 0 ), TRUE) ; + if( baked_img->getID() == mBakedTextureDatas[i].mLastTextureID ) { - // Even though the file may not be finished loading, we'll consider it loaded and use it (rather than doing compositing). + // Even though the file may not be finished loading, + // we'll consider it loaded and use it (rather than + // doing compositing). useBakedTexture( baked_img->getID() ); } else { mBakedTextureDatas[i].mIsLoaded = FALSE; - if ( (baked_img->getID() != IMG_INVISIBLE) && ((i == BAKED_HEAD) || (i == BAKED_UPPER) || (i == BAKED_LOWER)) ) + if ( (baked_img->getID() != IMG_INVISIBLE) && + ((i == BAKED_HEAD) || (i == BAKED_UPPER) || (i == BAKED_LOWER)) ) { baked_img->setLoadedCallback(onBakedTextureMasksLoaded, MORPH_MASK_REQUESTED_DISCARD, TRUE, TRUE, new LLTextureMaskData( mID ), src_callback_list, paused); @@ -6689,40 +6349,59 @@ void LLVOAvatar::updateMeshTextures() src_callback_list, paused ); } } - else if (mBakedTextureDatas[i].mTexLayerSet - && !other_culled) + else if (layerset && isUsingLocalAppearance()) { - mBakedTextureDatas[i].mTexLayerSet->createComposite(); - mBakedTextureDatas[i].mTexLayerSet->setUpdatesEnabled( TRUE ); + debugColorizeSubMeshes(i,LLColor4::yellow ); + + layerset->createComposite(); + layerset->setUpdatesEnabled( TRUE ); mBakedTextureDatas[i].mIsUsed = FALSE; - for (U32 k=0; k < mBakedTextureDatas[i].mMeshes.size(); k++) + + avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin(); + avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end(); + for (; iter != end; ++iter) { - mBakedTextureDatas[i].mMeshes[k]->setLayerSet( mBakedTextureDatas[i].mTexLayerSet ); + LLAvatarJointMesh* mesh = (*iter); + if (mesh) + { + mesh->setLayerSet( layerset ); + } } } + else + { + debugColorizeSubMeshes(i,LLColor4::blue); + } } // set texture and color of hair manually if we are not using a baked image. // This can happen while loading hair for yourself, or for clients that did not // bake a hair texture. Still needed for yourself after 1.22 is depricated. - if (!is_layer_baked[BAKED_HAIR] || self_customizing) + if (!is_layer_baked[BAKED_HAIR] || isEditingAppearance()) { const LLColor4 color = mTexHairColor ? mTexHairColor->getColor() : LLColor4(1,1,1,1); LLViewerTexture* hair_img = getImage( TEX_HAIR, 0 ); - for (U32 i = 0; i < mBakedTextureDatas[BAKED_HAIR].mMeshes.size(); i++) + avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[BAKED_HAIR].mJointMeshes.begin(); + avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[BAKED_HAIR].mJointMeshes.end(); + for (; iter != end; ++iter) + { + LLAvatarJointMesh* mesh = (*iter); + if (mesh) { - mBakedTextureDatas[BAKED_HAIR].mMeshes[i]->setColor( color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW] ); - mBakedTextureDatas[BAKED_HAIR].mMeshes[i]->setTexture( hair_img ); + mesh->setColor( color ); + mesh->setTexture( hair_img ); + } } } - for (LLVOAvatarDictionary::BakedTextures::const_iterator baked_iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin(); - baked_iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end(); + for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = + LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().begin(); + baked_iter != LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().end(); ++baked_iter) { const EBakedTextureIndex baked_index = baked_iter->first; - const LLVOAvatarDictionary::BakedEntry *baked_dict = baked_iter->second; + const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = baked_iter->second; for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin(); local_tex_iter != baked_dict->mLocalTextures.end(); @@ -6750,7 +6429,7 @@ void LLVOAvatar::setLocalTexture( ETextureIndex type, LLViewerTexture* in_tex, B } //virtual -void LLVOAvatar::setBakedReady(LLVOAvatarDefines::ETextureIndex type, BOOL baked_version_exists, U32 index) +void LLVOAvatar::setBakedReady(LLAvatarAppearanceDefines::ETextureIndex type, BOOL baked_version_exists, U32 index) { // invalid for anyone but self llassert(0); @@ -6785,18 +6464,30 @@ void LLVOAvatar::clearChat() mChats.clear(); } -// adds a morph mask to the appropriate baked texture structure -void LLVOAvatar::addMaskedMorph(EBakedTextureIndex index, LLPolyMorphTarget* morph_target, BOOL invert, std::string layer) + +void LLVOAvatar::applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components, LLAvatarAppearanceDefines::EBakedTextureIndex index) { - if (index < BAKED_NUM_INDICES) + if (index >= BAKED_NUM_INDICES) { - LLMaskedMorph *morph = new LLMaskedMorph(morph_target, invert, layer); - mBakedTextureDatas[index].mMaskedMorphs.push_front(morph); + llwarns << "invalid baked texture index passed to applyMorphMask" << llendl; + return; } + + for (morph_list_t::const_iterator iter = mBakedTextureDatas[index].mMaskedMorphs.begin(); + iter != mBakedTextureDatas[index].mMaskedMorphs.end(); ++iter) +{ + const LLMaskedMorph* maskedMorph = (*iter); + LLPolyMorphTarget* morph_target = dynamic_cast(maskedMorph->mMorphTarget); + if (morph_target) + { + morph_target->applyMask(tex_data, width, height, num_components, maskedMorph->mInvert); +} } +} + // returns TRUE if morph masks are present and not valid for a given baked texture, FALSE otherwise -BOOL LLVOAvatar::morphMaskNeedsUpdate(LLVOAvatarDefines::EBakedTextureIndex index) +BOOL LLVOAvatar::morphMaskNeedsUpdate(LLAvatarAppearanceDefines::EBakedTextureIndex index) { if (index >= BAKED_NUM_INDICES) { @@ -6807,7 +6498,7 @@ BOOL LLVOAvatar::morphMaskNeedsUpdate(LLVOAvatarDefines::EBakedTextureIndex inde { if (isSelf()) { - LLTexLayerSet *layer_set = mBakedTextureDatas[index].mTexLayerSet; + LLViewerTexLayerSet *layer_set = getTexLayerSet(index); if (layer_set) { return !layer_set->isMorphValid(); @@ -6822,23 +6513,6 @@ BOOL LLVOAvatar::morphMaskNeedsUpdate(LLVOAvatarDefines::EBakedTextureIndex inde return FALSE; } -void LLVOAvatar::applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components, LLVOAvatarDefines::EBakedTextureIndex index) -{ - if (index >= BAKED_NUM_INDICES) - { - llwarns << "invalid baked texture index passed to applyMorphMask" << llendl; - return; - } - - for (morph_list_t::const_iterator iter = mBakedTextureDatas[index].mMaskedMorphs.begin(); - iter != mBakedTextureDatas[index].mMaskedMorphs.end(); ++iter) - { - const LLMaskedMorph* maskedMorph = (*iter); - maskedMorph->mMorphTarget->applyMask(tex_data, width, height, num_components, maskedMorph->mInvert); - } -} - - //----------------------------------------------------------------------------- // releaseComponentTextures() // release any component texture UUIDs for which we have a baked texture @@ -6861,7 +6535,7 @@ void LLVOAvatar::releaseComponentTextures() for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++) { - const LLVOAvatarDictionary::BakedEntry * bakedDicEntry = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index); + const LLAvatarAppearanceDictionary::BakedEntry * bakedDicEntry = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index); // skip if this is a skirt and av is not wearing one, or if we don't have a baked texture UUID if (!isTextureDefined(bakedDicEntry->mTextureIndex) && ( (baked_index != BAKED_SKIRT) || isWearingWearableType(LLWearableType::WT_SKIRT) )) @@ -6877,120 +6551,14 @@ void LLVOAvatar::releaseComponentTextures() } } -//static -BOOL LLVOAvatar::teToColorParams( ETextureIndex te, U32 *param_name ) -{ - switch( te ) - { - case TEX_UPPER_SHIRT: - param_name[0] = 803; //"shirt_red"; - param_name[1] = 804; //"shirt_green"; - param_name[2] = 805; //"shirt_blue"; - break; - - case TEX_LOWER_PANTS: - param_name[0] = 806; //"pants_red"; - param_name[1] = 807; //"pants_green"; - param_name[2] = 808; //"pants_blue"; - break; - - case TEX_LOWER_SHOES: - param_name[0] = 812; //"shoes_red"; - param_name[1] = 813; //"shoes_green"; - param_name[2] = 817; //"shoes_blue"; - break; - - case TEX_LOWER_SOCKS: - param_name[0] = 818; //"socks_red"; - param_name[1] = 819; //"socks_green"; - param_name[2] = 820; //"socks_blue"; - break; - - case TEX_UPPER_JACKET: - case TEX_LOWER_JACKET: - param_name[0] = 834; //"jacket_red"; - param_name[1] = 835; //"jacket_green"; - param_name[2] = 836; //"jacket_blue"; - break; - - case TEX_UPPER_GLOVES: - param_name[0] = 827; //"gloves_red"; - param_name[1] = 829; //"gloves_green"; - param_name[2] = 830; //"gloves_blue"; - break; - - case TEX_UPPER_UNDERSHIRT: - param_name[0] = 821; //"undershirt_red"; - param_name[1] = 822; //"undershirt_green"; - param_name[2] = 823; //"undershirt_blue"; - break; - - case TEX_LOWER_UNDERPANTS: - param_name[0] = 824; //"underpants_red"; - param_name[1] = 825; //"underpants_green"; - param_name[2] = 826; //"underpants_blue"; - break; - - case TEX_SKIRT: - param_name[0] = 921; //"skirt_red"; - param_name[1] = 922; //"skirt_green"; - param_name[2] = 923; //"skirt_blue"; - break; - - case TEX_HEAD_TATTOO: - case TEX_LOWER_TATTOO: - case TEX_UPPER_TATTOO: - param_name[0] = 1071; //"tattoo_red"; - param_name[1] = 1072; //"tattoo_green"; - param_name[2] = 1073; //"tattoo_blue"; - break; - - default: - llassert(0); - return FALSE; - } - - return TRUE; -} - -void LLVOAvatar::setClothesColor( ETextureIndex te, const LLColor4& new_color, BOOL upload_bake ) -{ - U32 param_name[3]; - if( teToColorParams( te, param_name ) ) - { - setVisualParamWeight( param_name[0], new_color.mV[VX], upload_bake ); - setVisualParamWeight( param_name[1], new_color.mV[VY], upload_bake ); - setVisualParamWeight( param_name[2], new_color.mV[VZ], upload_bake ); - } -} - -LLColor4 LLVOAvatar::getClothesColor( ETextureIndex te ) -{ - LLColor4 color; - U32 param_name[3]; - if( teToColorParams( te, param_name ) ) - { - color.mV[VX] = getVisualParamWeight( param_name[0] ); - color.mV[VY] = getVisualParamWeight( param_name[1] ); - color.mV[VZ] = getVisualParamWeight( param_name[2] ); - } - return color; -} - -// static -LLColor4 LLVOAvatar::getDummyColor() -{ - return DUMMY_COLOR; -} - void LLVOAvatar::dumpAvatarTEs( const std::string& context ) const { LL_DEBUGS("Avatar") << avString() << (isSelf() ? "Self: " : "Other: ") << context << LL_ENDL; - for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); - iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); + for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin(); + iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end(); ++iter) { - const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second; + const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second; // TODO: MULTI-WEARABLE: handle multiple textures for self const LLViewerTexture* te_image = getImage(iter->first,0); if( !te_image ) @@ -7016,48 +6584,6 @@ void LLVOAvatar::dumpAvatarTEs( const std::string& context ) const } } -// Unlike most wearable functions, this works for both self and other. -BOOL LLVOAvatar::isWearingWearableType(LLWearableType::EType type) const -{ - if (mIsDummy) return TRUE; - - switch(type) - { - case LLWearableType::WT_SHAPE: - case LLWearableType::WT_SKIN: - case LLWearableType::WT_HAIR: - case LLWearableType::WT_EYES: - return TRUE; // everyone has all bodyparts - default: - break; // Do nothing - } - - /* switch(type) - case LLWearableType::WT_SHIRT: - indicator_te = TEX_UPPER_SHIRT; */ - for (LLVOAvatarDictionary::Textures::const_iterator tex_iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); - tex_iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); - ++tex_iter) - { - const LLVOAvatarDictionary::TextureEntry *texture_dict = tex_iter->second; - if (texture_dict->mWearableType == type) - { - // If you're checking another avatar's clothing, you don't have component textures. - // Thus, you must check to see if the corresponding baked texture is defined. - // NOTE: this is a poor substitute if you actually want to know about individual pieces of clothing - // this works for detecting a skirt (most important), but is ineffective at any piece of clothing that - // gets baked into a texture that always exists (upper or lower). - if (texture_dict->mIsUsedByBakedTexture) - { - const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex; - return isTextureDefined(LLVOAvatarDictionary::getInstance()->getBakedTexture(baked_index)->mTextureIndex); - } - return FALSE; - } - } - return FALSE; -} - //----------------------------------------------------------------------------- // clampAttachmentPositions() //----------------------------------------------------------------------------- @@ -7138,7 +6664,7 @@ LLBBox LLVOAvatar::getHUDBBox() const //----------------------------------------------------------------------------- void LLVOAvatar::onFirstTEMessageReceived() { - LL_INFOS("Avatar") << avString() << LL_ENDL; + LL_DEBUGS("Avatar") << avString() << LL_ENDL; if( !mFirstTEMessageReceived ) { mFirstTEMessageReceived = TRUE; @@ -7160,7 +6686,7 @@ void LLVOAvatar::onFirstTEMessageReceived() if (layer_baked) { LLViewerFetchedTexture* image = LLViewerTextureManager::staticCastToFetchedTexture(getImage( mBakedTextureDatas[i].mTextureIndex, 0 ), TRUE) ; - mBakedTextureDatas[i].mLastTextureIndex = image->getID(); + mBakedTextureDatas[i].mLastTextureID = image->getID(); // If we have more than one texture for the other baked layers, we'll want to call this for them too. if ( (image->getID() != IMG_INVISIBLE) && ((i == BAKED_HEAD) || (i == BAKED_UPPER) || (i == BAKED_LOWER)) ) { @@ -7212,114 +6738,329 @@ bool LLVOAvatar::visualParamWeightsAreDefault() return rtn; } +void dump_visual_param(apr_file_t* file, LLVisualParam* viewer_param, F32 value) +{ + std::string type_string = "unknown"; + if (dynamic_cast(viewer_param)) + type_string = "param_alpha"; + if (dynamic_cast(viewer_param)) + type_string = "param_color"; + if (dynamic_cast(viewer_param)) + type_string = "param_driver"; + if (dynamic_cast(viewer_param)) + type_string = "param_morph"; + if (dynamic_cast(viewer_param)) + type_string = "param_skeleton"; + S32 wtype = -1; + LLViewerVisualParam *vparam = dynamic_cast(viewer_param); + if (vparam) + { + wtype = vparam->getWearableType(); + } + S32 u8_value = F32_to_U8(value,viewer_param->getMinWeight(),viewer_param->getMaxWeight()); + apr_file_printf(file, "\t\t\n", + viewer_param->getID(), viewer_param->getName().c_str(), value, u8_value, type_string.c_str(), + LLWearableType::getTypeName(LLWearableType::EType(wtype)).c_str() +// param_location_name(vparam->getParamLocation()).c_str() + ); + } + + +void LLVOAvatar::dumpAppearanceMsgParams( const std::string& dump_prefix, + const LLAppearanceMessageContents& contents) + { + std::string outfilename = get_sequential_numbered_file_name(dump_prefix,".xml"); + const std::vector& params_for_dump = contents.mParamWeights; + const LLTEContents& tec = contents.mTEContents; + + LLAPRFile outfile; + std::string fullpath = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,outfilename); + outfile.open(fullpath, LL_APR_WB ); + apr_file_t* file = outfile.getFileHandle(); + if (!file) + { + return; + } + else + { + LL_DEBUGS("Avatar") << "dumping appearance message to " << fullpath << llendl; + } + + apr_file_printf(file, "
\n"); + apr_file_printf(file, "\t\t\n", contents.mCOFVersion); + apr_file_printf(file, "\t\t\n", contents.mAppearanceVersion); + apr_file_printf(file, "
\n"); + + apr_file_printf(file, "\n\n"); + LLVisualParam* param = getFirstVisualParam(); + for (S32 i = 0; i < params_for_dump.size(); i++) + { + while( param && (param->getGroup() != VISUAL_PARAM_GROUP_TWEAKABLE) ) // should not be any of group VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT + { + param = getNextVisualParam(); + } + LLViewerVisualParam* viewer_param = (LLViewerVisualParam*)param; + F32 value = params_for_dump[i]; + dump_visual_param(file, viewer_param, value); + param = getNextVisualParam(); + } + apr_file_printf(file, "\n"); + + apr_file_printf(file, "\n\n"); + for (U32 i = 0; i < tec.face_count; i++) + { + std::string uuid_str; + ((LLUUID*)tec.image_data)[i].toString(uuid_str); + apr_file_printf( file, "\t\t\n", i, uuid_str.c_str()); + } + apr_file_printf(file, "\n"); + } + +void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMessageContents& contents) +{ + parseTEMessage(mesgsys, _PREHASH_ObjectData, -1, contents.mTEContents); + + // Parse the AppearanceData field, if any. + if (mesgsys->has(_PREHASH_AppearanceData)) + { + U8 av_u8; + mesgsys->getU8Fast(_PREHASH_AppearanceData, _PREHASH_AppearanceVersion, av_u8, 0); + contents.mAppearanceVersion = av_u8; + LL_DEBUGS("Avatar") << "appversion set by AppearanceData field: " << contents.mAppearanceVersion << llendl; + mesgsys->getS32Fast(_PREHASH_AppearanceData, _PREHASH_CofVersion, contents.mCOFVersion, 0); + // For future use: + //mesgsys->getU32Fast(_PREHASH_AppearanceData, _PREHASH_Flags, appearance_flags, 0); + } + + // Parse visual params, if any. + S32 num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_VisualParam); + bool drop_visual_params_debug = gSavedSettings.getBOOL("BlockSomeAvatarAppearanceVisualParams") && (ll_rand(2) == 0); // pretend that ~12% of AvatarAppearance messages arrived without a VisualParam block, for testing + if( num_blocks > 1 && !drop_visual_params_debug) + { + LL_DEBUGS("Avatar") << avString() << " handle visual params, num_blocks " << num_blocks << LL_ENDL; + + LLVisualParam* param = getFirstVisualParam(); + llassert(param); // if this ever fires, we should do the same as when num_blocks<=1 + if (!param) + { + llwarns << "No visual params!" << llendl; + } + else + { + for( S32 i = 0; i < num_blocks; i++ ) + { + while( param && (param->getGroup() != VISUAL_PARAM_GROUP_TWEAKABLE) ) // should not be any of group VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT + { + param = getNextVisualParam(); + } + + if( !param ) + { + // more visual params supplied than expected - just process what we know about + break; + } + + U8 value; + mesgsys->getU8Fast(_PREHASH_VisualParam, _PREHASH_ParamValue, value, i); + F32 newWeight = U8_to_F32(value, param->getMinWeight(), param->getMaxWeight()); + contents.mParamWeights.push_back(newWeight); + contents.mParams.push_back(param); + + param = getNextVisualParam(); + } + } + + const S32 expected_tweakable_count = getVisualParamCountInGroup(VISUAL_PARAM_GROUP_TWEAKABLE); // don't worry about VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT + if (num_blocks != expected_tweakable_count) + { + LL_DEBUGS("Avatar") << "Number of params in AvatarAppearance msg (" << num_blocks << ") does not match number of tweakable params in avatar xml file (" << expected_tweakable_count << "). Processing what we can. object: " << getID() << llendl; + } + } + else + { + if (drop_visual_params_debug) + { + llinfos << "Debug-faked lack of parameters on AvatarAppearance for object: " << getID() << llendl; + } + else + { + LL_DEBUGS("Avatar") << "AvatarAppearance msg received without any parameters, object: " << getID() << llendl; + } + } + + LLVisualParam* appearance_version_param = getVisualParam(11000); + if (appearance_version_param) + { + std::vector::iterator it = std::find(contents.mParams.begin(), contents.mParams.end(),appearance_version_param); + if (it != contents.mParams.end()) + { + S32 index = it - contents.mParams.begin(); + contents.mParamAppearanceVersion = llround(contents.mParamWeights[index]); + LL_DEBUGS("Avatar") << "appversion req by appearance_version param: " << contents.mParamAppearanceVersion << llendl; + } + } +} + +bool resolve_appearance_version(const LLAppearanceMessageContents& contents, S32& appearance_version) +{ + appearance_version = -1; + + if ((contents.mAppearanceVersion) >= 0 && + (contents.mParamAppearanceVersion >= 0) && + (contents.mAppearanceVersion != contents.mParamAppearanceVersion)) + { + llwarns << "inconsistent appearance_version settings - field: " << + contents.mAppearanceVersion << ", param: " << contents.mParamAppearanceVersion << llendl; + return false; + } + if (contents.mParamAppearanceVersion >= 0) // use visual param if available. + { + appearance_version = contents.mParamAppearanceVersion; + } + if (contents.mAppearanceVersion >= 0) + { + appearance_version = contents.mAppearanceVersion; + } + if (appearance_version < 0) // still not set, go with 0. + { + appearance_version = 0; + } + LL_DEBUGS("Avatar") << "appearance version info - field " << contents.mAppearanceVersion + << " param: " << contents.mParamAppearanceVersion + << " final: " << appearance_version << llendl; + return true; +} //----------------------------------------------------------------------------- // processAvatarAppearance() //----------------------------------------------------------------------------- void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) { + LL_DEBUGS("Avatar") << "starts" << llendl; + + bool enable_verbose_dumps = gSavedSettings.getBOOL("DebugAvatarAppearanceMessage"); + std::string dump_prefix = getFullname() + "_" + (isSelf()?"s":"o") + "_"; if (gSavedSettings.getBOOL("BlockAvatarAppearanceMessages")) { llwarns << "Blocking AvatarAppearance message" << llendl; return; } - - BOOL is_first_appearance_message = !mFirstAppearanceMessageReceived; - mFirstAppearanceMessageReceived = TRUE; - LL_INFOS("Avatar") << avString() << "processAvatarAppearance start " << mID - << " first? " << is_first_appearance_message << " self? " << isSelf() << LL_ENDL; + ESex old_sex = getSex(); + LLAppearanceMessageContents contents; + parseAppearanceMessage(mesgsys, contents); + if (enable_verbose_dumps) + { + dumpAppearanceMsgParams(dump_prefix + "appearance_msg", contents); + } + S32 appearance_version; + if (!resolve_appearance_version(contents, appearance_version)) + { + llwarns << "bad appearance version info, discarding" << 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() ) { - llwarns << avString() << "Received AvatarAppearance for self" << llendl; - if( mFirstTEMessageReceived ) + 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)) { -// llinfos << "processAvatarAppearance end " << mID << llendl; return; } } + else + { + LL_DEBUGS("Avatar") << "appearance message received" << llendl; + } - ESex old_sex = getSex(); + // 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 + << ", got " << this_update_cof_version << llendl; + return; + } + + if (isSelf() && isEditingAppearance()) + { + LL_DEBUGS("Avatar") << "ignoring appearance message while in appearance edit" << llendl; + return; + } + + S32 num_params = contents.mParamWeights.size(); + if (num_params <= 1) + { + // In this case, we have no reliable basis for knowing + // appearance version, which may cause us to look for baked + // textures in the wrong place and flag them as missing + // assets. + LL_DEBUGS("Avatar") << "ignoring appearance message due to lack of params" << llendl; + return; + } -// llinfos << "LLVOAvatar::processAvatarAppearance()" << llendl; -// dumpAvatarTEs( "PRE processAvatarAppearance()" ); - unpackTEMessage(mesgsys, _PREHASH_ObjectData); -// dumpAvatarTEs( "POST processAvatarAppearance()" ); + mLastUpdateReceivedCOFVersion = this_update_cof_version; + + setIsUsingServerBakes(appearance_version > 0); + + applyParsedTEMessage(contents.mTEContents); // prevent the overwriting of valid baked textures with invalid baked textures for (U8 baked_index = 0; baked_index < mBakedTextureDatas.size(); baked_index++) { if (!isTextureDefined(mBakedTextureDatas[baked_index].mTextureIndex) - && mBakedTextureDatas[baked_index].mLastTextureIndex != IMG_DEFAULT + && mBakedTextureDatas[baked_index].mLastTextureID != IMG_DEFAULT && baked_index != BAKED_SKIRT) { setTEImage(mBakedTextureDatas[baked_index].mTextureIndex, - LLViewerTextureManager::getFetchedTexture(mBakedTextureDatas[baked_index].mLastTextureIndex, - TRUE, - LLViewerTexture::BOOST_NONE, - LLViewerTexture::LOD_TEXTURE)); + LLViewerTextureManager::getFetchedTexture(mBakedTextureDatas[baked_index].mLastTextureID, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); } } - // runway - was // if (!is_first_appearance_message ) // which means it would be called on second appearance message - probably wrong. + BOOL is_first_appearance_message = !mFirstAppearanceMessageReceived; + mFirstAppearanceMessageReceived = TRUE; + + LL_DEBUGS("Avatar") << avString() << "processAvatarAppearance start " << mID + << " first? " << is_first_appearance_message << " self? " << isSelf() << LL_ENDL; + if (is_first_appearance_message ) { onFirstTEMessageReceived(); } setCompositeUpdatesEnabled( FALSE ); - mMeshTexturesDirty = TRUE; gPipeline.markGLRebuild(this); - // ! BACKWARDS COMPATIBILITY ! - // Non-self avatars will no longer have component textures - if (!isSelf()) - { - releaseComponentTextures(); - } - - // parse visual params - S32 num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_VisualParam); - bool drop_visual_params_debug = gSavedSettings.getBOOL("BlockSomeAvatarAppearanceVisualParams") && (ll_rand(2) == 0); // pretend that ~12% of AvatarAppearance messages arrived without a VisualParam block, for testing - if( num_blocks > 1 && !drop_visual_params_debug) + // Apply visual params + if( num_params > 1) { - LL_DEBUGS("Avatar") << avString() << " handle visual params, num_blocks " << num_blocks << LL_ENDL; + LL_DEBUGS("Avatar") << avString() << " handle visual params, num_params " << num_params << LL_ENDL; BOOL params_changed = FALSE; BOOL interp_params = FALSE; - LLVisualParam* param = getFirstVisualParam(); - llassert(param); // if this ever fires, we should do the same as when num_blocks<=1 - if (!param) - { - llwarns << "No visual params!" << llendl; - } - else + for( S32 i = 0; i < num_params; i++ ) { - for( S32 i = 0; i < num_blocks; i++ ) - { - while( param && (param->getGroup() != VISUAL_PARAM_GROUP_TWEAKABLE) ) // should not be any of group VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT - { - param = getNextVisualParam(); - } - - if( !param ) - { - // more visual params supplied than expected - just process what we know about - break; - } - - U8 value; - mesgsys->getU8Fast(_PREHASH_VisualParam, _PREHASH_ParamValue, value, i); - F32 newWeight = U8_to_F32(value, param->getMinWeight(), param->getMaxWeight()); + LLVisualParam* param = contents.mParams[i]; + F32 newWeight = contents.mParamWeights[i]; if (is_first_appearance_message || (param->getWeight() != newWeight)) { - //llinfos << "Received update for param " << param->getDisplayName() << " at value " << newWeight << llendl; params_changed = TRUE; if(is_first_appearance_message) { @@ -7331,14 +7072,11 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) param->setAnimationTarget(newWeight, FALSE); } } - param = getNextVisualParam(); - } } - const S32 expected_tweakable_count = getVisualParamCountInGroup(VISUAL_PARAM_GROUP_TWEAKABLE); // don't worry about VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT - if (num_blocks != expected_tweakable_count) + if (num_params != expected_tweakable_count) { - llinfos << "Number of params in AvatarAppearance msg (" << num_blocks << ") does not match number of tweakable params in avatar xml file (" << expected_tweakable_count << "). Processing what we can. object: " << getID() << llendl; + LL_DEBUGS("Avatar") << "Number of params in AvatarAppearance msg (" << num_params << ") does not match number of tweakable params in avatar xml file (" << expected_tweakable_count << "). Processing what we can. object: " << getID() << llendl; } if (params_changed) @@ -7362,14 +7100,6 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) { // AvatarAppearance message arrived without visual params LL_DEBUGS("Avatar") << avString() << "no visual params" << LL_ENDL; - if (drop_visual_params_debug) - { - llinfos << "Debug-faked lack of parameters on AvatarAppearance for object: " << getID() << llendl; - } - else - { - llinfos << "AvatarAppearance msg received without any parameters, object: " << getID() << llendl; - } const F32 LOADING_TIMEOUT_SECONDS = 60.f; // this isn't really a problem if we already have a non-default shape @@ -7392,7 +7122,14 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) // If all of the avatars are completely baked, release the global image caches to conserve memory. LLVOAvatar::cullAvatarsByPixelArea(); -// llinfos << "processAvatarAppearance end " << mID << llendl; + if (isSelf()) + { + mUseLocalAppearance = false; + } + + updateMeshTextures(); + + //if (enable_verbose_dumps) dumpArchetypeXML(dump_prefix + "process_end"); } // static @@ -7422,6 +7159,7 @@ void LLVOAvatar::getAnimNames( LLDynamicArray* names ) names->put( "enter_away_from_keyboard_state" ); } +// static void LLVOAvatar::onBakedTextureMasksLoaded( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata ) { if (!userdata) return; @@ -7440,7 +7178,7 @@ void LLVOAvatar::onBakedTextureMasksLoaded( BOOL success, LLViewerFetchedTexture { if (!aux_src->getData()) { - llerrs << "No auxiliary source data for onBakedTextureMasksLoaded" << llendl; + llerrs << "No auxiliary source (morph mask) data for image id " << id << llendl; return; } @@ -7465,12 +7203,12 @@ void LLVOAvatar::onBakedTextureMasksLoaded( BOOL success, LLViewerFetchedTexture self->mBakedTextureDatas[BAKED_HEAD].mTexLayerSet->applyMorphMask(aux_src->getData(), aux_src->getWidth(), aux_src->getHeight(), 1); maskData->mLastDiscardLevel = discard_level; */ BOOL found_texture_id = false; - for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); - iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); + for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin(); + iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end(); ++iter) { - const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second; + const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second; if (texture_dict->mIsUsedByBakedTexture) { const ETextureIndex texture_index = iter->first; @@ -7492,7 +7230,7 @@ void LLVOAvatar::onBakedTextureMasksLoaded( BOOL success, LLViewerFetchedTexture } if (!found_texture_id) { - llinfos << "onBakedTextureMasksLoaded(): unexpected image id: " << id << llendl; + llinfos << "unexpected image id: " << id << llendl; } self->dirtyMesh(); } @@ -7500,7 +7238,7 @@ void LLVOAvatar::onBakedTextureMasksLoaded( BOOL success, LLViewerFetchedTexture { // this can happen when someone uses an old baked texture possibly provided by // viewer-side baked texture caching - llwarns << "Masks loaded callback but NO aux source!" << llendl; + llwarns << "Masks loaded callback but NO aux source, id " << id << llendl; } } @@ -7538,7 +7276,7 @@ void LLVOAvatar::onBakedTextureLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata) { - //llinfos << "onBakedTextureLoaded: " << src_vi->getID() << llendl; + LL_DEBUGS("Avatar") << "onBakedTextureLoaded: " << src_vi->getID() << LL_ENDL; LLUUID id = src_vi->getID(); LLUUID *avatar_idp = (LLUUID *)userdata; @@ -7575,17 +7313,31 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) { LL_DEBUGS("Avatar") << avString() << " i " << i << " id " << id << LL_ENDL; mBakedTextureDatas[i].mIsLoaded = true; - mBakedTextureDatas[i].mLastTextureIndex = id; + mBakedTextureDatas[i].mLastTextureID = id; mBakedTextureDatas[i].mIsUsed = true; - for (U32 k = 0; k < mBakedTextureDatas[i].mMeshes.size(); k++) + + if (isUsingLocalAppearance()) { - mBakedTextureDatas[i].mMeshes[k]->setTexture( image_baked ); + llinfos << "not changing to baked texture while isUsingLocalAppearance" << llendl; } - if (mBakedTextureDatas[i].mTexLayerSet) + else + { + debugColorizeSubMeshes(i,LLColor4::green); + + avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin(); + avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end(); + for (; iter != end; ++iter) + { + LLAvatarJointMesh* mesh = (*iter); + if (mesh) { - //mBakedTextureDatas[i].mTexLayerSet->destroyComposite(); + mesh->setTexture( image_baked ); + } + } } - const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i); + + const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = + LLAvatarAppearanceDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i); for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin(); local_tex_iter != baked_dict->mLocalTextures.end(); ++local_tex_iter) @@ -7598,9 +7350,15 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) // This is paired with similar code in updateMeshTextures that sets hair mesh color. if (i == BAKED_HAIR) { - for (U32 i = 0; i < mBakedTextureDatas[BAKED_HAIR].mMeshes.size(); i++) + avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin(); + avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end(); + for (; iter != end; ++iter) + { + LLAvatarJointMesh* mesh = (*iter); + if (mesh) { - mBakedTextureDatas[BAKED_HAIR].mMeshes[i]->setColor( 1.f, 1.f, 1.f, 1.f ); + mesh->setColor( LLColor4::white ); + } } } } @@ -7609,11 +7367,39 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) dirtyMesh(); } -// static -void LLVOAvatar::dumpArchetypeXML( void* ) +std::string get_sequential_numbered_file_name(const std::string& prefix, + const std::string& suffix) +{ + typedef std::map file_num_type; + static file_num_type file_nums; + file_num_type::iterator it = file_nums.find(prefix); + S32 num = 0; + if (it != file_nums.end()) +{ + num = it->second; + } + file_nums[prefix] = num+1; + std::string outfilename = prefix + " " + llformat("%04d",num) + ".xml"; + std::replace(outfilename.begin(),outfilename.end(),' ','_'); + return outfilename; +} + +void LLVOAvatar::dumpArchetypeXML(const std::string& prefix, bool group_by_wearables ) +{ + std::string outprefix(prefix); + if (outprefix.empty()) + { + outprefix = getFullname() + (isSelf()?"_s":"_o"); + } + if (outprefix.empty()) { + outprefix = std::string("new_archetype"); + } + std::string outfilename = get_sequential_numbered_file_name(outprefix,".xml"); + LLAPRFile outfile; - outfile.open(gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,"new archetype.xml"), LL_APR_WB ); + std::string fullpath = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,outfilename); + outfile.open(fullpath, LL_APR_WB ); apr_file_t* file = outfile.getFileHandle(); if (!file) { @@ -7621,36 +7407,60 @@ void LLVOAvatar::dumpArchetypeXML( void* ) } else { - llinfos << "xmlfile write handle obtained : " << gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,"new archetype.xml") << llendl; + llinfos << "xmlfile write handle obtained : " << fullpath << llendl; } apr_file_printf( file, "\n" ); apr_file_printf( file, "\n" ); apr_file_printf( file, "\n\t\n" ); - // only body parts, not clothing. - for (S32 type = LLWearableType::WT_SHAPE; type <= LLWearableType::WT_EYES; type++) + if (group_by_wearables) + { + for (S32 type = LLWearableType::WT_SHAPE; type < LLWearableType::WT_COUNT; type++) { const std::string& wearable_name = LLWearableType::getTypeName((LLWearableType::EType)type); apr_file_printf( file, "\n\t\t\n", wearable_name.c_str() ); - for (LLVisualParam* param = gAgentAvatarp->getFirstVisualParam(); param; param = gAgentAvatarp->getNextVisualParam()) + for (LLVisualParam* param = getFirstVisualParam(); param; param = getNextVisualParam()) { LLViewerVisualParam* viewer_param = (LLViewerVisualParam*)param; if( (viewer_param->getWearableType() == type) && (viewer_param->isTweakable() ) ) { - apr_file_printf(file, "\t\t\n", - viewer_param->getID(), viewer_param->getName().c_str(), viewer_param->getWeight()); + dump_visual_param(file, viewer_param, viewer_param->getWeight()); + } + } + + for (U8 te = 0; te < TEX_NUM_INDICES; te++) + { + if (LLAvatarAppearanceDictionary::getTEWearableType((ETextureIndex)te) == type) + { + // MULTIPLE_WEARABLES: extend to multiple wearables? + LLViewerTexture* te_image = getImage((ETextureIndex)te, 0); + if( te_image ) + { + std::string uuid_str; + te_image->getID().toString( uuid_str ); + apr_file_printf( file, "\t\t\n", te, uuid_str.c_str()); + } } } + } + } + else + { + // Just dump all params sequentially. + for (LLVisualParam* param = getFirstVisualParam(); param; param = getNextVisualParam()) + { + LLViewerVisualParam* viewer_param = (LLViewerVisualParam*)param; + dump_visual_param(file, viewer_param, viewer_param->getWeight()); + } for (U8 te = 0; te < TEX_NUM_INDICES; te++) { - if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex)te) == type) { // MULTIPLE_WEARABLES: extend to multiple wearables? - LLViewerTexture* te_image = ((LLVOAvatar *)(gAgentAvatarp))->getImage((ETextureIndex)te, 0); + LLViewerTexture* te_image = getImage((ETextureIndex)te, 0); if( te_image ) { std::string uuid_str; @@ -7659,14 +7469,18 @@ void LLVOAvatar::dumpArchetypeXML( void* ) } } } + } apr_file_printf( file, "\t\n" ); apr_file_printf( file, "\n\n" ); - //explictly close the file if it is still open which it should be - if (file) + + bool ultra_verbose = false; + if (isSelf() && ultra_verbose) { - outfile.close(); + // show the cloned params inside the wearables as well. + gAgentAvatarp->dumpWearableInfo(outfile); } + // File will close when handle goes out of scope } @@ -7748,15 +7562,9 @@ void LLVOAvatar::cullAvatarsByPixelArea() } } - // runway - this doesn't detect gray/grey state. - // think we just need to be checking self av since it's the only - // one with lltexlayer stuff. + // runway - this doesn't really detect gray/grey state. S32 grey_avatars = 0; - if (LLVOAvatar::areAllNearbyInstancesBaked(grey_avatars)) - { - LLVOAvatar::deleteCachedImages(false); - } - else + if (!LLVOAvatar::areAllNearbyInstancesBaked(grey_avatars)) { if (gFrameTimeSeconds != sUnbakedUpdateTime) // only update once per frame { @@ -7785,500 +7593,43 @@ void LLVOAvatar::startAppearanceAnimation() } // virtual -void LLVOAvatar::removeMissingBakedTextures() -{ -} - -//----------------------------------------------------------------------------- -// LLVOAvatarXmlInfo -//----------------------------------------------------------------------------- - -LLVOAvatar::LLVOAvatarXmlInfo::LLVOAvatarXmlInfo() - : mTexSkinColorInfo(0), mTexHairColorInfo(0), mTexEyeColorInfo(0) -{ -} - -LLVOAvatar::LLVOAvatarXmlInfo::~LLVOAvatarXmlInfo() -{ - std::for_each(mMeshInfoList.begin(), mMeshInfoList.end(), DeletePointer()); - std::for_each(mSkeletalDistortionInfoList.begin(), mSkeletalDistortionInfoList.end(), DeletePointer()); - std::for_each(mAttachmentInfoList.begin(), mAttachmentInfoList.end(), DeletePointer()); - deleteAndClear(mTexSkinColorInfo); - deleteAndClear(mTexHairColorInfo); - deleteAndClear(mTexEyeColorInfo); - std::for_each(mLayerInfoList.begin(), mLayerInfoList.end(), DeletePointer()); - std::for_each(mDriverInfoList.begin(), mDriverInfoList.end(), DeletePointer()); - std::for_each(mMorphMaskInfoList.begin(), mMorphMaskInfoList.end(), DeletePointer()); -} - -////----------------------------------------------------------------------------- -//// LLVOAvatarBoneInfo::parseXml() -////----------------------------------------------------------------------------- -//BOOL LLVOAvatarBoneInfo::parseXml(LLXmlTreeNode* node) -//{ -// if (node->hasName("bone")) -// { -// mIsJoint = TRUE; -// static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); -// if (!node->getFastAttributeString(name_string, mName)) -// { -// llwarns << "Bone without name" << llendl; -// return FALSE; -// } -// } -// else if (node->hasName("collision_volume")) -// { -// mIsJoint = FALSE; -// static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); -// if (!node->getFastAttributeString(name_string, mName)) -// { -// mName = "Collision Volume"; -// } -// } -// else -// { -// llwarns << "Invalid node " << node->getName() << llendl; -// return FALSE; -// } -// -// static LLStdStringHandle pos_string = LLXmlTree::addAttributeString("pos"); -// if (!node->getFastAttributeVector3(pos_string, mPos)) -// { -// llwarns << "Bone without position" << llendl; -// return FALSE; -// } -// -// static LLStdStringHandle rot_string = LLXmlTree::addAttributeString("rot"); -// if (!node->getFastAttributeVector3(rot_string, mRot)) -// { -// llwarns << "Bone without rotation" << llendl; -// return FALSE; -// } -// -// static LLStdStringHandle scale_string = LLXmlTree::addAttributeString("scale"); -// if (!node->getFastAttributeVector3(scale_string, mScale)) -// { -// llwarns << "Bone without scale" << llendl; -// return FALSE; -// } -// -// if (mIsJoint) -// { -// static LLStdStringHandle pivot_string = LLXmlTree::addAttributeString("pivot"); -// if (!node->getFastAttributeVector3(pivot_string, mPivot)) -// { -// llwarns << "Bone without pivot" << llendl; -// return FALSE; -// } -// } -// -// // parse children -// LLXmlTreeNode* child; -// for( child = node->getFirstChild(); child; child = node->getNextChild() ) -// { -// LLVOAvatarBoneInfo *child_info = new LLVOAvatarBoneInfo; -// if (!child_info->parseXml(child)) -// { -// delete child_info; -// return FALSE; -// } -// mChildList.push_back(child_info); -// } -// return TRUE; -//} -// -////----------------------------------------------------------------------------- -//// LLVOAvatarSkeletonInfo::parseXml() -////----------------------------------------------------------------------------- -//BOOL LLVOAvatarSkeletonInfo::parseXml(LLXmlTreeNode* node) -//{ -// static LLStdStringHandle num_bones_string = LLXmlTree::addAttributeString("num_bones"); -// if (!node->getFastAttributeS32(num_bones_string, mNumBones)) -// { -// llwarns << "Couldn't find number of bones." << llendl; -// return FALSE; -// } -// -// static LLStdStringHandle num_collision_volumes_string = LLXmlTree::addAttributeString("num_collision_volumes"); -// node->getFastAttributeS32(num_collision_volumes_string, mNumCollisionVolumes); -// -// LLXmlTreeNode* child; -// for( child = node->getFirstChild(); child; child = node->getNextChild() ) -// { -// LLVOAvatarBoneInfo *info = new LLVOAvatarBoneInfo; -// if (!info->parseXml(child)) -// { -// delete info; -// llwarns << "Error parsing bone in skeleton file" << llendl; -// return FALSE; -// } -// mBoneInfoList.push_back(info); -// } -// return TRUE; -//} - -//----------------------------------------------------------------------------- -// parseXmlSkeletonNode(): parses nodes from XML tree -//----------------------------------------------------------------------------- -BOOL LLVOAvatar::LLVOAvatarXmlInfo::parseXmlSkeletonNode(LLXmlTreeNode* root) -{ - LLXmlTreeNode* node = root->getChildByName( "skeleton" ); - if( !node ) - { - llwarns << "avatar file: missing " << llendl; - return FALSE; - } - - LLXmlTreeNode* child; - - // SKELETON DISTORTIONS - for (child = node->getChildByName( "param" ); - child; - child = node->getNextNamedChild()) - { - if (!child->getChildByName("param_skeleton")) - { - if (child->getChildByName("param_morph")) - { - llwarns << "Can't specify morph param in skeleton definition." << llendl; - } - else - { - llwarns << "Unknown param type." << llendl; - } - continue; - } - - LLPolySkeletalDistortionInfo *info = new LLPolySkeletalDistortionInfo; - if (!info->parseXml(child)) - { - delete info; - return FALSE; - } - - mSkeletalDistortionInfoList.push_back(info); - } - - // ATTACHMENT POINTS - for (child = node->getChildByName( "attachment_point" ); - child; - child = node->getNextNamedChild()) - { - LLVOAvatarAttachmentInfo* info = new LLVOAvatarAttachmentInfo(); - - static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); - if (!child->getFastAttributeString(name_string, info->mName)) - { - llwarns << "No name supplied for attachment point." << llendl; - delete info; - continue; - } - - static LLStdStringHandle joint_string = LLXmlTree::addAttributeString("joint"); - if (!child->getFastAttributeString(joint_string, info->mJointName)) - { - llwarns << "No bone declared in attachment point " << info->mName << llendl; - delete info; - continue; - } - - static LLStdStringHandle position_string = LLXmlTree::addAttributeString("position"); - if (child->getFastAttributeVector3(position_string, info->mPosition)) - { - info->mHasPosition = TRUE; - } - - static LLStdStringHandle rotation_string = LLXmlTree::addAttributeString("rotation"); - if (child->getFastAttributeVector3(rotation_string, info->mRotationEuler)) - { - info->mHasRotation = TRUE; - } - static LLStdStringHandle group_string = LLXmlTree::addAttributeString("group"); - if (child->getFastAttributeS32(group_string, info->mGroup)) - { - if (info->mGroup == -1) - info->mGroup = -1111; // -1 = none parsed, < -1 = bad value - } - - static LLStdStringHandle id_string = LLXmlTree::addAttributeString("id"); - if (!child->getFastAttributeS32(id_string, info->mAttachmentID)) - { - llwarns << "No id supplied for attachment point " << info->mName << llendl; - delete info; - continue; - } - - static LLStdStringHandle slot_string = LLXmlTree::addAttributeString("pie_slice"); - child->getFastAttributeS32(slot_string, info->mPieMenuSlice); - - static LLStdStringHandle visible_in_first_person_string = LLXmlTree::addAttributeString("visible_in_first_person"); - child->getFastAttributeBOOL(visible_in_first_person_string, info->mVisibleFirstPerson); - - static LLStdStringHandle hud_attachment_string = LLXmlTree::addAttributeString("hud"); - child->getFastAttributeBOOL(hud_attachment_string, info->mIsHUDAttachment); - - mAttachmentInfoList.push_back(info); - } - - return TRUE; -} - -//----------------------------------------------------------------------------- -// parseXmlMeshNodes(): parses nodes from XML tree -//----------------------------------------------------------------------------- -BOOL LLVOAvatar::LLVOAvatarXmlInfo::parseXmlMeshNodes(LLXmlTreeNode* root) -{ - for (LLXmlTreeNode* node = root->getChildByName( "mesh" ); - node; - node = root->getNextNamedChild()) - { - LLVOAvatarMeshInfo *info = new LLVOAvatarMeshInfo; - - // attribute: type - static LLStdStringHandle type_string = LLXmlTree::addAttributeString("type"); - if( !node->getFastAttributeString( type_string, info->mType ) ) - { - llwarns << "Avatar file: is missing type attribute. Ignoring element. " << llendl; - delete info; - return FALSE; // Ignore this element - } - - static LLStdStringHandle lod_string = LLXmlTree::addAttributeString("lod"); - if (!node->getFastAttributeS32( lod_string, info->mLOD )) - { - llwarns << "Avatar file: is missing lod attribute. Ignoring element. " << llendl; - delete info; - return FALSE; // Ignore this element - } - - static LLStdStringHandle file_name_string = LLXmlTree::addAttributeString("file_name"); - if( !node->getFastAttributeString( file_name_string, info->mMeshFileName ) ) - { - llwarns << "Avatar file: is missing file_name attribute. Ignoring: " << info->mType << llendl; - delete info; - return FALSE; // Ignore this element - } - - static LLStdStringHandle reference_string = LLXmlTree::addAttributeString("reference"); - node->getFastAttributeString( reference_string, info->mReferenceMeshName ); - - // attribute: min_pixel_area - static LLStdStringHandle min_pixel_area_string = LLXmlTree::addAttributeString("min_pixel_area"); - static LLStdStringHandle min_pixel_width_string = LLXmlTree::addAttributeString("min_pixel_width"); - if (!node->getFastAttributeF32( min_pixel_area_string, info->mMinPixelArea )) - { - F32 min_pixel_area = 0.1f; - if (node->getFastAttributeF32( min_pixel_width_string, min_pixel_area )) - { - // this is square root of pixel area (sensible to use linear space in defining lods) - min_pixel_area = min_pixel_area * min_pixel_area; - } - info->mMinPixelArea = min_pixel_area; - } - - // Parse visual params for this node only if we haven't already - for (LLXmlTreeNode* child = node->getChildByName( "param" ); - child; - child = node->getNextNamedChild()) - { - if (!child->getChildByName("param_morph")) - { - if (child->getChildByName("param_skeleton")) - { - llwarns << "Can't specify skeleton param in a mesh definition." << llendl; - } - else - { - llwarns << "Unknown param type." << llendl; - } - continue; - } - - LLPolyMorphTargetInfo *morphinfo = new LLPolyMorphTargetInfo(); - if (!morphinfo->parseXml(child)) - { - delete morphinfo; - delete info; - return -1; - } - BOOL shared = FALSE; - static LLStdStringHandle shared_string = LLXmlTree::addAttributeString("shared"); - child->getFastAttributeBOOL(shared_string, shared); - - info->mPolyMorphTargetInfoList.push_back(LLVOAvatarMeshInfo::morph_info_pair_t(morphinfo, shared)); - } - - mMeshInfoList.push_back(info); - } - return TRUE; -} - -//----------------------------------------------------------------------------- -// parseXmlColorNodes(): parses nodes from XML tree -//----------------------------------------------------------------------------- -BOOL LLVOAvatar::LLVOAvatarXmlInfo::parseXmlColorNodes(LLXmlTreeNode* root) -{ - for (LLXmlTreeNode* color_node = root->getChildByName( "global_color" ); - color_node; - color_node = root->getNextNamedChild()) - { - std::string global_color_name; - static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); - if (color_node->getFastAttributeString( name_string, global_color_name ) ) - { - if( global_color_name == "skin_color" ) - { - if (mTexSkinColorInfo) - { - llwarns << "avatar file: multiple instances of skin_color" << llendl; - return FALSE; - } - mTexSkinColorInfo = new LLTexGlobalColorInfo; - if( !mTexSkinColorInfo->parseXml( color_node ) ) - { - deleteAndClear(mTexSkinColorInfo); - llwarns << "avatar file: mTexSkinColor->parseXml() failed" << llendl; - return FALSE; - } - } - else if( global_color_name == "hair_color" ) - { - if (mTexHairColorInfo) - { - llwarns << "avatar file: multiple instances of hair_color" << llendl; - return FALSE; - } - mTexHairColorInfo = new LLTexGlobalColorInfo; - if( !mTexHairColorInfo->parseXml( color_node ) ) - { - deleteAndClear(mTexHairColorInfo); - llwarns << "avatar file: mTexHairColor->parseXml() failed" << llendl; - return FALSE; - } - } - else if( global_color_name == "eye_color" ) - { - if (mTexEyeColorInfo) - { - llwarns << "avatar file: multiple instances of eye_color" << llendl; - return FALSE; - } - mTexEyeColorInfo = new LLTexGlobalColorInfo; - if( !mTexEyeColorInfo->parseXml( color_node ) ) - { - llwarns << "avatar file: mTexEyeColor->parseXml() failed" << llendl; - return FALSE; - } - } - } - } - return TRUE; -} - -//----------------------------------------------------------------------------- -// parseXmlLayerNodes(): parses nodes from XML tree -//----------------------------------------------------------------------------- -BOOL LLVOAvatar::LLVOAvatarXmlInfo::parseXmlLayerNodes(LLXmlTreeNode* root) -{ - for (LLXmlTreeNode* layer_node = root->getChildByName( "layer_set" ); - layer_node; - layer_node = root->getNextNamedChild()) - { - LLTexLayerSetInfo* layer_info = new LLTexLayerSetInfo(); - if( layer_info->parseXml( layer_node ) ) - { - mLayerInfoList.push_back(layer_info); - } - else - { - delete layer_info; - llwarns << "avatar file: layer_set->parseXml() failed" << llendl; - return FALSE; - } - } - return TRUE; -} - -//----------------------------------------------------------------------------- -// parseXmlDriverNodes(): parses nodes from XML tree -//----------------------------------------------------------------------------- -BOOL LLVOAvatar::LLVOAvatarXmlInfo::parseXmlDriverNodes(LLXmlTreeNode* root) -{ - LLXmlTreeNode* driver = root->getChildByName( "driver_parameters" ); - if( driver ) - { - for (LLXmlTreeNode* grand_child = driver->getChildByName( "param" ); - grand_child; - grand_child = driver->getNextNamedChild()) +void LLVOAvatar::bodySizeChanged() { - if( grand_child->getChildByName( "param_driver" ) ) - { - LLDriverParamInfo* driver_info = new LLDriverParamInfo(); - if( driver_info->parseXml( grand_child ) ) - { - mDriverInfoList.push_back(driver_info); - } - else - { - delete driver_info; - llwarns << "avatar file: driver_param->parseXml() failed" << llendl; - return FALSE; - } - } - } + if (isSelf() && !LLAppearanceMgr::instance().isInUpdateAppearanceFromCOF()) + { // notify simulator of change in size + // but not if we are in the middle of updating appearance + gAgent.sendAgentSetAppearance(); } - return TRUE; } -//----------------------------------------------------------------------------- -// parseXmlDriverNodes(): parses nodes from XML tree -//----------------------------------------------------------------------------- -BOOL LLVOAvatar::LLVOAvatarXmlInfo::parseXmlMorphNodes(LLXmlTreeNode* root) +BOOL LLVOAvatar::isUsingServerBakes() const { - LLXmlTreeNode* masks = root->getChildByName( "morph_masks" ); - if( !masks ) +#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)) { - return FALSE; + llwarns << "wt " << wt << " differs from expected " << expect_wt << llendl; } +#endif - for (LLXmlTreeNode* grand_child = masks->getChildByName( "mask" ); - grand_child; - grand_child = masks->getNextNamedChild()) - { - LLVOAvatarMorphInfo* info = new LLVOAvatarMorphInfo(); - - static LLStdStringHandle name_string = LLXmlTree::addAttributeString("morph_name"); - if (!grand_child->getFastAttributeString(name_string, info->mName)) - { - llwarns << "No name supplied for morph mask." << llendl; - delete info; - continue; + return mUseServerBakes; } - static LLStdStringHandle region_string = LLXmlTree::addAttributeString("body_region"); - if (!grand_child->getFastAttributeString(region_string, info->mRegion)) +void LLVOAvatar::setIsUsingServerBakes(BOOL newval) { - llwarns << "No region supplied for morph mask." << llendl; - delete info; - continue; + mUseServerBakes = newval; + LLVisualParam* appearance_version_param = getVisualParam(11000); + llassert(appearance_version_param); + appearance_version_param->setWeight(newval ? 1.0 : 0.0, false); } - static LLStdStringHandle layer_string = LLXmlTree::addAttributeString("layer"); - if (!grand_child->getFastAttributeString(layer_string, info->mLayer)) +// virtual +void LLVOAvatar::removeMissingBakedTextures() { - llwarns << "No layer supplied for morph mask." << llendl; - delete info; - continue; - } - - // optional parameter. don't throw a warning if not present. - static LLStdStringHandle invert_string = LLXmlTree::addAttributeString("invert"); - grand_child->getFastAttributeBOOL(invert_string, info->mInvert); - - mMorphMaskInfoList.push_back(info); - } - - return TRUE; } //virtual @@ -8454,7 +7805,7 @@ void LLVOAvatar::idleUpdateRenderCost() for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++) { - const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index); + const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index); ETextureIndex tex_index = baked_dict->mTextureIndex; if ((tex_index != TEX_SKIRT_BAKED) || (isWearingWearableType(LLWearableType::WT_SKIRT))) { @@ -8534,11 +7885,11 @@ void LLVOAvatar::idleUpdateRenderCost() } // print any avatar textures we didn't already know about - for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); - iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); + for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin(); + iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end(); ++iter) { - const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second; + const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second; // TODO: MULTI-WEARABLE: handle multiple textures for self const LLViewerTexture* te_image = getImage(iter->first,0); if (!te_image) @@ -8567,26 +7918,26 @@ void LLVOAvatar::idleUpdateRenderCost() BOOL LLVOAvatar::isIndexLocalTexture(ETextureIndex index) { if (index < 0 || index >= TEX_NUM_INDICES) return false; - return LLVOAvatarDictionary::getInstance()->getTexture(index)->mIsLocalTexture; + return LLAvatarAppearanceDictionary::getInstance()->getTexture(index)->mIsLocalTexture; } // static BOOL LLVOAvatar::isIndexBakedTexture(ETextureIndex index) { if (index < 0 || index >= TEX_NUM_INDICES) return false; - return LLVOAvatarDictionary::getInstance()->getTexture(index)->mIsBakedTexture; + return LLAvatarAppearanceDictionary::getInstance()->getTexture(index)->mIsBakedTexture; } const std::string LLVOAvatar::getBakedStatusForPrintout() const { std::string line; - for (LLVOAvatarDictionary::Textures::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); - iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); + for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin(); + iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end(); ++iter) { const ETextureIndex index = iter->first; - const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second; + const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second; if (texture_dict->mIsBakedTexture) { line += texture_dict->mName; @@ -8618,7 +7969,7 @@ F32 calc_bouncy_animation(F32 x) } //virtual -BOOL LLVOAvatar::isTextureDefined(LLVOAvatarDefines::ETextureIndex te, U32 index ) const +BOOL LLVOAvatar::isTextureDefined(LLAvatarAppearanceDefines::ETextureIndex te, U32 index ) const { if (isIndexLocalTexture(te)) { @@ -8636,7 +7987,7 @@ BOOL LLVOAvatar::isTextureDefined(LLVOAvatarDefines::ETextureIndex te, U32 index } //virtual -BOOL LLVOAvatar::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, U32 index) const +BOOL LLVOAvatar::isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, U32 index) const { if (isIndexLocalTexture(type)) { @@ -8652,9 +8003,11 @@ BOOL LLVOAvatar::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, U32 ind } //virtual -BOOL LLVOAvatar::isTextureVisible(LLVOAvatarDefines::ETextureIndex type, LLWearable *wearable) const +BOOL LLVOAvatar::isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, LLViewerWearable *wearable) const { // non-self avatars don't have wearables return FALSE; } + + -- cgit v1.2.3 From 42b42826970bcb03486ce2ad10816a67eed4e373 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Wed, 1 May 2013 08:42:35 -0700 Subject: Restore mismerged sunshine change --- indra/newview/llvoavatar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index f190672847..7f7493626c 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -7937,7 +7937,7 @@ const std::string LLVOAvatar::getBakedStatusForPrintout() const ++iter) { const ETextureIndex index = iter->first; - const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second; + const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second; if (texture_dict->mIsBakedTexture) { line += texture_dict->mName; -- cgit v1.2.3 From e413f4b335a2f4f5a1ca151c8ab67324a72ebaee Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Fri, 10 May 2013 15:13:07 -0700 Subject: Fixup merge diffs --- indra/newview/llvoavatar.cpp | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 7f7493626c..373a59ad6b 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -24,12 +24,6 @@ * $/LicenseInfo$ */ -#if LL_MSVC -// disable warning about boost::lexical_cast returning uninitialized data -// when it fails to parse the string -#pragma warning (disable:4701) -#endif - #include "llviewerprecompiledheaders.h" #include "llvoavatar.h" @@ -113,12 +107,6 @@ extern F32 SPEED_ADJUST_MAX_SEC; extern F32 ANIM_SPEED_MAX; extern F32 ANIM_SPEED_MIN; -#if LL_MSVC -// disable boost::lexical_cast warning -#pragma warning (disable:4702) -#endif - -#include // #define OUTPUT_BREAST_DATA @@ -199,8 +187,6 @@ const F32 NAMETAG_UPDATE_THRESHOLD = 0.3f; const F32 NAMETAG_VERTICAL_SCREEN_OFFSET = 25.f; const F32 NAMETAG_VERT_OFFSET_WEIGHT = 0.17f; -const LLColor4 DUMMY_COLOR = LLColor4(0.5,0.5,0.5,1.0); - enum ERenderName { RENDER_NAME_NEVER, @@ -276,6 +262,8 @@ struct LLVOAvatarChildJoint : public LLInitParam::ChoiceBlock { LLVOAvatarBoneInfo() @@ -305,6 +293,8 @@ struct LLVOAvatarSkeletonInfo : public LLInitParam::Block skeleton_root; }; + + //----------------------------------------------------------------------------- // class LLBodyNoiseMotion //----------------------------------------------------------------------------- @@ -5853,6 +5843,8 @@ BOOL LLVOAvatar::isWearingWearableType(LLWearableType::EType type) const + + // virtual void LLVOAvatar::invalidateComposite( LLTexLayerSet* layerset, BOOL upload_result ) { @@ -6486,6 +6478,7 @@ void LLVOAvatar::applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_com } + // returns TRUE if morph masks are present and not valid for a given baked texture, FALSE otherwise BOOL LLVOAvatar::morphMaskNeedsUpdate(LLAvatarAppearanceDefines::EBakedTextureIndex index) { @@ -7393,6 +7386,10 @@ void LLVOAvatar::dumpArchetypeXML(const std::string& prefix, bool group_by_weara } if (outprefix.empty()) { + outprefix = getFullname() + (isSelf()?"_s":"_o"); + } + if (outprefix.empty()) + { outprefix = std::string("new_archetype"); } std::string outfilename = get_sequential_numbered_file_name(outprefix,".xml"); @@ -7458,7 +7455,6 @@ void LLVOAvatar::dumpArchetypeXML(const std::string& prefix, bool group_by_weara for (U8 te = 0; te < TEX_NUM_INDICES; te++) { - { // MULTIPLE_WEARABLES: extend to multiple wearables? LLViewerTexture* te_image = getImage((ETextureIndex)te, 0); if( te_image ) @@ -7470,7 +7466,6 @@ void LLVOAvatar::dumpArchetypeXML(const std::string& prefix, bool group_by_weara } } - } apr_file_printf( file, "\t\n" ); apr_file_printf( file, "\n\n" ); -- cgit v1.2.3 From c3f14b915c38a4978745f12f1f816572cce4b5a0 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 3 Jun 2013 12:50:48 -0500 Subject: NORSPEC-229 Fix for bad binormals on mirrored surfaces (use tangent calculator instead of binormal calculator, convert binormal centric code to tangent centric) --- indra/newview/llvoavatar.cpp | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 373a59ad6b..1a050800b4 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1388,19 +1388,20 @@ void LLVOAvatar::renderCollisionVolumes() if (mNameText.notNull()) { - LLVector3 unused; - mNameText->lineSegmentIntersect(LLVector3(0,0,0), LLVector3(0,0,1), unused, TRUE); + LLVector4a unused; + + mNameText->lineSegmentIntersect(unused, unused, unused, TRUE); } } -BOOL LLVOAvatar::lineSegmentIntersect(const LLVector3& start, const LLVector3& end, +BOOL LLVOAvatar::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, S32 face, BOOL pick_transparent, S32* face_hit, - LLVector3* intersection, + LLVector4a* intersection, LLVector2* tex_coord, - LLVector3* normal, - LLVector3* bi_normal) + LLVector4a* normal, + LLVector4a* tangent) { if ((isSelf() && !gAgent.needsRenderAvatar()) || !LLPipeline::sPickAvatar) { @@ -1417,8 +1418,8 @@ BOOL LLVOAvatar::lineSegmentIntersect(const LLVector3& start, const LLVector3& e glh::matrix4f inverse = mat.inverse(); glh::matrix4f norm_mat = inverse.transpose(); - glh::vec3f p1(start.mV); - glh::vec3f p2(end.mV); + glh::vec3f p1(start.getF32ptr()); + glh::vec3f p2(end.getF32ptr()); inverse.mult_matrix_vec(p1); inverse.mult_matrix_vec(p2); @@ -1437,12 +1438,12 @@ BOOL LLVOAvatar::lineSegmentIntersect(const LLVector3& start, const LLVector3& e if (intersection) { - *intersection = LLVector3(res_pos.v); + intersection->load3(res_pos.v); } if (normal) { - *normal = LLVector3(res_norm.v); + normal->load3(res_norm.v); } return TRUE; @@ -1478,7 +1479,7 @@ BOOL LLVOAvatar::lineSegmentIntersect(const LLVector3& start, const LLVector3& e - LLVector3 position; + LLVector4a position; if (mNameText.notNull() && mNameText->lineSegmentIntersect(start, end, position)) { if (intersection) @@ -1492,14 +1493,14 @@ BOOL LLVOAvatar::lineSegmentIntersect(const LLVector3& start, const LLVector3& e return FALSE; } -LLViewerObject* LLVOAvatar::lineSegmentIntersectRiggedAttachments(const LLVector3& start, const LLVector3& end, +LLViewerObject* LLVOAvatar::lineSegmentIntersectRiggedAttachments(const LLVector4a& start, const LLVector4a& end, S32 face, BOOL pick_transparent, S32* face_hit, - LLVector3* intersection, + LLVector4a* intersection, LLVector2* tex_coord, - LLVector3* normal, - LLVector3* bi_normal) + LLVector4a* normal, + LLVector4a* tangent) { if (isSelf() && !gAgent.needsRenderAvatar()) { @@ -1510,8 +1511,8 @@ LLViewerObject* LLVOAvatar::lineSegmentIntersectRiggedAttachments(const LLVector if (lineSegmentBoundingBox(start, end)) { - LLVector3 local_end = end; - LLVector3 local_intersection; + LLVector4a local_end = end; + LLVector4a local_intersection; for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); iter != mAttachmentPoints.end(); @@ -1525,7 +1526,7 @@ LLViewerObject* LLVOAvatar::lineSegmentIntersectRiggedAttachments(const LLVector { LLViewerObject* attached_object = (*attachment_iter); - if (attached_object->lineSegmentIntersect(start, local_end, face, pick_transparent, face_hit, &local_intersection, tex_coord, normal, bi_normal)) + if (attached_object->lineSegmentIntersect(start, local_end, face, pick_transparent, face_hit, &local_intersection, tex_coord, normal, tangent)) { local_end = local_intersection; if (intersection) -- cgit v1.2.3