summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelface.cpp
diff options
context:
space:
mode:
authorDave Houlton <euclid@lindenlab.com>2022-04-28 11:53:43 -0600
committerDave Houlton <euclid@lindenlab.com>2022-04-28 11:53:43 -0600
commitb08742d0b3e0000430b8ae772c7c4d25cfe084fa (patch)
tree811a295eaced8eb80e74b9a73678d1731205efb7 /indra/newview/llpanelface.cpp
parentc4625d26e51dcfa0480fa936b894d3625b68eda2 (diff)
Add a (broken) material upload handler fxn
Diffstat (limited to 'indra/newview/llpanelface.cpp')
-rw-r--r--indra/newview/llpanelface.cpp52
1 files changed, 48 insertions, 4 deletions
diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp
index c34010ce43..34a546f458 100644
--- a/indra/newview/llpanelface.cpp
+++ b/indra/newview/llpanelface.cpp
@@ -2542,14 +2542,58 @@ void LLPanelFace::onAlignTexture(void* userdata)
self->alignTestureLayer();
}
+#include "llagent.h"
+#include "llfilesystem.h"
+#include "llfloaterperms.h"
+#include "llviewerassetupload.h"
+#include "llviewermenufile.h"
+#include "llsd.h"
+#pragma warning (disable: 4189)
void LLPanelFace::onSaveMaterial(void* userdata)
{
+ // DRTVWR-559, Q&D material picker - save to inventory goes here
+ LL_DEBUGS("Material") << "saving material to inventory" << LL_ENDL;
+
LLPanelFace* self = (LLPanelFace*)userdata;
+
+ std::string name = "New Material";
+
+ LLSD* mat_llsd = new LLSD("Surely you jest...");
+ // TBD populate mat_llsd with material data
+ self->onCloseTexturePicker(*mat_llsd); // certainly wrong, but something like this?
+
+ // gen a new uuid for this asset
+ LLTransactionID tid;
+ tid.generate();
+ LLAssetID new_asset_id = tid.makeAssetID(gAgent.getSecureSessionID());
+
+ LLFileSystem fmt_file(new_asset_id, LLAssetType::AT_MATERIAL, LLFileSystem::WRITE);
+ fmt_file.write(mat_llsd->asBinary().data(), mat_llsd->size());
+
+ S32 expected_upload_cost = 0;// LLAgentBenefitsMgr::current().getTextureUploadCost();
- // DRTVWR-559, Q&D material picker - save to inventory goes here
- auto bound = self->getBoundingRect();
- self->setUseBoundingRect(self->getUseBoundingRect());
- //self->saveMaterialToInventory();
+ std::string res_name = name;
+ std::string res_desc = "Saved Material";
+ LLFolderType::EType folder_type = LLFolderType::FT_MATERIAL;
+ LLInventoryType::EType inv_type = LLInventoryType::IT_MATERIAL;
+
+ auto upload_info = new LLResourceUploadInfo(
+ tid,
+ LLAssetType::AT_MATERIAL,
+ res_name,
+ res_desc,
+ 0,
+ folder_type,
+ inv_type,
+ PERM_ALL,
+ LLFloaterPerms::getGroupPerms("Uploads"),
+ LLFloaterPerms::getEveryonePerms("Uploads"),
+ expected_upload_cost,
+ false);
+
+ LLResourceUploadInfo::ptr_t p_upload_info(upload_info);
+
+ upload_new_resource(p_upload_info);
}