From 248bab36f76161831c1d84550d85782bc14dfeff Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 18 Mar 2026 15:43:26 -0700 Subject: Issue #5547: When sending the request for a cost estimate for texture upload, include metadata about the texture size. --- indra/newview/llmeshrepository.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 20bda5039d..8a3eabf46e 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -2847,8 +2847,20 @@ void LLMeshUploadThread::packModelIntance( 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()); + if (include_textures) + { + std::string str = texture_str.str(); + res["texture_list"][texture_num] = LLSD::Binary(str.begin(), str.end()); + } + else + { // When not including the whole texture, we need to send some metadata about the image + // to ensure accurate price estimation. If not included, the server will assume all + // textures are 1024 x 1024, which could lead to a low estimate. + LLSD info = LLSD::emptyMap(); + info["width"] = texture->getFullWidth(); + info["height"] = texture->getFullHeight(); + res["texture_info"][texture_num] = info; + } // store indexes for error handling; texture_list_dest.push_back(material.mDiffuseMapFilename); texture_num++; @@ -2881,8 +2893,8 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, std::vector& LLSD res; if (mDestinationFolderId.isNull()) { - result["folder_id"] = gInventory.findUserDefinedCategoryUUIDForType(LLFolderType::FT_OBJECT); - result["texture_folder_id"] = gInventory.findUserDefinedCategoryUUIDForType(LLFolderType::FT_TEXTURE); + result["folder_id"] = gInventory.findUserDefinedCategoryUUIDForType(LLFolderType::FT_OBJECT); + result["texture_folder_id"] = gInventory.findUserDefinedCategoryUUIDForType(LLFolderType::FT_TEXTURE); } else { -- cgit v1.3 From 6e4e67d4cc2e8e22650e0adfc92caecf09140e0d Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 18 Mar 2026 16:54:01 -0700 Subject: Always include the empty texture_list array for backwards compat and get image hight and width from the jpeg. --- indra/newview/llmeshrepository.cpp | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 8a3eabf46e..fb6ecedcbf 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -2857,9 +2857,33 @@ void LLMeshUploadThread::packModelIntance( // to ensure accurate price estimation. If not included, the server will assume all // textures are 1024 x 1024, which could lead to a low estimate. LLSD info = LLSD::emptyMap(); - info["width"] = texture->getFullWidth(); - info["height"] = texture->getFullHeight(); + + S32 texture_width = 0; + S32 texture_height = 0; + 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_width = upload_file->getWidth(); + texture_height = upload_file->getHeight(); + } + } + + if ((texture_width <= 0) || (texture_height <= 0)) + { + // Fall back to the texture's stored dimensions if we can't get dimensions from the raw image. + texture_width = texture->getFullWidth(); + texture_height = texture->getFullHeight(); + } + + info["width"] = texture_width; + info["height"] = texture_height; res["texture_info"][texture_num] = info; + res["texture_list"][texture_num] = LLSD::Binary(); // empty binary to indicate texture is not included, for older server compatibility } // store indexes for error handling; texture_list_dest.push_back(material.mDiffuseMapFilename); -- cgit v1.3