コード例 #1
0
//-----------------------------------------------------------------------------
// draw()
//-----------------------------------------------------------------------------
void LLFloaterAnimPreview::draw()
{
	LLFloater::draw();
	LLRect r = getRect();

	refresh();

	if (mMotionID.notNull() && mAnimPreview)
	{
		if (sUseDummy)
		{
			gGL.color3f(1.f, 1.f, 1.f); 
			gGL.getTexUnit(0)->bind(mAnimPreview); 
			gGL.begin( LLRender::QUADS ); 
			{ 
				gGL.texCoord2f(0.f, 1.f); 
				gGL.vertex2i(PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT); 
				gGL.texCoord2f(0.f, 0.f); 
				gGL.vertex2i(PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD); 
				gGL.texCoord2f(1.f, 0.f); 
				gGL.vertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD); 
				gGL.texCoord2f(1.f, 1.f); 
				gGL.vertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT); 
			} 
		gGL.end(); 
		gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); 
		}
		LLVOAvatar* avatarp = mAnimPreview->getPreviewAvatar();
		if (!avatarp->areAnimationsPaused())
		{
			mAnimPreview->requestUpdate();
		}
	}
}
コード例 #2
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;
		}
	}
}
コード例 #3
0
//-----------------------------------------------------------------------------
// resetMotion()
//-----------------------------------------------------------------------------
void LLFloaterAnimPreview::resetMotion()
{
	LLVOAvatar* avatarp = mAnimPreview->getPreviewAvatar();
	BOOL paused = avatarp->areAnimationsPaused();

	// *TODO: Fix awful casting hack
	LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID);
	
	// Set emotion
	std::string emote = getChild<LLUICtrl>("emote_combo")->getValue().asString();
	motionp->setEmote(mIDList[emote]);
	
	LLUUID base_id = mIDList[getChild<LLUICtrl>("preview_base_anim")->getValue().asString()];
	avatarp->deactivateAllMotions();
	avatarp->startMotion(mMotionID, 0.0f);
	avatarp->startMotion(base_id, BASE_ANIM_TIME_OFFSET);
	getChild<LLUICtrl>("playback_slider")->setValue(0.0f);

	// Set pose
	std::string handpose = getChild<LLUICtrl>("hand_pose_combo")->getValue().asString();
	avatarp->startMotion( ANIM_AGENT_HAND_MOTION, 0.0f );
	motionp->setHandPose(LLHandMotion::getHandPose(handpose));

	if (paused)
	{
		mPauseRequest = avatarp->requestPause();
	}
	else
	{
		mPauseRequest = NULL;	
	}
}
コード例 #4
0
//-----------------------------------------------------------------------------
// 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;
		}
	}
}
コード例 #5
0
//-----------------------------------------------------------------------------
// onBtnPlay()
//-----------------------------------------------------------------------------
void LLFloaterAnimPreview::onBtnPlay(void* user_data)
{
	LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)user_data;
	if (!previewp->getEnabled())
		return;

	if (previewp->mMotionID.notNull() && previewp->mAnimPreview)
	{
		LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar();

		if(!avatarp->isMotionActive(previewp->mMotionID))
		{
			previewp->resetMotion();
			previewp->mPauseRequest = NULL;
		}
		else
		{
			if (avatarp->areAnimationsPaused())
			{
				previewp->mPauseRequest = NULL;
			}
			else
			{
				previewp->mPauseRequest = avatarp->requestPause();
			}
		}
	}
}
コード例 #6
0
//-----------------------------------------------------------------------------
// refresh()
//-----------------------------------------------------------------------------
void LLFloaterAnimPreview::refresh()
{
	if (!mAnimPreview)
	{
		childShow("bad_animation_text");
		mPlayButton->setEnabled(FALSE);
		mStopButton->setEnabled(FALSE);
		childDisable("ok_btn");
	}
	else
	{
		childHide("bad_animation_text");
		mPlayButton->setEnabled(TRUE);
		LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar();
		if (avatarp->isMotionActive(mMotionID))
		{
			mStopButton->setEnabled(TRUE);
			LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID);
			if (avatarp->areAnimationsPaused())
			{

				mPlayButton->setImages(std::string("button_anim_play.tga"),
									   std::string("button_anim_play_selected.tga"));

			}
			else
			{
				if (motionp)
				{
					F32 fraction_complete = motionp->getLastUpdateTime() / motionp->getDuration();
					childSetValue("playback_slider", fraction_complete);
				}
				mPlayButton->setImages(std::string("button_anim_pause.tga"),
									   std::string("button_anim_pause_selected.tga"));

			}
		}
		else
		{
			mPauseRequest = avatarp->requestPause();
			mPlayButton->setImages(std::string("button_anim_play.tga"),
								   std::string("button_anim_play_selected.tga"));

			mStopButton->setEnabled(TRUE); // stop also resets, leave enabled.
		}
		childEnable("ok_btn");
		mAnimPreview->requestUpdate();
	}
}
コード例 #7
0
//-----------------------------------------------------------------------------
// refresh()
//-----------------------------------------------------------------------------
void LLFloaterAnimPreview::refresh()
{
	// Are we showing the play button (default) or the pause button?
	bool show_play = true;
	if (!mAnimPreview)
	{
		getChildView("bad_animation_text")->setVisible(TRUE);
		// play button visible but disabled
		mPlayButton->setEnabled(FALSE);
		mStopButton->setEnabled(FALSE);
		getChildView("ok_btn")->setEnabled(FALSE);
	}
	else
	{
		getChildView("bad_animation_text")->setVisible(FALSE);
		// re-enabled in case previous animation was bad
		mPlayButton->setEnabled(TRUE);
		mStopButton->setEnabled(TRUE);
		LLVOAvatar* avatarp = mAnimPreview->getPreviewAvatar();
		if (avatarp->isMotionActive(mMotionID))
		{
			mStopButton->setEnabled(TRUE);
			LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID);
			if (!avatarp->areAnimationsPaused())
			{
				// animation is playing
				if (motionp)
				{
					F32 fraction_complete = motionp->getLastUpdateTime() / motionp->getDuration();
					getChild<LLUICtrl>("playback_slider")->setValue(fraction_complete);
				}
				show_play = false;
			}
		}
		else
		{
			// Motion just finished playing
			mPauseRequest = avatarp->requestPause();
		}
		getChildView("ok_btn")->setEnabled(TRUE);
		mAnimPreview->requestUpdate();
	}
	mPlayButton->setVisible(show_play);
	mPauseButton->setVisible(!show_play);
}
コード例 #8
0
//-----------------------------------------------------------------------------
// resetMotion()
//-----------------------------------------------------------------------------
void LLFloaterAnimPreview::resetMotion()
{
	LLVOAvatar* avatarp;
	if (mInWorld)
	{
		avatarp = gAgent.getAvatarObject();
	}
	else
	{
		avatarp = mAnimPreview->getDummyAvatar();
	}
	if (!avatarp)
	{
		return;
	}

	BOOL paused = avatarp->areAnimationsPaused();

	// *TODO: Fix awful casting hack
	LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID);
	
	// Set emotion
	std::string emote = childGetValue("emote_combo").asString();
	motionp->setEmote(mIDList[emote]);
	
	LLUUID base_id = mIDList[childGetValue("preview_base_anim").asString()];
	avatarp->deactivateAllMotions();
	avatarp->startMotion(base_id, BASE_ANIM_TIME_OFFSET);
	avatarp->startMotion(mMotionID, 0.0f);
	childSetValue("playback_slider", 0.0f);

	// Set pose
	std::string handpose = childGetValue("hand_pose_combo").asString();
	avatarp->startMotion( ANIM_AGENT_HAND_MOTION, 0.0f );
	motionp->setHandPose(LLHandMotion::getHandPose(handpose));

	if (paused)
	{
		mPauseRequest = avatarp->requestPause();
	}
	else
	{
		mPauseRequest = NULL;	
	}
}
コード例 #9
0
//-----------------------------------------------------------------------------
// onBtnPause()
//-----------------------------------------------------------------------------
void LLFloaterAnimPreview::onBtnPause()
{
	if (!getEnabled())
		return;
	
	if (mMotionID.notNull() && mAnimPreview)
	{
		LLVOAvatar* avatarp = mAnimPreview->getPreviewAvatar();

		if (avatarp->isMotionActive(mMotionID))
		{
			if (!avatarp->areAnimationsPaused())
			{
				mPauseRequest = avatarp->requestPause();
			}
		}
	}
}
コード例 #10
0
//-----------------------------------------------------------------------------
// onBtnPlay()
//-----------------------------------------------------------------------------
void LLFloaterAnimPreview::onBtnPlay()
{
    if (!getEnabled())
        return;

    if (mMotionID.notNull() && mAnimPreview)
    {
        LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar();

        if (!avatarp->isMotionActive(mMotionID))
        {
            resetMotion();
            mPauseRequest = NULL;
        }
        else if (avatarp->areAnimationsPaused())
        {
            mPauseRequest = NULL;
        }
    }
}