From 666129f45ce49703153c20f551b3b05b98791abb Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Mon, 30 Sep 2019 15:18:13 +0300 Subject: SL-4354 Hide partially loaded avatar with cloud more reliably --- indra/newview/llvoavatar.cpp | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index f861c0cecf..1e4b5cc599 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -883,8 +883,9 @@ BOOL LLVOAvatar::hasGray() const S32 LLVOAvatar::getRezzedStatus() const { if (getIsCloud()) return 0; - if (isFullyTextured() && allBakedTexturesCompletelyDownloaded()) return 3; - if (isFullyTextured()) return 2; + bool textured = isFullyTextured(); + if (textured && allBakedTexturesCompletelyDownloaded()) return 3; + if (textured) return 2; llassert(hasGray()); return 1; // gray } @@ -7621,14 +7622,13 @@ bool LLVOAvatar::getIsCloud() const ); } -void LLVOAvatar::updateRezzedStatusTimers() +void LLVOAvatar::updateRezzedStatusTimers(S32 rez_status) { // State machine for rezzed status. Statuses are -1 on startup, 0 // = cloud, 1 = gray, 2 = downloading, 3 = full. // 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; @@ -7798,8 +7798,13 @@ void LLVOAvatar::logMetricsTimerRecord(const std::string& phase_name, F32 elapse // returns true if the value has changed. BOOL LLVOAvatar::updateIsFullyLoaded() { - const bool loading = getIsCloud(); - updateRezzedStatusTimers(); + S32 rez_status = getRezzedStatus(); + bool loading = getIsCloud(); + if (mFirstFullyVisible && !mIsControlAvatar && rez_status < 3) + { + loading = ((rez_status < 2) || !isFullyBaked()); + } + updateRezzedStatusTimers(rez_status); updateRuthTimer(loading); return processFullyLoadedChange(loading); } @@ -7835,13 +7840,22 @@ void LLVOAvatar::updateRuthTimer(bool loading) BOOL LLVOAvatar::processFullyLoadedChange(bool loading) { - // we wait a little bit before giving the all clear, - // to let textures settle down - const F32 PAUSE = 1.f; + // We wait a little bit before giving the 'all clear', to let things to + // settle down (models to snap into place, textures to get first packets) + const F32 LOADED_DELAY = 1.f; + const F32 FIRST_USE_DELAY = 3.f; + if (loading) mFullyLoadedTimer.reset(); - - mFullyLoaded = (mFullyLoadedTimer.getElapsedTimeF32() > PAUSE); + + if (mFirstFullyVisible) + { + mFullyLoaded = (mFullyLoadedTimer.getElapsedTimeF32() > FIRST_USE_DELAY); + } + else + { + mFullyLoaded = (mFullyLoadedTimer.getElapsedTimeF32() > LOADED_DELAY); + } if (!mPreviousFullyLoaded && !loading && mFullyLoaded) { -- cgit v1.2.3 From 06e316b0ad0b79f048852da14ff64e9213a7db31 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Mon, 7 Oct 2019 14:56:23 +0300 Subject: SL-11838 Resetting attach points was not resetting HUD --- 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 1e4b5cc599..37ad7a53a8 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2046,8 +2046,10 @@ void LLVOAvatar::resetSkeleton(bool reset_animations) LL_ERRS() << "Error resetting skeleton" << LL_ENDL; } - // Reset attachment points (buildSkeleton only does bones and CVs) - bool ignore_hud_joints = true; + // Reset attachment points + // BuildSkeleton only does bones and CVs but we still need to reinit huds + // since huds can be animated. + bool ignore_hud_joints = !isSelf(); initAttachmentPoints(ignore_hud_joints); // Fix up collision volumes @@ -6577,7 +6579,7 @@ void LLVOAvatar::initAttachmentPoints(bool ignore_hud_joints) LLAvatarXmlInfo::LLAvatarAttachmentInfo *info = *iter; if (info->mIsHUDAttachment && (!isSelf() || ignore_hud_joints)) { - //don't process hud joint for other avatars, or when doing a skeleton reset. + //don't process hud joint for other avatars. continue; } -- cgit v1.2.3 From 66a831dcf94edb7e391c270ccb79a8f023219e09 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Wed, 29 Jan 2020 18:09:19 +0200 Subject: SL-4354 Mesh avatars look broken while loading. --- indra/newview/llvoavatar.cpp | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 887456dcfb..f4f91a4009 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -197,6 +197,8 @@ const F32 NAMETAG_VERT_OFFSET_WEIGHT = 0.17f; const U32 LLVOAvatar::VISUAL_COMPLEXITY_UNKNOWN = 0; const F64 HUD_OVERSIZED_TEXTURE_DATA_SIZE = 1024 * 1024; +const F32 MAX_TEXTURE_WAIT_TIME_SEC = 60; + enum ERenderName { RENDER_NAME_NEVER, @@ -663,6 +665,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mFullyLoadedInitialized(FALSE), mVisualComplexity(VISUAL_COMPLEXITY_UNKNOWN), mLoadedCallbacksPaused(FALSE), + mLoadedCallbackTextures(0), mRenderUnloadedAvatar(LLCachedControl(gSavedSettings, "RenderUnloadedAvatar", false)), mLastRezzedStatus(-1), mIsEditingAppearance(FALSE), @@ -5327,6 +5330,7 @@ void LLVOAvatar::checkTextureLoading() if(mCallbackTextureList.empty()) //when is self or no callbacks. Note: this list for self is always empty. { mLoadedCallbacksPaused = pause ; + mLoadedCallbackTextures = 0; return ; //nothing to check. } @@ -5334,7 +5338,9 @@ void LLVOAvatar::checkTextureLoading() { return ; //have not been invisible for enough time. } - + + mLoadedCallbackTextures = 0; + for(LLLoadedCallbackEntry::source_callback_list_t::iterator iter = mCallbackTextureList.begin(); iter != mCallbackTextureList.end(); ++iter) { @@ -5356,8 +5362,12 @@ void LLVOAvatar::checkTextureLoading() tex->unpauseLoadedCallbacks(&mCallbackTextureList) ; tex->addTextureStats(START_AREA); //jump start the fetching again } - } - } + } + if (tex->isFullyLoaded()) + { + mLoadedCallbackTextures++; + } + } if(!pause) { @@ -7799,9 +7809,19 @@ BOOL LLVOAvatar::updateIsFullyLoaded() { S32 rez_status = getRezzedStatus(); bool loading = getIsCloud(); - if (mFirstFullyVisible && !mIsControlAvatar && rez_status < 3) - { - loading = ((rez_status < 2) || !isFullyBaked()); + if (mFirstFullyVisible && !mIsControlAvatar) + { + loading = ((rez_status < 2) + || mMeshTexturesDirty + || mVisualComplexityStale //complexity just updated + // Wait at least 60s for unfinished textures to finish on first load, + // don't wait forever, it might fail. Even if it will eventually load by + // itself and update mLoadedCallbackTextures (or fail and clean the list), + // avatars are more time-sensitive than textures and can't wait that long. + || (mLoadedCallbackTextures != mCallbackTextureList.size() && mLastTexCallbackAddedTime.getElapsedTimeF32() <= MAX_TEXTURE_WAIT_TIME_SEC) + || !mPendingAttachment.empty() + || (rez_status < 3 && !isFullyBaked()) + ); } updateRezzedStatusTimers(rez_status); updateRuthTimer(loading); @@ -8185,6 +8205,7 @@ void LLVOAvatar::updateMeshTextures() } baked_img->setLoadedCallback(onBakedTextureLoaded, SWITCH_TO_BAKED_DISCARD, FALSE, FALSE, new LLUUID( mID ), src_callback_list, paused ); + mLastTexCallbackAddedTime.reset(); // this could add paused texture callbacks mLoadedCallbacksPaused |= paused; @@ -8578,7 +8599,7 @@ void LLVOAvatar::onFirstTEMessageReceived() LL_DEBUGS("Avatar") << avString() << "layer_baked, setting onInitialBakedTextureLoaded as callback" << LL_ENDL; image->setLoadedCallback( onInitialBakedTextureLoaded, MAX_DISCARD_LEVEL, FALSE, FALSE, new LLUUID( mID ), src_callback_list, paused ); - + mLastTexCallbackAddedTime.reset(); // this could add paused texture callbacks mLoadedCallbacksPaused |= paused; } @@ -10351,7 +10372,7 @@ void LLVOAvatar::calculateUpdateRenderComplexity() // Diagnostic list of all textures on our avatar static std::set all_textures; - if (mVisualComplexityStale) + if (mVisualComplexityStale) { U32 cost = VISUAL_COMPLEXITY_UNKNOWN; LLVOVolume::texture_cost_t textures; -- cgit v1.2.3 From 712164210cf57cfde3b17c3162dc4129d52e2780 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Thu, 30 Jan 2020 15:20:00 +0200 Subject: SL-4354 Mesh avatars look broken while loading. --- indra/newview/llvoavatar.cpp | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index f4f91a4009..780b6f81f1 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5339,7 +5339,7 @@ void LLVOAvatar::checkTextureLoading() return ; //have not been invisible for enough time. } - mLoadedCallbackTextures = 0; + mLoadedCallbackTextures = pause ? mCallbackTextureList.size() : 0; for(LLLoadedCallbackEntry::source_callback_list_t::iterator iter = mCallbackTextureList.begin(); iter != mCallbackTextureList.end(); ++iter) @@ -5361,12 +5361,13 @@ void LLVOAvatar::checkTextureLoading() tex->unpauseLoadedCallbacks(&mCallbackTextureList) ; tex->addTextureStats(START_AREA); //jump start the fetching again + + if (tex->isFullyLoaded()) + { + mLoadedCallbackTextures++; // consider it loaded + } } } - if (tex->isFullyLoaded()) - { - mLoadedCallbackTextures++; - } } if(!pause) @@ -7812,13 +7813,11 @@ BOOL LLVOAvatar::updateIsFullyLoaded() if (mFirstFullyVisible && !mIsControlAvatar) { loading = ((rez_status < 2) - || mMeshTexturesDirty - || mVisualComplexityStale //complexity just updated // Wait at least 60s for unfinished textures to finish on first load, // don't wait forever, it might fail. Even if it will eventually load by // itself and update mLoadedCallbackTextures (or fail and clean the list), // avatars are more time-sensitive than textures and can't wait that long. - || (mLoadedCallbackTextures != mCallbackTextureList.size() && mLastTexCallbackAddedTime.getElapsedTimeF32() <= MAX_TEXTURE_WAIT_TIME_SEC) + || (mLoadedCallbackTextures < mCallbackTextureList.size() && mLastTexCallbackAddedTime.getElapsedTimeF32() < MAX_TEXTURE_WAIT_TIME_SEC) || !mPendingAttachment.empty() || (rez_status < 3 && !isFullyBaked()) ); @@ -8205,7 +8204,14 @@ void LLVOAvatar::updateMeshTextures() } baked_img->setLoadedCallback(onBakedTextureLoaded, SWITCH_TO_BAKED_DISCARD, FALSE, FALSE, new LLUUID( mID ), src_callback_list, paused ); - mLastTexCallbackAddedTime.reset(); + if (!baked_img->isFullyLoaded() && !paused) + { + mLastTexCallbackAddedTime.reset(); + } + else + { + mLoadedCallbackTextures++; // consider it loaded + } // this could add paused texture callbacks mLoadedCallbacksPaused |= paused; @@ -8599,7 +8605,14 @@ void LLVOAvatar::onFirstTEMessageReceived() LL_DEBUGS("Avatar") << avString() << "layer_baked, setting onInitialBakedTextureLoaded as callback" << LL_ENDL; image->setLoadedCallback( onInitialBakedTextureLoaded, MAX_DISCARD_LEVEL, FALSE, FALSE, new LLUUID( mID ), src_callback_list, paused ); - mLastTexCallbackAddedTime.reset(); + if (!image->isFullyLoaded() && !paused) + { + mLastTexCallbackAddedTime.reset(); + } + else + { + mLoadedCallbackTextures++; // consider it loaded + } // this could add paused texture callbacks mLoadedCallbacksPaused |= paused; } -- cgit v1.2.3 From a43b997c0768b32f0dd3bd80b9a44b3b37084cfe Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 4 Feb 2020 22:41:55 +0200 Subject: SL-4354 Used wrong condition --- indra/newview/llvoavatar.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 780b6f81f1..090766e71c 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5362,9 +5362,10 @@ void LLVOAvatar::checkTextureLoading() tex->unpauseLoadedCallbacks(&mCallbackTextureList) ; tex->addTextureStats(START_AREA); //jump start the fetching again - if (tex->isFullyLoaded()) + // technically shouldn't need to account for missing, but callback might not have happened yet + if (tex->getDiscardLevel() >= 0 || tex->isMissingAsset()) { - mLoadedCallbackTextures++; // consider it loaded + mLoadedCallbackTextures++; // consider it loaded (we have at least some data) } } } @@ -8204,7 +8205,7 @@ void LLVOAvatar::updateMeshTextures() } baked_img->setLoadedCallback(onBakedTextureLoaded, SWITCH_TO_BAKED_DISCARD, FALSE, FALSE, new LLUUID( mID ), src_callback_list, paused ); - if (!baked_img->isFullyLoaded() && !paused) + if (baked_img->getDiscardLevel() < 0 && !paused) { mLastTexCallbackAddedTime.reset(); } @@ -8605,7 +8606,7 @@ void LLVOAvatar::onFirstTEMessageReceived() LL_DEBUGS("Avatar") << avString() << "layer_baked, setting onInitialBakedTextureLoaded as callback" << LL_ENDL; image->setLoadedCallback( onInitialBakedTextureLoaded, MAX_DISCARD_LEVEL, FALSE, FALSE, new LLUUID( mID ), src_callback_list, paused ); - if (!image->isFullyLoaded() && !paused) + if (image->getDiscardLevel() < 0 && !paused) { mLastTexCallbackAddedTime.reset(); } -- cgit v1.2.3 From 47622f0af60b7577b803fa98549aaeb8d709b960 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 5 Feb 2020 03:52:49 +0200 Subject: Revert SL-4354 --- indra/newview/llvoavatar.cpp | 79 +++++++++----------------------------------- 1 file changed, 15 insertions(+), 64 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 090766e71c..71ff441600 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -197,8 +197,6 @@ const F32 NAMETAG_VERT_OFFSET_WEIGHT = 0.17f; const U32 LLVOAvatar::VISUAL_COMPLEXITY_UNKNOWN = 0; const F64 HUD_OVERSIZED_TEXTURE_DATA_SIZE = 1024 * 1024; -const F32 MAX_TEXTURE_WAIT_TIME_SEC = 60; - enum ERenderName { RENDER_NAME_NEVER, @@ -665,7 +663,6 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mFullyLoadedInitialized(FALSE), mVisualComplexity(VISUAL_COMPLEXITY_UNKNOWN), mLoadedCallbacksPaused(FALSE), - mLoadedCallbackTextures(0), mRenderUnloadedAvatar(LLCachedControl(gSavedSettings, "RenderUnloadedAvatar", false)), mLastRezzedStatus(-1), mIsEditingAppearance(FALSE), @@ -886,9 +883,8 @@ BOOL LLVOAvatar::hasGray() const S32 LLVOAvatar::getRezzedStatus() const { if (getIsCloud()) return 0; - bool textured = isFullyTextured(); - if (textured && allBakedTexturesCompletelyDownloaded()) return 3; - if (textured) return 2; + if (isFullyTextured() && allBakedTexturesCompletelyDownloaded()) return 3; + if (isFullyTextured()) return 2; llassert(hasGray()); return 1; // gray } @@ -5330,7 +5326,6 @@ void LLVOAvatar::checkTextureLoading() if(mCallbackTextureList.empty()) //when is self or no callbacks. Note: this list for self is always empty. { mLoadedCallbacksPaused = pause ; - mLoadedCallbackTextures = 0; return ; //nothing to check. } @@ -5338,9 +5333,7 @@ void LLVOAvatar::checkTextureLoading() { return ; //have not been invisible for enough time. } - - mLoadedCallbackTextures = pause ? mCallbackTextureList.size() : 0; - + for(LLLoadedCallbackEntry::source_callback_list_t::iterator iter = mCallbackTextureList.begin(); iter != mCallbackTextureList.end(); ++iter) { @@ -5361,15 +5354,9 @@ void LLVOAvatar::checkTextureLoading() tex->unpauseLoadedCallbacks(&mCallbackTextureList) ; tex->addTextureStats(START_AREA); //jump start the fetching again - - // technically shouldn't need to account for missing, but callback might not have happened yet - if (tex->getDiscardLevel() >= 0 || tex->isMissingAsset()) - { - mLoadedCallbackTextures++; // consider it loaded (we have at least some data) - } } - } - } + } + } if(!pause) { @@ -7633,13 +7620,14 @@ bool LLVOAvatar::getIsCloud() const ); } -void LLVOAvatar::updateRezzedStatusTimers(S32 rez_status) +void LLVOAvatar::updateRezzedStatusTimers() { // State machine for rezzed status. Statuses are -1 on startup, 0 // = cloud, 1 = gray, 2 = downloading, 3 = full. // 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; @@ -7809,21 +7797,8 @@ void LLVOAvatar::logMetricsTimerRecord(const std::string& phase_name, F32 elapse // returns true if the value has changed. BOOL LLVOAvatar::updateIsFullyLoaded() { - S32 rez_status = getRezzedStatus(); - bool loading = getIsCloud(); - if (mFirstFullyVisible && !mIsControlAvatar) - { - loading = ((rez_status < 2) - // Wait at least 60s for unfinished textures to finish on first load, - // don't wait forever, it might fail. Even if it will eventually load by - // itself and update mLoadedCallbackTextures (or fail and clean the list), - // avatars are more time-sensitive than textures and can't wait that long. - || (mLoadedCallbackTextures < mCallbackTextureList.size() && mLastTexCallbackAddedTime.getElapsedTimeF32() < MAX_TEXTURE_WAIT_TIME_SEC) - || !mPendingAttachment.empty() - || (rez_status < 3 && !isFullyBaked()) - ); - } - updateRezzedStatusTimers(rez_status); + const bool loading = getIsCloud(); + updateRezzedStatusTimers(); updateRuthTimer(loading); return processFullyLoadedChange(loading); } @@ -7859,22 +7834,13 @@ void LLVOAvatar::updateRuthTimer(bool loading) BOOL LLVOAvatar::processFullyLoadedChange(bool loading) { - // We wait a little bit before giving the 'all clear', to let things to - // settle down (models to snap into place, textures to get first packets) - const F32 LOADED_DELAY = 1.f; - const F32 FIRST_USE_DELAY = 3.f; - + // we wait a little bit before giving the all clear, + // to let textures settle down + const F32 PAUSE = 1.f; if (loading) mFullyLoadedTimer.reset(); - - if (mFirstFullyVisible) - { - mFullyLoaded = (mFullyLoadedTimer.getElapsedTimeF32() > FIRST_USE_DELAY); - } - else - { - mFullyLoaded = (mFullyLoadedTimer.getElapsedTimeF32() > LOADED_DELAY); - } + + mFullyLoaded = (mFullyLoadedTimer.getElapsedTimeF32() > PAUSE); if (!mPreviousFullyLoaded && !loading && mFullyLoaded) { @@ -8205,14 +8171,6 @@ void LLVOAvatar::updateMeshTextures() } baked_img->setLoadedCallback(onBakedTextureLoaded, SWITCH_TO_BAKED_DISCARD, FALSE, FALSE, new LLUUID( mID ), src_callback_list, paused ); - if (baked_img->getDiscardLevel() < 0 && !paused) - { - mLastTexCallbackAddedTime.reset(); - } - else - { - mLoadedCallbackTextures++; // consider it loaded - } // this could add paused texture callbacks mLoadedCallbacksPaused |= paused; @@ -8606,14 +8564,7 @@ void LLVOAvatar::onFirstTEMessageReceived() LL_DEBUGS("Avatar") << avString() << "layer_baked, setting onInitialBakedTextureLoaded as callback" << LL_ENDL; image->setLoadedCallback( onInitialBakedTextureLoaded, MAX_DISCARD_LEVEL, FALSE, FALSE, new LLUUID( mID ), src_callback_list, paused ); - if (image->getDiscardLevel() < 0 && !paused) - { - mLastTexCallbackAddedTime.reset(); - } - else - { - mLoadedCallbackTextures++; // consider it loaded - } + // this could add paused texture callbacks mLoadedCallbacksPaused |= paused; } -- cgit v1.2.3