From db05176138e6bf3e2011db1b5db4bc1b125d070f Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 16 May 2011 12:56:18 -0400 Subject: sh-1491 WIP --- indra/newview/llmeshrepository.cpp | 43 +++++++++++++++++++++++++++----------- 1 file changed, 31 insertions(+), 12 deletions(-) (limited to 'indra/newview/llmeshrepository.cpp') diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 2a68fbac8d..653fb46754 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -84,6 +84,8 @@ U32 LLMeshRepository::sPeakKbps = 0; const U32 MAX_TEXTURE_UPLOAD_RETRIES = 5; +void dumpLLSDToFile(LLSD& content, std::string filename); + std::string header_lod[] = { "lowest_lod", @@ -492,11 +494,18 @@ public: const LLChannelDescriptors& channels, const LLIOPipe::buffer_ptr_t& buffer) { - assert_main_thread(); + //assert_main_thread(); llinfos << "completed" << llendl; mThread->mPendingUploads--; + + LLSD content; + LLBufferStream istr(channels, buffer.get()); + if (!LLSDSerialize::fromXML(content, istr)) + { + llinfos << "Failed to deserialize LLSD. " << " [" << status << "]: " << reason << llendl; + } + dumpLLSDToFile(content,"whole_model_response.xml"); } - }; LLMeshRepoThread::LLMeshRepoThread() @@ -1362,8 +1371,8 @@ void LLMeshUploadThread::run() } } -#if 0 -void dumpLLSDToFile(LLSD& content, std::string& filename) +#if 1 +void dumpLLSDToFile(LLSD& content, std::string filename) { std::ofstream of(filename); LLSDSerialize::toPrettyXML(content,of); @@ -1373,9 +1382,10 @@ void dumpLLSDToFile(LLSD& content, std::string& filename) void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) { // TODO where do textures go? - + LLSD result; + LLSD res; result["folder_id"] = gInventory.findCategoryUUIDForType(LLFolderType::FT_OBJECT); result["asset_type"] = "mesh"; result["inventory_type"] = "object"; @@ -1384,9 +1394,9 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) // TODO "optional" fields from the spec - LLSD res; res["mesh_list"] = LLSD::emptyArray(); - res["texture_list"] = LLSD::emptyArray(); +// TODO Textures + //res["texture_list"] = LLSD::emptyArray(); S32 mesh_num = 0; S32 texture_num = 0; @@ -1432,10 +1442,15 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) LLQuaternion rot; LLMatrix4 transformation = instance.mTransform; decomposeMeshMatrix(transformation,pos,rot,scale); - + +#if 0 mesh_entry["childpos"] = ll_sd_from_vector3(pos); mesh_entry["childrot"] = ll_sd_from_quaternion(rot); mesh_entry["scale"] = ll_sd_from_vector3(scale); +#endif + mesh_entry["position"] = ll_sd_from_vector3(LLVector3()); + mesh_entry["rotation"] = ll_sd_from_quaternion(rot); + mesh_entry["scale"] = ll_sd_from_vector3(scale); // TODO should be binary. std::string str = ostr.str(); @@ -1479,9 +1494,8 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) } result["asset_resources"] = res; -#if 0 - std::string name("whole_model.xml"); - dumpLLSDToFile(result,name); +#if 1 + dumpLLSDToFile(result,"whole_model.xml"); #endif dest = result; @@ -1540,9 +1554,14 @@ void LLMeshUploadThread::doWholeModelUpload() mPendingUploads++; LLCurlRequest::headers_t headers; - mCurlRequest->post(mWholeModelUploadCapability, headers, model_data.asString(), + mCurlRequest->post(mWholeModelUploadCapability, headers, model_data, new LLWholeModelFeeResponder(this)); + do + { + mCurlRequest->process(); + } while (mCurlRequest->getQueued() > 0); + // Currently a no-op. mFinished = true; } -- cgit v1.2.3 From bde7cd91130ee91993f6b42863ac7ab6430bafd6 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 16 May 2011 17:39:42 -0400 Subject: sh-1491 WIP --- indra/newview/llmeshrepository.cpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'indra/newview/llmeshrepository.cpp') diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 653fb46754..7d48416292 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -84,7 +84,7 @@ U32 LLMeshRepository::sPeakKbps = 0; const U32 MAX_TEXTURE_UPLOAD_RETRIES = 5; -void dumpLLSDToFile(LLSD& content, std::string filename); +void dumpLLSDToFile(const LLSD& content, std::string filename); std::string header_lod[] = { @@ -490,20 +490,13 @@ public: mThread(thread) { } - virtual void completedRaw(U32 status, const std::string& reason, - const LLChannelDescriptors& channels, - const LLIOPipe::buffer_ptr_t& buffer) + virtual void completed(U32 status, + const std::string& reason, + const LLSD& content) { //assert_main_thread(); llinfos << "completed" << llendl; mThread->mPendingUploads--; - - LLSD content; - LLBufferStream istr(channels, buffer.get()); - if (!LLSDSerialize::fromXML(content, istr)) - { - llinfos << "Failed to deserialize LLSD. " << " [" << status << "]: " << reason << llendl; - } dumpLLSDToFile(content,"whole_model_response.xml"); } }; @@ -1372,7 +1365,7 @@ void LLMeshUploadThread::run() } #if 1 -void dumpLLSDToFile(LLSD& content, std::string filename) +void dumpLLSDToFile(const LLSD& content, std::string filename) { std::ofstream of(filename); LLSDSerialize::toPrettyXML(content,of); @@ -1562,6 +1555,9 @@ void LLMeshUploadThread::doWholeModelUpload() mCurlRequest->process(); } while (mCurlRequest->getQueued() > 0); + delete mCurlRequest; + mCurlRequest = NULL; + // Currently a no-op. mFinished = true; } -- cgit v1.2.3 From 7a02501aae8a21f4bf552d47e0799c4abdcd4228 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 18 May 2011 09:47:58 -0400 Subject: SH-1492 WIP --- indra/newview/llmeshrepository.cpp | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) mode change 100644 => 100755 indra/newview/llmeshrepository.cpp (limited to 'indra/newview/llmeshrepository.cpp') diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp old mode 100644 new mode 100755 index 922291c9e1..5305f3dbca --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -499,6 +499,27 @@ public: llinfos << "completed" << llendl; mThread->mPendingUploads--; dumpLLSDToFile(content,"whole_model_response.xml"); + + mThread->mWholeModelUploadURL = content["uploader"]; + } +}; + +class LLWholeModelUploadResponder: public LLCurl::Responder +{ + LLMeshUploadThread* mThread; +public: + LLWholeModelUploadResponder(LLMeshUploadThread* thread): + mThread(thread) + { + } + virtual void completed(U32 status, + const std::string& reason, + const LLSD& content) + { + //assert_main_thread(); + llinfos << "upload completed" << llendl; + mThread->mPendingUploads--; + dumpLLSDToFile(content,"whole_model_upload_response.xml"); } }; @@ -1263,7 +1284,7 @@ LLMeshUploadThread::LLMeshUploadThread(LLMeshUploadThread::instance_list& data, mUploadObjectAssetCapability = gAgent.getRegion()->getCapability("UploadObjectAsset"); mNewInventoryCapability = gAgent.getRegion()->getCapability("NewFileAgentInventoryVariablePrice"); - mWholeModelUploadCapability = gAgent.getRegion()->getCapability("NewFileAgentInventory"); + mWholeModelFeeCapability = gAgent.getRegion()->getCapability("NewFileAgentInventory"); mOrigin += gAgent.getAtAxis() * scale.magVec(); } @@ -1548,7 +1569,7 @@ void LLMeshUploadThread::doWholeModelUpload() mPendingUploads++; LLCurlRequest::headers_t headers; - mCurlRequest->post(mWholeModelUploadCapability, headers, model_data, + mCurlRequest->post(mWholeModelFeeCapability, headers, model_data, new LLWholeModelFeeResponder(this)); do @@ -1556,6 +1577,13 @@ void LLMeshUploadThread::doWholeModelUpload() mCurlRequest->process(); } while (mCurlRequest->getQueued() > 0); + mCurlRequest->post(mWholeModelUploadURL, headers, model_data["asset_resources"], new LLWholeModelUploadResponder(this)); + + do + { + mCurlRequest->process(); + } while (mCurlRequest->getQueued() > 0); + delete mCurlRequest; mCurlRequest = NULL; -- cgit v1.2.3 From 3990324e8f8391aee335ad74b33b22e0b1c849af Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 18 May 2011 11:33:28 -0400 Subject: trying to fix mac build complaints --- indra/newview/llmeshrepository.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llmeshrepository.cpp') diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 5305f3dbca..d9a58d56fe 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -500,7 +500,7 @@ public: mThread->mPendingUploads--; dumpLLSDToFile(content,"whole_model_response.xml"); - mThread->mWholeModelUploadURL = content["uploader"]; + mThread->mWholeModelUploadURL = content["uploader"].asString(); } }; @@ -1389,7 +1389,7 @@ void LLMeshUploadThread::run() #if 1 void dumpLLSDToFile(const LLSD& content, std::string filename) { - std::ofstream of(filename); + std::ofstream of(filename.c_str()); LLSDSerialize::toPrettyXML(content,of); } #endif -- cgit v1.2.3