diff options
author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2011-05-09 11:23:15 -0400 |
---|---|---|
committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2011-05-09 11:23:15 -0400 |
commit | 369b34443d3d09b8bc71e85f23628c079935b615 (patch) | |
tree | 06fe8eed6b5b6affc5092a42511a00c5ca7818b1 /indra | |
parent | 9b0f5c815fcd8381f336ba860ae1f5bf0c842e58 (diff) |
SH-1491 WIP - whole model upload for fee request
Diffstat (limited to 'indra')
-rwxr-xr-x | indra/newview/llmeshrepository.cpp | 101 | ||||
-rwxr-xr-x | indra/newview/llmeshrepository.h | 2 |
2 files changed, 102 insertions, 1 deletions
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 4c04b0ea35..0789bbe28a 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -58,6 +58,8 @@ #include "llworld.h" #include "material_codes.h" #include "pipeline.h" +#include "llinventorymodel.h" +#include "llfoldertype.h" #ifndef LL_WINDOWS #include "netdb.h" @@ -478,6 +480,25 @@ public: } }; +class LLWholeModelFeeResponder: public LLCurl::Responder +{ + LLMeshUploadThread* mThread; +public: + LLWholeModelFeeResponder(LLMeshUploadThread* thread): + mThread(thread) + { + } + virtual void completedRaw(U32 status, const std::string& reason, + const LLChannelDescriptors& channels, + const LLIOPipe::buffer_ptr_t& buffer) + { + assert_main_thread(); + llinfos << "completed" << llendl; + mThread->mPendingUploads--; + } + +}; + LLMeshRepoThread::LLMeshRepoThread() : LLThread("mesh repo", NULL) { @@ -1341,8 +1362,81 @@ void LLMeshUploadThread::run() } } +LLSD LLMeshUploadThread::wholeModelToLLSD(bool include_textures) +{ + // TODO where do textures go? + + LLSD result; + + result["folder_id"] = gInventory.findCategoryUUIDForType(LLFolderType::FT_OBJECT); + result["asset_type"] = "mesh"; + result["inventory_type"] = "object"; + result["name"] = "your name here"; + result["description"] = "your description here"; + + LLSD res; + res["mesh_list"] = LLSD::emptyArray(); + S32 mesh_num = 0; + + for (instance_map::iterator iter = mInstance.begin(); iter != mInstance.end(); ++iter) + { + LLMeshUploadData data; + data.mBaseModel = iter->first; + + LLModelInstance& instance = *(iter->second.begin()); + + for (S32 i = 0; i < 5; i++) + { + data.mModel[i] = instance.mLOD[i]; + } + + std::stringstream ostr; + + LLModel::Decomposition& decomp = + data.mModel[LLModel::LOD_PHYSICS].notNull() ? + data.mModel[LLModel::LOD_PHYSICS]->mPhysics : + data.mBaseModel->mPhysics; + + decomp.mBaseHull = mHullMap[data.mBaseModel]; + + LLModel::writeModel( + ostr, + data.mModel[LLModel::LOD_PHYSICS], + data.mModel[LLModel::LOD_HIGH], + data.mModel[LLModel::LOD_MEDIUM], + data.mModel[LLModel::LOD_LOW], + data.mModel[LLModel::LOD_IMPOSTOR], + decomp, + mUploadSkin, + mUploadJoints); + + data.mAssetData = ostr.str(); + + LLSD mesh_entry; + + // TODO - correct coords based on instance.mTransform. + mesh_entry["coords"]["x"] = 1.0; + mesh_entry["coords"]["y"] = 1.0; + mesh_entry["coords"]["z"] = 1.0; + mesh_entry["coords"]["rot_x"] = 1.0; + mesh_entry["coords"]["rot_y"] = 1.0; + mesh_entry["coords"]["rot_z"] = 1.0; + mesh_entry["mesh_data"] = ostr.str(); + + res["mesh_list"][mesh_num] = mesh_entry; + + mesh_num++; + } + + result["asset_resources"] = res; + + return result; +} + void LLMeshUploadThread::doWholeModelUpload() { + mCurlRequest = new LLCurlRequest(); + // Queue up models for hull generation (viewer-side) for (instance_map::iterator iter = mInstance.begin(); iter != mInstance.end(); ++iter) { @@ -1388,7 +1482,12 @@ void LLMeshUploadThread::doWholeModelUpload() bool do_include_textures = false; // not needed for initial cost/validation check. LLSD model_data = wholeModelToLLSD(do_include_textures); - + + mPendingUploads++; + LLCurlRequest::headers_t headers; + mCurlRequest->post(mWholeModelUploadCapability, headers, model_data.asString(), + new LLWholeModelFeeResponder(this)); + // Currently a no-op. mFinished = true; } diff --git a/indra/newview/llmeshrepository.h b/indra/newview/llmeshrepository.h index e2faed52cf..9d8119dc48 100755 --- a/indra/newview/llmeshrepository.h +++ b/indra/newview/llmeshrepository.h @@ -424,6 +424,8 @@ public: void doWholeModelUpload(); void doIterativeUpload(); + + LLSD wholeModelToLLSD(bool include_textures); }; class LLMeshRepository |