summaryrefslogtreecommitdiff
path: root/indra/newview/llmeshrepository.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llmeshrepository.cpp')
-rwxr-xr-xindra/newview/llmeshrepository.cpp147
1 files changed, 88 insertions, 59 deletions
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
index 4673289094..6e0722bcf9 100755
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -94,7 +94,8 @@ std::string make_dump_name(std::string prefix, S32 num)
return prefix + boost::lexical_cast<std::string>(num) + std::string(".xml");
}
-void dumpLLSDToFile(const LLSD& content, std::string filename);
+void dump_llsd_to_file(const LLSD& content, std::string filename);
+LLSD llsd_from_file(std::string filename);
std::string header_lod[] =
{
@@ -468,38 +469,46 @@ public:
};
-void log_upload_error(const LLSD& content,std::string stage)
+void log_upload_error(S32 status, const LLSD& content, std::string stage, std::string model_name)
{
+ // Add notification popup.
+ LLSD args;
+ std::string message = content["error"]["message"];
+ std::string identifier = content["error"]["identifier"];
+ args["MESSAGE"] = message;
+ args["IDENTIFIER"] = identifier;
+ args["LABEL"] = model_name;
+ gMeshRepo.uploadError(args);
+
+ // Log details.
+ llwarns << "stage: " << stage << " http status: " << status << llendl;
if (content.has("error"))
{
const LLSD& err = content["error"];
- llwarns << "mesh upload failed, stage " << stage
- << " message " << err["message"].asString() << " id " << err["identifier"].asString()
- << llendl;
-
- if (content.has("errors"))
- {
- const LLSD& err_list = content["errors"];
+ llwarns << "err: " << err << llendl;
+ llwarns << "mesh upload failed, stage '" << stage
+ << "' error '" << err["error"].asString()
+ << "', message '" << err["message"].asString()
+ << "', id '" << err["identifier"].asString()
+ << "'" << llendl;
+ if (err.has("errors"))
+ {
+ S32 error_num = 0;
+ const LLSD& err_list = err["errors"];
for (LLSD::array_const_iterator it = err_list.beginArray();
it != err_list.endArray();
++it)
{
const LLSD& err_entry = *it;
- std::string index_info;
- std::string texture_index_str = err_entry["TextureIndex"].asString();
- if (!texture_index_str.empty())
+ llwarns << "error[" << error_num << "]:" << llendl;
+ for (LLSD::map_const_iterator map_it = err_entry.beginMap();
+ map_it != err_entry.endMap();
+ ++map_it)
{
- index_info += " texture_index: " + texture_index_str;
+ llwarns << "\t" << map_it->first << ": "
+ << map_it->second << llendl;
}
- std::string mesh_index_str = err_entry["MeshIndex"].asString();
- if (!mesh_index_str.empty())
- {
- index_info += " mesh_index: " + mesh_index_str;
- }
- llwarns << "mesh err code " << err_entry["error"].asString()
- << " message " << err_entry["message"]
- << index_info
- << llendl;
+ error_num++;
}
}
}
@@ -507,8 +516,6 @@ void log_upload_error(const LLSD& content,std::string stage)
{
llwarns << "bad mesh, no error information available" << llendl;
}
-
-
}
class LLModelObjectUploadResponder: public LLCurl::Responder
@@ -538,29 +545,36 @@ public:
class LLWholeModelFeeResponder: public LLCurl::Responder
{
LLMeshUploadThread* mThread;
+ LLSD mModelData;
public:
- LLWholeModelFeeResponder(LLMeshUploadThread* thread):
- mThread(thread)
+ LLWholeModelFeeResponder(LLMeshUploadThread* thread, LLSD& model_data):
+ mThread(thread),
+ mModelData(model_data)
{
}
virtual void completed(U32 status,
const std::string& reason,
const LLSD& content)
{
- //assert_main_thread();
+ LLSD cc = content;
+ if (gSavedSettings.getS32("MeshUploadFakeErrors")&1)
+ {
+ cc = llsd_from_file("fake_upload_error.xml");
+ }
+
llinfos << "completed" << llendl;
mThread->mPendingUploads--;
- dumpLLSDToFile(content,make_dump_name("whole_model_fee_response_",dump_num));
- llinfos << "LLWholeModelFeeResponder content: " << content << llendl;
- if (isGoodStatus(status))
+ dump_llsd_to_file(cc,make_dump_name("whole_model_fee_response_",dump_num));
+ if (isGoodStatus(status) &&
+ cc["state"].asString() == "upload")
{
llinfos << "fee request succeeded" << llendl;
- mThread->mWholeModelUploadURL = content["uploader"].asString();
+ mThread->mWholeModelUploadURL = cc["uploader"].asString();
}
else
{
llwarns << "fee request failed" << llendl;
- log_upload_error(content,"fee");
+ log_upload_error(status,cc,"fee",mModelData["name"]);
mThread->mWholeModelUploadURL = "";
}
}
@@ -570,34 +584,42 @@ public:
class LLWholeModelUploadResponder: public LLCurl::Responder
{
LLMeshUploadThread* mThread;
- LLSD mPostData;
+ LLSD mModelData;
public:
- LLWholeModelUploadResponder(LLMeshUploadThread* thread, LLSD& post_data):
+ LLWholeModelUploadResponder(LLMeshUploadThread* thread, LLSD& model_data):
mThread(thread),
- mPostData(post_data)
+ mModelData(model_data)
{
}
virtual void completed(U32 status,
const std::string& reason,
const LLSD& content)
{
+ LLSD cc = content;
+ if (gSavedSettings.getS32("MeshUploadFakeErrors")&2)
+ {
+ cc = llsd_from_file("fake_upload_error.xml");
+ }
+
//assert_main_thread();
mThread->mPendingUploads--;
- dumpLLSDToFile(content,make_dump_name("whole_model_upload_response_",dump_num));
- llinfos << "LLWholeModelUploadResponder content: " << content << llendl;
+ dump_llsd_to_file(cc,make_dump_name("whole_model_upload_response_",dump_num));
+ llinfos << "LLWholeModelUploadResponder content: " << cc << llendl;
// requested "mesh" asset type isn't actually the type
// of the resultant object, fix it up here.
- if (isGoodStatus(status))
+ if (isGoodStatus(status) &&
+ cc["state"].asString() == "complete")
{
llinfos << "upload succeeded" << llendl;
- mPostData["asset_type"] = "object";
- gMeshRepo.updateInventory(LLMeshRepository::inventory_data(mPostData,content));
+ mModelData["asset_type"] = "object";
+ gMeshRepo.updateInventory(LLMeshRepository::inventory_data(mModelData,cc));
}
else
{
llwarns << "upload failed" << llendl;
- log_upload_error(content,"upload");
+ std::string model_name = mModelData["name"].asString();
+ log_upload_error(status,cc,"upload",model_name);
}
}
};
@@ -1422,7 +1444,7 @@ void LLMeshUploadThread::run()
doWholeModelUpload();
}
-void dumpLLSDToFile(const LLSD& content, std::string filename)
+void dump_llsd_to_file(const LLSD& content, std::string filename)
{
if (gSavedSettings.getBOOL("MeshUploadLogXML"))
{
@@ -1431,6 +1453,14 @@ void dumpLLSDToFile(const LLSD& content, std::string filename)
}
}
+LLSD llsd_from_file(std::string filename)
+{
+ std::ifstream ifs(filename.c_str());
+ LLSD result;
+ LLSDSerialize::fromXML(result,ifs);
+ return result;
+}
+
void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures)
{
LLSD result;
@@ -1556,16 +1586,12 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures)
std::stringstream texture_str;
if (texture != NULL && include_textures && mUploadTextures)
{
- // Get binary rep of texture, if needed.
- LLTextureUploadData data(texture, material.mDiffuseMapLabel);
- if (!data.mTexture->isRawImageValid())
- {
- data.mTexture->reloadRawImage(data.mTexture->getDiscardLevel());
+ if(texture->hasSavedRawImage())
+ {
+ LLPointer<LLImageJ2C> upload_file =
+ LLViewerTextureList::convertToUploadFile(texture->getSavedRawImage());
+ texture_str.write((const char*) upload_file->getData(), upload_file->getDataSize());
}
-
- LLPointer<LLImageJ2C> upload_file =
- LLViewerTextureList::convertToUploadFile(data.mTexture->getRawImage());
- texture_str.write((const char*) upload_file->getData(), upload_file->getDataSize());
}
if (texture != NULL &&
@@ -1599,7 +1625,7 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures)
}
result["asset_resources"] = res;
- dumpLLSDToFile(result,make_dump_name("whole_model_",dump_num));
+ dump_llsd_to_file(result,make_dump_name("whole_model_",dump_num));
dest = result;
}
@@ -1655,12 +1681,12 @@ void LLMeshUploadThread::doWholeModelUpload()
LLSD model_data;
wholeModelToLLSD(model_data,false);
- dumpLLSDToFile(model_data,make_dump_name("whole_model_fee_request_",dump_num));
+ dump_llsd_to_file(model_data,make_dump_name("whole_model_fee_request_",dump_num));
mPendingUploads++;
LLCurlRequest::headers_t headers;
mCurlRequest->post(mWholeModelFeeCapability, headers, model_data,
- new LLWholeModelFeeResponder(this));
+ new LLWholeModelFeeResponder(this,model_data));
do
{
@@ -1677,7 +1703,7 @@ void LLMeshUploadThread::doWholeModelUpload()
LLSD full_model_data;
wholeModelToLLSD(full_model_data, true);
LLSD body = full_model_data["asset_resources"];
- dumpLLSDToFile(body,make_dump_name("whole_model_body_",dump_num));
+ dump_llsd_to_file(body,make_dump_name("whole_model_body_",dump_num));
mCurlRequest->post(mWholeModelUploadURL, headers, body,
new LLWholeModelUploadResponder(this, model_data));
do
@@ -2868,9 +2894,12 @@ void LLMeshUploadThread::doUploadTexture(LLTextureUploadData& data)
data.mTexture->reloadRawImage(data.mTexture->getDiscardLevel());
}
- LLPointer<LLImageJ2C> upload_file = LLViewerTextureList::convertToUploadFile(data.mTexture->getRawImage());
+ if(data.mTexture->hasSavedRawImage())
+ {
+ LLPointer<LLImageJ2C> upload_file = LLViewerTextureList::convertToUploadFile(data.mTexture->getSavedRawImage());
- ostr.write((const char*) upload_file->getData(), upload_file->getDataSize());
+ ostr.write((const char*) upload_file->getData(), upload_file->getDataSize());
+ }
data.mAssetData = ostr.str();
@@ -3115,8 +3144,8 @@ bool LLImportMaterial::operator<(const LLImportMaterial &rhs) const
void LLMeshRepository::updateInventory(inventory_data data)
{
LLMutexLock lock(mMeshMutex);
- dumpLLSDToFile(data.mPostData,make_dump_name("update_inventory_post_data_",dump_num));
- dumpLLSDToFile(data.mResponse,make_dump_name("update_inventory_response_",dump_num));
+ dump_llsd_to_file(data.mPostData,make_dump_name("update_inventory_post_data_",dump_num));
+ dump_llsd_to_file(data.mResponse,make_dump_name("update_inventory_response_",dump_num));
mInventoryQ.push(data);
}