diff options
author | Maxim Nikolenko <maximnproductengine@lindenlab.com> | 2023-03-24 12:56:57 +0200 |
---|---|---|
committer | Maxim Nikolenko <maximnproductengine@lindenlab.com> | 2023-03-24 12:56:57 +0200 |
commit | d733ee60ea1d7cd7a9259c188b7b942a41d24460 (patch) | |
tree | 475a5b59c3e0864d5dbcaed361600a9a7c6a1433 | |
parent | 1800e969c5fa443f18ea4b01e59840e4bbf2afeb (diff) |
SL-19379 WIP add double-click attach action for objects; add icon link overlays
-rw-r--r-- | indra/newview/llinventorybridge.cpp | 27 | ||||
-rw-r--r-- | indra/newview/llinventorygallery.cpp | 14 | ||||
-rw-r--r-- | indra/newview/llinventorygallery.h | 4 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_inventory_gallery_item.xml | 10 |
4 files changed, 44 insertions, 11 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 0cd1e9bf44..1fac4dd1ad 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -7575,13 +7575,26 @@ class LLObjectBridgeAction: public LLInvFVBridgeAction public: virtual void doIt() { - LLInvFVBridgeAction::doIt(); + attachOrDetach(); } virtual ~LLObjectBridgeAction(){} protected: LLObjectBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {} + void attachOrDetach(); }; +void LLObjectBridgeAction::attachOrDetach() +{ + if (get_is_item_worn(mUUID)) + { + LLAppearanceMgr::instance().removeItemFromAvatar(mUUID); + } + else + { + LLAppearanceMgr::instance().wearItemOnAvatar(mUUID, true, false); // Don't replace if adding. + } +} + class LLLSLTextBridgeAction: public LLInvFVBridgeAction { friend class LLInvFVBridgeAction; @@ -7640,7 +7653,17 @@ void LLWearableBridgeAction::wearOnAvatar() LLViewerInventoryItem* item = getItem(); if(item) { - LLAppearanceMgr::instance().wearItemOnAvatar(item->getUUID(), true, true); + if (get_is_item_worn(mUUID)) + { + if(item->getType() != LLAssetType::AT_BODYPART) + { + LLAppearanceMgr::instance().removeItemFromAvatar(item->getUUID()); + } + } + else + { + LLAppearanceMgr::instance().wearItemOnAvatar(item->getUUID(), true, true); + } } } diff --git a/indra/newview/llinventorygallery.cpp b/indra/newview/llinventorygallery.cpp index 86f60b5644..c2594c1b87 100644 --- a/indra/newview/llinventorygallery.cpp +++ b/indra/newview/llinventorygallery.cpp @@ -458,7 +458,7 @@ void LLInventoryGallery::removeFromLastRow(LLInventoryGalleryItem* item) mItemPanels.pop_back(); } -LLInventoryGalleryItem* LLInventoryGallery::buildGalleryItem(std::string name, LLUUID item_id, LLAssetType::EType type, LLUUID thumbnail_id) +LLInventoryGalleryItem* LLInventoryGallery::buildGalleryItem(std::string name, LLUUID item_id, LLAssetType::EType type, LLUUID thumbnail_id, bool is_link) { LLInventoryGalleryItem::Params giparams; LLInventoryGalleryItem* gitem = LLUICtrlFactory::create<LLInventoryGalleryItem>(giparams); @@ -469,7 +469,7 @@ LLInventoryGalleryItem* LLInventoryGallery::buildGalleryItem(std::string name, L gitem->setName(name); gitem->setUUID(item_id); gitem->setGallery(this); - gitem->setType(type); + gitem->setType(type, is_link); gitem->setThumbnail(thumbnail_id); return gitem; } @@ -593,7 +593,7 @@ void LLInventoryGallery::updateAddedItem(LLUUID item_id) thumbnail_id = getOutfitImageID(item_id); } - LLInventoryGalleryItem* item = buildGalleryItem(obj->getName(), item_id, obj->getType(), thumbnail_id); + LLInventoryGalleryItem* item = buildGalleryItem(obj->getName(), item_id, obj->getType(), thumbnail_id, obj->getIsLinkType()); mItemMap.insert(LLInventoryGallery::gallery_item_map_t::value_type(item_id, item)); item->setFocusReceivedCallback(boost::bind(&LLInventoryGallery::onChangeItemSelection, this, item_id)); @@ -902,7 +902,7 @@ BOOL LLInventoryGalleryItem::postBuild() return TRUE; } -void LLInventoryGalleryItem::setType(LLAssetType::EType type) +void LLInventoryGalleryItem::setType(LLAssetType::EType type, bool is_link) { mType = type; mIsFolder = (mType == LLAssetType::AT_CATEGORY); @@ -929,6 +929,7 @@ void LLInventoryGalleryItem::setType(LLAssetType::EType type) } getChild<LLIconCtrl>("item_type")->setValue(icon_name); + getChild<LLIconCtrl>("link_overlay")->setVisible(is_link); } void LLInventoryGalleryItem::setThumbnail(LLUUID id) @@ -1002,7 +1003,7 @@ BOOL LLInventoryGalleryItem::handleHover(S32 x, S32 y, MASK mask) { S32 screen_x; S32 screen_y; - const LLInventoryItem *item = gInventory.getItem(mUUID);; + const LLInventoryItem *item = gInventory.getItem(mUUID); localPointToScreen(x, y, &screen_x, &screen_y ); if(item && LLToolDragAndDrop::getInstance()->isOverThreshold(screen_x, screen_y)) @@ -1028,8 +1029,7 @@ BOOL LLInventoryGalleryItem::handleDoubleClick(S32 x, S32 y, MASK mask) } else { - LLInvFVBridgeAction::doAction(mUUID,&gInventory); - //todo: some item types require different handling + LLInvFVBridgeAction::doAction(mUUID, &gInventory); } return TRUE; diff --git a/indra/newview/llinventorygallery.h b/indra/newview/llinventorygallery.h index 0a779037db..1c45a8345f 100644 --- a/indra/newview/llinventorygallery.h +++ b/indra/newview/llinventorygallery.h @@ -136,7 +136,7 @@ private: void updateRowsIfNeeded(); void updateGalleryWidth(); - LLInventoryGalleryItem* buildGalleryItem(std::string name, LLUUID item_id, LLAssetType::EType type, LLUUID thumbnail_id); + LLInventoryGalleryItem* buildGalleryItem(std::string name, LLUUID item_id, LLAssetType::EType type, LLUUID thumbnail_id, bool is_link); void buildGalleryPanel(int row_count); void reshapeGalleryPanel(int row_count); @@ -219,7 +219,7 @@ public: bool isHidden() {return mHidden;} void setHidden(bool hidden) {mHidden = hidden;} - void setType(LLAssetType::EType type); + void setType(LLAssetType::EType type, bool is_link); void setThumbnail(LLUUID id); void setGallery(LLInventoryGallery* gallery) { mGallery = gallery; } bool isFolder() { return mIsFolder; } diff --git a/indra/newview/skins/default/xui/en/panel_inventory_gallery_item.xml b/indra/newview/skins/default/xui/en/panel_inventory_gallery_item.xml index c180024aa7..73889af71a 100644 --- a/indra/newview/skins/default/xui/en/panel_inventory_gallery_item.xml +++ b/indra/newview/skins/default/xui/en/panel_inventory_gallery_item.xml @@ -33,6 +33,16 @@ follows="left|top" visible="true" image_name="Inv_Eye"/> + <icon + left="5" + top_pad="-8" + layout="topleft" + name="link_overlay" + height="8" + width="6" + follows="left|top" + visible="false" + image_name="Inv_Link"/> <panel background_visible="false" background_opaque="true" |