RLVa 1.1.2 to 1.1.3 upgrade. InvLinks + COF
This commit is contained in:
@@ -69,7 +69,10 @@ LLGestureManager gGestureManager;
|
||||
// Longest time, in seconds, to wait for all animations to stop playing
|
||||
const F32 MAX_WAIT_ANIM_SECS = 30.f;
|
||||
|
||||
|
||||
// If this gesture is a link, get the base gesture that this link points to,
|
||||
// otherwise just return this id.
|
||||
static const LLUUID& get_linked_uuid(const LLUUID& item_id);
|
||||
|
||||
// Lightweight constructor.
|
||||
// init() does the heavy lifting.
|
||||
LLGestureManager::LLGestureManager()
|
||||
@@ -216,15 +219,17 @@ void LLGestureManager::activateGestureWithAsset(const LLUUID& item_id,
|
||||
BOOL inform_server,
|
||||
BOOL deactivate_similar)
|
||||
{
|
||||
const LLUUID& base_item_id = get_linked_uuid(item_id);
|
||||
|
||||
if( !gAssetStorage )
|
||||
{
|
||||
llwarns << "LLGestureManager::activateGestureWithAsset without valid gAssetStorage" << llendl;
|
||||
return;
|
||||
}
|
||||
// If gesture is already active, nothing to do.
|
||||
if (isGestureActive(item_id))
|
||||
if (isGestureActive(base_item_id))
|
||||
{
|
||||
llwarns << "Tried to loadGesture twice " << item_id << llendl;
|
||||
llwarns << "Tried to loadGesture twice " << base_item_id << llendl;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -236,13 +241,13 @@ void LLGestureManager::activateGestureWithAsset(const LLUUID& item_id,
|
||||
|
||||
// For now, put NULL into the item map. We'll build a gesture
|
||||
// class object when the asset data arrives.
|
||||
mActive[item_id] = NULL;
|
||||
mActive[base_item_id] = NULL;
|
||||
|
||||
// Copy the UUID
|
||||
if (asset_id.notNull())
|
||||
{
|
||||
LLLoadInfo* info = new LLLoadInfo;
|
||||
info->mItemID = item_id;
|
||||
info->mItemID = base_item_id;
|
||||
info->mInformServer = inform_server;
|
||||
info->mDeactivateSimilar = deactivate_similar;
|
||||
|
||||
@@ -262,10 +267,11 @@ void LLGestureManager::activateGestureWithAsset(const LLUUID& item_id,
|
||||
|
||||
void LLGestureManager::deactivateGesture(const LLUUID& item_id)
|
||||
{
|
||||
item_map_t::iterator it = mActive.find(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())
|
||||
{
|
||||
llwarns << "deactivateGesture for inactive gesture " << item_id << llendl;
|
||||
llwarns << "deactivateGesture for inactive gesture " << base_item_id << llendl;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -282,7 +288,7 @@ void LLGestureManager::deactivateGesture(const LLUUID& item_id)
|
||||
}
|
||||
|
||||
mActive.erase(it);
|
||||
gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);
|
||||
gInventory.addChangedMask(LLInventoryObserver::LABEL, base_item_id);
|
||||
|
||||
// Inform the database of this change
|
||||
LLMessageSystem* msg = gMessageSystem;
|
||||
@@ -293,7 +299,7 @@ void LLGestureManager::deactivateGesture(const LLUUID& item_id)
|
||||
msg->addU32("Flags", 0x0);
|
||||
|
||||
msg->nextBlock("Data");
|
||||
msg->addUUID("ItemID", item_id);
|
||||
msg->addUUID("ItemID", base_item_id);
|
||||
msg->addU32("GestureFlags", 0x0);
|
||||
|
||||
gAgent.sendReliableMessage();
|
||||
@@ -304,6 +310,7 @@ void LLGestureManager::deactivateGesture(const LLUUID& item_id)
|
||||
|
||||
void LLGestureManager::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;
|
||||
|
||||
// Deactivate all gestures that match
|
||||
@@ -315,7 +322,7 @@ void LLGestureManager::deactivateSimilarGestures(LLMultiGesture* in, const LLUUI
|
||||
|
||||
// Don't deactivate the gesture we are looking for duplicates of
|
||||
// (for replaceGesture)
|
||||
if (!gest || item_id == in_item_id)
|
||||
if (!gest || item_id == base_in_item_id)
|
||||
{
|
||||
// legal, can have null pointers in list
|
||||
++it;
|
||||
@@ -390,14 +397,16 @@ void LLGestureManager::deactivateSimilarGestures(LLMultiGesture* in, const LLUUI
|
||||
|
||||
BOOL LLGestureManager::isGestureActive(const LLUUID& item_id)
|
||||
{
|
||||
item_map_t::iterator it = mActive.find(item_id);
|
||||
const LLUUID& base_item_id = get_linked_uuid(item_id);
|
||||
item_map_t::iterator it = mActive.find(base_item_id);
|
||||
return (it != mActive.end());
|
||||
}
|
||||
|
||||
|
||||
BOOL LLGestureManager::isGesturePlaying(const LLUUID& item_id)
|
||||
{
|
||||
item_map_t::iterator it = mActive.find(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 FALSE;
|
||||
|
||||
LLMultiGesture* gesture = (*it).second;
|
||||
@@ -408,19 +417,20 @@ BOOL LLGestureManager::isGesturePlaying(const LLUUID& item_id)
|
||||
|
||||
void LLGestureManager::replaceGesture(const LLUUID& item_id, LLMultiGesture* new_gesture, const LLUUID& asset_id)
|
||||
{
|
||||
item_map_t::iterator it = mActive.find(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())
|
||||
{
|
||||
llwarns << "replaceGesture for inactive gesture " << item_id << llendl;
|
||||
llwarns << "replaceGesture for inactive gesture " << base_item_id << llendl;
|
||||
return;
|
||||
}
|
||||
|
||||
LLMultiGesture* old_gesture = (*it).second;
|
||||
stopGesture(old_gesture);
|
||||
|
||||
mActive.erase(item_id);
|
||||
mActive.erase(base_item_id);
|
||||
|
||||
mActive[item_id] = new_gesture;
|
||||
mActive[base_item_id] = new_gesture;
|
||||
|
||||
delete old_gesture;
|
||||
old_gesture = NULL;
|
||||
@@ -431,7 +441,7 @@ void LLGestureManager::replaceGesture(const LLUUID& item_id, LLMultiGesture* new
|
||||
mDeactivateSimilarNames.clear();
|
||||
|
||||
LLLoadInfo* info = new LLLoadInfo;
|
||||
info->mItemID = item_id;
|
||||
info->mItemID = base_item_id;
|
||||
info->mInformServer = TRUE;
|
||||
info->mDeactivateSimilar = FALSE;
|
||||
|
||||
@@ -448,16 +458,17 @@ 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);
|
||||
const LLUUID& base_item_id = get_linked_uuid(item_id);
|
||||
item_map_t::iterator it = gGestureManager.mActive.find(base_item_id);
|
||||
if (it == mActive.end())
|
||||
{
|
||||
llwarns << "replaceGesture for inactive gesture " << item_id << llendl;
|
||||
llwarns << "replaceGesture for inactive gesture " << base_item_id << llendl;
|
||||
return;
|
||||
}
|
||||
|
||||
// mActive owns this gesture pointer, so clean up memory.
|
||||
LLMultiGesture* gesture = (*it).second;
|
||||
gGestureManager.replaceGesture(item_id, gesture, new_asset_id);
|
||||
gGestureManager.replaceGesture(base_item_id, gesture, new_asset_id);
|
||||
}
|
||||
|
||||
void LLGestureManager::playGesture(LLMultiGesture* gesture)
|
||||
@@ -481,7 +492,8 @@ void LLGestureManager::playGesture(LLMultiGesture* gesture)
|
||||
// Convenience function that looks up the item_id for you.
|
||||
void LLGestureManager::playGesture(const LLUUID& item_id)
|
||||
{
|
||||
item_map_t::iterator it = mActive.find(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;
|
||||
|
||||
LLMultiGesture* gesture = (*it).second;
|
||||
@@ -1070,7 +1082,8 @@ void LLGestureManager::stopGesture(LLMultiGesture* gesture)
|
||||
|
||||
void LLGestureManager::stopGesture(const LLUUID& item_id)
|
||||
{
|
||||
item_map_t::iterator it = mActive.find(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;
|
||||
|
||||
LLMultiGesture* gesture = (*it).second;
|
||||
@@ -1151,3 +1164,14 @@ void LLGestureManager::getItemIDs(std::vector<LLUUID>* ids)
|
||||
ids->push_back(it->first);
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
const LLUUID& get_linked_uuid(const LLUUID &item_id)
|
||||
{
|
||||
LLViewerInventoryItem* item = gInventory.getItem(item_id);
|
||||
if (item && item->getIsLinkType())
|
||||
{
|
||||
return item->getLinkedUUID();
|
||||
}
|
||||
return item_id;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user