diff options
| author | Rider Linden <rider@lindenlab.com> | 2026-03-26 11:41:39 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-26 11:41:39 -0700 |
| commit | b9875b377fc1f78dac50916e6dfa20290d8f8e0c (patch) | |
| tree | ed38b58239956856aa756d31300cd27afc6d8937 | |
| parent | 3410a0e45ce94bf25ad91905ed31905358930f4d (diff) | |
| parent | 6e4e67d4cc2e8e22650e0adfc92caecf09140e0d (diff) | |
Merge pull request #5554 from secondlife/rider/mesh_upload
Send metadata for textures to get correct upload cost estimate.
| -rw-r--r-- | indra/newview/llmeshrepository.cpp | 44 |
1 files changed, 40 insertions, 4 deletions
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 20bda5039d..fb6ecedcbf 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -2847,8 +2847,44 @@ 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(); + + S32 texture_width = 0; + S32 texture_height = 0; + if (texture->hasSavedRawImage()) + { + LLImageDataLock lock(texture->getSavedRawImage()); + + LLPointer<LLImageJ2C> 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); texture_num++; @@ -2881,8 +2917,8 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, std::vector<std::string>& 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 { |
