void ActorAnimationSettingEditor::init()
{

	wxGraphDialog* pGraphDialog = m_Frame->GetGraphDialog();
	if(pGraphDialog)
		pGraphDialog->SetLoop(mDObject->getAnimationLoop());

	this->SetTitle(Fairy::VariantCast<Ogre::String>(mObject->getProperty("actor name")));

	//重新设置动画列表框

	mListBoxAnimation->Clear();

	for ( unsigned short i = 0; i < mDObject->getSkeletonAnimationCount(); ++i )
	{
		Ogre::Animation *anim = mDObject->getSkeletonAnimation(i);

		if ( anim )
		{
			wxString nameStr(anim->getName().c_str());
			mListBoxAnimation->InsertItems( 1, &nameStr, 0 );            
		}
	}
	// 加入obj中定义的动作名称
	Fairy::LogicModelManager::AnimationSkeletonLinksIterator asmIt = 
		Fairy::LogicModelManager::getSingleton().getAnimationSkeletonLinksIterator(mDObject->getName());

	while ( asmIt.hasMoreElements() )
	{
		wxString animName(asmIt.peekNextKey().c_str());

		if ( wxNOT_FOUND == mListBoxAnimation->FindString(animName) )
		{
			wxString nameStr(animName.c_str());
			mListBoxAnimation->InsertItems( 1, &nameStr, 0 );
		}

		asmIt.moveNext();
	}

	//重新设置声音
	if ( NULL == Fairy::LogicModel::GetPlaySoundFuncton() )
	{
		Fairy::LogicModel::SetPlaySoundFuncton(wxGetApp().funcPlay);
	}

	if ( NULL == Fairy::LogicModel::GetStopSoundFunction() )
		Fairy::LogicModel::SetStopSoundFunction(wxGetApp().funcStop);


   
}
Пример #2
0
void
AddSkillDialog::OnInitDialog(wxInitDialogEvent &e)
{
	wxDialog::OnInitDialog(e);

	wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );

	wxFlexGridSizer *item1 = new wxFlexGridSizer( 2, 0, 0 );

	wxStaticText *item2 = new wxStaticText( this, wxID_ANY, /*_("Animation")*/ wxT("动作"), wxDefaultPosition, wxDefaultSize, 0 );
	item1->Add( item2, 0, wxALIGN_CENTER|wxALL, 5 );

	wxString *strs3 = (wxString*) NULL;
	wxComboBox *item3 = new wxComboBox( this, ID_COMBO_ANIMATION, wxT(""), wxDefaultPosition, wxSize(200,-1), 0, strs3, wxCB_DROPDOWN );
	item1->Add( item3, 0, wxALIGN_CENTER|wxALL, 5 );

	wxStaticText *item4 = new wxStaticText( this, wxID_ANY, /*_("Skill Name")*/wxT("技能名称"), wxDefaultPosition, wxDefaultSize, 0 );
	item1->Add( item4, 0, wxALIGN_CENTER|wxALL, 5 );

	wxTextCtrl *item5 = new wxTextCtrl( this, ID_TEXTCTRL_SKILL, wxT(""), wxDefaultPosition, wxSize(200,-1), 0 );
	item1->Add( item5, 0, wxALIGN_CENTER|wxALL, 5 );

	wxButton *item6 = new wxButton( this, wxID_OK, /*_("OK")*/wxT("确认[&O]"), wxDefaultPosition, wxDefaultSize, 0 );
	item1->Add( item6, 0, wxALIGN_CENTER|wxALL, 5 );

	wxButton *item7 = new wxButton( this, wxID_CANCEL, /*_("Cancel")*/wxT("取消[&C]"), wxDefaultPosition, wxDefaultSize, 0 );
	item1->Add( item7, 0, wxALIGN_CENTER|wxALL, 5 );

	item0->Add( item1, 0, wxALIGN_CENTER|wxALL, 5 );

	this->SetSizer( item0 );
	item0->SetSizeHints( this );

	SkillObjectEditor* pSkillEditor = dynamic_cast<SkillObjectEditor*>(m_parent);
	assert(pSkillEditor);

	ActorAnimationSettingEditor *parentDialog = pSkillEditor->GetParentFrame()->GetActorSettingEditor();
	assert (parentDialog);
	Fairy::LogicModel *object = parentDialog->GetCurrentObject();

	for ( unsigned short i = 0; i < object->getSkeletonAnimationCount(); ++i )
	{
		Ogre::Animation *anim = object->getSkeletonAnimation(i);

		if ( anim )
		{
			wxString nameStr(anim->getName().c_str());
			item3->AppendString(nameStr);
		}
	}

	// 加入obj中定义的动作名称
	Fairy::LogicModelManager::AnimationSkeletonLinksIterator asmIt = 
		Fairy::LogicModelManager::getSingleton().getAnimationSkeletonLinksIterator(object->getName());

	while ( asmIt.hasMoreElements() )
	{
		wxString animName(asmIt.peekNextKey().c_str());

		if ( wxNOT_FOUND == item3->FindString(animName) )
		{
			wxString nameStr(animName.c_str());
			item3->AppendString(nameStr);
		}

		asmIt.moveNext();
	}

	item3->SetSelection(0);
	mAnimComboBox = item3;

	mSkillNameTextCtrl = item5;	
}
void ActorAnimationSettingDialog::OnInitDialog(wxInitDialogEvent &e)
{
	wxDialog::OnInitDialog(e);
	wxSizer* sizer = ActorAnimationSetting(this, true, true);

	// 获取各控件的引用
	mListBoxAnimation = wxDynamicCast(this->FindWindow(ID_LISTBOX_ANIMATION),wxListBox);
	mSliderAnimTimePos = wxDynamicCast(this->FindWindow(ID_SLIDER_TIME),wxSlider);
	mSliderAnimRate = wxDynamicCast(this->FindWindow(ID_SLIDER_GLOBAL_ANIM_RATE),wxSlider);
	mSliderAnimFadeOutTime = wxDynamicCast(this->FindWindow(ID_SLIDER_FADE_OUT_TIME),wxSlider);

	mListBoxAllSkill = wxDynamicCast(this->FindWindow(ID_LISTBOX_ALL_SKILL),wxListBox);
	mCheckBoxLoop = wxDynamicCast(this->FindWindow(ID_CHECKBOX_LOOP),wxCheckBox);

	mHairTextCtrl = wxDynamicCast(this->FindWindow(ID_TEXTCTRL_HAIR), wxTextCtrl);
	mCapTextCtrl = wxDynamicCast(this->FindWindow(ID_TEXTCTRL_CAP), wxTextCtrl);
	mBodyTextCtrl = wxDynamicCast(this->FindWindow(ID_TEXTCTRL_BODY), wxTextCtrl);
	mHandTextCtrl = wxDynamicCast(this->FindWindow(ID_TEXTCTRL_HAND), wxTextCtrl);
	mFootTextCtrl = wxDynamicCast(this->FindWindow(ID_TEXTCTRL_FOOT), wxTextCtrl);

    mHairTextMatCtrl = wxDynamicCast(this->FindWindow(ID_TEXTCTRL_HAIR_MAT), wxTextCtrl);
    mCapTextMatCtrl = wxDynamicCast(this->FindWindow(ID_TEXTCTRL_CAP_MAT), wxTextCtrl);
    mBodyTextMatCtrl = wxDynamicCast(this->FindWindow(ID_TEXTCTRL_BODY_MAT), wxTextCtrl);
    mHandTextMatCtrl = wxDynamicCast(this->FindWindow(ID_TEXTCTRL_HAND_MAT), wxTextCtrl);
    mFootTextMatCtrl = wxDynamicCast(this->FindWindow(ID_TEXTCTRL_FOOT_MAT), wxTextCtrl);

    mColourButton = wxDynamicCast(this->FindWindow(ID_BUTTON_COLOUR), wxButton);

	mCheckBoxLoop->SetValue(mDObject->getAnimationLoop());

	for ( unsigned short i = 0; i < mDObject->getSkeletonAnimationCount(); ++i )
	{
		Ogre::Animation *anim = mDObject->getSkeletonAnimation(i);

		if ( anim )
		{
			wxString nameStr(anim->getName().c_str());
			mListBoxAnimation->InsertItems( 1, &nameStr, 0 );            
		}
	}

    // 加入obj中定义的动作名称
    Fairy::LogicModelManager::AnimationSkeletonLinksIterator asmIt = 
        Fairy::LogicModelManager::getSingleton().getAnimationSkeletonLinksIterator(mDObject->getName());

    while ( asmIt.hasMoreElements() )
    {
        wxString animName(asmIt.peekNextKey().c_str());

        if ( wxNOT_FOUND == mListBoxAnimation->FindString(animName) )
        {
            wxString nameStr(animName.c_str());
            mListBoxAnimation->InsertItems( 1, &nameStr, 0 );
        }

        asmIt.moveNext();
    }

    if ( NULL == Fairy::LogicModel::GetPlaySoundFuncton() )
	{
		Fairy::LogicModel::SetPlaySoundFuncton(wxGetApp().funcPlay);
	}
	
	if ( NULL == Fairy::LogicModel::GetStopSoundFunction() )
		Fairy::LogicModel::SetStopSoundFunction(wxGetApp().funcStop);

	FillAllSkillListBox();
}