diff options
-rw-r--r-- | indra/llcommon/llassettype.cpp | 3 | ||||
-rw-r--r-- | indra/llcommon/llassettype.h | 4 | ||||
-rw-r--r-- | indra/llinventory/llfoldertype.h | 4 | ||||
-rw-r--r-- | indra/llinventory/llinventorytype.cpp | 1 | ||||
-rw-r--r-- | indra/llinventory/llinventorytype.h | 3 | ||||
-rw-r--r-- | indra/llui/llui.h | 3 | ||||
-rw-r--r-- | indra/newview/llpanelface.cpp | 52 | ||||
-rw-r--r-- | indra/newview/llviewerassettype.cpp | 1 |
8 files changed, 63 insertions, 8 deletions
diff --git a/indra/llcommon/llassettype.cpp b/indra/llcommon/llassettype.cpp index e6cc06e8d0..7bf3c6553e 100644 --- a/indra/llcommon/llassettype.cpp +++ b/indra/llcommon/llassettype.cpp @@ -96,7 +96,8 @@ LLAssetDictionary::LLAssetDictionary() addEntry(LLAssetType::AT_WIDGET, new AssetEntry("WIDGET", "widget", "widget", false, false, false)); addEntry(LLAssetType::AT_PERSON, new AssetEntry("PERSON", "person", "person", false, false, false)); addEntry(LLAssetType::AT_SETTINGS, new AssetEntry("SETTINGS", "settings", "settings blob", true, true, true)); - addEntry(LLAssetType::AT_UNKNOWN, new AssetEntry("UNKNOWN", "invalid", NULL, false, false, false)); + addEntry(LLAssetType::AT_MATERIAL, new AssetEntry("MATERIAL", "material", "material", true, false, true)); + addEntry(LLAssetType::AT_UNKNOWN, new AssetEntry("UNKNOWN", "invalid", NULL, false, false, false)); addEntry(LLAssetType::AT_NONE, new AssetEntry("NONE", "-1", NULL, FALSE, FALSE, FALSE)); }; diff --git a/indra/llcommon/llassettype.h b/indra/llcommon/llassettype.h index 652c548d59..1027957863 100644 --- a/indra/llcommon/llassettype.h +++ b/indra/llcommon/llassettype.h @@ -127,8 +127,10 @@ public: AT_RESERVED_6 = 55, AT_SETTINGS = 56, // Collection of settings + + AT_MATERIAL = 57, - AT_COUNT = 57, + AT_COUNT = 58, // +*********************************************************+ // | TO ADD AN ELEMENT TO THIS ENUM: | diff --git a/indra/llinventory/llfoldertype.h b/indra/llinventory/llfoldertype.h index 1f174520da..19f4d61b5b 100644 --- a/indra/llinventory/llfoldertype.h +++ b/indra/llinventory/llfoldertype.h @@ -93,9 +93,13 @@ public: FT_SETTINGS = 56, + FT_MATERIAL = 57, + FT_COUNT, FT_NONE = -1 + + // When adding, see note at bottom of LLAssetType::Etype }; static EType lookup(const std::string& type_name); diff --git a/indra/llinventory/llinventorytype.cpp b/indra/llinventory/llinventorytype.cpp index 853ed655f5..71223d65b9 100644 --- a/indra/llinventory/llinventorytype.cpp +++ b/indra/llinventory/llinventorytype.cpp @@ -154,6 +154,7 @@ DEFAULT_ASSET_FOR_INV_TYPE[LLAssetType::AT_COUNT] = LLInventoryType::IT_NONE, // 54 AT_RESERVED_5 LLInventoryType::IT_SETTINGS, // 55 AT_SETTINGS + LLInventoryType::IT_MATERIAL, // 56 AT_MATERIAL }; // static diff --git a/indra/llinventory/llinventorytype.h b/indra/llinventory/llinventorytype.h index b6e7fb047f..e1aac054f6 100644 --- a/indra/llinventory/llinventorytype.h +++ b/indra/llinventory/llinventorytype.h @@ -65,7 +65,8 @@ public: IT_WIDGET = 23, IT_PERSON = 24, IT_SETTINGS = 25, - IT_COUNT = 26, + IT_MATERIAL = 26, + IT_COUNT = 27, IT_UNKNOWN = 255, IT_NONE = -1 diff --git a/indra/llui/llui.h b/indra/llui/llui.h index 30dbd7248f..f46e993f8e 100644 --- a/indra/llui/llui.h +++ b/indra/llui/llui.h @@ -76,7 +76,8 @@ enum EDragAndDropType DAD_WIDGET = 16, DAD_PERSON = 17, DAD_SETTINGS = 18, - DAD_COUNT = 19, // number of types in this enum + DAD_MATERIAL = 19, + DAD_COUNT = 20, // number of types in this enum }; // Reasons for drags to be denied. 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); } diff --git a/indra/newview/llviewerassettype.cpp b/indra/newview/llviewerassettype.cpp index 4804ef6ddc..481086f760 100644 --- a/indra/newview/llviewerassettype.cpp +++ b/indra/newview/llviewerassettype.cpp @@ -88,6 +88,7 @@ LLViewerAssetDictionary::LLViewerAssetDictionary() addEntry(LLViewerAssetType::AT_NONE, new ViewerAssetEntry(DAD_NONE)); addEntry(LLViewerAssetType::AT_SETTINGS, new ViewerAssetEntry(DAD_SETTINGS)); + addEntry(LLViewerAssetType::AT_MATERIAL, new ViewerAssetEntry(DAD_MATERIAL)); }; EDragAndDropType LLViewerAssetType::lookupDragAndDropType(EType asset_type) |