From 85f940092705281f1040081ca5ebc207c3cb4a5b Mon Sep 17 00:00:00 2001 From: Steven Bennetts Date: Wed, 5 Aug 2009 01:05:39 +0000 Subject: EXT-316 Enable the Viewer to generate calling cards for any agent Added code to store agent ID in the description field of calling cards so that we can use them to store user generated contacts. Currently enabled as a context menu for avatars (just for initial testing). reviewed by richard --- indra/newview/llviewerinventory.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'indra/newview/llviewerinventory.cpp') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index bb14a619c5..820abe2fbd 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -728,6 +728,16 @@ void create_inventory_item(const LLUUID& agent_id, const LLUUID& session_id, gAgent.sendReliableMessage(); } +void create_inventory_callingcard(const LLUUID& avatar_id) +{ + std::string item_desc = avatar_id.asString(); + std::string item_name; + gCacheName->getFullName(avatar_id, item_name); + create_inventory_item(gAgent.getID(), gAgent.getSessionID(), + LLUUID::null, LLTransactionID::tnull, item_name, item_desc, LLAssetType::AT_CALLINGCARD, + LLInventoryType::IT_CALLINGCARD, NOT_WEARABLE, PERM_MOVE | PERM_TRANSFER, NULL); +} + void copy_inventory_item( const LLUUID& agent_id, const LLUUID& current_owner, @@ -1102,3 +1112,13 @@ const LLViewerInventoryCategory *LLViewerInventoryItem::getLinkedCategory() cons } return NULL; } + +//---------- + +void LLViewerInventoryItem::onCallingCardNameLookup(const LLUUID& id, const std::string& first_name, const std::string& last_name) +{ + rename(first_name + " " + last_name); + gInventory.addChangedMask(LLInventoryObserver::LABEL, getUUID()); + gInventory.notifyObservers(); +} + -- cgit v1.2.3 From 7bbc5cdea6beb4e05c26d1472f789fe6fa536ee3 Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Wed, 12 Aug 2009 19:03:20 +0000 Subject: svn merge -r129617:130277 svn+ssh://svn.lindenlab.com/svn/linden/branches/avatar-pipeline/currently-worn-folder-5 into svn+ssh://svn.lindenlab.com/svn/linden/branches/viewer/viewer-2.0.0-3 For DEV-34223 : AVP Current Outfit Folder For DEV-37485 : AVP Appearance Side Panel For DEV-35335 : AVP Automatic Folder Classification This merges the Appearance Side Panel / Ensemble Typing / Current Outfit Folder work for the AVP team. --- indra/newview/llviewerinventory.cpp | 100 ++++++++++++++++++++++++++++++++++-- 1 file changed, 96 insertions(+), 4 deletions(-) (limited to 'indra/newview/llviewerinventory.cpp') diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 820abe2fbd..78e8f084c7 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -37,6 +37,7 @@ #include "indra_constants.h" #include "llagent.h" +#include "llfoldertype.h" #include "llviewercontrol.h" #include "llconsole.h" #include "llinventorymodel.h" @@ -587,6 +588,79 @@ bool LLViewerInventoryCategory::exportFileLocal(LLFILE* fp) const return true; } +void LLViewerInventoryCategory::determineFolderType() +{ + LLAssetType::EType original_type = getPreferredType(); + if (LLAssetType::lookupIsProtectedCategoryType(original_type)) + return; + + U64 folder_valid = 0; + U64 folder_invalid = 0; + LLInventoryModel::cat_array_t category_array; + LLInventoryModel::item_array_t item_array; + gInventory.collectDescendents(getUUID(),category_array,item_array,FALSE); + + // For ensembles + if (category_array.empty()) + { + for (LLInventoryModel::item_array_t::iterator item_iter = item_array.begin(); + item_iter != item_array.end(); + item_iter++) + { + const LLViewerInventoryItem *item = (*item_iter); + if (item->getIsLinkType()) + return; + if (item->getInventoryType() == LLInventoryType::IT_WEARABLE) + { + U32 flags = item->getFlags(); + if (flags > WT_COUNT) + return; + const EWearableType wearable_type = EWearableType(flags); + const std::string& wearable_name = LLWearableDictionary::getTypeName(wearable_type); + U64 valid_folder_types = LLFolderType::lookupValidFolderTypes(wearable_name); + folder_valid |= valid_folder_types; + folder_invalid |= ~valid_folder_types; + } + } + for (U8 i = LLAssetType::AT_FOLDER_ENSEMBLE_START; i <= LLAssetType::AT_FOLDER_ENSEMBLE_END; i++) + { + if ((folder_valid & (1LL << i)) && + !(folder_invalid & (1LL << i))) + { + changeType((LLAssetType::EType)i); + return; + } + } + } + if (LLAssetType::lookupIsEnsembleCategoryType(original_type)) + { + changeType(LLAssetType::AT_NONE); + } +} + +void LLViewerInventoryCategory::changeType(LLAssetType::EType new_folder_type) +{ + const LLUUID &folder_id = getUUID(); + const LLUUID &parent_id = getParentUUID(); + const std::string &name = getName(); + + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_UpdateInventoryFolder); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_FolderData); + msg->addUUIDFast(_PREHASH_FolderID, folder_id); + msg->addUUIDFast(_PREHASH_ParentID, parent_id); + msg->addS8Fast(_PREHASH_Type, new_folder_type); + msg->addStringFast(_PREHASH_Name, name); + gAgent.sendReliableMessage(); + + setPreferredType(new_folder_type); + gInventory.addChangedMask(LLInventoryObserver::LABEL, folder_id); + gInventory.updateLinkedObjects(folder_id); +} + ///---------------------------------------------------------------------------- /// Local function definitions ///---------------------------------------------------------------------------- @@ -880,16 +954,23 @@ void menu_create_inventory_item(LLFolderView* folder, LLFolderBridge *bridge, co { std::string type = userdata.asString(); - if ("category" == type) + if (("category" == type) || ("current" == type) || ("outfit" == type) || ("my_otfts" == type) ) { + LLAssetType::EType a_type = LLAssetType::AT_NONE; + if ("current" == type) + a_type = LLAssetType::AT_CURRENT_OUTFIT; + if ("outfit" == type) + a_type = LLAssetType::AT_OUTFIT; + if ("my_otfts" == type) + a_type = LLAssetType::AT_MY_OUTFITS; LLUUID category; if (bridge) { - category = gInventory.createNewCategory(bridge->getUUID(), LLAssetType::AT_NONE, LLStringUtil::null); + category = gInventory.createNewCategory(bridge->getUUID(), a_type, LLStringUtil::null); } else { - category = gInventory.createNewCategory(gInventory.getRootFolderID(), LLAssetType::AT_NONE, LLStringUtil::null); + category = gInventory.createNewCategory(gInventory.getRootFolderID(), a_type, LLStringUtil::null); } gInventory.notifyObservers(); folder->setSelectionByID(category, TRUE); @@ -1029,6 +1110,11 @@ const std::string& LLViewerInventoryItem::getName() const const LLPermissions& LLViewerInventoryItem::getPermissions() const { + if (const LLViewerInventoryItem *linked_item = getLinkedItem()) + { + return linked_item->getPermissions(); + } + // Use the actual permissions of the symlink, not its parent. return LLInventoryItem::getPermissions(); } @@ -1070,6 +1156,13 @@ LLInventoryType::EType LLViewerInventoryItem::getInventoryType() const return linked_item->getInventoryType(); } + // Categories don't have types. If this item is an AT_FOLDER_LINK, + // treat it as a category. + if (getLinkedCategory()) + { + return LLInventoryType::IT_CATEGORY; + } + return LLInventoryItem::getInventoryType(); } @@ -1079,7 +1172,6 @@ U32 LLViewerInventoryItem::getFlags() const { return linked_item->getFlags(); } - return LLInventoryItem::getFlags(); } -- cgit v1.2.3