void LLGestureMgr::activateGestures(LLViewerInventoryItem::item_array_t& items) { // Load up the assets S32 count = 0; LLViewerInventoryItem::item_array_t::const_iterator it; for (it = items.begin(); it != items.end(); ++it) { LLViewerInventoryItem* item = *it; if (isGestureActive(item->getUUID())) { continue; } else { // Make gesture active and persistent through login sessions. -Aura 07-12-06 activateGesture(item->getUUID()); } count++; } mLoadingCount = count; mDeactivateSimilarNames.clear(); for (it = items.begin(); it != items.end(); ++it) { LLViewerInventoryItem* item = *it; if (isGestureActive(item->getUUID())) { continue; } // Don't inform server, we'll do that in bulk const BOOL no_inform_server = FALSE; const BOOL deactivate_similar = TRUE; activateGestureWithAsset(item->getUUID(), item->getAssetUUID(), no_inform_server, deactivate_similar); } // Inform the database of this change LLMessageSystem* msg = gMessageSystem; BOOL start_message = TRUE; for (it = items.begin(); it != items.end(); ++it) { LLViewerInventoryItem* item = *it; if (isGestureActive(item->getUUID())) { continue; } if (start_message) { msg->newMessage("ActivateGestures"); msg->nextBlock("AgentData"); msg->addUUID("AgentID", gAgent.getID()); msg->addUUID("SessionID", gAgent.getSessionID()); msg->addU32("Flags", 0x0); start_message = FALSE; } msg->nextBlock("Data"); msg->addUUID("ItemID", item->getUUID()); msg->addUUID("AssetID", item->getAssetUUID()); msg->addU32("GestureFlags", 0x0); if (msg->getCurrentSendTotal() > MTUBYTES) { gAgent.sendReliableMessage(); start_message = TRUE; } } if (!start_message) { gAgent.sendReliableMessage(); } }
LLFolderViewItem* LLInventoryPanel::buildNewViews(const LLUUID& id) { LLInventoryObject const* objectp = gInventory.getObject(id); LLUUID root_id = mFolderRoot.get()->getListener()->getUUID(); LLFolderViewFolder* parent_folder = NULL; LLFolderViewItem* itemp = NULL; if (id == root_id) { parent_folder = mFolderRoot.get(); } else if (objectp) { const LLUUID &parent_id = objectp->getParentUUID(); parent_folder = (LLFolderViewFolder*)mFolderRoot.get()->getItemByID(parent_id); if (parent_folder) { if (objectp->getType() <= LLAssetType::AT_NONE || objectp->getType() >= LLAssetType::AT_COUNT) { llwarns << "LLInventoryPanel::buildNewViews called with invalid objectp->mType : " << ((S32) objectp->getType()) << " name " << objectp->getName() << " UUID " << objectp->getUUID() << llendl; return NULL; } if ((objectp->getType() == LLAssetType::AT_CATEGORY) && (objectp->getActualType() != LLAssetType::AT_LINK_FOLDER)) { LLInvFVBridge* new_listener = mInvFVBridgeBuilder->createBridge(objectp->getType(), objectp->getType(), LLInventoryType::IT_CATEGORY, this, mFolderRoot.get(), objectp->getUUID()); if (new_listener) { LLFolderViewFolder* folderp = createFolderViewFolder(new_listener); if (folderp) { folderp->setItemSortOrder(mFolderRoot.get()->getSortOrder()); } itemp = folderp; } } else { // Build new view for item. LLInventoryItem* item = (LLInventoryItem*)objectp; LLInvFVBridge* new_listener = mInvFVBridgeBuilder->createBridge(item->getType(), item->getActualType(), item->getInventoryType(), this, mFolderRoot.get(), item->getUUID(), item->getFlags()); if (new_listener) { itemp = createFolderViewItem(new_listener); } } if (itemp) { itemp->addToFolder(parent_folder, mFolderRoot.get()); } } } // If this is a folder, add the children of the folder and recursively add any // child folders. if (id.isNull() || (objectp && objectp->getType() == LLAssetType::AT_CATEGORY)) { LLViewerInventoryCategory::cat_array_t* categories; LLViewerInventoryItem::item_array_t* items; mInventory->lockDirectDescendentArrays(id, categories, items); if(categories) { for (LLViewerInventoryCategory::cat_array_t::const_iterator cat_iter = categories->begin(); cat_iter != categories->end(); ++cat_iter) { const LLViewerInventoryCategory* cat = (*cat_iter); buildNewViews(cat->getUUID()); } } if(items && parent_folder) { for (LLViewerInventoryItem::item_array_t::const_iterator item_iter = items->begin(); item_iter != items->end(); ++item_iter) { const LLViewerInventoryItem* item = (*item_iter); buildNewViews(item->getUUID()); } } mInventory->unlockDirectDescendentArrays(id); } return itemp; }
void LLInventoryPanel::buildNewViews(const LLUUID& id) { LLMemType mt(LLMemType::MTYPE_INVENTORY_BUILD_NEW_VIEWS); LLFolderViewItem* itemp = NULL; LLInventoryObject* objectp = gInventory.getObject(id); if (objectp) { const LLUUID &parent_id = objectp->getParentUUID(); LLFolderViewFolder* parent_folder = (LLFolderViewFolder*)mFolderRoot->getItemByID(parent_id); if (id == mStartFolderID) { parent_folder = mFolderRoot; } else if ((mStartFolderID != LLUUID::null) && (!gInventory.isObjectDescendentOf(id, mStartFolderID))) { // This item exists outside the inventory's hierarchy, so don't add it. return; } if (objectp->getType() <= LLAssetType::AT_NONE || objectp->getType() >= LLAssetType::AT_COUNT) { llwarns << "LLInventoryPanel::buildNewViews called with invalid objectp->mType : " << ((S32) objectp->getType()) << " name " << objectp->getName() << " UUID " << objectp->getUUID() << llendl; return; } if ((objectp->getType() == LLAssetType::AT_CATEGORY) && (objectp->getActualType() != LLAssetType::AT_LINK_FOLDER)) { LLInvFVBridge* new_listener = mInvFVBridgeBuilder->createBridge(objectp->getType(), objectp->getType(), LLInventoryType::IT_CATEGORY, this, mFolderRoot, objectp->getUUID()); if (new_listener) { LLFolderViewFolder::Params params; params.name = new_listener->getDisplayName(); params.icon = new_listener->getIcon(); params.icon_open = new_listener->getOpenIcon(); if (mShowItemLinkOverlays) // if false, then links show up just like normal items { params.icon_overlay = LLUI::getUIImage("Inv_Link"); } params.root = mFolderRoot; params.listener = new_listener; params.tool_tip = params.name; LLFolderViewFolder* folderp = LLUICtrlFactory::create<LLFolderViewFolder>(params); folderp->setItemSortOrder(mFolderRoot->getSortOrder()); itemp = folderp; // Hide the root folder, so we can show the contents of a folder flat // but still have the parent folder present for listener-related operations. if (id == mStartFolderID) { folderp->setHidden(TRUE); } const LLViewerInventoryCategory *cat = dynamic_cast<LLViewerInventoryCategory *>(objectp); if (cat && getIsHiddenFolderType(cat->getPreferredType())) { folderp->setHidden(TRUE); } } } else { // Build new view for item. LLInventoryItem* item = (LLInventoryItem*)objectp; LLInvFVBridge* new_listener = mInvFVBridgeBuilder->createBridge(item->getType(), item->getActualType(), item->getInventoryType(), this, mFolderRoot, item->getUUID(), item->getFlags()); if (new_listener) { LLFolderViewItem::Params params; params.name = new_listener->getDisplayName(); params.icon = new_listener->getIcon(); params.icon_open = new_listener->getOpenIcon(); if (mShowItemLinkOverlays) // if false, then links show up just like normal items { params.icon_overlay = LLUI::getUIImage("Inv_Link"); } params.creation_date = new_listener->getCreationDate(); params.root = mFolderRoot; params.listener = new_listener; params.rect = LLRect (0, 0, 0, 0); params.tool_tip = params.name; itemp = LLUICtrlFactory::create<LLFolderViewItem> (params); } } if (itemp) { itemp->addToFolder(parent_folder, mFolderRoot); // Don't add children of hidden folders unless this is the panel's root folder. if (itemp->getHidden() && (id != mStartFolderID)) { return; } } } // If this is a folder, add the children of the folder and recursively add any // child folders. if ((id == mStartFolderID) || (objectp && objectp->getType() == LLAssetType::AT_CATEGORY)) { LLViewerInventoryCategory::cat_array_t* categories; LLViewerInventoryItem::item_array_t* items; mInventory->lockDirectDescendentArrays(id, categories, items); if(categories) { for (LLViewerInventoryCategory::cat_array_t::const_iterator cat_iter = categories->begin(); cat_iter != categories->end(); ++cat_iter) { const LLViewerInventoryCategory* cat = (*cat_iter); buildNewViews(cat->getUUID()); } } if(items) { for (LLViewerInventoryItem::item_array_t::const_iterator item_iter = items->begin(); item_iter != items->end(); ++item_iter) { const LLViewerInventoryItem* item = (*item_iter); buildNewViews(item->getUUID()); } } mInventory->unlockDirectDescendentArrays(id); } }