Exemple #1
0
void
AnimationSelector::OnAnimationListSelChanged(wxTreeEvent& e)
{
	// reset the state
	resetState();

    wxTreeItemId item = e.GetItem();

    wxASSERT(item.IsOk());

	wxTreeCtrl* tree = wxStaticCast(e.GetEventObject(), wxTreeCtrl);
    mActivedItem = e.GetItem();

    wxArrayTreeItemIds selections;
    int nCount = tree->GetSelections(selections);

	if(nCount <= 0)
		return;

	if (mIsMeshAnim)
	{
		GetDataManipulator()->changeMeshAnimation(DoActiveItem(item));
		return;
	}

	GetDataManipulator()->changeAnimation(DoActiveItem(item),0.0);

	Fairy::LogicModel* pObjModel = GetDataManipulator()->m_pObjTemplate;

	if ( pObjModel && !pObjModel->getCurrentAnimName().empty())
	{
		
		m_btnPause->Enable(true);
 
 		pObjModel->setAnimEditing(m_bPause);

		Ogre::String animationName = pObjModel->getCurrentAnimName();

		bool bLoop = pObjModel->getAnimationLoop();
		Ogre::Real timeTotal = pObjModel->getAnimationLength(animationName);

		m_endTimeText->SetValue(Ogre::StringConverter::toString(timeTotal));
		m_endFrameText->SetValue(Ogre::StringConverter::toString(timeTotal*STATIC_FPS));
	}
}
Exemple #2
0
void AnimationSelector::OnSliderUpdate(wxCommandEvent & e)
{
	if (!m_bPause)
	{
		return;
	}
	int pos = m_slider->GetValue();
	
	Fairy::LogicModel* pObjModel = GetDataManipulator()->m_pObjTemplate;

	if ( pObjModel && !pObjModel->getCurrentAnimName().empty())
	{
		Ogre::Real timeTotal = pObjModel->getAnimationLength(pObjModel->getCurrentAnimName());

		Ogre::Real posValue = ((Ogre::Real)pos)/m_slider->GetMax();
		pObjModel->setAnimTimePos(posValue);
		m_curTimeText->SetValue(Ogre::StringConverter::toString(posValue*timeTotal));
		m_curFrameText->SetValue(Ogre::StringConverter::toString(posValue*timeTotal*STATIC_FPS));
	}
}