From a1eb7144f5e226264cb6bc9f3545456a8de3ec78 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> Date: Tue, 23 Sep 2025 21:47:11 +0300 Subject: [PATCH 1/8] SL-20598 Fix user not being able to reset display name --- indra/newview/llfloaterdisplayname.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/indra/newview/llfloaterdisplayname.cpp b/indra/newview/llfloaterdisplayname.cpp index 236aadfbc1..4843a48e66 100644 --- a/indra/newview/llfloaterdisplayname.cpp +++ b/indra/newview/llfloaterdisplayname.cpp @@ -56,6 +56,7 @@ private: void onCacheSetName(bool success, const std::string& reason, const LLSD& content); + bool mIsLockedOut = false; }; LLFloaterDisplayName::LLFloaterDisplayName(const LLSD& key) : @@ -72,8 +73,8 @@ void LLFloaterDisplayName::onOpen(const LLSD& key) LLAvatarNameCache::get(gAgent.getID(), &av_name); F64 now_secs = LLDate::now().secondsSinceEpoch(); - - if (now_secs < av_name.mNextUpdate) + mIsLockedOut = now_secs < av_name.mNextUpdate; + if (mIsLockedOut) { // ...can't update until some time in the future F64 next_update_local_secs = @@ -167,18 +168,19 @@ void LLFloaterDisplayName::onReset() } getChild("display_name_editor")->setValue(av_name.getUserName()); - if (getChild("display_name_editor")->getEnabled()) + if (mIsLockedOut) { - // UI is enabled, fill the first field - getChild("display_name_confirm")->clear(); - getChild("display_name_confirm")->setFocus(true); + // UI is disabled. + // We should allow resetting even if user already + // set a display name, enable save button + getChild("display_name_confirm")->setValue(av_name.getUserName()); + getChild("save_btn")->setEnabled(true); } else { - // UI is disabled, looks like we should allow resetting - // even if user already set a display name, enable save button - getChild("display_name_confirm")->setValue(av_name.getUserName()); - getChild("save_btn")->setEnabled(true); + // UI is enabled, focus on the confirm field + getChild("display_name_confirm")->clear(); + getChild("display_name_confirm")->setFocus(true); } } From 921856d83e3cd5580481713acda318cbe9a39ec3 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> Date: Tue, 23 Sep 2025 22:35:01 +0300 Subject: [PATCH 2/8] #4730 Extend login timeout --- indra/newview/app_settings/settings.xml | 2 +- indra/newview/lllogininstance.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index e1be629f15..43270eb3ea 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -4380,7 +4380,7 @@ Type F32 Value - 40.0 + 90.0 LogMessages diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp index 4bffe7feac..41cec4f074 100644 --- a/indra/newview/lllogininstance.cpp +++ b/indra/newview/lllogininstance.cpp @@ -62,7 +62,7 @@ const S32 LOGIN_MAX_RETRIES = 0; // Viewer should not autmatically retry login const F32 LOGIN_SRV_TIMEOUT_MIN = 10; -const F32 LOGIN_SRV_TIMEOUT_MAX = 120; +const F32 LOGIN_SRV_TIMEOUT_MAX = 180; const F32 LOGIN_DNS_TIMEOUT_FACTOR = 0.9; // make DNS wait shorter then retry time class LLLoginInstance::Disposable { From c2460e2dbd6dc3525703f5eb7312714716bb5bc8 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> Date: Tue, 23 Sep 2025 00:13:11 +0300 Subject: [PATCH 3/8] #4724 Fix performance problems with My Outfits --- indra/llui/llaccordionctrl.cpp | 8 ++- indra/llui/llaccordionctrltab.cpp | 25 ++++++-- indra/llui/lltextbase.cpp | 2 + indra/newview/llinventoryitemslist.cpp | 85 +++++++++++++++++++++++--- indra/newview/llinventoryitemslist.h | 13 +++- indra/newview/lloutfitgallery.cpp | 1 + indra/newview/lloutfitslist.cpp | 8 ++- 7 files changed, 122 insertions(+), 20 deletions(-) diff --git a/indra/llui/llaccordionctrl.cpp b/indra/llui/llaccordionctrl.cpp index 495ba2f40f..1a64c2699d 100644 --- a/indra/llui/llaccordionctrl.cpp +++ b/indra/llui/llaccordionctrl.cpp @@ -303,8 +303,11 @@ void LLAccordionCtrl::ctrlSetLeftTopAndSize(LLView* panel, S32 left, S32 top, S3 return; LLRect panel_rect = panel->getRect(); panel_rect.setLeftTopAndSize( left, top, width, height); - panel->reshape( width, height, 1); - panel->setRect(panel_rect); + if (panel->getRect() != panel_rect) + { + panel->reshape( width, height, 1); + panel->setRect(panel_rect); + } } void LLAccordionCtrl::ctrlShiftVertical(LLView* panel, S32 delta) @@ -494,6 +497,7 @@ void LLAccordionCtrl::arrangeMultiple() void LLAccordionCtrl::arrange() { + LL_PROFILE_ZONE_SCOPED; updateNoTabsHelpTextVisibility(); if (mAccordionTabs.empty()) diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp index ac66525030..bdf93348bb 100644 --- a/indra/llui/llaccordionctrltab.cpp +++ b/indra/llui/llaccordionctrltab.cpp @@ -248,10 +248,22 @@ void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::draw() void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::reshape(S32 width, S32 height, bool called_from_parent /* = true */) { S32 header_height = mHeaderTextbox->getTextPixelHeight(); + LLRect old_header_rect = mHeaderTextbox->getRect(); LLRect textboxRect(HEADER_TEXT_LEFT_OFFSET, (height + header_height) / 2, width, (height - header_height) / 2); - mHeaderTextbox->reshape(textboxRect.getWidth(), textboxRect.getHeight()); - mHeaderTextbox->setRect(textboxRect); + if (old_header_rect.getHeight() != textboxRect.getHeight() + || old_header_rect.mLeft != textboxRect.mLeft + || old_header_rect.mTop != textboxRect.mTop + || old_header_rect.getWidth() > textboxRect.getWidth() // reducing header's width + || (old_header_rect.getWidth() < textboxRect.getWidth() && old_header_rect.getWidth() < mHeaderTextbox->getTextPixelWidth())) + { + // Expensive text reflow + // Update if position or height changes + // Update if width reduces + // But do not update if text already fits and width increases (arguably LLTextBox::reshape should be smarter, not Accordion) + mHeaderTextbox->reshape(textboxRect.getWidth(), textboxRect.getHeight()); + mHeaderTextbox->setRect(textboxRect); + } if (mHeaderTextbox->getTextPixelWidth() > mHeaderTextbox->getRect().getWidth()) { @@ -416,8 +428,11 @@ void LLAccordionCtrlTab::reshape(S32 width, S32 height, bool called_from_parent LLRect headerRect; headerRect.setLeftTopAndSize(0, height, width, HEADER_HEIGHT); - mHeader->setRect(headerRect); - mHeader->reshape(headerRect.getWidth(), headerRect.getHeight()); + if (mHeader->getRect() != headerRect) + { + mHeader->setRect(headerRect); + mHeader->reshape(headerRect.getWidth(), headerRect.getHeight()); + } if (!mDisplayChildren) return; @@ -932,7 +947,7 @@ void LLAccordionCtrlTab::adjustContainerPanel(const LLRect& child_rect) show_hide_scrollbar(child_rect); updateLayout(child_rect); } - else + else if (mContainerPanel->getRect() != child_rect) { mContainerPanel->reshape(child_rect.getWidth(), child_rect.getHeight()); mContainerPanel->setRect(child_rect); diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 69729fa421..1de12896eb 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -1448,6 +1448,8 @@ void LLTextBase::reshape(S32 width, S32 height, bool called_from_parent) // up-to-date mVisibleTextRect updateRects(); + // Todo: This might be wrong. updateRects already sets needsReflow conditionaly. + // Reflow is expensive and doing it at any twith can be too much. needsReflow(); } } diff --git a/indra/newview/llinventoryitemslist.cpp b/indra/newview/llinventoryitemslist.cpp index cfa37cc3ee..73cc953692 100644 --- a/indra/newview/llinventoryitemslist.cpp +++ b/indra/newview/llinventoryitemslist.cpp @@ -40,6 +40,10 @@ #include "llinventorymodel.h" #include "llviewerinventory.h" +bool LLInventoryItemsList::sListIdleRegistered = false; +LLInventoryItemsList::all_list_t LLInventoryItemsList::sAllLists; +LLInventoryItemsList::all_list_t::iterator LLInventoryItemsList::sAllListIter; + LLInventoryItemsList::Params::Params() {} @@ -55,13 +59,39 @@ LLInventoryItemsList::LLInventoryItemsList(const LLInventoryItemsList::Params& p setNoFilteredItemsMsg(LLTrans::getString("InventoryNoMatchingItems")); - gIdleCallbacks.addFunction(idle, this); + sAllLists.push_back(this); + sAllListIter = sAllLists.begin(); + + if (!sListIdleRegistered) + { + sAllListIter = sAllLists.begin(); + gIdleCallbacks.addFunction(idle, nullptr); + + LLEventPumps::instance().obtain("LLApp").listen( + "LLInventoryItemsList", + [](const LLSD& stat) + { + std::string status(stat["status"]); + if (status != "running") + { + // viewer is starting shutdown + gIdleCallbacks.deleteFunction(idle, nullptr); + } + return false; + }); + sListIdleRegistered = true; + } } // virtual LLInventoryItemsList::~LLInventoryItemsList() { - gIdleCallbacks.deleteFunction(idle, this); + auto it = std::find(sAllLists.begin(), sAllLists.end(), this); + if (it != sAllLists.end()) + { + sAllLists.erase(it); + sAllListIter = sAllLists.begin(); + } } void LLInventoryItemsList::refreshList(const LLInventoryModel::item_array_t item_array) @@ -111,25 +141,55 @@ void LLInventoryItemsList::updateSelection() mSelectTheseIDs.clear(); } -void LLInventoryItemsList::doIdle() +bool LLInventoryItemsList::doIdle() { - if (mRefreshState == REFRESH_COMPLETE) return; + if (mRefreshState == REFRESH_COMPLETE) return true; // done if (isInVisibleChain() || mForceRefresh || !getFilterSubString().empty()) { refresh(); mRefreshCompleteSignal(this, LLSD()); + return false; // keep going } + return true; // done } //static void LLInventoryItemsList::idle(void* user_data) { - LLInventoryItemsList* self = static_cast(user_data); - if ( self ) - { // Do the real idle - self->doIdle(); + if (sAllLists.empty()) + return; + + LL_PROFILE_ZONE_SCOPED; + + using namespace std::chrono; + auto start = steady_clock::now(); + const milliseconds time_limit = milliseconds(3); + const auto end_time = start + time_limit; + S32 max_update_count = 50; + + if (sAllListIter == sAllLists.end()) + { + sAllListIter = sAllLists.begin(); + } + + S32 updated = 0; + while (steady_clock::now() < end_time + && updated < max_update_count + && sAllListIter != sAllLists.end()) + { + LLInventoryItemsList* list = *sAllListIter; + // Refresh is split into multiple separate parts, + // so keep repeating it while there is time, until done. + // Todo: refresh() split is pointless now? + // Or still useful for large folders? + if (list->doIdle()) + { + // Item is done + ++sAllListIter; + updated++; + } } } @@ -141,6 +201,7 @@ void LLInventoryItemsList::refresh() { case REFRESH_ALL: { + LL_PROFILE_ZONE_NAMED("items_refresh_all"); mAddedItems.clear(); mRemovedItems.clear(); computeDifference(getIDs(), mAddedItems, mRemovedItems); @@ -163,6 +224,7 @@ void LLInventoryItemsList::refresh() } case REFRESH_LIST_ERASE: { + LL_PROFILE_ZONE_NAMED("items_refresh_erase"); uuid_vec_t::const_iterator it = mRemovedItems.begin(); for (; mRemovedItems.end() != it; ++it) { @@ -175,6 +237,7 @@ void LLInventoryItemsList::refresh() } case REFRESH_LIST_APPEND: { + LL_PROFILE_ZONE_NAMED("items_refresh_append"); static const unsigned ADD_LIMIT = 25; // Note: affects perfomance unsigned int nadded = 0; @@ -239,6 +302,7 @@ void LLInventoryItemsList::refresh() } case REFRESH_LIST_SORT: { + LL_PROFILE_ZONE_NAMED("items_refresh_sort"); // Filter, sort, rearrange and notify parent about shape changes filterItems(true, true); @@ -255,7 +319,10 @@ void LLInventoryItemsList::refresh() break; } default: - break; + { + mRefreshState = REFRESH_COMPLETE; + break; + } } setForceRefresh(mRefreshState != REFRESH_COMPLETE); diff --git a/indra/newview/llinventoryitemslist.h b/indra/newview/llinventoryitemslist.h index 9ebeb5e52b..b20c27eec8 100644 --- a/indra/newview/llinventoryitemslist.h +++ b/indra/newview/llinventoryitemslist.h @@ -59,7 +59,10 @@ public: * Sets the flag indicating that the list needs to be refreshed even if it is * not currently visible. */ - void setForceRefresh(bool force_refresh) { mForceRefresh = force_refresh; } + void setForceRefresh(bool force_refresh) + { + mForceRefresh = force_refresh; + } /** * If refreshes when invisible. @@ -76,7 +79,7 @@ public: * This is needed for example to filter items of the list hidden by closed * accordion tab. */ - virtual void doIdle(); // Real idle routine + bool doIdle(); // Real idle routine static void idle(void* user_data); // static glue to doIdle() protected: @@ -126,6 +129,12 @@ private: bool mForceRefresh; commit_signal_t mRefreshCompleteSignal; + + // Update synchronization + typedef std::vector all_list_t; + static all_list_t sAllLists; + static all_list_t::iterator sAllListIter; + static bool sListIdleRegistered; }; #endif //LL_LLINVENTORYITEMSLIST_H diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp index 3adee9fa16..8589afae06 100644 --- a/indra/newview/lloutfitgallery.cpp +++ b/indra/newview/lloutfitgallery.cpp @@ -818,6 +818,7 @@ void LLOutfitGallery::getCurrentCategories(uuid_vec_t& vcur) void LLOutfitGallery::updateAddedCategory(LLUUID cat_id) { + LL_PROFILE_ZONE_SCOPED; LLViewerInventoryCategory *cat = gInventory.getCategory(cat_id); if (!cat) return; diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 4e594af432..58cd9fab83 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -181,6 +181,7 @@ void LLOutfitsList::onOpen(const LLSD& info) void LLOutfitsList::updateAddedCategory(LLUUID cat_id) { + LL_PROFILE_ZONE_SCOPED; LLViewerInventoryCategory *cat = gInventory.getCategory(cat_id); if (!cat) return; @@ -251,7 +252,9 @@ void LLOutfitsList::updateAddedCategory(LLUUID cat_id) if (AISAPI::isAvailable() && LLInventoryModelBackgroundFetch::instance().folderFetchActive()) { - // for reliability just fetch it whole, linked items included + // For reliability just fetch it whole, linked items included + // Todo: list is not warrantied to exist once callback arrives + // Fix it! LLInventoryModelBackgroundFetch::instance().fetchFolderAndLinks(cat_id, [cat_id, list] { if (list) @@ -1059,6 +1062,7 @@ void LLOutfitListBase::onIdle(void* userdata) void LLOutfitListBase::onIdleRefreshList() { + LL_PROFILE_ZONE_SCOPED; if (LLAppViewer::instance()->quitRequested()) { mRefreshListState.CategoryUUID.setNull(); @@ -1072,7 +1076,7 @@ void LLOutfitListBase::onIdleRefreshList() return; } - const F64 MAX_TIME = 0.05f; + const F64 MAX_TIME = 0.005f; F64 curent_time = LLTimer::getTotalSeconds(); const F64 end_time = curent_time + MAX_TIME; From 97ff76c420cfaf32e7ad4602506917666129253c Mon Sep 17 00:00:00 2001 From: Maxim Nikolenko Date: Wed, 24 Sep 2025 18:10:29 +0300 Subject: [PATCH 4/8] #4733 When moving the cache, the old cef_cache should be removed --- indra/llrender/llshadermgr.cpp | 1 + indra/newview/llappviewer.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 9cdd02f403..e9bbdeead5 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -1048,6 +1048,7 @@ void LLShaderMgr::clearShaderCache() LL_INFOS("ShaderMgr") << "Removing shader cache at " << shader_cache << LL_ENDL; const std::string mask = "*"; gDirUtilp->deleteFilesInDir(shader_cache, mask); + LLFile::rmdir(shader_cache); mShaderBinaryCache.clear(); } diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 3d2946b8aa..4a4a2bdbb3 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -4481,6 +4481,7 @@ void LLAppViewer::purgeCache() LLAppViewer::getTextureCache()->purgeCache(LL_PATH_CACHE); LLVOCache::getInstance()->removeCache(LL_PATH_CACHE); LLViewerShaderMgr::instance()->clearShaderCache(); + purgeCefStaleCaches(); gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""), "*"); } From 351b7763a8aaa7d8dcd09d21b00fa9b290bd91cf Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> Date: Wed, 24 Sep 2025 21:02:57 +0300 Subject: [PATCH 5/8] #4515 Improve ordering of sub-meshes upon upload --- indra/newview/llmeshrepository.cpp | 537 +++++++++++++---------------- indra/newview/llmeshrepository.h | 32 +- indra/newview/llmodelpreview.cpp | 10 +- indra/newview/llmodelpreview.h | 2 +- 4 files changed, 266 insertions(+), 315 deletions(-) diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 8d5f94cdbb..e0f942b083 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -2570,7 +2570,7 @@ EMeshProcessingResult LLMeshRepoThread::physicsShapeReceived(const LLUUID& mesh_ return MESH_OK; } -LLMeshUploadThread::LLMeshUploadThread(LLMeshUploadThread::instance_list& data, const LLMeshUploadThread::lod_sources_map_t& sources_list, +LLMeshUploadThread::LLMeshUploadThread(LLMeshUploadThread::instance_list_t& data, const LLMeshUploadThread::lod_sources_map_t& sources_list, LLVector3& scale, bool upload_textures, bool upload_skin, bool upload_joints, bool lock_scale_if_joint_position, const std::string & upload_url, LLUUID destination_folder_id, bool do_upload, @@ -2652,7 +2652,7 @@ void LLMeshUploadThread::DecompRequest::completed() void LLMeshUploadThread::preStart() { //build map of LLModel refs to instances for callbacks - for (instance_list::iterator iter = mInstanceList.begin(); iter != mInstanceList.end(); ++iter) + for (instance_list_t::iterator iter = mInstanceList.begin(); iter != mInstanceList.end(); ++iter) { mInstance[iter->mModel].push_back(*iter); } @@ -2701,6 +2701,179 @@ LLSD llsd_from_file(std::string filename) return result; } +void LLMeshUploadThread::packModelIntance( + LLModel* model, + LLMeshUploadThread::instance_list_t& instance_list, + std::string& model_name, + LLSD& res, + S32& mesh_num, + S32& texture_num, + S32& instance_num, + std::unordered_set& textures, + std::unordered_map texture_index, + std::unordered_map& mesh_index, + std::vector& texture_list_dest, + bool include_textures + ) +{ + LLMeshUploadData data; + data.mBaseModel = model; + + LLModelInstance& first_instance = *(instance_list.begin()); + for (S32 i = 0; i < 5; i++) + { + data.mModel[i] = first_instance.mLOD[i]; + } + + if (mesh_index.find(data.mBaseModel) == mesh_index.end()) + { + // Have not seen this model before - create a new mesh_list entry for it. + if (model_name.empty()) + { + model_name = data.mBaseModel->getName(); + } + + std::stringstream ostr; + + LLModel::Decomposition& decomp = + data.mModel[LLModel::LOD_PHYSICS].notNull() ? + data.mModel[LLModel::LOD_PHYSICS]->mPhysics : + data.mBaseModel->mPhysics; + + decomp.mBaseHull = mHullMap[data.mBaseModel]; + + LLSD mesh_header = LLModel::writeModel( + ostr, + data.mModel[LLModel::LOD_PHYSICS], + data.mModel[LLModel::LOD_HIGH], + data.mModel[LLModel::LOD_MEDIUM], + data.mModel[LLModel::LOD_LOW], + data.mModel[LLModel::LOD_IMPOSTOR], + decomp, + mUploadSkin, + mUploadJoints, + mLockScaleIfJointPosition, + LLModel::WRITE_BINARY, + false, + data.mBaseModel->mSubmodelID); + + data.mAssetData = ostr.str(); + std::string str = ostr.str(); + + res["mesh_list"][mesh_num] = LLSD::Binary(str.begin(), str.end()); + mesh_index[data.mBaseModel] = mesh_num; + mesh_num++; + } + + // For all instances that use this model + for (instance_list_t::iterator instance_iter = instance_list.begin(); + instance_iter != instance_list.end(); + ++instance_iter) + { + LLModelInstance& instance = *instance_iter; + + LLSD instance_entry; + + for (S32 i = 0; i < 5; i++) + { + data.mModel[i] = instance.mLOD[i]; + } + + LLVector3 pos, scale; + LLQuaternion rot; + LLMatrix4 transformation = instance.mTransform; + decomposeMeshMatrix(transformation, pos, rot, scale); + instance_entry["position"] = ll_sd_from_vector3(pos); + instance_entry["rotation"] = ll_sd_from_quaternion(rot); + instance_entry["scale"] = ll_sd_from_vector3(scale); + + instance_entry["material"] = LL_MCODE_WOOD; + if (model->mSubmodelID) + { + // Should it really be different? + instance_entry["physics_shape_type"] = (U8)(LLViewerObject::PHYSICS_SHAPE_NONE); + } + else + { + instance_entry["physics_shape_type"] = data.mModel[LLModel::LOD_PHYSICS].notNull() ? (U8)(LLViewerObject::PHYSICS_SHAPE_PRIM) : (U8)(LLViewerObject::PHYSICS_SHAPE_CONVEX_HULL); + } + instance_entry["mesh"] = mesh_index[data.mBaseModel]; + instance_entry["mesh_name"] = instance.mLabel; + + instance_entry["face_list"] = LLSD::emptyArray(); + + // We want to be able to allow more than 8 materials... + // + S32 end = llmin((S32)data.mBaseModel->mMaterialList.size(), instance.mModel->getNumVolumeFaces()); + + for (S32 face_num = 0; face_num < end; face_num++) + { + // multiple faces can reuse the same material + LLImportMaterial& material = instance.mMaterial[data.mBaseModel->mMaterialList[face_num]]; + LLSD face_entry = LLSD::emptyMap(); + + LLViewerFetchedTexture* texture = NULL; + + if (material.mDiffuseMapFilename.size()) + { + texture = FindViewerTexture(material); + } + + if ((texture != NULL) && + (textures.find(texture) == textures.end())) + { + textures.insert(texture); + } + + std::stringstream texture_str; + if (texture != NULL && include_textures && mUploadTextures) + { + if (texture->hasSavedRawImage()) + { + LLImageDataLock lock(texture->getSavedRawImage()); + + LLPointer upload_file = + LLViewerTextureList::convertToUploadFile(texture->getSavedRawImage()); + + if (!upload_file.isNull() && upload_file->getDataSize() && !upload_file->isBufferInvalid()) + { + texture_str.write((const char*)upload_file->getData(), upload_file->getDataSize()); + } + } + } + + if (texture != NULL && + mUploadTextures && + texture_index.find(texture) == texture_index.end()) + { + texture_index[texture] = texture_num; + std::string str = texture_str.str(); + res["texture_list"][texture_num] = LLSD::Binary(str.begin(), str.end()); + // store indexes for error handling; + texture_list_dest.push_back(material.mDiffuseMapFilename); + texture_num++; + } + + // Subset of TextureEntry fields. + if (texture != NULL && mUploadTextures) + { + face_entry["image"] = texture_index[texture]; + face_entry["scales"] = 1.0; + face_entry["scalet"] = 1.0; + face_entry["offsets"] = 0.0; + face_entry["offsett"] = 0.0; + face_entry["imagerot"] = 0.0; + } + face_entry["diffuse_color"] = ll_sd_from_color4(material.mDiffuseColor); + face_entry["fullbright"] = material.mFullbright; + instance_entry["face_list"][face_num] = face_entry; + } + + res["instance_list"][instance_num] = instance_entry; + instance_num++; + } +} + void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, std::vector& texture_list_dest, bool include_textures) { LLSD result; @@ -2734,6 +2907,7 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, std::vector& } S32 mesh_num = 0; S32 texture_num = 0; + S32 instance_num = 0; std::unordered_set textures; std::unordered_map texture_index; @@ -2741,7 +2915,34 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, std::vector& std::unordered_map mesh_index; std::string model_name; - S32 instance_num = 0; + // If server gets a m1, m2, m3, m4 list, m1 becomes the root + // and the rest go as m4, m3, m2 + // to counter that mInstance is sorted as m4, m3, m2, m1 + // and we grab m1 from the end and send it first + LLModel* root_model = nullptr; + for (instance_map_t::reverse_iterator iter = mInstance.rbegin(); iter != mInstance.rend(); ++iter) + { + if (iter->first->mSubmodelID) + { + // Submodel can't be root + continue; + } + root_model = iter->first; + packModelIntance( + iter->first, + iter->second, + model_name, + res, + mesh_num, + texture_num, + instance_num, + textures, + texture_index, + mesh_index, + texture_list_dest, + include_textures); + break; + } // Handle models, ignore submodels for now. // Probably should pre-sort by mSubmodelID instead of running twice. @@ -2749,319 +2950,53 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, std::vector& // deterministic order. for (auto& iter : mInstance) { - LLMeshUploadData data; - data.mBaseModel = iter.first; - - if (data.mBaseModel->mSubmodelID) + if (iter.first->mSubmodelID) { // These are handled below to insure correct parenting order on creation // due to map walking being based on model address (aka random) continue; } - - LLModelInstance& first_instance = *(iter.second.begin()); - for (S32 i = 0; i < 5; i++) + if (root_model == iter.first) { - data.mModel[i] = first_instance.mLOD[i]; - } - - if (mesh_index.find(data.mBaseModel) == mesh_index.end()) - { - // Have not seen this model before - create a new mesh_list entry for it. - if (model_name.empty()) - { - model_name = data.mBaseModel->getName(); - } - - std::stringstream ostr; - - LLModel::Decomposition& decomp = - data.mModel[LLModel::LOD_PHYSICS].notNull() ? - data.mModel[LLModel::LOD_PHYSICS]->mPhysics : - data.mBaseModel->mPhysics; - - decomp.mBaseHull = mHullMap[data.mBaseModel]; - - LLSD mesh_header = LLModel::writeModel( - ostr, - data.mModel[LLModel::LOD_PHYSICS], - data.mModel[LLModel::LOD_HIGH], - data.mModel[LLModel::LOD_MEDIUM], - data.mModel[LLModel::LOD_LOW], - data.mModel[LLModel::LOD_IMPOSTOR], - decomp, - mUploadSkin, - mUploadJoints, - mLockScaleIfJointPosition, - LLModel::WRITE_BINARY, - false, - data.mBaseModel->mSubmodelID); - - data.mAssetData = ostr.str(); - std::string str = ostr.str(); - - res["mesh_list"][mesh_num] = LLSD::Binary(str.begin(),str.end()); - mesh_index[data.mBaseModel] = mesh_num; - mesh_num++; - } - - // For all instances that use this model - for (instance_list::iterator instance_iter = iter.second.begin(); - instance_iter != iter.second.end(); - ++instance_iter) - { - - LLModelInstance& instance = *instance_iter; - - LLSD instance_entry; - - for (S32 i = 0; i < 5; i++) - { - data.mModel[i] = instance.mLOD[i]; - } - - LLVector3 pos, scale; - LLQuaternion rot; - LLMatrix4 transformation = instance.mTransform; - decomposeMeshMatrix(transformation,pos,rot,scale); - instance_entry["position"] = ll_sd_from_vector3(pos); - instance_entry["rotation"] = ll_sd_from_quaternion(rot); - instance_entry["scale"] = ll_sd_from_vector3(scale); - - instance_entry["material"] = LL_MCODE_WOOD; - instance_entry["physics_shape_type"] = data.mModel[LLModel::LOD_PHYSICS].notNull() ? (U8)(LLViewerObject::PHYSICS_SHAPE_PRIM) : (U8)(LLViewerObject::PHYSICS_SHAPE_CONVEX_HULL); - instance_entry["mesh"] = mesh_index[data.mBaseModel]; - instance_entry["mesh_name"] = instance.mLabel; - - instance_entry["face_list"] = LLSD::emptyArray(); - - // We want to be able to allow more than 8 materials... - // - S32 end = llmin((S32)data.mBaseModel->mMaterialList.size(), instance.mModel->getNumVolumeFaces()) ; - - for (S32 face_num = 0; face_num < end; face_num++) - { - // multiple faces can reuse the same material - LLImportMaterial& material = instance.mMaterial[data.mBaseModel->mMaterialList[face_num]]; - LLSD face_entry = LLSD::emptyMap(); - - LLViewerFetchedTexture *texture = NULL; - - if (material.mDiffuseMapFilename.size()) - { - texture = FindViewerTexture(material); - } - - if ((texture != NULL) && - (textures.find(texture) == textures.end())) - { - textures.insert(texture); - } - - std::stringstream texture_str; - if (texture != NULL && include_textures && mUploadTextures) - { - if (texture->hasSavedRawImage()) - { - LLImageDataLock lock(texture->getSavedRawImage()); - - LLPointer upload_file = - LLViewerTextureList::convertToUploadFile(texture->getSavedRawImage()); - - if (!upload_file.isNull() && upload_file->getDataSize() && !upload_file->isBufferInvalid()) - { - texture_str.write((const char*) upload_file->getData(), upload_file->getDataSize()); - } - } - } - - if (texture != NULL && - mUploadTextures && - texture_index.find(texture) == texture_index.end()) - { - texture_index[texture] = texture_num; - std::string str = texture_str.str(); - res["texture_list"][texture_num] = LLSD::Binary(str.begin(),str.end()); - // store indexes for error handling; - texture_list_dest.push_back(material.mDiffuseMapFilename); - texture_num++; - } - - // Subset of TextureEntry fields. - if (texture != NULL && mUploadTextures) - { - face_entry["image"] = texture_index[texture]; - face_entry["scales"] = 1.0; - face_entry["scalet"] = 1.0; - face_entry["offsets"] = 0.0; - face_entry["offsett"] = 0.0; - face_entry["imagerot"] = 0.0; - } - face_entry["diffuse_color"] = ll_sd_from_color4(material.mDiffuseColor); - face_entry["fullbright"] = material.mFullbright; - instance_entry["face_list"][face_num] = face_entry; - } - - res["instance_list"][instance_num] = instance_entry; - instance_num++; + // Reached root, root was already packed and is last non-submodel + break; } + packModelIntance( + iter.first, + iter.second, + model_name, + res, + mesh_num, + texture_num, + instance_num, + textures, + texture_index, + mesh_index, + texture_list_dest, + include_textures); } // Now handle the submodels. for (auto& iter : mInstance) { - LLMeshUploadData data; - data.mBaseModel = iter.first; - - if (!data.mBaseModel->mSubmodelID) + if (!iter.first->mSubmodelID) { // These were handled above already... - // continue; } - - LLModelInstance& first_instance = *(iter.second.begin()); - for (S32 i = 0; i < 5; i++) - { - data.mModel[i] = first_instance.mLOD[i]; - } - - if (mesh_index.find(data.mBaseModel) == mesh_index.end()) - { - // Have not seen this model before - create a new mesh_list entry for it. - if (model_name.empty()) - { - model_name = data.mBaseModel->getName(); - } - - std::stringstream ostr; - - LLModel::Decomposition& decomp = - data.mModel[LLModel::LOD_PHYSICS].notNull() ? - data.mModel[LLModel::LOD_PHYSICS]->mPhysics : - data.mBaseModel->mPhysics; - - decomp.mBaseHull = mHullMap[data.mBaseModel]; - - LLSD mesh_header = LLModel::writeModel( - ostr, - data.mModel[LLModel::LOD_PHYSICS], - data.mModel[LLModel::LOD_HIGH], - data.mModel[LLModel::LOD_MEDIUM], - data.mModel[LLModel::LOD_LOW], - data.mModel[LLModel::LOD_IMPOSTOR], - decomp, - mUploadSkin, - mUploadJoints, - mLockScaleIfJointPosition, - LLModel::WRITE_BINARY, - false, - data.mBaseModel->mSubmodelID); - - data.mAssetData = ostr.str(); - std::string str = ostr.str(); - - res["mesh_list"][mesh_num] = LLSD::Binary(str.begin(),str.end()); - mesh_index[data.mBaseModel] = mesh_num; - mesh_num++; - } - - // For all instances that use this model - for (instance_list::iterator instance_iter = iter.second.begin(); - instance_iter != iter.second.end(); - ++instance_iter) - { - - LLModelInstance& instance = *instance_iter; - - LLSD instance_entry; - - for (S32 i = 0; i < 5; i++) - { - data.mModel[i] = instance.mLOD[i]; - } - - LLVector3 pos, scale; - LLQuaternion rot; - LLMatrix4 transformation = instance.mTransform; - decomposeMeshMatrix(transformation,pos,rot,scale); - instance_entry["position"] = ll_sd_from_vector3(pos); - instance_entry["rotation"] = ll_sd_from_quaternion(rot); - instance_entry["scale"] = ll_sd_from_vector3(scale); - - instance_entry["material"] = LL_MCODE_WOOD; - instance_entry["physics_shape_type"] = (U8)(LLViewerObject::PHYSICS_SHAPE_NONE); - instance_entry["mesh"] = mesh_index[data.mBaseModel]; - - instance_entry["face_list"] = LLSD::emptyArray(); - - // We want to be able to allow more than 8 materials... - // - S32 end = llmin((S32)instance.mMaterial.size(), instance.mModel->getNumVolumeFaces()) ; - - for (S32 face_num = 0; face_num < end; face_num++) - { - LLImportMaterial& material = instance.mMaterial[data.mBaseModel->mMaterialList[face_num]]; - LLSD face_entry = LLSD::emptyMap(); - - LLViewerFetchedTexture *texture = NULL; - - if (material.mDiffuseMapFilename.size()) - { - texture = FindViewerTexture(material); - } - - if ((texture != NULL) && - (textures.find(texture) == textures.end())) - { - textures.insert(texture); - } - - std::stringstream texture_str; - if (texture != NULL && include_textures && mUploadTextures) - { - if (texture->hasSavedRawImage()) - { - LLImageDataLock lock(texture->getSavedRawImage()); - - LLPointer upload_file = - LLViewerTextureList::convertToUploadFile(texture->getSavedRawImage()); - - if (!upload_file.isNull() && upload_file->getDataSize()) - { - texture_str.write((const char*) upload_file->getData(), upload_file->getDataSize()); - } - } - } - - if (texture != NULL && - mUploadTextures && - texture_index.find(texture) == texture_index.end()) - { - texture_index[texture] = texture_num; - std::string str = texture_str.str(); - res["texture_list"][texture_num] = LLSD::Binary(str.begin(),str.end()); - texture_num++; - } - - // Subset of TextureEntry fields. - if (texture != NULL && mUploadTextures) - { - face_entry["image"] = texture_index[texture]; - face_entry["scales"] = 1.0; - face_entry["scalet"] = 1.0; - face_entry["offsets"] = 0.0; - face_entry["offsett"] = 0.0; - face_entry["imagerot"] = 0.0; - } - face_entry["diffuse_color"] = ll_sd_from_color4(material.mDiffuseColor); - face_entry["fullbright"] = material.mFullbright; - instance_entry["face_list"][face_num] = face_entry; - } - - res["instance_list"][instance_num] = instance_entry; - instance_num++; - } + packModelIntance( + iter.first, + iter.second, + model_name, + res, + mesh_num, + texture_num, + instance_num, + textures, + texture_index, + mesh_index, + texture_list_dest, + include_textures); } if (model_name.empty()) model_name = "mesh model"; @@ -3077,7 +3012,7 @@ void LLMeshUploadThread::generateHulls() { bool has_valid_requests = false ; - for (instance_map::iterator iter = mInstance.begin(); iter != mInstance.end(); ++iter) + for (instance_map_t::iterator iter = mInstance.begin(); iter != mInstance.end(); ++iter) { LLMeshUploadData data; data.mBaseModel = iter->first; diff --git a/indra/newview/llmeshrepository.h b/indra/newview/llmeshrepository.h index ab17b921d6..450afd5d5a 100644 --- a/indra/newview/llmeshrepository.h +++ b/indra/newview/llmeshrepository.h @@ -668,11 +668,11 @@ public: LLPointer mFinalDecomp; volatile bool mPhysicsComplete; - typedef std::map, std::vector > hull_map; - hull_map mHullMap; + typedef std::map, std::vector > hull_map_t; + hull_map_t mHullMap; - typedef std::vector instance_list; - instance_list mInstanceList; + typedef std::vector instance_list_t; + instance_list_t mInstanceList; // Upload should happen in deterministic order, so sort instances by model name. struct LLUploadModelInstanceLess @@ -686,11 +686,11 @@ public: } // Note: probably can sort by mBaseModel->mSubmodelID here as well to avoid // running over the list twice in wholeModelToLLSD. - return a->mLabel < b->mLabel; + return a->mLabel > b->mLabel; } }; - typedef std::map, instance_list, LLUploadModelInstanceLess> instance_map; - instance_map mInstance; + typedef std::map, instance_list_t, LLUploadModelInstanceLess> instance_map_t; + instance_map_t mInstance; typedef std::map lod_sources_map_t; lod_sources_map_t mLodSources; @@ -709,7 +709,7 @@ public: std::string mWholeModelUploadURL; LLUUID mDestinationFolderId; - LLMeshUploadThread(instance_list& data, const lod_sources_map_t& sources_list, + LLMeshUploadThread(instance_list_t& data, const lod_sources_map_t& sources_list, LLVector3& scale, bool upload_textures, bool upload_skin, bool upload_joints, bool lock_scale_if_joint_position, const std::string & upload_url, @@ -745,6 +745,22 @@ public: static LLViewerFetchedTexture* FindViewerTexture(const LLImportMaterial& material); +protected: + void packModelIntance( + LLModel* model, + LLMeshUploadThread::instance_list_t& instance_list, + std::string& model_name, + LLSD& res, + S32& mesh_num, + S32& texture_num, + S32& instance_num, + std::unordered_set &textures, + std::unordered_map texture_index, + std::unordered_map& mesh_index, + std::vector& texture_list_dest, + bool include_textures + ); + private: LLHandle mFeeObserverHandle; LLHandle mUploadObserverHandle; diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index e0649e1d88..46411fc4a0 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -576,7 +576,7 @@ void LLModelPreview::rebuildUploadData() for (U32 model_ind = 0; model_ind < mModel[lod].size(); ++model_ind) { bool found_model = false; - for (LLMeshUploadThread::instance_list::iterator iter = mUploadData.begin(); iter != mUploadData.end(); ++iter) + for (LLMeshUploadThread::instance_list_t::iterator iter = mUploadData.begin(); iter != mUploadData.end(); ++iter) { LLModelInstance& instance = *iter; if (instance.mLOD[lod] == mModel[lod][model_ind]) @@ -2209,7 +2209,7 @@ void LLModelPreview::updateStatusMessages() total_submeshes[i] = 0; } - for (LLMeshUploadThread::instance_list::iterator iter = mUploadData.begin(); iter != mUploadData.end(); ++iter) + for (LLMeshUploadThread::instance_list_t::iterator iter = mUploadData.begin(); iter != mUploadData.end(); ++iter) { LLModelInstance& instance = *iter; @@ -3530,7 +3530,7 @@ bool LLModelPreview::render() if (!show_skin_weight) { - for (LLMeshUploadThread::instance_list::iterator iter = mUploadData.begin(); iter != mUploadData.end(); ++iter) + for (LLMeshUploadThread::instance_list_t::iterator iter = mUploadData.begin(); iter != mUploadData.end(); ++iter) { LLModelInstance& instance = *iter; @@ -3616,7 +3616,7 @@ bool LLModelPreview::render() gGL.blendFunc(LLRender::BF_SOURCE_ALPHA, LLRender::BF_ONE_MINUS_SOURCE_ALPHA); - for (LLMeshUploadThread::instance_list::iterator iter = mUploadData.begin(); iter != mUploadData.end(); ++iter) + for (LLMeshUploadThread::instance_list_t::iterator iter = mUploadData.begin(); iter != mUploadData.end(); ++iter) { LLModelInstance& instance = *iter; @@ -3738,7 +3738,7 @@ bool LLModelPreview::render() gGL.diffuseColor4f(1.f, 0.f, 0.f, 1.f); const LLVector4a scale(0.5f); - for (LLMeshUploadThread::instance_list::iterator iter = mUploadData.begin(); iter != mUploadData.end(); ++iter) + for (LLMeshUploadThread::instance_list_t::iterator iter = mUploadData.begin(); iter != mUploadData.end(); ++iter) { LLModelInstance& instance = *iter; diff --git a/indra/newview/llmodelpreview.h b/indra/newview/llmodelpreview.h index 7b3b699b33..92ac2d1faf 100644 --- a/indra/newview/llmodelpreview.h +++ b/indra/newview/llmodelpreview.h @@ -319,7 +319,7 @@ protected: // Amount of triangles in original(base) model U32 mMaxTriangleLimit; - LLMeshUploadThread::instance_list mUploadData; + LLMeshUploadThread::instance_list_t mUploadData; std::set mTextureSet; LLLoadedCallbackEntry::source_callback_list_t mCallbackTextureList; From 8976d69dba6a45d7a507d15794e98e26d00c0ea3 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> Date: Wed, 24 Sep 2025 21:32:12 +0300 Subject: [PATCH 6/8] #4723 Fix emoji warnings and missing emojis --- indra/llui/llemojidictionary.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/indra/llui/llemojidictionary.cpp b/indra/llui/llemojidictionary.cpp index 925608e47e..16e6f0591a 100644 --- a/indra/llui/llemojidictionary.cpp +++ b/indra/llui/llemojidictionary.cpp @@ -390,14 +390,17 @@ void LLEmojiDictionary::loadEmojis() continue; } + std::string category; std::list categories = loadCategories(sd); if (categories.empty()) { - LL_WARNS() << "Skipping invalid emoji descriptor (no categories)" << LL_ENDL; - continue; + // Should already have a localization for "other symbols" + category = "other symbols"; + } + else + { + category = categories.front(); } - - std::string category = categories.front(); if (std::find(mSkipCategories.begin(), mSkipCategories.end(), category) != mSkipCategories.end()) { From 6ea4fc913f979d640e441c6ba2465c95f4f252e8 Mon Sep 17 00:00:00 2001 From: Maxim Nikolenko Date: Thu, 25 Sep 2025 19:24:25 +0300 Subject: [PATCH 7/8] #p473 fix XUI warnings --- indra/newview/llpanelprofile.cpp | 2 +- indra/newview/skins/default/xui/en/panel_profile_firstlife.xml | 1 - .../newview/skins/default/xui/en/panel_profile_secondlife.xml | 3 +-- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index b77ee2f439..6ea9cd2b92 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -859,7 +859,7 @@ void LLPanelProfileSecondLife::resetData() resetLoading(); // Set default image and 1:1 dimensions for it - mSecondLifePic->setValue("Generic_Person_Large"); + mSecondLifePic->setValue(LLUUID()); LLRect imageRect = mSecondLifePicLayout->getRect(); mSecondLifePicLayout->reshape(imageRect.getWidth(), imageRect.getWidth()); diff --git a/indra/newview/skins/default/xui/en/panel_profile_firstlife.xml b/indra/newview/skins/default/xui/en/panel_profile_firstlife.xml index 6554dd0952..831b631505 100644 --- a/indra/newview/skins/default/xui/en/panel_profile_firstlife.xml +++ b/indra/newview/skins/default/xui/en/panel_profile_firstlife.xml @@ -22,7 +22,6 @@ Date: Thu, 25 Sep 2025 23:36:38 +0300 Subject: [PATCH 8/8] p#475 Excessive texture fetch logging on shutdown --- indra/newview/lltexturefetch.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 93b5806acf..8b991f3f34 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -1295,10 +1295,19 @@ bool LLTextureFetchWorker::doWork(S32 param) else { mCanUseCapability = false; - mRegionRetryAttempt++; - mRegionRetryTimer.setTimerExpirySec(CAP_MISSING_EXPIRATION_DELAY); - // ex: waiting for caps - LL_INFOS_ONCE(LOG_TXT) << "Texture not available via HTTP: empty URL." << LL_ENDL; + if (gDisconnected) + { + // We lost connection or are shutting down. + mCanUseHTTP = false; + return true; // abort + } + else + { + // Ex: waiting for caps + mRegionRetryAttempt++; + mRegionRetryTimer.setTimerExpirySec(CAP_MISSING_EXPIRATION_DELAY); + LL_INFOS_ONCE(LOG_TXT) << "Texture not available via HTTP: empty URL." << LL_ENDL; + } } } else