diff options
author | Brad Kittenbrink <brad@lindenlab.com> | 2022-04-28 14:05:49 -0700 |
---|---|---|
committer | Brad Kittenbrink <brad@lindenlab.com> | 2022-04-28 14:05:49 -0700 |
commit | cc04903379c3a5dc094e0c9582cf41f022406ef5 (patch) | |
tree | 41dabc7b9c53a17591c8c4d6da93207a52a1b793 /indra/newview/llpanelface.cpp | |
parent | c9ef206e39063c46c1fbab355c1a015e3e8b022e (diff) | |
parent | b08742d0b3e0000430b8ae772c7c4d25cfe084fa (diff) |
Merge remote-tracking branch 'origin/euclid-17277' into brad/SL-17116-material-messaging
Diffstat (limited to 'indra/newview/llpanelface.cpp')
-rw-r--r-- | indra/newview/llpanelface.cpp | 60 |
1 files changed, 59 insertions, 1 deletions
diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 0b986e9a07..6f4d57f30e 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -159,6 +159,7 @@ BOOL LLPanelFace::postBuild() childSetAction("button align",&LLPanelFace::onClickAutoFix,this); childSetAction("button align textures", &LLPanelFace::onAlignTexture, this); + childSetAction("button save material", &LLPanelFace::onSaveMaterial, this); LLTextureCtrl* mTextureCtrl; LLTextureCtrl* mShinyTextureCtrl; @@ -1411,7 +1412,10 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) LLMaterialPtr material; LLSelectedTEMaterial::getCurrent(material, identical); - if (material && editable) + // QUICKHACK - enable this UI box, indiscriminatly. TODO discriminate DJH 2022-04 + childSetEnabled("button save material", true); + + if (material && editable) { LL_DEBUGS("Materials") << material->asLLSD() << LL_ENDL; @@ -2549,6 +2553,60 @@ 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(); + + 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); +} + // TODO: I don't know who put these in or what these are for??? void LLPanelFace::setMediaURL(const std::string& url) |