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); if (it == mActive.end()) return FALSE; LLMultiGesture* gesture = (*it).second; if (!gesture) return FALSE; return gesture->mPlaying; }
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); if (it == mActive.end()) return; LLMultiGesture* gesture = (*it).second; if (!gesture) return; stopGesture(gesture); }
void LLGestureManager::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); if (it == mActive.end()) { 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(base_item_id, gesture, new_asset_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) { const LLUUID& base_item_id = get_linked_uuid(item_id); if( !gAssetStorage ) { LL_WARNS() << "LLGestureMgr::activateGestureWithAsset without valid gAssetStorage" << LL_ENDL; return; } // If gesture is already active, nothing to do. if (isGestureActive(base_item_id)) { LL_WARNS() << "Tried to loadGesture twice " << base_item_id << LL_ENDL; return; } // if (asset_id.isNull()) // { // LL_WARNS() << "loadGesture() - gesture has no asset" << LL_ENDL; // return; // } // For now, put NULL into the item map. We'll build a gesture // class object when the asset data arrives. mActive[base_item_id] = NULL; // Copy the UUID if (asset_id.notNull()) { LLLoadInfo* info = new LLLoadInfo; info->mItemID = base_item_id; info->mInformServer = inform_server; info->mDeactivateSimilar = deactivate_similar; const BOOL high_priority = TRUE; gAssetStorage->getAssetData(asset_id, LLAssetType::AT_GESTURE, onLoadComplete, (void*)info, high_priority); } else { notifyObservers(); } }
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 = LLGestureMgr::instance().mActive.find(base_item_id); if (it == mActive.end()) { LL_WARNS() << "replaceGesture for inactive gesture " << base_item_id << LL_ENDL; return; } // mActive owns this gesture pointer, so clean up memory. LLMultiGesture* gesture = (*it).second; LLGestureMgr::instance().replaceGesture(base_item_id, gesture, new_asset_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); if (it == mActive.end()) { LL_WARNS() << "deactivateGesture for inactive gesture " << base_item_id << LL_ENDL; return; } // mActive owns this gesture pointer, so clean up memory. LLMultiGesture* gesture = (*it).second; // Can be NULL gestures in the map if (gesture) { stopGesture(gesture); delete gesture; gesture = NULL; } mActive.erase(it); gInventory.addChangedMask(LLInventoryObserver::LABEL, base_item_id); // Inform the database of this change LLMessageSystem* msg = gMessageSystem; msg->newMessage("DeactivateGestures"); msg->nextBlock("AgentData"); msg->addUUID("AgentID", gAgent.getID()); msg->addUUID("SessionID", gAgent.getSessionID()); msg->addU32("Flags", 0x0); msg->nextBlock("Data"); msg->addUUID("ItemID", base_item_id); msg->addU32("GestureFlags", 0x0); gAgent.sendReliableMessage(); LLAppearanceMgr::instance().removeCOFItemLinks(base_item_id); notifyObservers(); }
void LLGestureManager::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); if (it == mActive.end()) { llwarns << "replaceGesture for inactive gesture " << base_item_id << llendl; return; } LLMultiGesture* old_gesture = (*it).second; stopGesture(old_gesture); mActive.erase(base_item_id); mActive[base_item_id] = new_gesture; delete old_gesture; old_gesture = NULL; if (asset_id.notNull()) { mLoadingCount = 1; mDeactivateSimilarNames.clear(); LLLoadInfo* info = new LLLoadInfo; info->mItemID = base_item_id; info->mInformServer = TRUE; info->mDeactivateSimilar = FALSE; const BOOL high_priority = TRUE; gAssetStorage->getAssetData(asset_id, LLAssetType::AT_GESTURE, onLoadComplete, (void*)info, high_priority); } notifyObservers(); }
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); return (it != mActive.end()); }
void LLGestureMgr::deactivateSimilarGestures(LLMultiGesture* in, const LLUUID& in_item_id) { const LLUUID& base_in_item_id = get_linked_uuid(in_item_id); uuid_vec_t gest_item_ids; // Deactivate all gestures that match item_map_t::iterator it; for (it = mActive.begin(); it != mActive.end(); ) { const LLUUID& item_id = (*it).first; LLMultiGesture* gest = (*it).second; // Don't deactivate the gesture we are looking for duplicates of // (for replaceGesture) if (!gest || item_id == base_in_item_id) { // legal, can have null pointers in list ++it; } else if ((!gest->mTrigger.empty() && gest->mTrigger == in->mTrigger) || (gest->mKey != KEY_NONE && gest->mKey == in->mKey && gest->mMask == in->mMask)) { gest_item_ids.push_back(item_id); stopGesture(gest); delete gest; gest = NULL; mActive.erase(it++); gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id); } else { ++it; } } // Inform database of the change LLMessageSystem* msg = gMessageSystem; BOOL start_message = TRUE; uuid_vec_t::const_iterator vit = gest_item_ids.begin(); while (vit != gest_item_ids.end()) { if (start_message) { msg->newMessage("DeactivateGestures"); msg->nextBlock("AgentData"); msg->addUUID("AgentID", gAgent.getID()); msg->addUUID("SessionID", gAgent.getSessionID()); msg->addU32("Flags", 0x0); start_message = FALSE; } msg->nextBlock("Data"); msg->addUUID("ItemID", *vit); msg->addU32("GestureFlags", 0x0); if (msg->getCurrentSendTotal() > MTUBYTES) { gAgent.sendReliableMessage(); start_message = TRUE; } ++vit; } if (!start_message) { gAgent.sendReliableMessage(); } // Add to the list of names for the user. for (vit = gest_item_ids.begin(); vit != gest_item_ids.end(); ++vit) { LLViewerInventoryItem* item = gInventory.getItem(*vit); if (!item) continue; mDeactivateSimilarNames.append(item->getName()); mDeactivateSimilarNames.append("\n"); } notifyObservers(); }