summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2024-05-09 23:51:11 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2024-05-16 15:16:13 +0300
commit738cf84c340d8ade3ab462340d1444c4e70ef9f5 (patch)
tree07bb35f01c09d0598f57261f8a976fb7559e244b /indra/newview
parent50b93bd83af7cc4ddbd5b8b68f20099dac5f5ed2 (diff)
viewer#1424 Favorite support for items in outfits
For now marking originals, pointless to marks links in COF, needs a revision due to inconsistency with inventory
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llinventoryfunctions.cpp13
-rw-r--r--indra/newview/llinventoryfunctions.h1
-rw-r--r--indra/newview/llpanelwearing.cpp10
-rw-r--r--indra/newview/llwearableitemslist.cpp15
-rw-r--r--indra/newview/skins/default/xui/en/menu_wearable_list_item.xml14
-rw-r--r--indra/newview/skins/default/xui/en/menu_wearing_tab.xml14
6 files changed, 66 insertions, 1 deletions
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index 123d47b474..3e19bf885d 100644
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -2427,6 +2427,19 @@ void toggle_favorite(const LLUUID& obj_id)
}
}
+void toggle_linked_favorite(const LLUUID& obj_id)
+{
+ LLViewerInventoryItem* item = gInventory.getItem(obj_id);
+ if (!item)
+ {
+ LL_WARNS() << "Invalid item" << LL_ENDL;
+ return;
+ }
+
+ LLUUID linked_id = item->getLinkedUUID();
+ toggle_favorite(linked_id);
+}
+
std::string get_searchable_description(LLInventoryModel* model, const LLUUID& item_id)
{
if (model)
diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h
index fe05e30353..681d5e1611 100644
--- a/indra/newview/llinventoryfunctions.h
+++ b/indra/newview/llinventoryfunctions.h
@@ -116,6 +116,7 @@ void new_folder_window(const LLUUID& folder_id);
void ungroup_folder_items(const LLUUID& folder_id);
void set_favorite(const LLUUID& obj_id, bool favorite);
void toggle_favorite(const LLUUID& obj_id);
+void toggle_linked_favorite(const LLUUID& obj_id);
std::string get_searchable_description(LLInventoryModel* model, const LLUUID& item_id);
std::string get_searchable_creator_name(LLInventoryModel* model, const LLUUID& item_id);
std::string get_searchable_UUID(LLInventoryModel* model, const LLUUID& item_id);
diff --git a/indra/newview/llpanelwearing.cpp b/indra/newview/llpanelwearing.cpp
index b66c546f9b..aecdf13495 100644
--- a/indra/newview/llpanelwearing.cpp
+++ b/indra/newview/llpanelwearing.cpp
@@ -113,6 +113,7 @@ protected:
boost::bind(&LLAppearanceMgr::removeItemsFromAvatar, LLAppearanceMgr::getInstance(), mUUIDs));
registrar.add("Wearing.Detach",
boost::bind(&LLAppearanceMgr::removeItemsFromAvatar, LLAppearanceMgr::getInstance(), mUUIDs));
+ registrar.add("Wearing.Favorite", boost::bind(toggle_linked_favorite, mUUIDs.front()));
LLContextMenu* menu = createFromFile("menu_wearing_tab.xml");
updateMenuItemsVisibility(menu);
@@ -125,6 +126,8 @@ protected:
bool bp_selected = false; // true if body parts selected
bool clothes_selected = false;
bool attachments_selected = false;
+ bool can_favorite = false;
+ bool can_unfavorite = false;
// See what types of wearables are selected.
for (uuid_vec_t::const_iterator it = mUUIDs.begin(); it != mUUIDs.end(); ++it)
@@ -137,6 +140,9 @@ protected:
continue;
}
+ LLUUID linked_id = item->getLinkedUUID();
+ LLViewerInventoryItem* linked_item = gInventory.getItem(linked_id);
+
LLAssetType::EType type = item->getType();
if (type == LLAssetType::AT_CLOTHING)
{
@@ -150,6 +156,8 @@ protected:
{
attachments_selected = true;
}
+ can_favorite |= !linked_item->getIsFavorite();
+ can_unfavorite |= linked_item->getIsFavorite();
}
// Enable/disable some menu items depending on the selection.
@@ -166,6 +174,8 @@ protected:
menu->setItemVisible("detach", allow_detach);
menu->setItemVisible("edit_outfit_separator", show_touch | show_edit | allow_take_off || allow_detach);
menu->setItemVisible("show_original", mUUIDs.size() == 1);
+ menu->setItemVisible("favorites_add", can_favorite);
+ menu->setItemVisible("favorites_remove", can_unfavorite);
}
};
diff --git a/indra/newview/llwearableitemslist.cpp b/indra/newview/llwearableitemslist.cpp
index 948fe55e0d..0576862dfb 100644
--- a/indra/newview/llwearableitemslist.cpp
+++ b/indra/newview/llwearableitemslist.cpp
@@ -936,6 +936,7 @@ LLContextMenu* LLWearableItemsList::ContextMenu::createMenu()
// Register handlers for attachments.
registrar.add("Attachment.Detach",
boost::bind(&LLAppearanceMgr::removeItemsFromAvatar, LLAppearanceMgr::getInstance(), ids));
+ registrar.add("Attachment.Favorite", boost::bind(toggle_linked_favorite, selected_id));
registrar.add("Attachment.Touch", boost::bind(handle_attachment_touch, selected_id));
registrar.add("Attachment.Profile", boost::bind(show_item_profile, selected_id));
registrar.add("Object.Attach", boost::bind(LLViewerAttachMenu::attachObjects, ids, _2));
@@ -967,6 +968,7 @@ void LLWearableItemsList::ContextMenu::updateItemsVisibility(LLContextMenu* menu
U32 n_links = 0; // number of links among the selected items
U32 n_editable = 0; // number of editable items among the selected ones
U32 n_touchable = 0; // number of touchable items among the selected ones
+ U32 n_favorites = 0; // number of favorite items among the selected ones
bool can_be_worn = true;
@@ -990,6 +992,11 @@ void LLWearableItemsList::ContextMenu::updateItemsVisibility(LLContextMenu* menu
const bool is_editable = get_is_item_editable(id);
const bool is_touchable = enable_attachment_touch(id);
const bool is_already_worn = gAgentWearables.selfHasWearable(wearable_type);
+
+ LLUUID linked_id = item->getLinkedUUID();
+ LLViewerInventoryItem* linked_item = gInventory.getItem(linked_id);
+ const bool is_favorite = linked_item->getIsFavorite();
+
if (is_worn)
{
++n_worn;
@@ -1010,10 +1017,14 @@ void LLWearableItemsList::ContextMenu::updateItemsVisibility(LLContextMenu* menu
{
++n_already_worn;
}
+ if (is_favorite)
+ {
+ ++n_favorites;
+ }
if (can_be_worn)
{
- can_be_worn = get_can_item_be_worn(item->getLinkedUUID());
+ can_be_worn = get_can_item_be_worn(linked_id);
}
} // for
@@ -1035,6 +1046,8 @@ void LLWearableItemsList::ContextMenu::updateItemsVisibility(LLContextMenu* menu
setMenuItemEnabled(menu, "create_new", LLAppearanceMgr::instance().canAddWearables(ids));
setMenuItemVisible(menu, "show_original", !standalone);
setMenuItemEnabled(menu, "show_original", n_items == 1 && n_links == n_items);
+ setMenuItemVisible(menu, "favorites_add", n_favorites < n_items);
+ setMenuItemVisible(menu, "favorites_remove", n_favorites > 0);
setMenuItemVisible(menu, "take_off", mask == MASK_CLOTHING && n_worn == n_items);
setMenuItemVisible(menu, "detach", mask == MASK_ATTACHMENT && n_worn == n_items);
setMenuItemVisible(menu, "take_off_or_detach", mask == (MASK_ATTACHMENT|MASK_CLOTHING));
diff --git a/indra/newview/skins/default/xui/en/menu_wearable_list_item.xml b/indra/newview/skins/default/xui/en/menu_wearable_list_item.xml
index ee77ef23f0..63d37edf38 100644
--- a/indra/newview/skins/default/xui/en/menu_wearable_list_item.xml
+++ b/indra/newview/skins/default/xui/en/menu_wearable_list_item.xml
@@ -80,6 +80,20 @@
function="Attachment.Profile" />
</menu_item_call>
<menu_item_call
+ label="Add to favorites"
+ layout="topleft"
+ name="favorites_add">
+ <on_click
+ function="Attachment.Favorite" />
+ </menu_item_call>
+ <menu_item_call
+ label="Remove from favorites"
+ layout="topleft"
+ name="favorites_remove">
+ <on_click
+ function="Attachment.Favorite" />
+ </menu_item_call>
+ <menu_item_call
label="Show Original"
layout="topleft"
visible="false"
diff --git a/indra/newview/skins/default/xui/en/menu_wearing_tab.xml b/indra/newview/skins/default/xui/en/menu_wearing_tab.xml
index 321e8a0831..9a752a1643 100644
--- a/indra/newview/skins/default/xui/en/menu_wearing_tab.xml
+++ b/indra/newview/skins/default/xui/en/menu_wearing_tab.xml
@@ -31,6 +31,20 @@
function="Wearing.Detach"
parameter="detach"/>
</menu_item_call>
+ <menu_item_call
+ label="Add to favorites"
+ layout="topleft"
+ name="favorites_add">
+ <on_click
+ function="Wearing.Favorite" />
+ </menu_item_call>
+ <menu_item_call
+ label="Remove from favorites"
+ layout="topleft"
+ name="favorites_remove">
+ <on_click
+ function="Wearing.Favorite" />
+ </menu_item_call>
<menu_item_separator
layout="topleft"
name="edit_outfit_separator" />