summaryrefslogtreecommitdiff
path: root/indra/newview/llgesturemgr.cpp
diff options
context:
space:
mode:
authorRichard Nelson <richard@lindenlab.com>2009-08-04 01:12:59 +0000
committerRichard Nelson <richard@lindenlab.com>2009-08-04 01:12:59 +0000
commiteb853f55c07ae4a3c3f2aa05fbabcf2e4b4dc115 (patch)
tree7707fccb8d0946b6257d5ed7c5dfd3941c53eec0 /indra/newview/llgesturemgr.cpp
parentdb5cda26676f376f18816013c0c5e3fbad5b20d0 (diff)
svn merge -r 128442:129343 svn+ssh://svn.lindenlab.com/svn/linden/branches/skinning/skinning-18 into svn+ssh://svn.lindenlab.com/svn/linden/branches/viewer/viewer-2.0.0-3
Diffstat (limited to 'indra/newview/llgesturemgr.cpp')
-rw-r--r--indra/newview/llgesturemgr.cpp57
1 files changed, 43 insertions, 14 deletions
diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp
index eb2c6768f3..69498d3099 100644
--- a/indra/newview/llgesturemgr.cpp
+++ b/indra/newview/llgesturemgr.cpp
@@ -58,8 +58,6 @@
#include "llviewerstats.h"
#include "llnearbychatbar.h"
-LLGestureManager gGestureManager;
-
// Longest time, in seconds, to wait for all animations to stop playing
const F32 MAX_WAIT_ANIM_SECS = 30.f;
@@ -71,7 +69,9 @@ LLGestureManager::LLGestureManager()
mPlaying(),
mActive(),
mLoadingCount(0)
-{ }
+{
+ gInventory.addObserver(this);
+}
// We own the data for gestures, so clean them up.
@@ -85,6 +85,7 @@ LLGestureManager::~LLGestureManager()
delete gesture;
gesture = NULL;
}
+ gInventory.removeObserver(this);
}
@@ -442,7 +443,7 @@ void LLGestureManager::replaceGesture(const LLUUID& item_id, LLMultiGesture* new
void LLGestureManager::replaceGesture(const LLUUID& item_id, const LLUUID& new_asset_id)
{
- item_map_t::iterator it = gGestureManager.mActive.find(item_id);
+ item_map_t::iterator it = LLGestureManager::instance().mActive.find(item_id);
if (it == mActive.end())
{
llwarns << "replaceGesture for inactive gesture " << item_id << llendl;
@@ -451,7 +452,7 @@ void LLGestureManager::replaceGesture(const LLUUID& item_id, const LLUUID& new_a
// mActive owns this gesture pointer, so clean up memory.
LLMultiGesture* gesture = (*it).second;
- gGestureManager.replaceGesture(item_id, gesture, new_asset_id);
+ LLGestureManager::instance().replaceGesture(item_id, gesture, new_asset_id);
}
void LLGestureManager::playGesture(LLMultiGesture* gesture)
@@ -921,7 +922,7 @@ void LLGestureManager::onLoadComplete(LLVFS *vfs,
delete info;
info = NULL;
- gGestureManager.mLoadingCount--;
+ LLGestureManager::instance().mLoadingCount--;
if (0 == status)
{
@@ -943,22 +944,34 @@ void LLGestureManager::onLoadComplete(LLVFS *vfs,
{
if (deactivate_similar)
{
- gGestureManager.deactivateSimilarGestures(gesture, item_id);
+ LLGestureManager::instance().deactivateSimilarGestures(gesture, item_id);
// Display deactivation message if this was the last of the bunch.
- if (gGestureManager.mLoadingCount == 0
- && gGestureManager.mDeactivateSimilarNames.length() > 0)
+ if (LLGestureManager::instance().mLoadingCount == 0
+ && LLGestureManager::instance().mDeactivateSimilarNames.length() > 0)
{
// we're done with this set of deactivations
LLSD args;
- args["NAMES"] = gGestureManager.mDeactivateSimilarNames;
+ args["NAMES"] = LLGestureManager::instance().mDeactivateSimilarNames;
LLNotifications::instance().add("DeactivatedGesturesTrigger", args);
}
}
+ LLViewerInventoryItem* item = gInventory.getItem(item_id);
+ if(item)
+ {
+ gesture->mName = item->getName();
+ }
+ else
+ {
+ // Watch this item and set gesture name when item exists in inventory
+ LLGestureManager::instance().watchItem(item_id);
+ }
+ LLGestureManager::instance().mActive[item_id] = gesture;
+
// Everything has been successful. Add to the active list.
- gGestureManager.mActive[item_id] = gesture;
gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);
+
if (inform_server)
{
// Inform the database of this change
@@ -977,13 +990,13 @@ void LLGestureManager::onLoadComplete(LLVFS *vfs,
gAgent.sendReliableMessage();
}
- gGestureManager.notifyObservers();
+ LLGestureManager::instance().notifyObservers();
}
else
{
llwarns << "Unable to load gesture" << llendl;
- gGestureManager.mActive.erase(item_id);
+ LLGestureManager::instance().mActive.erase(item_id);
delete gesture;
gesture = NULL;
@@ -1005,7 +1018,7 @@ void LLGestureManager::onLoadComplete(LLVFS *vfs,
llwarns << "Problem loading gesture: " << status << llendl;
- gGestureManager.mActive.erase(item_id);
+ LLGestureManager::instance().mActive.erase(item_id);
}
}
@@ -1133,3 +1146,19 @@ void LLGestureManager::getItemIDs(std::vector<LLUUID>* ids)
ids->push_back(it->first);
}
}
+
+void LLGestureManager::done()
+{
+ for(item_map_t::iterator it = mActive.begin(); it != mActive.end(); ++it)
+ {
+ if(it->second->mName.empty())
+ {
+ LLViewerInventoryItem* item = gInventory.getItem(it->first);
+ if(item)
+ {
+ it->second->mName = item->getName();
+ }
+ }
+ }
+ notifyObservers();
+}