Example #1
0
// private
void LLViewerGesture::doTrigger( BOOL send_chat )
{
	if (mSoundItemID != LLUUID::null)
	{
		LLViewerInventoryItem *item;
		item = gInventory.getItem(mSoundItemID);
		if (item)
		{
			send_sound_trigger(item->getAssetUUID(), SOUND_VOLUME);
		}
	}

	if (!mAnimation.empty())
	{
		// AFK animations trigger the special "away" state, which
		// includes agent control settings. JC
		if (mAnimation == "enter_away_from_keyboard_state" || mAnimation == "away")
		{
			gAgent.setAFK();
		}
		else
		{
			LLUUID anim_id = gAnimLibrary.stringToAnimState(mAnimation);
			gAgent.sendAnimationRequest(anim_id, ANIM_REQUEST_START);
		}
	}

	if ( send_chat && !mOutputString.empty())
	{
		// Don't play nodding animation, since that might not blend
		// with the gesture animation.
		gChatBar->sendChatFromViewer(mOutputString, CHAT_TYPE_NORMAL, FALSE);
	}
}
void LLFloaterGesture::onClickPlay()
{
	const LLUUID& item_id = mGestureList->getCurrentID();
	if(item_id.isNull()) return;

	LL_DEBUGS("Gesture")<<" Trying to play gesture id: "<< item_id <<LL_ENDL;
	if(!LLGestureMgr::instance().isGestureActive(item_id))
	{
		// we need to inform server about gesture activating to be consistent with LLPreviewGesture and  LLGestureComboList.
		BOOL inform_server = TRUE;
		BOOL deactivate_similar = FALSE;
		LLGestureMgr::instance().setGestureLoadedCallback(item_id, boost::bind(&LLFloaterGesture::playGesture, this, item_id));
		LLViewerInventoryItem *item = gInventory.getItem(item_id);
		llassert(item);
		if (item)
		{
			LLGestureMgr::instance().activateGestureWithAsset(item_id, item->getAssetUUID(), inform_server, deactivate_similar);
			LL_DEBUGS("Gesture")<< "Activating gesture with inventory ID: " << item_id <<LL_ENDL;
		}
	}
	else
	{
		playGesture(item_id);
	}
}
Example #3
0
// 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)
{
	LLViewerInventoryItem* item = gInventory.getItem(item_id);
	if (!item) return;

	LLUUID asset_id = item->getAssetUUID();

	mLoadingCount = 1;
	mDeactivateSimilarNames.clear();

	const BOOL inform_server = TRUE;
	const BOOL deactivate_similar = FALSE; 
	activateGestureWithAsset(item_id, asset_id, inform_server, deactivate_similar);
}
Example #4
0
bool LLLandmarkActions::getLandmarkGlobalPos(const LLUUID& landmarkInventoryItemID, LLVector3d& posGlobal)
{
	LLViewerInventoryItem* item = gInventory.getItem(landmarkInventoryItemID);
	if (NULL == item)
		return false;

	const LLUUID& asset_id = item->getAssetUUID();

	LLLandmark* landmark = gLandmarkList.getAsset(asset_id, NULL);
	if (NULL == landmark)
		return false;

	return landmark->getGlobalPos(posGlobal);
}
Example #5
0
LLLandmark* LLLandmarkActions::getLandmark(const LLUUID& landmarkInventoryItemID, LLLandmarkList::loaded_callback_t cb)
{
	LLViewerInventoryItem* item = gInventory.getItem(landmarkInventoryItemID);
	if (NULL == item)
		return NULL;

	const LLUUID& asset_id = item->getAssetUUID();

	LLLandmark* landmark = gLandmarkList.getAsset(asset_id, cb);
	if (landmark)
	{
		return landmark;
	}

	return NULL;
}
void LLGestureMgr::activateGestures(LLViewerInventoryItem::item_array_t& items)
{
	// Load up the assets
	S32 count = 0;
	LLViewerInventoryItem::item_array_t::const_iterator it;
	for (it = items.begin(); it != items.end(); ++it)
	{
		LLViewerInventoryItem* item = *it;

		if (isGestureActive(item->getUUID()))
		{
			continue;
		}
		else 
		{ // Make gesture active and persistent through login sessions.  -Aura 07-12-06
			activateGesture(item->getUUID());
		}

		count++;
	}

	mLoadingCount = count;
	mDeactivateSimilarNames.clear();

	for (it = items.begin(); it != items.end(); ++it)
	{
		LLViewerInventoryItem* item = *it;

		if (isGestureActive(item->getUUID()))
		{
			continue;
		}

		// Don't inform server, we'll do that in bulk
		const BOOL no_inform_server = FALSE;
		const BOOL deactivate_similar = TRUE;
		activateGestureWithAsset(item->getUUID(), item->getAssetUUID(),
								 no_inform_server,
								 deactivate_similar);
	}

	// Inform the database of this change
	LLMessageSystem* msg = gMessageSystem;

	BOOL start_message = TRUE;

	for (it = items.begin(); it != items.end(); ++it)
	{
		LLViewerInventoryItem* item = *it;

		if (isGestureActive(item->getUUID()))
		{
			continue;
		}

		if (start_message)
		{
			msg->newMessage("ActivateGestures");
			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", item->getUUID());
		msg->addUUID("AssetID", item->getAssetUUID());
		msg->addU32("GestureFlags", 0x0);

		if (msg->getCurrentSendTotal() > MTUBYTES)
		{
			gAgent.sendReliableMessage();
			start_message = TRUE;
		}
	}

	if (!start_message)
	{
		gAgent.sendReliableMessage();
	}
}
// Checked: 2010-09-18 (RLVa-1.2.1a) | Modified: RLVa-1.2.1a
void RlvForceWear::done()
{
	// Sanity check - don't go through all the motions below only to find out there's nothing to actually do
	if ( (m_remWearables.empty()) && (m_remAttachments.empty()) && (m_remGestures.empty()) &&
		 (m_addWearables.empty()) && (m_addAttachments.empty()) && (m_addGestures.empty()) )
	{
		return;
	}

	//
	// Process removals
	//

	// Wearables
	if (m_remWearables.size())
	{
		for (std::list<const LLWearable*>::const_iterator itWearable = m_remWearables.begin(); itWearable != m_remWearables.end(); ++itWearable)
			gAgent.removeWearable((*itWearable)->getType());
		m_remWearables.clear();
	}

	// Gestures
	if (m_remGestures.size())
	{
		for (S32 idxGesture = 0, cntGesture = m_remGestures.count(); idxGesture < cntGesture; idxGesture++)
		{
			LLViewerInventoryItem* pItem = m_remGestures.get(idxGesture);
			gGestureManager.deactivateGesture(pItem->getUUID());
			gInventory.updateItem(pItem);
			gInventory.notifyObservers();
		}
		m_remGestures.clear();
	}

	// Attachments
	if (m_remAttachments.size())
	{
		// Don't bother with COF if all we're doing is detaching some attachments (keeps people from rebaking on every @remattach=force)
		gMessageSystem->newMessage("ObjectDetach");
		gMessageSystem->nextBlockFast(_PREHASH_AgentData);
		gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
		gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
		for (std::list<const LLViewerObject*>::const_iterator itAttachObj = m_remAttachments.begin(); 
				itAttachObj != m_remAttachments.end(); ++itAttachObj)
		{
			gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
			gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, (*itAttachObj)->getLocalID());
		}
		gMessageSystem->sendReliable(gAgent.getRegionHost());

		m_remAttachments.clear();
	}

	//
	// Process additions
	//

	// Process wearables
	if (m_addWearables.size())
	{
		// [See wear_inventory_category_on_avatar_step2()]
		LLWearableHoldingPattern* pWearData = new LLWearableHoldingPattern(TRUE);

		// We need to populate 'pWearData->mFoundList' before doing anything else because (some of) the assets might already be available
		for (addwearables_map_t::const_iterator itAddWearables = m_addWearables.begin(); 
				itAddWearables != m_addWearables.end(); ++itAddWearables)
		{
			const LLInventoryModel::item_array_t& wearItems = itAddWearables->second;

			RLV_VERIFY(1 == wearItems.count());
			if (wearItems.count() > 0)
			{
				LLViewerInventoryItem* pItem = wearItems.get(0);
				if ( (pItem) && ((LLAssetType::AT_BODYPART == pItem->getType()) || (LLAssetType::AT_CLOTHING == pItem->getType())) )
				{
					LLFoundData* pFound = new LLFoundData(pItem->getUUID(), pItem->getAssetUUID(), pItem->getName(), pItem->getType());
					pWearData->mFoundList.push_front(pFound);
				}
			}
		}

		if (!pWearData->mFoundList.size())
		{
			delete pWearData;
			return;
		}

		// If all the assets are available locally then "pWearData" will be freed *before* the last "gWearableList.getAsset()" call returns
		bool fContinue = true; LLWearableHoldingPattern::found_list_t::const_iterator itWearable = pWearData->mFoundList.begin();
		while ( (fContinue) && (itWearable != pWearData->mFoundList.end()) )
		{
			const LLFoundData* pFound = *itWearable;
			++itWearable;
			fContinue = (itWearable != pWearData->mFoundList.end());
			gWearableList.getAsset(pFound->mAssetID, pFound->mName, pFound->mAssetType, wear_inventory_category_on_avatar_loop, (void*)pWearData);
		}

		m_addWearables.clear();
	}

	// Until LL provides a way for updateCOF to selectively attach add/replace we have to deal with attachments ourselves
	for (addattachments_map_t::const_iterator itAddAttachments = m_addAttachments.begin(); 
			itAddAttachments != m_addAttachments.end(); ++itAddAttachments)
	{
		const LLInventoryModel::item_array_t& wearItems = itAddAttachments->second;
		for (S32 idxItem = 0, cntItem = wearItems.count(); idxItem < cntItem; idxItem++)
		{
			const LLUUID& idItem = wearItems.get(idxItem)->getLinkedUUID();
//			if (gAgentAvatarp->attachmentWasRequested(idItem))
//				continue;
//			gAgentAvatarp->addAttachmentRequest(idItem);

			LLAttachmentsMgr::instance().addAttachment(idItem, itAddAttachments->first & ~ATTACHMENT_ADD, itAddAttachments->first & ATTACHMENT_ADD);
		}
	}
	m_addAttachments.clear();

	// Process gestures
	if (m_addGestures.size())
	{
		gGestureManager.activateGestures(m_addGestures);
		for (S32 idxGesture = 0, cntGesture = m_addGestures.count(); idxGesture < cntGesture; idxGesture++)
			gInventory.updateItem(m_addGestures.get(idxGesture));
		gInventory.notifyObservers();

		m_addGestures.clear();
	}

	// Since RlvForceWear is a singleton now we want to be sure there aren't any leftovers
	RLV_ASSERT( (m_remWearables.empty()) && (m_remAttachments.empty()) && (m_remGestures.empty()) );
	RLV_ASSERT( (m_addWearables.empty()) && (m_addAttachments.empty()) && (m_addGestures.empty()) );
}