Exemple #1
0
//-----------------------------------------------------------------------------
// onCommitBaseAnim()
//-----------------------------------------------------------------------------
void LLFloaterAnimPreview::onCommitBaseAnim()
{
	if (!getEnabled())
		return;

	if (mAnimPreview)
	{
		LLVOAvatar* avatarp = mAnimPreview->getPreviewAvatar();

		BOOL paused = avatarp->areAnimationsPaused();

		// stop all other possible base motions
		avatarp->stopMotion(mIDList["Standing"], TRUE);
		avatarp->stopMotion(mIDList["Walking"], TRUE);
		avatarp->stopMotion(mIDList["Sitting"], TRUE);
		avatarp->stopMotion(mIDList["Flying"], TRUE);

		resetMotion();

		if (!paused)
		{
			mPauseRequest = NULL;
		}
	}
}
//-----------------------------------------------------------------------------
// onCommitBaseAnim()
//-----------------------------------------------------------------------------
void LLFloaterAnimPreview::onCommitBaseAnim(LLUICtrl* ctrl, void* data)
{
	LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data;
	if (!previewp->getEnabled())
		return;

	if (previewp->mAnimPreview)
	{
		LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar();

		BOOL paused = avatarp->areAnimationsPaused();

		// stop all other possible base motions
		avatarp->stopMotion(ANIM_AGENT_STAND, TRUE);
		avatarp->stopMotion(ANIM_AGENT_WALK, TRUE);
		avatarp->stopMotion(ANIM_AGENT_SIT, TRUE);
		avatarp->stopMotion(ANIM_AGENT_HOVER, TRUE);

		previewp->resetMotion();

		if (!paused)
		{
			previewp->mPauseRequest = NULL;
		}
	}
}
//-----------------------------------------------------------------------------
// LLFloaterAnimPreview()
//-----------------------------------------------------------------------------
LLFloaterAnimPreview::~LLFloaterAnimPreview()
{
	if (mInWorld)
	{
		LLVOAvatar* avatarp = gAgent.getAvatarObject();
		if (avatarp)
		{
			if (mMotionID.notNull())
			{
				avatarp->stopMotion(mMotionID, TRUE);
				avatarp->removeMotion(mMotionID);
			}
			avatarp->deactivateAllMotions();
			avatarp->startMotion(ANIM_AGENT_HEAD_ROT);
			avatarp->startMotion(ANIM_AGENT_EYE);
			avatarp->startMotion(ANIM_AGENT_BODY_NOISE);
			avatarp->startMotion(ANIM_AGENT_BREATHE_ROT);
			avatarp->startMotion(ANIM_AGENT_HAND_MOTION);
			avatarp->startMotion(ANIM_AGENT_PELVIS_FIX);
			avatarp->startMotion(ANIM_AGENT_STAND, BASE_ANIM_TIME_OFFSET);
		}
	}
	delete mAnimPreview;
	mAnimPreview = NULL;

	setEnabled(FALSE);
}
Exemple #4
0
//static
void LLAO::runAnims(BOOL enabled)
{
	LLVOAvatar* avatarp = gAgent.getAvatarObject();
	if (avatarp)
	{
		for ( LLVOAvatar::AnimIterator anim_it =
				  avatarp->mPlayingAnimations.begin();
			  anim_it != avatarp->mPlayingAnimations.end();
			  anim_it++)
		{
			if(LLAO::mOverrides.find(anim_it->first) != LLAO::mOverrides.end())
			{
				LLUUID anim_id = mOverrides[anim_it->first];
				// this is an override anim
				if(enabled)
				{
					// make override start
					avatarp->startMotion(anim_id);
				}
				else
				{
					avatarp->stopMotion(anim_id);
					gAgent.sendAnimationRequest(anim_id, ANIM_REQUEST_STOP);
				}
			}
		}
		if(mTimer)
		{
			if(enabled)
				mTimer->resume();
			else
				mTimer->pause();
		}
	}
}
Exemple #5
0
BOOL LLAOStandTimer::tick()
{
	if(!mPaused && LLAO::isEnabled() && !LLAO::mStandOverrides.empty())
	{
		LLVOAvatar* avatarp = gAgent.getAvatarObject();
		if (avatarp)
		{
			for ( LLVOAvatar::AnimIterator anim_it =
					  avatarp->mPlayingAnimations.begin();
				  anim_it != avatarp->mPlayingAnimations.end();
				  anim_it++)
			{
				if(LLAO::isStand(anim_it->first))
				{
					//back is always last played, front is next
					avatarp->stopMotion(LLAO::mStandOverrides.back());
					avatarp->startMotion(LLAO::mStandOverrides.front());
					LLAO::mStandOverrides.push_back(LLAO::mStandOverrides.front());
					LLAO::mStandOverrides.pop_front();
					LLFloaterAO* ao = LLFloaterAO::sInstance;
					if(ao)
					{
						ao->mStandsCombo->setSimple(LLStringExplicit(LLAO::mStandOverrides.back().asString()));
					}
					break;
				}
			}
		}
	}
	return FALSE;
}
Exemple #6
0
void LLAOStandTimer::pause()
{
	if(mPaused) return;
	LLVOAvatar* avatarp = gAgent.getAvatarObject();
	if (avatarp)
	{
		gAgent.sendAnimationRequest(LLAO::mStandOverrides.back(), ANIM_REQUEST_STOP);
		avatarp->stopMotion(LLAO::mStandOverrides.back());
	}
	mEventTimer.reset();
	mEventTimer.stop();
	mPaused = TRUE;
}
Exemple #7
0
//static
void LLFloaterAO::onClickStandAdd(void* user_data)
{
	LLFloaterAO* floater = (LLFloaterAO*)user_data;
	LLUUID id = LLUUID(floater->mStandsCombo->getValue());
	std::list<LLUUID>::iterator itr = std::find(LLAO::mStandOverrides.begin(),LLAO::mStandOverrides.end(),id);
	LLVOAvatar* avatarp = gAgent.getAvatarObject();
	if(id.notNull() && itr == LLAO::mStandOverrides.end())
	{
		//back is always last played
		avatarp->stopMotion(LLAO::mStandOverrides.back());
		avatarp->startMotion(id);
		LLAO::mStandOverrides.push_back(id);

		floater->refresh();
		LLAO::mTimer->reset();
	}
	onCommitAnim(NULL,user_data);
}
//-----------------------------------------------------------------------------
// initialize()
//-----------------------------------------------------------------------------
void	LLMorphView::initialize()
{
    mCameraPitch = 0.f;
    mCameraYaw = 0.f;
    mCameraDist = -1.f;

    LLVOAvatar *avatarp = gAgent.getAvatarObject();
    if (!avatarp || avatarp->isDead())
    {
        gAgent.changeCameraToDefault();
        return;
    }

    avatarp->stopMotion( ANIM_AGENT_BODY_NOISE );
    avatarp->mSpecialRenderMode = 3;

    // set up camera for close look at avatar
    mOldCameraNearClip = LLViewerCamera::getInstance()->getNear();
    LLViewerCamera::getInstance()->setNear(MORPH_NEAR_CLIP);
}