summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorMaxim Nikolenko <maximnproductengine@lindenlab.com>2023-04-13 17:49:26 +0300
committerMaxim Nikolenko <maximnproductengine@lindenlab.com>2023-04-13 17:49:26 +0300
commit107a7eb919bb0afadf6ad3f92482cf7e6d67c56e (patch)
treef01c774bd61274661f8504812f5ad2b563953a27 /indra/newview
parentc3d22fba600a6c40268dfbec15ec1fe145cbbb1d (diff)
SL-19544 WIP add active suffix for gestures and add appropriate context menu handling
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llinventorygallery.cpp54
-rw-r--r--indra/newview/llinventorygallery.h17
-rw-r--r--indra/newview/llinventorygallerymenu.cpp33
-rw-r--r--indra/newview/skins/default/xui/en/panel_inventory_gallery_item.xml1
4 files changed, 103 insertions, 2 deletions
diff --git a/indra/newview/llinventorygallery.cpp b/indra/newview/llinventorygallery.cpp
index 9766a39e3c..9344668f52 100644
--- a/indra/newview/llinventorygallery.cpp
+++ b/indra/newview/llinventorygallery.cpp
@@ -92,6 +92,9 @@ LLInventoryGallery::LLInventoryGallery(const LLInventoryGallery::Params& p)
mThumbnailsObserver = new LLThumbnailsObserver();
gInventory.addObserver(mThumbnailsObserver);
+ mGestureObserver = new LLGalleryGestureObserver(this);
+ LLGestureMgr::instance().addObserver(mGestureObserver);
+
mUsername = gAgentUsername;
LLStringUtil::toUpper(mUsername);
}
@@ -154,6 +157,9 @@ LLInventoryGallery::~LLInventoryGallery()
gInventory.removeObserver(mThumbnailsObserver);
}
delete mThumbnailsObserver;
+
+ LLGestureMgr::instance().removeObserver(mGestureObserver);
+ delete mGestureObserver;
}
void LLInventoryGallery::setRootFolder(const LLUUID cat_id)
@@ -701,7 +707,14 @@ void LLInventoryGallery::updateAddedItem(LLUUID item_id)
{
inventory_type = inv_item->getInventoryType();
misc_flags = inv_item->getFlags();
- is_worn = LLAppearanceMgr::instance().isLinkedInCOF(item_id);
+ if (LLAssetType::AT_GESTURE == obj->getType())
+ {
+ is_worn = LLGestureMgr::instance().isGestureActive(item_id);
+ }
+ else
+ {
+ is_worn = LLAppearanceMgr::instance().isLinkedInCOF(item_id);
+ }
}
else if (LLAssetType::AT_CATEGORY == obj->getType())
{
@@ -943,6 +956,37 @@ void LLInventoryGallery::onCOFChanged()
}
}
+void LLInventoryGallery::onGesturesChanged()
+{
+ uuid_vec_t vnew;
+ uuid_vec_t vadded;
+ uuid_vec_t vremoved;
+
+ const LLGestureMgr::item_map_t& active_gestures = LLGestureMgr::instance().getActiveGestures();
+ for (LLGestureMgr::item_map_t::const_iterator iter = active_gestures.begin();
+ iter != active_gestures.end();
+ ++iter)
+ {
+ vnew.push_back(iter->first);
+ }
+
+ LLCommonUtils::computeDifference(vnew, mActiveGestures, vadded, vremoved);
+
+ mActiveGestures = vnew;
+
+ for (uuid_vec_t::const_iterator iter = vadded.begin();
+ iter != vadded.end();
+ ++iter)
+ {
+ updateWornItem(*iter, true);
+ }
+
+ for (uuid_vec_t::const_iterator iter = vremoved.begin(); iter != vremoved.end(); ++iter)
+ {
+ updateWornItem(*iter, false);
+ }
+}
+
void LLInventoryGallery::deselectItem(const LLUUID& category_id)
{
// Reset selection if the item is selected.
@@ -1353,7 +1397,13 @@ BOOL LLInventoryGalleryItem::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL dro
void LLInventoryGalleryItem::setWorn(bool value)
{
mWorn = value;
- mSuffixText->setValue(mWorn ? getString("worn_string") : "");
+ std::string suffix("");
+
+ if(mWorn)
+ {
+ suffix = (mType == LLAssetType::AT_GESTURE) ? getString("active_string") : getString("worn_string");
+ }
+ mSuffixText->setValue(suffix);
mNameText->setFont(getTextFont());
mNameText->setText(mName); // refresh to pick up font changes
diff --git a/indra/newview/llinventorygallery.h b/indra/newview/llinventorygallery.h
index 6bca8a0dc5..f0f4c45e04 100644
--- a/indra/newview/llinventorygallery.h
+++ b/indra/newview/llinventorygallery.h
@@ -27,6 +27,7 @@
#ifndef LL_LLINVENTORYGALLERY_H
#define LL_LLINVENTORYGALLERY_H
+#include "llgesturemgr.h"
#include "lllistcontextmenu.h"
#include "llpanel.h"
#include "llinventoryfilter.h"
@@ -38,6 +39,7 @@ class LLInventoryGalleryItem;
class LLScrollContainer;
class LLTextBox;
class LLThumbnailsObserver;
+class LLGalleryGestureObserver;
class LLInventoryGalleryContextMenu;
@@ -110,6 +112,7 @@ public:
void refreshList(const LLUUID& category_id);
void onCOFChanged();
+ void onGesturesChanged();
void computeDifference(const LLInventoryModel::cat_array_t vcats, const LLInventoryModel::item_array_t vitems, uuid_vec_t& vadded, uuid_vec_t& vremoved);
void deselectItem(const LLUUID& category_id);
@@ -133,6 +136,7 @@ protected:
LLInventoryCategoriesObserver* mCategoriesObserver;
LLThumbnailsObserver* mThumbnailsObserver;
+ LLGalleryGestureObserver* mGestureObserver;
LLUUID mSelectedItemID;
bool mIsInitialized;
@@ -199,6 +203,7 @@ private:
typedef std::map<LLUUID, LLInventoryGalleryItem*> gallery_item_map_t;
gallery_item_map_t mItemMap;
uuid_vec_t mCOFLinkedItems;
+ uuid_vec_t mActiveGestures;
std::map<LLInventoryGalleryItem*, S32> mItemIndexMap;
LLInventoryFilter::ESearchType mSearchType;
@@ -257,6 +262,7 @@ public:
void setHidden(bool hidden) {mHidden = hidden;}
void setType(LLAssetType::EType type, LLInventoryType::EType inventory_type, U32 flags, bool is_link);
+ LLAssetType::EType getAssetType() { return mType; }
void setThumbnail(LLUUID id);
void setGallery(LLInventoryGallery* gallery) { mGallery = gallery; }
bool isFolder() { return mIsFolder; }
@@ -314,4 +320,15 @@ protected:
item_map_t mItemMap;
};
+class LLGalleryGestureObserver : public LLGestureManagerObserver
+{
+public:
+ LLGalleryGestureObserver(LLInventoryGallery* gallery) : mGallery(gallery) {}
+ virtual ~LLGalleryGestureObserver() {}
+ virtual void changed() { mGallery->onGesturesChanged(); }
+
+private:
+ LLInventoryGallery* mGallery;
+};
+
#endif
diff --git a/indra/newview/llinventorygallerymenu.cpp b/indra/newview/llinventorygallerymenu.cpp
index e91ec78730..84b18c1517 100644
--- a/indra/newview/llinventorygallerymenu.cpp
+++ b/indra/newview/llinventorygallerymenu.cpp
@@ -314,6 +314,26 @@ void LLInventoryGalleryContextMenu::doToSelected(const LLSD& userdata, const LLU
{
LLAppearanceMgr::instance().wearItemOnAvatar(selected_id, true, true);
}
+ else if ("activate" == action)
+ {
+ LLGestureMgr::instance().activateGesture(selected_id);
+
+ LLViewerInventoryItem* item = gInventory.getItem(selected_id);
+ if (!item) return;
+
+ gInventory.updateItem(item);
+ gInventory.notifyObservers();
+ }
+ else if ("deactivate" == action)
+ {
+ LLGestureMgr::instance().deactivateGesture(selected_id);
+
+ LLViewerInventoryItem* item = gInventory.getItem(selected_id);
+ if (!item) return;
+
+ gInventory.updateItem(item);
+ gInventory.notifyObservers();
+ }
}
void LLInventoryGalleryContextMenu::onRename(const LLSD& notification, const LLSD& response)
@@ -590,6 +610,19 @@ void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* men
disabled_items.push_back(std::string("Open"));
disabled_items.push_back(std::string("Open Original"));
}
+
+ if(LLAssetType::AT_GESTURE == obj->getType())
+ {
+ items.push_back(std::string("Gesture Separator"));
+ if(!LLGestureMgr::instance().isGestureActive(selected_id))
+ {
+ items.push_back(std::string("Activate"));
+ }
+ else
+ {
+ items.push_back(std::string("Deactivate"));
+ }
+ }
}
else if(LLAssetType::AT_LANDMARK == obj->getType())
{
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 b343aafca5..e7589f889f 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
@@ -14,6 +14,7 @@
left="0"
top="0">
<string name="worn_string">(worn)</string>
+ <string name="active_string">(active)</string>
<thumbnail
name="preview_thumbnail"
fallback_image="Thumbnail_Fallback"