summaryrefslogtreecommitdiff
path: root/indra/newview/llmeshrepository.cpp
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2011-05-09 16:56:29 -0400
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2011-05-09 16:56:29 -0400
commit0b677dd2198af4608435fd5c8d84cc4f77db47b8 (patch)
tree9336284f9c3b839f57e1f27a19aa3d24ef97c743 /indra/newview/llmeshrepository.cpp
parent369b34443d3d09b8bc71e85f23628c079935b615 (diff)
SH-1491 WIP - whole model upload for fee request
Diffstat (limited to 'indra/newview/llmeshrepository.cpp')
-rwxr-xr-xindra/newview/llmeshrepository.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
index 0789bbe28a..9c72550847 100755
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -1362,6 +1362,12 @@ void LLMeshUploadThread::run()
}
}
+void dumpLLSDToFile(LLSD& content, std::string& filename)
+{
+ std::ofstream of(filename);
+ LLSDSerialize::toXML(content,of);
+}
+
LLSD LLMeshUploadThread::wholeModelToLLSD(bool include_textures)
{
// TODO where do textures go?
@@ -1376,8 +1382,12 @@ LLSD LLMeshUploadThread::wholeModelToLLSD(bool include_textures)
LLSD res;
res["mesh_list"] = LLSD::emptyArray();
+ res["texture_list"] = LLSD::emptyArray();
S32 mesh_num = 0;
+ S32 texture_num = 0;
+ std::set<LLViewerTexture* > textures;
+
for (instance_map::iterator iter = mInstance.begin(); iter != mInstance.end(); ++iter)
{
LLMeshUploadData data;
@@ -1425,11 +1435,44 @@ LLSD LLMeshUploadThread::wholeModelToLLSD(bool include_textures)
res["mesh_list"][mesh_num] = mesh_entry;
+ if (mUploadTextures)
+ {
+ for (std::vector<LLImportMaterial>::iterator material_iter = instance.mMaterial.begin();
+ material_iter != instance.mMaterial.end(); ++material_iter)
+ {
+
+ if (textures.find(material_iter->mDiffuseMap.get()) == textures.end())
+ {
+ textures.insert(material_iter->mDiffuseMap.get());
+
+ std::stringstream ostr;
+ if (include_textures) // otherwise data is blank.
+ {
+ LLTextureUploadData data(material_iter->mDiffuseMap.get(), material_iter->mDiffuseMapLabel);
+ if (!data.mTexture->isRawImageValid())
+ {
+ data.mTexture->reloadRawImage(data.mTexture->getDiscardLevel());
+ }
+
+ LLPointer<LLImageJ2C> upload_file =
+ LLViewerTextureList::convertToUploadFile(data.mTexture->getRawImage());
+ ostr.write((const char*) upload_file->getData(), upload_file->getDataSize());
+ }
+ LLSD texture_entry;
+ texture_entry["texture_data"] = ostr.str();
+ res["texture_list"][texture_num] = texture_entry;
+ texture_num++;
+ }
+ }
+ }
+
mesh_num++;
}
result["asset_resources"] = res;
+ dumpLLSDToFile(result,std::string("whole_model.xml"));
+
return result;
}