From 6b4823429ed1bd83da156c0aa56751a08b6fbbff Mon Sep 17 00:00:00 2001 From: Siana Gearz Date: Wed, 5 Oct 2011 15:54:57 +0200 Subject: [PATCH] Inventory mesh type. Conflicts: indra/llcommon/llassettype.cpp indra/llcommon/llassettype.h --- indra/llcommon/llassettype.cpp | 10 ++--- indra/llcommon/llassettype.h | 12 ++---- indra/llcommon/stdenums.h | 3 +- indra/llinventory/llinventorytype.h | 4 +- indra/newview/llinventorybridge.cpp | 64 +++++++++++++++++++++++++++++ indra/newview/llinventorybridge.h | 16 ++++++++ indra/newview/llinventoryview.cpp | 3 ++ indra/newview/llviewerassettype.cpp | 2 + 8 files changed, 97 insertions(+), 17 deletions(-) diff --git a/indra/llcommon/llassettype.cpp b/indra/llcommon/llassettype.cpp index 6aea07fd0..8391f3d2f 100644 --- a/indra/llcommon/llassettype.cpp +++ b/indra/llcommon/llassettype.cpp @@ -103,12 +103,10 @@ LLAssetDictionary::LLAssetDictionary() //addEntry(LLAssetType::AT_FAVORITE, new AssetEntry("FAVORITE", "favorite", "", false, false, false)); addEntry(LLAssetType::AT_LINK, new AssetEntry("LINK", "link", "sym link", false, false, true)); addEntry(LLAssetType::AT_LINK_FOLDER, new AssetEntry("FOLDER_LINK", "link_f", "sym folder link", false, false, true)); - //addEntry(LLAssetType::AT_CURRENT_OUTFIT, new AssetEntry("FOLDER_LINK", "current", "current outfit", false, false, false)); - //addEntry(LLAssetType::AT_OUTFIT, new AssetEntry("OUTFIT", "outfit", "outfit", false, false, false)); - //addEntry(LLAssetType::AT_MY_OUTFITS, new AssetEntry("MY_OUTFITS", "my_otfts", "my outfits", false, false, false)); -#if MESH_ENABLED - addEntry(LLAssetType::AT_MESH, new AssetEntry("MESH", "mesh", "mesh", false, false, false)); -#endif //MESH_ENABLED + addEntry(LLAssetType::AT_CURRENT_OUTFIT, new AssetEntry("FOLDER_LINK", "current", "current outfit", false, false, false)); + addEntry(LLAssetType::AT_OUTFIT, new AssetEntry("OUTFIT", "outfit", "outfit", false, false, false)); + addEntry(LLAssetType::AT_MY_OUTFITS, new AssetEntry("MY_OUTFITS", "my_otfts", "my outfits", false, false, false)); + addEntry(LLAssetType::AT_MESH, new AssetEntry("MESH", "mesh", "mesh", false, true, true)); 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 4590fc831..c253754ab 100644 --- a/indra/llcommon/llassettype.h +++ b/indra/llcommon/llassettype.h @@ -139,18 +139,16 @@ public: // Inventory folder link AT_LINK_FOLDER = 25, - //AT_CURRENT_OUTFIT = 46, + AT_CURRENT_OUTFIT = 46, - //AT_OUTFIT = 47, + AT_OUTFIT = 47, - //AT_MY_OUTFITS = 48, + AT_MY_OUTFITS = 48, -#if MESH_ENABLED AT_MESH = 49, // Mesh data in our proprietary SLM format AT_COUNT = 50, -#endif //MESH_ENABLED // +*********************************************+ // | TO ADD AN ELEMENT TO THIS ENUM: | // +*********************************************+ @@ -160,10 +158,6 @@ public: // | 4. ADD TO LLAssetType::mAssetTypeHumanNames | // +*********************************************+ - //AT_COUNT = 49, -#if !MESH_ENABLED - AT_COUNT = 26, -#endif //!MESH_ENABLED AT_NONE = -1 }; diff --git a/indra/llcommon/stdenums.h b/indra/llcommon/stdenums.h index 1a5678dde..ef0582f95 100644 --- a/indra/llcommon/stdenums.h +++ b/indra/llcommon/stdenums.h @@ -55,7 +55,8 @@ enum EDragAndDropType DAD_ANIMATION = 12, DAD_GESTURE = 13, DAD_LINK = 14, - DAD_COUNT = 15, // number of types in this enum + DAD_MESH = 15, + DAD_COUNT = 16, // number of types in this enum }; // Reasons for drags to be denied. diff --git a/indra/llinventory/llinventorytype.h b/indra/llinventory/llinventorytype.h index f4ab79d03..f833ec692 100644 --- a/indra/llinventory/llinventorytype.h +++ b/indra/llinventory/llinventorytype.h @@ -67,7 +67,9 @@ public: IT_WEARABLE = 18, IT_ANIMATION = 19, IT_GESTURE = 20, - IT_COUNT = 21, + + IT_MESH = 22, + IT_COUNT = 23, IT_NONE = -1 }; diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 2124b197b..0295fa258 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -200,6 +200,7 @@ std::string ICON_NAME[ICON_NAME_COUNT] = "inv_link_item.tga", "inv_link_folder.tga" + "inv_item_mesh.png" }; struct LLWearInfo @@ -1119,6 +1120,13 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type, // Only should happen for broken links. new_listener = new LLLinkItemBridge(inventory, uuid); break; + case LLAssetType::AT_MESH: + if(!(inv_type == LLInventoryType::IT_MESH)) + { + llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl; + } + new_listener = new LLMeshBridge(inventory, uuid); + break; default: llinfos << "Unhandled asset type (llassetstorage.h): " << (S32)asset_type << llendl; @@ -5685,3 +5693,59 @@ const LLUUID &LLLinkFolderBridge::getFolderID() const return LLUUID::null; } +// +=================================================+ +// | LLMeshBridge | +// +=================================================+ + +LLUIImagePtr LLMeshBridge::getIcon() const +{ + return get_item_icon(LLAssetType::AT_TEXTURE, LLInventoryType::IT_TEXTURE, 0, FALSE); +} + +void LLMeshBridge::openItem() +{ + LLViewerInventoryItem* item = getItem(); + + if (item) + { + // open mesh + } +} + +void LLMeshBridge::previewItem() +{ + LLViewerInventoryItem* item = getItem(); + if(item) + { + // preview mesh + } +} + + +void LLMeshBridge::buildContextMenu(LLMenuGL& menu, U32 flags) +{ + lldebugs << "LLMeshBridge::buildContextMenu()" << llendl; + std::vector items; + std::vector disabled_items; + + if(isItemInTrash()) + { + items.push_back(std::string("Purge Item")); + if (!isItemRemovable()) + { + disabled_items.push_back(std::string("Purge Item")); + } + + items.push_back(std::string("Restore Item")); + } + else + { + items.push_back(std::string("Properties")); + + getClipboardEntries(true, items, disabled_items, flags); + } + + + hide_context_entries(menu, items, disabled_items); +} + diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index af74e9091..5b385f538 100644 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -85,6 +85,7 @@ enum EInventoryIcon LINKITEM_ICON_NAME, LINKFOLDER_ICON_NAME, + MESH_ICON_NAME, ICON_NAME_COUNT }; @@ -646,6 +647,21 @@ protected: static std::string sPrefix; }; +class LLMeshBridge : public LLItemBridge +{ + friend class LLInvFVBridge; +public: + virtual LLUIImagePtr getIcon() const; + virtual void openItem(); + virtual void previewItem(); + virtual void buildContextMenu(LLMenuGL& menu, U32 flags); + +protected: + LLMeshBridge(LLInventoryPanel* inventory, + const LLUUID& uuid) : + LLItemBridge(inventory, uuid) {} +}; + void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attachment, bool replace = false); diff --git a/indra/newview/llinventoryview.cpp b/indra/newview/llinventoryview.cpp index ea8d1e0c6..ec1cab830 100644 --- a/indra/newview/llinventoryview.cpp +++ b/indra/newview/llinventoryview.cpp @@ -1541,6 +1541,9 @@ std::string get_item_icon_name(LLAssetType::EType asset_type, case LLAssetType::AT_GESTURE: idx = GESTURE_ICON_NAME; break; + case LLAssetType::AT_MESH: + idx = MESH_ICON_NAME; + break; default: break; } diff --git a/indra/newview/llviewerassettype.cpp b/indra/newview/llviewerassettype.cpp index 5bab702cf..3eee60882 100644 --- a/indra/newview/llviewerassettype.cpp +++ b/indra/newview/llviewerassettype.cpp @@ -86,6 +86,8 @@ LLViewerAssetDictionary::LLViewerAssetDictionary() addEntry(LLViewerAssetType::AT_LINK, new ViewerAssetEntry(DAD_LINK)); addEntry(LLViewerAssetType::AT_LINK_FOLDER, new ViewerAssetEntry(DAD_LINK)); + addEntry(LLViewerAssetType::AT_MESH, new ViewerAssetEntry(DAD_MESH)); + addEntry(LLViewerAssetType::AT_NONE, new ViewerAssetEntry(DAD_NONE)); };