viewer#1781 More detailed model upload errors for textures

Show filename of a specific texture
master
Andrey Kleshchev 2024-06-17 13:56:46 +03:00 committed by Andrey Kleshchev
parent 3d84a147f0
commit 6b251fb7a4
3 changed files with 43 additions and 15 deletions

View File

@ -66,7 +66,12 @@ LLModel::~LLModel()
{
if (mDecompID >= 0)
{
LLConvexDecomposition::getInstance()->deleteDecomposition(mDecompID);
// can be null on shutdown
LLConvexDecomposition* decomp = LLConvexDecomposition::getInstance();
if (decomp)
{
decomp->deleteDecomposition(mDecompID);
}
}
mPhysics.mMesh.clear();
}

View File

@ -740,8 +740,12 @@ public:
};
void log_upload_error(LLCore::HttpStatus status, const LLSD& content,
const char * const stage, const std::string & model_name)
void log_upload_error(
LLCore::HttpStatus status,
const LLSD& content,
const char * const stage,
const std::string & model_name,
const std::vector<std::string> & texture_filenames)
{
// Add notification popup.
LLSD args;
@ -799,6 +803,20 @@ void log_upload_error(LLCore::HttpStatus status, const LLSD& content,
error_num++;
}
}
if (err.has("TextureIndex"))
{
S32 texture_index = err["TextureIndex"].asInteger();
if (texture_index < texture_filenames.size())
{
args["MESSAGE"] = message + "\n" + texture_filenames[texture_index];
}
else
{
llassert(false); // figure out why or how texture wasn't in the list
args["MESSAGE"] = message + llformat("\nTexture index: %d", texture_index);
}
}
}
else
{
@ -2220,7 +2238,7 @@ LLSD llsd_from_file(std::string filename)
return result;
}
void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures)
void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, std::vector<std::string>& texture_list_dest, bool include_textures)
{
LLSD result;
@ -2374,12 +2392,12 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures)
LLPointer<LLImageJ2C> upload_file =
LLViewerTextureList::convertToUploadFile(texture->getSavedRawImage());
if (!upload_file.isNull() && upload_file->getDataSize())
if (!upload_file.isNull() && upload_file->getDataSize() && !upload_file->isBufferInvalid())
{
texture_str.write((const char*) upload_file->getData(), upload_file->getDataSize());
texture_str.write((const char*) upload_file->getData(), upload_file->getDataSize());
}
}
}
}
if (texture != NULL &&
mUploadTextures &&
@ -2387,7 +2405,9 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures)
{
texture_index[texture] = texture_num;
std::string str = texture_str.str();
res["texture_list"][texture_num] = LLSD::Binary(str.begin(),str.end());
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++;
}
@ -2650,7 +2670,8 @@ void LLMeshUploadThread::doWholeModelUpload()
LL_DEBUGS(LOG_MESH) << "Hull generation completed." << LL_ENDL;
mModelData = LLSD::emptyMap();
wholeModelToLLSD(mModelData, true);
mTextureFiles.clear();
wholeModelToLLSD(mModelData, mTextureFiles, true);
LLSD body = mModelData["asset_resources"];
dump_llsd_to_file(body, make_dump_name("whole_model_body_", dump_num));
@ -2703,7 +2724,8 @@ void LLMeshUploadThread::requestWholeModelFee()
generateHulls();
mModelData = LLSD::emptyMap();
wholeModelToLLSD(mModelData, false);
mTextureFiles.clear();
wholeModelToLLSD(mModelData, mTextureFiles, false);
dump_llsd_to_file(mModelData, make_dump_name("whole_model_fee_request_", dump_num));
LLCore::HttpHandle handle = LLCoreHttpUtil::requestPostWithLLSD(mHttpRequest,
mHttpPolicyClass,
@ -2769,7 +2791,7 @@ void LLMeshUploadThread::onCompleted(LLCore::HttpHandle handle, LLCore::HttpResp
body["error"] = LLSD::emptyMap();
body["error"]["message"] = reason;
body["error"]["identifier"] = "NetworkError"; // from asset-upload/upload_util.py
log_upload_error(status, body, "upload", mModelData["name"].asString());
log_upload_error(status, body, "upload", mModelData["name"].asString(), mTextureFiles);
if (observer)
{
@ -2804,7 +2826,7 @@ void LLMeshUploadThread::onCompleted(LLCore::HttpHandle handle, LLCore::HttpResp
else
{
LL_WARNS(LOG_MESH) << "Upload failed. Not in expected 'complete' state." << LL_ENDL;
log_upload_error(status, body, "upload", mModelData["name"].asString());
log_upload_error(status, body, "upload", mModelData["name"].asString(), mTextureFiles);
if (observer)
{
@ -2829,7 +2851,7 @@ void LLMeshUploadThread::onCompleted(LLCore::HttpHandle handle, LLCore::HttpResp
body["error"] = LLSD::emptyMap();
body["error"]["message"] = reason;
body["error"]["identifier"] = "NetworkError"; // from asset-upload/upload_util.py
log_upload_error(status, body, "fee", mModelData["name"].asString());
log_upload_error(status, body, "fee", mModelData["name"].asString(), mTextureFiles);
if (observer)
{
@ -2862,7 +2884,7 @@ void LLMeshUploadThread::onCompleted(LLCore::HttpHandle handle, LLCore::HttpResp
else
{
LL_WARNS(LOG_MESH) << "Fee request failed. Not in expected 'upload' state." << LL_ENDL;
log_upload_error(status, body, "fee", mModelData["name"].asString());
log_upload_error(status, body, "fee", mModelData["name"].asString(), mTextureFiles);
if (observer)
{

View File

@ -523,7 +523,7 @@ public:
void doWholeModelUpload();
void requestWholeModelFee();
void wholeModelToLLSD(LLSD& dest, bool include_textures);
void wholeModelToLLSD(LLSD& dest, std::vector<std::string>& texture_list_dest, bool include_textures);
void decomposeMeshMatrix(LLMatrix4& transformation,
LLVector3& result_pos,
@ -544,6 +544,7 @@ private:
bool mDoUpload; // if FALSE only model data will be requested, otherwise the model will be uploaded
LLSD mModelData;
std::vector<std::string> mTextureFiles;
// llcorehttp library interface objects.
LLCore::HttpStatus mHttpStatus;