diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llfolderview.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llfolderviewitem.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llinventorybridge.cpp | 214 | ||||
-rw-r--r-- | indra/newview/llinventorybridge.h | 1 | ||||
-rw-r--r-- | indra/newview/llinventoryfunctions.cpp | 30 | ||||
-rw-r--r-- | indra/newview/llinventoryfunctions.h | 19 | ||||
-rw-r--r-- | indra/newview/llviewermenu.cpp | 17 |
7 files changed, 164 insertions, 127 deletions
diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index adf7f08702..640b0d7d8f 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -748,6 +748,12 @@ void LLFolderView::sanitizeSelection() } } } + + // Don't allow invisible items (such as root folders) to be selected. + if (item->getDontShowInHierarchy()) + { + items_to_remove.push_back(item); + } } std::vector<LLFolderViewItem*>::iterator item_it; diff --git a/indra/newview/llfolderviewitem.cpp b/indra/newview/llfolderviewitem.cpp index 135821f662..c2607dcc9a 100644 --- a/indra/newview/llfolderviewitem.cpp +++ b/indra/newview/llfolderviewitem.cpp @@ -198,7 +198,9 @@ LLFolderViewItem* LLFolderViewItem::getPreviousOpenNode(BOOL include_children) } LLFolderViewItem* itemp = mParentFolder->getPreviousFromChild( this, include_children ); - while(itemp && !itemp->getVisible()) + + // Skip over items that are invisible or are hidden from the UI. + while(itemp && (!itemp->getVisible() || itemp->getDontShowInHierarchy())) { LLFolderViewItem* next_itemp = itemp->mParentFolder->getPreviousFromChild( itemp, include_children ); if (itemp == next_itemp) diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index bacc685130..e2bab7eef2 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -190,12 +190,7 @@ BOOL LLInvFVBridge::isItemRemovable() { return TRUE; } - if (gAgentWearables.isWearingItem(mUUID)) - { - return FALSE; - } - const LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); - if (avatar && avatar->isWearingAttachment(mUUID)) + if (get_is_item_worn(mUUID)) { return FALSE; } @@ -506,41 +501,6 @@ void hide_context_entries(LLMenuGL& menu, } } -bool isWornLink(LLUUID link_id) -{ - LLViewerInventoryItem *link = gInventory.getItem(link_id); - if (!link) - return false; - LLViewerInventoryItem *item = link->getLinkedItem(); - if (!item) - return false; - - switch(item->getType()) - { - case LLAssetType::AT_OBJECT: - { - LLVOAvatarSelf* my_avatar = gAgent.getAvatarObject(); - if(my_avatar && my_avatar->isWearingAttachment(item->getUUID())) - return true; - } - break; - - case LLAssetType::AT_BODYPART: - case LLAssetType::AT_CLOTHING: - if(gAgentWearables.isWearingItem(item->getUUID())) - return true; - break; - - case LLAssetType::AT_GESTURE: - if (LLGestureManager::instance().isGestureActive(item->getUUID())) - return true; - break; - default: - break; - } - return false; -} - // Helper for commonly-used entries void LLInvFVBridge::getClipboardEntries(bool show_asset_id, std::vector<std::string> &items, @@ -552,7 +512,7 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, if (is_sidepanel) { // Sidepanel includes restricted menu. - if (obj && obj->getIsLinkType() && !isWornLink(mUUID)) + if (obj && obj->getIsLinkType() && !get_is_item_worn(mUUID)) { items.push_back(std::string("Remove Link")); } @@ -606,15 +566,18 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, disabled_items.push_back(std::string("Paste")); } - items.push_back(std::string("Paste As Link")); - if (!isClipboardPasteableAsLink() || (flags & FIRST_SELECTED_ITEM) == 0) + if (gAgent.isGodlike()) { - disabled_items.push_back(std::string("Paste As Link")); + items.push_back(std::string("Paste As Link")); + if (!isClipboardPasteableAsLink() || (flags & FIRST_SELECTED_ITEM) == 0) + { + disabled_items.push_back(std::string("Paste As Link")); + } } items.push_back(std::string("Paste Separator")); - if (obj && obj->getIsLinkType() && !isWornLink(mUUID)) + if (obj && obj->getIsLinkType() && !get_is_item_worn(mUUID)) { items.push_back(std::string("Remove Link")); } @@ -1196,7 +1159,7 @@ LLFontGL::StyleFlags LLItemBridge::getLabelStyle() const { U8 font = LLFontGL::NORMAL; - if( gAgentWearables.isWearingItem( mUUID ) ) + if (get_is_item_worn(mUUID)) { // llinfos << "BOLD" << llendl; font |= LLFontGL::BOLD; @@ -1339,29 +1302,33 @@ BOOL LLItemBridge::isItemCopyable() const LLViewerInventoryItem* item = getItem(); if (item) { - // can't copy worn objects. DEV-15183 - LLVOAvatarSelf *avatarp = gAgent.getAvatarObject(); - if( !avatarp ) + // Can't copy worn objects. DEV-15183 + if(get_is_item_worn(mUUID)) { return FALSE; } - if(avatarp->isWearingAttachment(mUUID)) + // You can never copy a link. + if (item->getIsLinkType()) { return FALSE; } - // All items can be copied, not all can be pasted. - // The only time an item can't be copied is if it's a link - // return (item->getPermissions().allowCopyBy(gAgent.getID())); - if (item->getIsLinkType()) + if (gAgent.isGodlike()) { - return FALSE; + // All items can be copied in god mode since you can + // at least paste-as-link the item, though you + // still may not be able paste the item. + return TRUE; + } + else + { + return (item->getPermissions().allowCopyBy(gAgent.getID())); } - return TRUE; } return FALSE; } + BOOL LLItemBridge::copyToClipboard() const { if(isItemCopyable()) @@ -1681,23 +1648,10 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, for( i = 0; i < descendent_items.count(); i++ ) { LLInventoryItem* item = descendent_items[i]; - if( (item->getType() == LLAssetType::AT_CLOTHING) || - (item->getType() == LLAssetType::AT_BODYPART) ) + if (get_is_item_worn(item->getUUID())) { - if( gAgentWearables.isWearingItem( item->getUUID() ) ) - { - is_movable = FALSE; // It's generally movable, but not into the trash! - break; - } - } - else - if( item->getType() == LLAssetType::AT_OBJECT ) - { - if( avatar->isWearingAttachment( item->getUUID() ) ) - { - is_movable = FALSE; // It's generally movable, but not into the trash! - break; - } + is_movable = FALSE; + break; // It's generally movable, but not into the trash! } } } @@ -2512,7 +2466,10 @@ void LLFolderBridge::folderOptionsMenu() mItems.push_back(std::string("Wear As Ensemble")); } mItems.push_back(std::string("Remove From Outfit")); - + if (!areAnyContentsWorn(model)) + { + disabled_items.push_back(std::string("Remove From Outfit")); + } mItems.push_back(std::string("Outfit Separator")); } hide_context_entries(*mMenu, mItems, disabled_items); @@ -2534,6 +2491,35 @@ BOOL LLFolderBridge::checkFolderForContentsOfType(LLInventoryModel* model, LLInv return ((item_array.count() > 0) ? TRUE : FALSE ); } +class LLFindWorn : public LLInventoryCollectFunctor +{ +public: + LLFindWorn() {} + virtual ~LLFindWorn() {} + virtual bool operator()(LLInventoryCategory* cat, + LLInventoryItem* item) + { + if (item && get_is_item_worn(item->getUUID())) + { + return TRUE; + } + return FALSE; + } +}; + +BOOL LLFolderBridge::areAnyContentsWorn(LLInventoryModel* model) const +{ + LLInventoryModel::cat_array_t cat_array; + LLInventoryModel::item_array_t item_array; + LLFindWorn is_worn; + model->collectDescendentsIf(mUUID, + cat_array, + item_array, + LLInventoryModel::EXCLUDE_TRASH, + is_worn); + return (item_array.size() > 0); +} + // Flags unused void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { @@ -2977,19 +2963,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, if(is_movable && move_is_into_trash) { - switch(inv_item->getType()) - { - case LLAssetType::AT_CLOTHING: - case LLAssetType::AT_BODYPART: - is_movable = !gAgentWearables.isWearingItem(inv_item->getUUID()); - break; - - case LLAssetType::AT_OBJECT: - is_movable = !avatar->isWearingAttachment(inv_item->getUUID()); - break; - default: - break; - } + is_movable = inv_item->getIsLinkType() || !get_is_item_worn(inv_item->getUUID()); } if ( is_movable ) @@ -4056,8 +4030,7 @@ LLFontGL::StyleFlags LLObjectBridge::getLabelStyle() const { U8 font = LLFontGL::NORMAL; - LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); - if( avatar && avatar->isWearingAttachment( mUUID ) ) + if(get_is_item_worn( mUUID ) ) { font |= LLFontGL::BOLD; } @@ -4073,9 +4046,9 @@ LLFontGL::StyleFlags LLObjectBridge::getLabelStyle() const std::string LLObjectBridge::getLabelSuffix() const { - LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); - if( avatar && avatar->isWearingAttachment( mUUID ) ) + if (get_is_item_worn(mUUID)) { + LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); std::string attachment_point_name = avatar->getAttachedPointName(mUUID); // e.g. "(worn on ...)" / "(attached to ...)" @@ -4200,12 +4173,11 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) return; } - if( avatarp->isWearingAttachment( mUUID ) ) + if( get_is_item_worn( mUUID ) ) { items.push_back(std::string("Detach From Yourself")); } - else - if( !isInTrash() && !isLinkedObjectInTrash() && !isLinkedObjectMissing()) + else if (!isInTrash() && !isLinkedObjectInTrash() && !isLinkedObjectMissing()) { items.push_back(std::string("Attach Separator")); items.push_back(std::string("Object Wear")); @@ -4431,7 +4403,7 @@ void remove_inventory_category_from_avatar_step2( BOOL proceed, LLUUID category_ if (gAgent.isTeen() && item->isWearableType() && (item->getWearableType() == WT_UNDERPANTS || item->getWearableType() == WT_UNDERSHIRT)) continue; - if( gAgentWearables.isWearingItem (item->getLinkedUUID()) ) + if (get_is_item_worn(item->getUUID())) { LLWearableList::instance().getAsset(item->getAssetUUID(), item->getName(), @@ -4447,18 +4419,21 @@ void remove_inventory_category_from_avatar_step2( BOOL proceed, LLUUID category_ for(i = 0; i < obj_count; ++i) { LLViewerInventoryItem *obj_item = obj_item_array.get(i); - gMessageSystem->newMessageFast(_PREHASH_DetachAttachmentIntoInv); - gMessageSystem->nextBlockFast(_PREHASH_ObjectData ); - gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); - gMessageSystem->addUUIDFast(_PREHASH_ItemID, obj_item->getLinkedUUID() ); - - gMessageSystem->sendReliable( gAgent.getRegion()->getHost() ); - - // this object might have been selected, so let the selection manager know it's gone now - LLViewerObject *found_obj = gObjectList.findObject( obj_item->getLinkedUUID()); - if (found_obj) + if (get_is_item_worn(obj_item->getUUID())) { - LLSelectMgr::getInstance()->remove(found_obj); + gMessageSystem->newMessageFast(_PREHASH_DetachAttachmentIntoInv); + gMessageSystem->nextBlockFast(_PREHASH_ObjectData ); + gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); + gMessageSystem->addUUIDFast(_PREHASH_ItemID, obj_item->getLinkedUUID() ); + + gMessageSystem->sendReliable( gAgent.getRegion()->getHost() ); + + // this object might have been selected, so let the selection manager know it's gone now + LLViewerObject *found_obj = gObjectList.findObject( obj_item->getLinkedUUID()); + if (found_obj) + { + LLSelectMgr::getInstance()->remove(found_obj); + } } } } @@ -4468,7 +4443,7 @@ void remove_inventory_category_from_avatar_step2( BOOL proceed, LLUUID category_ for(i = 0; i < gest_count; ++i) { LLViewerInventoryItem *gest_item = gest_item_array.get(i); - if ( LLGestureManager::instance().isGestureActive( gest_item->getLinkedUUID()) ) + if (get_is_item_worn(gest_item->getUUID())) { LLGestureManager::instance().deactivateGesture( gest_item->getLinkedUUID() ); gInventory.updateItem( gest_item ); @@ -4482,7 +4457,7 @@ void remove_inventory_category_from_avatar_step2( BOOL proceed, LLUUID category_ BOOL LLWearableBridge::renameItem(const std::string& new_name) { - if( gAgentWearables.isWearingItem( mUUID ) ) + if (get_is_item_worn(mUUID)) { gAgentWearables.setWearableName( mUUID, new_name ); } @@ -4491,7 +4466,7 @@ BOOL LLWearableBridge::renameItem(const std::string& new_name) std::string LLWearableBridge::getLabelSuffix() const { - if( gAgentWearables.isWearingItem( mUUID ) ) + if (get_is_item_worn(mUUID)) { // e.g. "(worn)" return LLItemBridge::getLabelSuffix() + LLTrans::getString("worn"); @@ -4525,7 +4500,7 @@ void LLWearableBridge::performAction(LLFolderView* folder, LLInventoryModel* mod } else if (isRemoveAction(action)) { - if(gAgentWearables.isWearingItem(mUUID)) + if (get_is_item_worn(mUUID)) { LLViewerInventoryItem* item = getItem(); if (item) @@ -4556,7 +4531,7 @@ void LLWearableBridge::openItem() } else if(isAgentInventory()) { - if( !gAgentWearables.isWearingItem( mUUID ) ) + if( !get_is_item_worn( mUUID ) ) { wearOnAvatar(); } @@ -4656,7 +4631,7 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags) case LLAssetType::AT_CLOTHING: items.push_back(std::string("Take Off")); case LLAssetType::AT_BODYPART: - if (gAgentWearables.isWearingItem(item->getUUID())) + if (get_is_item_worn(item->getUUID())) { disabled_items.push_back(std::string("Wearable Wear")); disabled_items.push_back(std::string("Wearable Add")); @@ -4687,7 +4662,7 @@ BOOL LLWearableBridge::canWearOnAvatar(void* user_data) LLViewerInventoryItem* item = (LLViewerInventoryItem*)self->getItem(); if(!item || !item->isComplete()) return FALSE; } - return (!gAgentWearables.isWearingItem(self->mUUID)); + return (!get_is_item_worn(self->mUUID)); } // Called from menus @@ -4819,7 +4794,7 @@ BOOL LLWearableBridge::canEditOnAvatar(void* user_data) LLWearableBridge* self = (LLWearableBridge*)user_data; if(!self) return FALSE; - return (gAgentWearables.isWearingItem(self->mUUID)); + return (get_is_item_worn(self->mUUID)); } // static @@ -4856,7 +4831,7 @@ BOOL LLWearableBridge::canRemoveFromAvatar(void* user_data) LLWearableBridge* self = (LLWearableBridge*)user_data; if( self && (LLAssetType::AT_BODYPART != self->mAssetType) ) { - return gAgentWearables.isWearingItem( self->mUUID ); + return get_is_item_worn( self->mUUID ); } return FALSE; } @@ -4866,7 +4841,7 @@ void LLWearableBridge::onRemoveFromAvatar(void* user_data) { LLWearableBridge* self = (LLWearableBridge*)user_data; if(!self) return; - if(gAgentWearables.isWearingItem(self->mUUID)) + if(get_is_item_worn(self->mUUID)) { LLViewerInventoryItem* item = self->getItem(); if (item) @@ -4889,7 +4864,7 @@ void LLWearableBridge::onRemoveFromAvatarArrived(LLWearable* wearable, const LLUUID &item_id = gInventory.getLinkedItemID(on_remove_struct->mUUID); if(wearable) { - if( gAgentWearables.isWearingItem( item_id ) ) + if( get_is_item_worn( item_id ) ) { EWearableType type = wearable->getType(); @@ -5099,8 +5074,9 @@ void LLAnimationBridgeAction::doIt() //virtual void LLObjectBridgeAction::doIt() { + /* LLFloaterReg::showInstance("properties", mUUID); - + */ LLInvFVBridgeAction::doIt(); } @@ -5172,7 +5148,7 @@ void LLWearableBridgeAction::doIt() } else if(isAgentInventory()) { - if(!gAgentWearables.isWearingItem(mUUID)) + if(!get_is_item_worn(mUUID)) { wearOnAvatar(); } diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index 117e32c6be..54eb27db39 100644 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -339,6 +339,7 @@ protected: static void createNewEyes(void* user_data); BOOL checkFolderForContentsOfType(LLInventoryModel* model, LLInventoryCollectFunctor& typeToCheck); + BOOL areAnyContentsWorn(LLInventoryModel* model) const; void modifyOutfit(BOOL append); void determineFolderType(); diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 75218e98e0..8f4136c01f 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -338,3 +338,33 @@ LLUIImagePtr get_item_icon(LLAssetType::EType asset_type, const std::string& icon_name = get_item_icon_name(asset_type, inventory_type, attachment_point, item_is_multi ); return LLUI::getUIImage(icon_name); } + +BOOL get_is_item_worn(const LLUUID& id) +{ + const LLViewerInventoryItem* item = gInventory.getItem(id); + if (!item) + return FALSE; + + switch(item->getType()) + { + case LLAssetType::AT_OBJECT: + { + const LLVOAvatarSelf* my_avatar = gAgent.getAvatarObject(); + if(my_avatar && my_avatar->isWearingAttachment(item->getLinkedUUID())) + return TRUE; + break; + } + case LLAssetType::AT_BODYPART: + case LLAssetType::AT_CLOTHING: + if(gAgentWearables.isWearingItem(item->getLinkedUUID())) + return TRUE; + break; + case LLAssetType::AT_GESTURE: + if (LLGestureManager::instance().isGestureActive(item->getLinkedUUID())) + return TRUE; + break; + default: + break; + } + return FALSE; +} diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h index 9916a2351c..968db84819 100644 --- a/indra/newview/llinventoryfunctions.h +++ b/indra/newview/llinventoryfunctions.h @@ -41,7 +41,9 @@ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // This is a collection of miscellaneous functions and classes -// that don't fit cleanly into any other class header. +// that don't fit cleanly into any other class header. Eventually, +// we should figure out where to put these functions so that we can +// get rid of this generic file. // //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -98,14 +100,17 @@ public: }; const std::string& get_item_icon_name(LLAssetType::EType asset_type, - LLInventoryType::EType inventory_type, - U32 attachment_point, - BOOL item_is_multi ); + LLInventoryType::EType inventory_type, + U32 attachment_point, + BOOL item_is_multi ); LLUIImagePtr get_item_icon(LLAssetType::EType asset_type, - LLInventoryType::EType inventory_type, - U32 attachment_point, - BOOL item_is_multi ); + LLInventoryType::EType inventory_type, + U32 attachment_point, + BOOL item_is_multi ); + +// Is this item or its baseitem is worn, attached, etc... +BOOL get_is_item_worn(const LLUUID& id); #endif // LL_LLINVENTORYFUNCTIONS_H diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 93702bf5dc..f1ae573c32 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -633,6 +633,20 @@ class LLAdvancedCheckHUDInfo : public view_listener_t } }; + +////////////// +// FLYING // +////////////// + +class LLAdvancedAgentFlyingInfo : public view_listener_t +{ + bool handleEvent(const LLSD&) + { + return gAgent.getFlying(); + } +}; + + /////////////////////// // CLEAR GROUP CACHE // /////////////////////// @@ -7703,6 +7717,9 @@ void initialize_menus() // Advanced Other Settings view_listener_t::addMenu(new LLAdvancedClearGroupCache(), "Advanced.ClearGroupCache"); + // Advanced > Shortcuts + view_listener_t::addMenu(new LLAdvancedAgentFlyingInfo(), "Agent.getFlying"); + // Advanced > Render > Types view_listener_t::addMenu(new LLAdvancedToggleRenderType(), "Advanced.ToggleRenderType"); view_listener_t::addMenu(new LLAdvancedCheckRenderType(), "Advanced.CheckRenderType"); |