LLGestureManager renamed to LLGestureMgr. Also, derived from LLSingleton.
This commit is contained in:
@@ -3756,7 +3756,7 @@ void LLAppViewer::idle()
|
||||
|
||||
{
|
||||
// Handle pending gesture processing
|
||||
gGestureManager.update();
|
||||
LLGestureMgr::instance().update();
|
||||
|
||||
gAgent.updateAgentPosition(gFrameDTClamped, yaw, current_mouse.mX, current_mouse.mY);
|
||||
}
|
||||
|
||||
@@ -481,10 +481,10 @@ void LLUpdateAgentInventoryResponder::uploadComplete(const LLSD& content)
|
||||
{
|
||||
// If this gesture is active, then we need to update the in-memory
|
||||
// active map with the new pointer.
|
||||
if (gGestureManager.isGestureActive(item_id))
|
||||
if (LLGestureMgr::instance().isGestureActive(item_id))
|
||||
{
|
||||
LLUUID asset_id = new_item->getAssetUUID();
|
||||
gGestureManager.replaceGesture(item_id, asset_id);
|
||||
LLGestureMgr::instance().replaceGesture(item_id, asset_id);
|
||||
gInventory.notifyObservers();
|
||||
}
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ LLChatBar::LLChatBar()
|
||||
|
||||
LLChatBar::~LLChatBar()
|
||||
{
|
||||
gGestureManager.removeObserver(mObserver);
|
||||
LLGestureMgr::instance().removeObserver(mObserver);
|
||||
delete mObserver;
|
||||
mObserver = NULL;
|
||||
// LLView destructor cleans up children
|
||||
@@ -247,8 +247,8 @@ void LLChatBar::refreshGestures()
|
||||
|
||||
// collect list of unique gestures
|
||||
std::map <std::string, BOOL> unique;
|
||||
LLGestureManager::item_map_t::iterator it;
|
||||
for (it = gGestureManager.mActive.begin(); it != gGestureManager.mActive.end(); ++it)
|
||||
LLGestureMgr::item_map_t::const_iterator it;
|
||||
for (it = LLGestureMgr::instance().getActiveGestures().begin(); it != LLGestureMgr::instance().getActiveGestures().end(); ++it)
|
||||
{
|
||||
LLMultiGesture* gesture = (*it).second;
|
||||
if (gesture)
|
||||
@@ -334,7 +334,7 @@ void LLChatBar::setGestureCombo(LLComboBox* combo)
|
||||
|
||||
// now register observer since we have a place to put the results
|
||||
mObserver = new LLChatBarGestureObserver(this);
|
||||
gGestureManager.addObserver(mObserver);
|
||||
LLGestureMgr::instance().addObserver(mObserver);
|
||||
|
||||
// refresh list from current active gestures
|
||||
refreshGestures();
|
||||
@@ -469,7 +469,7 @@ void LLChatBar::sendChat( EChatType type )
|
||||
}
|
||||
}
|
||||
// discard returned "found" boolean
|
||||
gGestureManager.triggerAndReviseString(utf8text, &utf8_revised_text);
|
||||
LLGestureMgr::instance().triggerAndReviseString(utf8text, &utf8_revised_text);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -601,7 +601,7 @@ void LLChatBar::onInputEditorKeystroke( LLLineEditor* caller, void* userdata )
|
||||
std::string utf8_trigger = wstring_to_utf8str(raw_text);
|
||||
std::string utf8_out_str(utf8_trigger);
|
||||
|
||||
if (gGestureManager.matchPrefix(utf8_trigger, &utf8_out_str))
|
||||
if (LLGestureMgr::instance().matchPrefix(utf8_trigger, &utf8_out_str))
|
||||
{
|
||||
if (self->mInputEditor)
|
||||
{
|
||||
@@ -826,7 +826,7 @@ void LLChatBar::onCommitGesture(LLUICtrl* ctrl, void* data)
|
||||
// substitution and logging.
|
||||
std::string text(trigger);
|
||||
std::string revised_text;
|
||||
gGestureManager.triggerAndReviseString(text, &revised_text);
|
||||
LLGestureMgr::instance().triggerAndReviseString(text, &revised_text);
|
||||
|
||||
revised_text = utf8str_trim(revised_text);
|
||||
if (!revised_text.empty())
|
||||
|
||||
@@ -86,13 +86,13 @@ LLFloaterGesture::LLFloaterGesture()
|
||||
sInstance = this;
|
||||
|
||||
sObserver = new LLFloaterGestureObserver;
|
||||
gGestureManager.addObserver(sObserver);
|
||||
LLGestureMgr::instance().addObserver(sObserver);
|
||||
}
|
||||
|
||||
// virtual
|
||||
LLFloaterGesture::~LLFloaterGesture()
|
||||
{
|
||||
gGestureManager.removeObserver(sObserver);
|
||||
LLGestureMgr::instance().removeObserver(sObserver);
|
||||
delete sObserver;
|
||||
sObserver = NULL;
|
||||
|
||||
@@ -223,8 +223,8 @@ void LLFloaterGesture::buildGestureList()
|
||||
|
||||
list->operateOnAll(LLCtrlListInterface::OP_DELETE);
|
||||
|
||||
LLGestureManager::item_map_t::iterator it;
|
||||
for (it = gGestureManager.mActive.begin(); it != gGestureManager.mActive.end(); ++it)
|
||||
LLGestureMgr::item_map_t::const_iterator it;
|
||||
for (it = LLGestureMgr::instance().getActiveGestures().begin(); it != LLGestureMgr::instance().getActiveGestures().end(); ++it)
|
||||
{
|
||||
const LLUUID& item_id = (*it).first;
|
||||
LLMultiGesture* gesture = (*it).second;
|
||||
@@ -344,13 +344,13 @@ void LLFloaterGesture::onClickPlay(void* data)
|
||||
if (!list) return;
|
||||
const LLUUID& item_id = list->getCurrentID();
|
||||
|
||||
if (gGestureManager.isGesturePlaying(item_id))
|
||||
if (LLGestureMgr::instance().isGesturePlaying(item_id))
|
||||
{
|
||||
gGestureManager.stopGesture(item_id);
|
||||
LLGestureMgr::instance().stopGesture(item_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
gGestureManager.playGesture(item_id);
|
||||
LLGestureMgr::instance().playGesture(item_id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -411,7 +411,7 @@ void LLFloaterGesture::onCommitList(LLUICtrl* ctrl, void* data)
|
||||
const LLUUID& item_id = self->childGetValue("gesture_list").asUUID();
|
||||
|
||||
self->mSelectedID = item_id;
|
||||
if (gGestureManager.isGesturePlaying(item_id))
|
||||
if (LLGestureMgr::instance().isGesturePlaying(item_id))
|
||||
{
|
||||
self->childSetVisible("play_btn", false);
|
||||
self->childSetVisible("stop_btn", true);
|
||||
|
||||
@@ -64,8 +64,6 @@
|
||||
#include "shcommandhandler.h"
|
||||
#endif //shy_mod
|
||||
|
||||
LLGestureManager gGestureManager;
|
||||
|
||||
// Longest time, in seconds, to wait for all animations to stop playing
|
||||
const F32 MAX_WAIT_ANIM_SECS = 30.f;
|
||||
|
||||
@@ -75,7 +73,7 @@ static const LLUUID& get_linked_uuid(const LLUUID& item_id);
|
||||
|
||||
// Lightweight constructor.
|
||||
// init() does the heavy lifting.
|
||||
LLGestureManager::LLGestureManager()
|
||||
LLGestureMgr::LLGestureMgr()
|
||||
: mValid(FALSE),
|
||||
mPlaying(),
|
||||
mActive(),
|
||||
@@ -84,7 +82,7 @@ LLGestureManager::LLGestureManager()
|
||||
|
||||
|
||||
// We own the data for gestures, so clean them up.
|
||||
LLGestureManager::~LLGestureManager()
|
||||
LLGestureMgr::~LLGestureMgr()
|
||||
{
|
||||
item_map_t::iterator it;
|
||||
for (it = mActive.begin(); it != mActive.end(); ++it)
|
||||
@@ -97,7 +95,7 @@ LLGestureManager::~LLGestureManager()
|
||||
}
|
||||
|
||||
|
||||
void LLGestureManager::init()
|
||||
void LLGestureMgr::init()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
@@ -105,10 +103,12 @@ void LLGestureManager::init()
|
||||
|
||||
// Use this version when you have the item_id but not the asset_id,
|
||||
// and you KNOW the inventory is loaded.
|
||||
void LLGestureManager::activateGesture(const LLUUID& item_id)
|
||||
void LLGestureMgr::activateGesture(const LLUUID& item_id)
|
||||
{
|
||||
LLViewerInventoryItem* item = gInventory.getItem(item_id);
|
||||
if (!item) return;
|
||||
if (item->getType() != LLAssetType::AT_GESTURE)
|
||||
return;
|
||||
|
||||
LLUUID asset_id = item->getAssetUUID();
|
||||
|
||||
@@ -121,7 +121,7 @@ void LLGestureManager::activateGesture(const LLUUID& item_id)
|
||||
}
|
||||
|
||||
|
||||
void LLGestureManager::activateGestures(LLViewerInventoryItem::item_array_t& items)
|
||||
void LLGestureMgr::activateGestures(LLViewerInventoryItem::item_array_t& items)
|
||||
{
|
||||
// Load up the assets
|
||||
S32 count = 0;
|
||||
@@ -214,7 +214,10 @@ struct LLLoadInfo
|
||||
|
||||
// If inform_server is true, will send a message upstream to update
|
||||
// the user_gesture_active table.
|
||||
void LLGestureManager::activateGestureWithAsset(const LLUUID& item_id,
|
||||
/**
|
||||
* It will load a gesture from remote storage
|
||||
*/
|
||||
void LLGestureMgr::activateGestureWithAsset(const LLUUID& item_id,
|
||||
const LLUUID& asset_id,
|
||||
BOOL inform_server,
|
||||
BOOL deactivate_similar)
|
||||
@@ -223,7 +226,7 @@ void LLGestureManager::activateGestureWithAsset(const LLUUID& item_id,
|
||||
|
||||
if( !gAssetStorage )
|
||||
{
|
||||
llwarns << "LLGestureManager::activateGestureWithAsset without valid gAssetStorage" << llendl;
|
||||
llwarns << "LLGestureMgr::activateGestureWithAsset without valid gAssetStorage" << llendl;
|
||||
return;
|
||||
}
|
||||
// If gesture is already active, nothing to do.
|
||||
@@ -265,7 +268,7 @@ void LLGestureManager::activateGestureWithAsset(const LLUUID& item_id,
|
||||
}
|
||||
|
||||
|
||||
void LLGestureManager::deactivateGesture(const LLUUID& item_id)
|
||||
void LLGestureMgr::deactivateGesture(const LLUUID& item_id)
|
||||
{
|
||||
const LLUUID& base_item_id = get_linked_uuid(item_id);
|
||||
item_map_t::iterator it = mActive.find(base_item_id);
|
||||
@@ -308,10 +311,10 @@ void LLGestureManager::deactivateGesture(const LLUUID& item_id)
|
||||
}
|
||||
|
||||
|
||||
void LLGestureManager::deactivateSimilarGestures(LLMultiGesture* in, const LLUUID& in_item_id)
|
||||
void LLGestureMgr::deactivateSimilarGestures(LLMultiGesture* in, const LLUUID& in_item_id)
|
||||
{
|
||||
const LLUUID& base_in_item_id = get_linked_uuid(in_item_id);
|
||||
std::vector<LLUUID> gest_item_ids;
|
||||
uuid_vec_t gest_item_ids;
|
||||
|
||||
// Deactivate all gestures that match
|
||||
item_map_t::iterator it;
|
||||
@@ -350,7 +353,7 @@ void LLGestureManager::deactivateSimilarGestures(LLMultiGesture* in, const LLUUI
|
||||
// Inform database of the change
|
||||
LLMessageSystem* msg = gMessageSystem;
|
||||
BOOL start_message = TRUE;
|
||||
std::vector<LLUUID>::const_iterator vit = gest_item_ids.begin();
|
||||
uuid_vec_t::const_iterator vit = gest_item_ids.begin();
|
||||
while (vit != gest_item_ids.end())
|
||||
{
|
||||
if (start_message)
|
||||
@@ -395,7 +398,7 @@ void LLGestureManager::deactivateSimilarGestures(LLMultiGesture* in, const LLUUI
|
||||
}
|
||||
|
||||
|
||||
BOOL LLGestureManager::isGestureActive(const LLUUID& item_id)
|
||||
BOOL LLGestureMgr::isGestureActive(const LLUUID& item_id)
|
||||
{
|
||||
const LLUUID& base_item_id = get_linked_uuid(item_id);
|
||||
item_map_t::iterator it = mActive.find(base_item_id);
|
||||
@@ -403,7 +406,7 @@ BOOL LLGestureManager::isGestureActive(const LLUUID& item_id)
|
||||
}
|
||||
|
||||
|
||||
BOOL LLGestureManager::isGesturePlaying(const LLUUID& item_id)
|
||||
BOOL LLGestureMgr::isGesturePlaying(const LLUUID& item_id)
|
||||
{
|
||||
const LLUUID& base_item_id = get_linked_uuid(item_id);
|
||||
item_map_t::iterator it = mActive.find(base_item_id);
|
||||
@@ -415,7 +418,17 @@ BOOL LLGestureManager::isGesturePlaying(const LLUUID& item_id)
|
||||
return gesture->mPlaying;
|
||||
}
|
||||
|
||||
void LLGestureManager::replaceGesture(const LLUUID& item_id, LLMultiGesture* new_gesture, const LLUUID& asset_id)
|
||||
BOOL LLGestureMgr::isGesturePlaying(LLMultiGesture* gesture)
|
||||
{
|
||||
if(!gesture)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return gesture->mPlaying;
|
||||
}
|
||||
|
||||
void LLGestureMgr::replaceGesture(const LLUUID& item_id, LLMultiGesture* new_gesture, const LLUUID& asset_id)
|
||||
{
|
||||
const LLUUID& base_item_id = get_linked_uuid(item_id);
|
||||
item_map_t::iterator it = mActive.find(base_item_id);
|
||||
@@ -456,10 +469,11 @@ void LLGestureManager::replaceGesture(const LLUUID& item_id, LLMultiGesture* new
|
||||
notifyObservers();
|
||||
}
|
||||
|
||||
void LLGestureManager::replaceGesture(const LLUUID& item_id, const LLUUID& new_asset_id)
|
||||
void LLGestureMgr::replaceGesture(const LLUUID& item_id, const LLUUID& new_asset_id)
|
||||
{
|
||||
const LLUUID& base_item_id = get_linked_uuid(item_id);
|
||||
item_map_t::iterator it = gGestureManager.mActive.find(base_item_id);
|
||||
|
||||
item_map_t::iterator it = LLGestureMgr::instance().mActive.find(base_item_id);
|
||||
if (it == mActive.end())
|
||||
{
|
||||
llwarns << "replaceGesture for inactive gesture " << base_item_id << llendl;
|
||||
@@ -468,10 +482,10 @@ 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(base_item_id, gesture, new_asset_id);
|
||||
LLGestureMgr::instance().replaceGesture(base_item_id, gesture, new_asset_id);
|
||||
}
|
||||
|
||||
void LLGestureManager::playGesture(LLMultiGesture* gesture)
|
||||
void LLGestureMgr::playGesture(LLMultiGesture* gesture)
|
||||
{
|
||||
if (!gesture) return;
|
||||
|
||||
@@ -490,9 +504,10 @@ void LLGestureManager::playGesture(LLMultiGesture* gesture)
|
||||
|
||||
|
||||
// Convenience function that looks up the item_id for you.
|
||||
void LLGestureManager::playGesture(const LLUUID& item_id)
|
||||
void LLGestureMgr::playGesture(const LLUUID& item_id)
|
||||
{
|
||||
const LLUUID& base_item_id = get_linked_uuid(item_id);
|
||||
|
||||
item_map_t::iterator it = mActive.find(base_item_id);
|
||||
if (it == mActive.end()) return;
|
||||
|
||||
@@ -506,7 +521,7 @@ void LLGestureManager::playGesture(const LLUUID& item_id)
|
||||
// Iterates through space delimited tokens in string, triggering any gestures found.
|
||||
// Generates a revised string that has the found tokens replaced by their replacement strings
|
||||
// and (as a minor side effect) has multiple spaces in a row replaced by single spaces.
|
||||
BOOL LLGestureManager::triggerAndReviseString(const std::string &utf8str, std::string* revised_string)
|
||||
BOOL LLGestureMgr::triggerAndReviseString(const std::string &utf8str, std::string* revised_string)
|
||||
{
|
||||
std::string tokenized = utf8str;
|
||||
|
||||
@@ -599,7 +614,7 @@ BOOL LLGestureManager::triggerAndReviseString(const std::string &utf8str, std::s
|
||||
}
|
||||
|
||||
|
||||
BOOL LLGestureManager::triggerGesture(KEY key, MASK mask)
|
||||
BOOL LLGestureMgr::triggerGesture(KEY key, MASK mask)
|
||||
{
|
||||
std::vector <LLMultiGesture *> matching;
|
||||
item_map_t::iterator it;
|
||||
@@ -633,7 +648,7 @@ BOOL LLGestureManager::triggerGesture(KEY key, MASK mask)
|
||||
}
|
||||
|
||||
|
||||
S32 LLGestureManager::getPlayingCount() const
|
||||
S32 LLGestureMgr::getPlayingCount() const
|
||||
{
|
||||
return mPlaying.size();
|
||||
}
|
||||
@@ -647,7 +662,7 @@ struct IsGesturePlaying : public std::unary_function<LLMultiGesture*, bool>
|
||||
}
|
||||
};
|
||||
|
||||
void LLGestureManager::update()
|
||||
void LLGestureMgr::update()
|
||||
{
|
||||
S32 i;
|
||||
for (i = 0; i < (S32)mPlaying.size(); ++i)
|
||||
@@ -690,7 +705,7 @@ void LLGestureManager::update()
|
||||
|
||||
|
||||
// Run all steps until you're either done or hit a wait.
|
||||
void LLGestureManager::stepGesture(LLMultiGesture* gesture)
|
||||
void LLGestureMgr::stepGesture(LLMultiGesture* gesture)
|
||||
{
|
||||
if (!gesture)
|
||||
{
|
||||
@@ -838,7 +853,7 @@ void LLGestureManager::stepGesture(LLMultiGesture* gesture)
|
||||
}
|
||||
|
||||
|
||||
void LLGestureManager::runStep(LLMultiGesture* gesture, LLGestureStep* step)
|
||||
void LLGestureMgr::runStep(LLMultiGesture* gesture, LLGestureStep* step)
|
||||
{
|
||||
switch(step->getType())
|
||||
{
|
||||
@@ -929,7 +944,7 @@ void LLGestureManager::runStep(LLMultiGesture* gesture, LLGestureStep* step)
|
||||
|
||||
|
||||
// static
|
||||
void LLGestureManager::onLoadComplete(LLVFS *vfs,
|
||||
void LLGestureMgr::onLoadComplete(LLVFS *vfs,
|
||||
const LLUUID& asset_uuid,
|
||||
LLAssetType::EType type,
|
||||
void* user_data, S32 status, LLExtStat ext_status)
|
||||
@@ -942,8 +957,8 @@ void LLGestureManager::onLoadComplete(LLVFS *vfs,
|
||||
|
||||
delete info;
|
||||
info = NULL;
|
||||
|
||||
gGestureManager.mLoadingCount--;
|
||||
LLGestureMgr& self = LLGestureMgr::instance();
|
||||
self.mLoadingCount--;
|
||||
|
||||
if (0 == status)
|
||||
{
|
||||
@@ -970,21 +985,22 @@ void LLGestureManager::onLoadComplete(LLVFS *vfs,
|
||||
{
|
||||
if (deactivate_similar)
|
||||
{
|
||||
gGestureManager.deactivateSimilarGestures(gesture, item_id);
|
||||
self.deactivateSimilarGestures(gesture, item_id);
|
||||
|
||||
// Display deactivation message if this was the last of the bunch.
|
||||
if (gGestureManager.mLoadingCount == 0
|
||||
&& gGestureManager.mDeactivateSimilarNames.length() > 0)
|
||||
if (self.mLoadingCount == 0
|
||||
&& self.mDeactivateSimilarNames.length() > 0)
|
||||
{
|
||||
// we're done with this set of deactivations
|
||||
LLSD args;
|
||||
args["NAMES"] = gGestureManager.mDeactivateSimilarNames;
|
||||
args["NAMES"] = self.mDeactivateSimilarNames;
|
||||
LLNotifications::instance().add("DeactivatedGesturesTrigger", args);
|
||||
}
|
||||
}
|
||||
|
||||
self.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)
|
||||
{
|
||||
@@ -1004,13 +1020,13 @@ void LLGestureManager::onLoadComplete(LLVFS *vfs,
|
||||
gAgent.sendReliableMessage();
|
||||
}
|
||||
|
||||
gGestureManager.notifyObservers();
|
||||
self.notifyObservers();
|
||||
}
|
||||
else
|
||||
{
|
||||
llwarns << "Unable to load gesture" << llendl;
|
||||
|
||||
gGestureManager.mActive.erase(item_id);
|
||||
self.mActive.erase(item_id);
|
||||
|
||||
delete gesture;
|
||||
gesture = NULL;
|
||||
@@ -1035,12 +1051,13 @@ void LLGestureManager::onLoadComplete(LLVFS *vfs,
|
||||
|
||||
llwarns << "Problem loading gesture: " << status << llendl;
|
||||
|
||||
gGestureManager.mActive.erase(item_id);
|
||||
LLGestureMgr::instance().mActive.erase(item_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LLGestureManager::stopGesture(LLMultiGesture* gesture)
|
||||
|
||||
void LLGestureMgr::stopGesture(LLMultiGesture* gesture)
|
||||
{
|
||||
if (!gesture) return;
|
||||
|
||||
@@ -1080,7 +1097,7 @@ void LLGestureManager::stopGesture(LLMultiGesture* gesture)
|
||||
}
|
||||
|
||||
|
||||
void LLGestureManager::stopGesture(const LLUUID& item_id)
|
||||
void LLGestureMgr::stopGesture(const LLUUID& item_id)
|
||||
{
|
||||
const LLUUID& base_item_id = get_linked_uuid(item_id);
|
||||
item_map_t::iterator it = mActive.find(base_item_id);
|
||||
@@ -1093,12 +1110,12 @@ void LLGestureManager::stopGesture(const LLUUID& item_id)
|
||||
}
|
||||
|
||||
|
||||
void LLGestureManager::addObserver(LLGestureManagerObserver* observer)
|
||||
void LLGestureMgr::addObserver(LLGestureManagerObserver* observer)
|
||||
{
|
||||
mObservers.push_back(observer);
|
||||
}
|
||||
|
||||
void LLGestureManager::removeObserver(LLGestureManagerObserver* observer)
|
||||
void LLGestureMgr::removeObserver(LLGestureManagerObserver* observer)
|
||||
{
|
||||
std::vector<LLGestureManagerObserver*>::iterator it;
|
||||
it = std::find(mObservers.begin(), mObservers.end(), observer);
|
||||
@@ -1111,9 +1128,9 @@ void LLGestureManager::removeObserver(LLGestureManagerObserver* observer)
|
||||
// Call this method when it's time to update everyone on a new state.
|
||||
// Copy the list because an observer could respond by removing itself
|
||||
// from the list.
|
||||
void LLGestureManager::notifyObservers()
|
||||
void LLGestureMgr::notifyObservers()
|
||||
{
|
||||
lldebugs << "LLGestureManager::notifyObservers" << llendl;
|
||||
lldebugs << "LLGestureMgr::notifyObservers" << llendl;
|
||||
|
||||
for(std::vector<LLGestureManagerObserver*>::iterator iter = mObservers.begin();
|
||||
iter != mObservers.end();
|
||||
@@ -1124,7 +1141,7 @@ void LLGestureManager::notifyObservers()
|
||||
}
|
||||
}
|
||||
|
||||
BOOL LLGestureManager::matchPrefix(const std::string& in_str, std::string* out_str)
|
||||
BOOL LLGestureMgr::matchPrefix(const std::string& in_str, std::string* out_str)
|
||||
{
|
||||
S32 in_len = in_str.length();
|
||||
|
||||
@@ -1155,7 +1172,7 @@ BOOL LLGestureManager::matchPrefix(const std::string& in_str, std::string* out_s
|
||||
}
|
||||
|
||||
|
||||
void LLGestureManager::getItemIDs(std::vector<LLUUID>* ids)
|
||||
void LLGestureMgr::getItemIDs(uuid_vec_t* ids)
|
||||
{
|
||||
item_map_t::const_iterator it;
|
||||
for (it = mActive.begin(); it != mActive.end(); ++it)
|
||||
|
||||
@@ -52,11 +52,14 @@ public:
|
||||
virtual void changed() = 0;
|
||||
};
|
||||
|
||||
class LLGestureManager
|
||||
class LLGestureMgr : public LLSingleton<LLGestureMgr>
|
||||
{
|
||||
public:
|
||||
LLGestureManager();
|
||||
~LLGestureManager();
|
||||
// Maps inventory item_id to gesture
|
||||
typedef std::map<LLUUID, LLMultiGesture*> item_map_t;
|
||||
|
||||
LLGestureMgr();
|
||||
~LLGestureMgr();
|
||||
|
||||
void init();
|
||||
|
||||
@@ -95,6 +98,9 @@ public:
|
||||
|
||||
BOOL isGesturePlaying(const LLUUID& item_id);
|
||||
|
||||
BOOL isGesturePlaying(LLMultiGesture* gesture);
|
||||
|
||||
const item_map_t& getActiveGestures() const { return mActive; }
|
||||
// Force a gesture to be played, for example, if it is being
|
||||
// previewed.
|
||||
void playGesture(LLMultiGesture* gesture);
|
||||
@@ -124,7 +130,7 @@ public:
|
||||
BOOL matchPrefix(const std::string& in_str, std::string* out_str);
|
||||
|
||||
// Copy item ids into the vector
|
||||
void getItemIDs(std::vector<LLUUID>* ids);
|
||||
void getItemIDs(uuid_vec_t* ids);
|
||||
|
||||
protected:
|
||||
// Handle the processing of a single gesture
|
||||
@@ -139,13 +145,10 @@ protected:
|
||||
LLAssetType::EType type,
|
||||
void* user_data, S32 status, LLExtStat ext_status);
|
||||
|
||||
public:
|
||||
BOOL mValid;
|
||||
std::vector<LLMultiGesture*> mPlaying;
|
||||
|
||||
// Maps inventory item_id to gesture
|
||||
typedef std::map<LLUUID, LLMultiGesture*> item_map_t;
|
||||
|
||||
|
||||
private:
|
||||
// Active gestures.
|
||||
// NOTE: The gesture pointer CAN BE NULL. This means that
|
||||
// there is a gesture with that item_id, but the asset data
|
||||
@@ -156,8 +159,7 @@ public:
|
||||
std::string mDeactivateSimilarNames;
|
||||
|
||||
std::vector<LLGestureManagerObserver*> mObservers;
|
||||
std::vector<LLMultiGesture*> mPlaying;
|
||||
BOOL mValid;
|
||||
};
|
||||
|
||||
extern LLGestureManager gGestureManager;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -226,7 +226,7 @@ BOOL get_is_item_worn(const LLInventoryItem *item)
|
||||
return TRUE;
|
||||
break;
|
||||
case LLAssetType::AT_GESTURE:
|
||||
if (gGestureManager.isGestureActive(item->getLinkedUUID()))
|
||||
if (LLGestureMgr::instance().isGestureActive(item->getLinkedUUID()))
|
||||
return TRUE;
|
||||
break;
|
||||
default:
|
||||
@@ -362,7 +362,7 @@ void LLInvFVBridge::removeBatch(LLDynamicArray<LLFolderViewEventListener*>& batc
|
||||
{
|
||||
if(LLAssetType::AT_GESTURE == item->getType())
|
||||
{
|
||||
gGestureManager.deactivateGesture(item->getUUID());
|
||||
LLGestureMgr::instance().deactivateGesture(item->getUUID());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -378,7 +378,7 @@ void LLInvFVBridge::removeBatch(LLDynamicArray<LLFolderViewEventListener*>& batc
|
||||
{
|
||||
if(LLAssetType::AT_GESTURE == descendent_items[j]->getType())
|
||||
{
|
||||
gGestureManager.deactivateGesture(descendent_items[j]->getUUID());
|
||||
LLGestureMgr::instance().deactivateGesture(descendent_items[j]->getUUID());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1838,9 +1838,9 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
|
||||
{
|
||||
LLInventoryItem* item = descendent_items[i];
|
||||
if (item->getType() == LLAssetType::AT_GESTURE
|
||||
&& gGestureManager.isGestureActive(item->getUUID()))
|
||||
&& LLGestureMgr::instance().isGestureActive(item->getUUID()))
|
||||
{
|
||||
gGestureManager.deactivateGesture(item->getUUID());
|
||||
LLGestureMgr::instance().deactivateGesture(item->getUUID());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2403,9 +2403,9 @@ BOOL LLFolderBridge::removeItem()
|
||||
{
|
||||
LLInventoryItem* item = descendent_items[i];
|
||||
if (item->getType() == LLAssetType::AT_GESTURE
|
||||
&& gGestureManager.isGestureActive(item->getUUID()))
|
||||
&& LLGestureMgr::instance().isGestureActive(item->getUUID()))
|
||||
{
|
||||
gGestureManager.deactivateGesture(item->getUUID());
|
||||
LLGestureMgr::instance().deactivateGesture(item->getUUID());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3020,9 +3020,9 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
|
||||
if(accept && drop)
|
||||
{
|
||||
if (inv_item->getType() == LLAssetType::AT_GESTURE
|
||||
&& gGestureManager.isGestureActive(inv_item->getUUID()) && move_is_into_trash)
|
||||
&& LLGestureMgr::instance().isGestureActive(inv_item->getUUID()) && move_is_into_trash)
|
||||
{
|
||||
gGestureManager.deactivateGesture(inv_item->getUUID());
|
||||
LLGestureMgr::instance().deactivateGesture(inv_item->getUUID());
|
||||
}
|
||||
// If an item is being dragged between windows, unselect
|
||||
// everything in the active window so that we don't follow
|
||||
@@ -3749,7 +3749,7 @@ LLFontGL::StyleFlags LLGestureBridge::getLabelStyle() const
|
||||
{
|
||||
U8 font = LLFontGL::NORMAL;
|
||||
|
||||
if (gGestureManager.isGestureActive(mUUID))
|
||||
if (LLGestureMgr::instance().isGestureActive(mUUID))
|
||||
{
|
||||
font |= LLFontGL::BOLD;
|
||||
}
|
||||
@@ -3765,7 +3765,7 @@ LLFontGL::StyleFlags LLGestureBridge::getLabelStyle() const
|
||||
|
||||
std::string LLGestureBridge::getLabelSuffix() const
|
||||
{
|
||||
if( gGestureManager.isGestureActive(mUUID) )
|
||||
if( LLGestureMgr::instance().isGestureActive(mUUID) )
|
||||
{
|
||||
return LLItemBridge::getLabelSuffix() + " (active)";
|
||||
}
|
||||
@@ -3780,7 +3780,7 @@ void LLGestureBridge::performAction(LLFolderView* folder, LLInventoryModel* mode
|
||||
{
|
||||
if ("activate" == action)
|
||||
{
|
||||
gGestureManager.activateGesture(mUUID);
|
||||
LLGestureMgr::instance().activateGesture(mUUID);
|
||||
|
||||
LLViewerInventoryItem* item = gInventory.getItem(mUUID);
|
||||
if (!item) return;
|
||||
@@ -3792,7 +3792,7 @@ void LLGestureBridge::performAction(LLFolderView* folder, LLInventoryModel* mode
|
||||
}
|
||||
else if ("deactivate" == action)
|
||||
{
|
||||
gGestureManager.deactivateGesture(mUUID);
|
||||
LLGestureMgr::instance().deactivateGesture(mUUID);
|
||||
|
||||
LLViewerInventoryItem* item = gInventory.getItem(mUUID);
|
||||
if (!item) return;
|
||||
@@ -3838,7 +3838,7 @@ BOOL LLGestureBridge::removeItem()
|
||||
const LLUUID item_id = mUUID;
|
||||
|
||||
// Force close the preview window, if it exists
|
||||
gGestureManager.deactivateGesture(item_id);
|
||||
LLGestureMgr::instance().deactivateGesture(item_id);
|
||||
|
||||
// If deactivateGesture deleted *this, then return out immediately.
|
||||
if (!model->getObject(item_id))
|
||||
@@ -3868,7 +3868,7 @@ void LLGestureBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
|
||||
getClipboardEntries(true, items, disabled_items, flags);
|
||||
|
||||
items.push_back(std::string("Gesture Separator"));
|
||||
if (gGestureManager.isGestureActive(getUUID()))
|
||||
if (LLGestureMgr::instance().isGestureActive(getUUID()))
|
||||
{
|
||||
items.push_back(std::string("Deactivate"));
|
||||
}
|
||||
@@ -4864,7 +4864,7 @@ void wear_inventory_category_on_avatar_step2( BOOL proceed, void* userdata )
|
||||
{
|
||||
llinfos << "Activating " << gest_count << " gestures" << llendl;
|
||||
|
||||
gGestureManager.activateGestures(gest_item_array);
|
||||
LLGestureMgr::instance().activateGestures(gest_item_array);
|
||||
|
||||
// Update the inventory item labels to reflect the fact
|
||||
// they are active.
|
||||
@@ -5170,7 +5170,7 @@ void remove_inventory_category_from_avatar_step2( BOOL proceed, void* userdata)
|
||||
LLViewerInventoryItem *gest_item = gest_item_array.get(i);
|
||||
if (get_is_item_worn(gest_item->getUUID()))
|
||||
{
|
||||
gGestureManager.deactivateGesture( gest_item_array.get(i)->getLinkedUUID() );
|
||||
LLGestureMgr::instance().deactivateGesture( gest_item_array.get(i)->getLinkedUUID() );
|
||||
gInventory.updateItem( gest_item );
|
||||
gInventory.notifyObservers();
|
||||
}
|
||||
|
||||
@@ -296,7 +296,7 @@ BOOL LLPreviewGesture::canClose()
|
||||
// virtual
|
||||
void LLPreviewGesture::onClose(bool app_quitting)
|
||||
{
|
||||
gGestureManager.stopGesture(mPreviewGesture);
|
||||
LLGestureMgr::instance().stopGesture(mPreviewGesture);
|
||||
LLPreview::onClose(app_quitting);
|
||||
}
|
||||
|
||||
@@ -328,13 +328,13 @@ bool LLPreviewGesture::handleSaveChangesDialog(const LLSD& notification, const L
|
||||
switch(option)
|
||||
{
|
||||
case 0: // "Yes"
|
||||
gGestureManager.stopGesture(mPreviewGesture);
|
||||
LLGestureMgr::instance().stopGesture(mPreviewGesture);
|
||||
mCloseAfterSave = TRUE;
|
||||
onClickSave(this);
|
||||
break;
|
||||
|
||||
case 1: // "No"
|
||||
gGestureManager.stopGesture(mPreviewGesture);
|
||||
LLGestureMgr::instance().stopGesture(mPreviewGesture);
|
||||
mDirty = FALSE; // Force the dirty flag because user has clicked NO on confirm save dialog...
|
||||
close();
|
||||
break;
|
||||
@@ -841,7 +841,7 @@ void LLPreviewGesture::refresh()
|
||||
|
||||
mOptionsText->setText(optionstext);
|
||||
|
||||
BOOL active = gGestureManager.isGestureActive(mItemUUID);
|
||||
BOOL active = LLGestureMgr::instance().isGestureActive(mItemUUID);
|
||||
mActiveCheck->set(active);
|
||||
|
||||
// Can only preview if there are steps
|
||||
@@ -1195,10 +1195,10 @@ void LLPreviewGesture::saveIfNeeded()
|
||||
|
||||
// If this gesture is active, then we need to update the in-memory
|
||||
// active map with the new pointer.
|
||||
if (!delayedUpload && gGestureManager.isGestureActive(mItemUUID))
|
||||
if (!delayedUpload && LLGestureMgr::instance().isGestureActive(mItemUUID))
|
||||
{
|
||||
// gesture manager now owns the pointer
|
||||
gGestureManager.replaceGesture(mItemUUID, gesture, asset_id);
|
||||
LLGestureMgr::instance().replaceGesture(mItemUUID, gesture, asset_id);
|
||||
|
||||
// replaceGesture may deactivate other gestures so let the
|
||||
// inventory know.
|
||||
@@ -1721,13 +1721,13 @@ void LLPreviewGesture::onClickDelete(void* data)
|
||||
void LLPreviewGesture::onCommitActive(LLUICtrl* ctrl, void* data)
|
||||
{
|
||||
LLPreviewGesture* self = (LLPreviewGesture*)data;
|
||||
if (!gGestureManager.isGestureActive(self->mItemUUID))
|
||||
if (!LLGestureMgr::instance().isGestureActive(self->mItemUUID))
|
||||
{
|
||||
gGestureManager.activateGesture(self->mItemUUID);
|
||||
LLGestureMgr::instance().activateGesture(self->mItemUUID);
|
||||
}
|
||||
else
|
||||
{
|
||||
gGestureManager.deactivateGesture(self->mItemUUID);
|
||||
LLGestureMgr::instance().deactivateGesture(self->mItemUUID);
|
||||
}
|
||||
|
||||
// Make sure the (active) label in the inventory gets updated.
|
||||
@@ -1766,14 +1766,14 @@ void LLPreviewGesture::onClickPreview(void* data)
|
||||
self->mPreviewBtn->setLabel(self->getString("stop_txt"));
|
||||
|
||||
// play it, and delete when done
|
||||
gGestureManager.playGesture(self->mPreviewGesture);
|
||||
LLGestureMgr::instance().playGesture(self->mPreviewGesture);
|
||||
|
||||
self->refresh();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Will call onDonePreview() below
|
||||
gGestureManager.stopGesture(self->mPreviewGesture);
|
||||
LLGestureMgr::instance().stopGesture(self->mPreviewGesture);
|
||||
|
||||
self->refresh();
|
||||
}
|
||||
|
||||
@@ -2615,7 +2615,7 @@ bool idle_startup()
|
||||
// Could schedule and delay these for later.
|
||||
const BOOL no_inform_server = FALSE;
|
||||
const BOOL no_deactivate_similar = FALSE;
|
||||
gGestureManager.activateGestureWithAsset(item_id, asset_id,
|
||||
LLGestureMgr::instance().activateGestureWithAsset(item_id, asset_id,
|
||||
no_inform_server,
|
||||
no_deactivate_similar);
|
||||
// We need to fetch the inventory items for these gestures
|
||||
|
||||
@@ -2629,7 +2629,7 @@ EAcceptance LLToolDragAndDrop::dad3dActivateGesture(
|
||||
}
|
||||
else
|
||||
{
|
||||
gGestureManager.activateGesture(item->getUUID());
|
||||
LLGestureMgr::instance().activateGesture(item->getUUID());
|
||||
gInventory.updateItem(item);
|
||||
gInventory.notifyObservers();
|
||||
}
|
||||
|
||||
@@ -720,13 +720,12 @@ void RezAttachmentCallback::fire(const LLUUID& inv_item)
|
||||
}
|
||||
}
|
||||
|
||||
extern LLGestureManager gGestureManager;
|
||||
void ActivateGestureCallback::fire(const LLUUID& inv_item)
|
||||
{
|
||||
if (inv_item.isNull())
|
||||
return;
|
||||
|
||||
gGestureManager.activateGesture(inv_item);
|
||||
LLGestureMgr::instance().activateGesture(inv_item);
|
||||
}
|
||||
|
||||
void CreateGestureCallback::fire(const LLUUID& inv_item)
|
||||
@@ -734,7 +733,7 @@ void CreateGestureCallback::fire(const LLUUID& inv_item)
|
||||
if (inv_item.isNull())
|
||||
return;
|
||||
|
||||
gGestureManager.activateGesture(inv_item);
|
||||
LLGestureMgr::instance().activateGesture(inv_item);
|
||||
|
||||
LLViewerInventoryItem* item = gInventory.getItem(inv_item);
|
||||
if (!item) return;
|
||||
|
||||
@@ -2719,7 +2719,7 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
|
||||
}
|
||||
|
||||
// Try for a new-format gesture
|
||||
if (gGestureManager.triggerGesture(key, mask))
|
||||
if (LLGestureMgr::instance().triggerGesture(key, mask))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -2930,7 +2930,7 @@ void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled)
|
||||
else { llinfos << "oops - CurrentGesticulationLevel can be only 0, 1, or 2" << llendl; }
|
||||
|
||||
// this is the call that Karl S. created for triggering gestures from within the code.
|
||||
gGestureManager.triggerAndReviseString( gestureString );
|
||||
LLGestureMgr::instance().triggerAndReviseString( gestureString );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -335,7 +335,7 @@ bool RlvForceWear::isWearingItem(const LLInventoryItem* pItem)
|
||||
case LLAssetType::AT_OBJECT:
|
||||
return (gAgent.getAvatarObject()) && (gAgent.getAvatarObject()->isWearingAttachment(pItem->getUUID()));
|
||||
case LLAssetType::AT_GESTURE:
|
||||
return gGestureManager.isGestureActive(pItem->getUUID());
|
||||
return LLGestureMgr::instance().isGestureActive(pItem->getUUID());
|
||||
case LLAssetType::AT_LINK:
|
||||
return isWearingItem(gInventory.getItem(pItem->getLinkedUUID()));
|
||||
default:
|
||||
@@ -784,7 +784,7 @@ void RlvForceWear::done()
|
||||
for (S32 idxGesture = 0, cntGesture = m_remGestures.count(); idxGesture < cntGesture; idxGesture++)
|
||||
{
|
||||
LLViewerInventoryItem* pItem = m_remGestures.get(idxGesture);
|
||||
gGestureManager.deactivateGesture(pItem->getUUID());
|
||||
LLGestureMgr::instance().deactivateGesture(pItem->getUUID());
|
||||
gInventory.updateItem(pItem);
|
||||
gInventory.notifyObservers();
|
||||
}
|
||||
@@ -877,7 +877,7 @@ void RlvForceWear::done()
|
||||
// Process gestures
|
||||
if (m_addGestures.size())
|
||||
{
|
||||
gGestureManager.activateGestures(m_addGestures);
|
||||
LLGestureMgr::instance().activateGestures(m_addGestures);
|
||||
for (S32 idxGesture = 0, cntGesture = m_addGestures.count(); idxGesture < cntGesture; idxGesture++)
|
||||
gInventory.updateItem(m_addGestures.get(idxGesture));
|
||||
gInventory.notifyObservers();
|
||||
|
||||
Reference in New Issue
Block a user