void FairySkillEditDialog::OnAddEffectInfoButtonDown(wxCommandEvent &e)
{
	if (mSkill)
	{
		AddEffectInfoDialog *dlg = new AddEffectInfoDialog(this, wxID_ANY,
			_("Animation Effect Info"));

		bool ok = (dlg->ShowModal() == wxID_OK);
		if(ok)
		{
			Ogre::String effect = wxDynamicCast(dlg->FindWindow(feID_COMBOCTRL_EFFECT),wxComboBox)->GetValue().c_str();
			Ogre::String locator1 = wxDynamicCast(dlg->FindWindow(feID_COMBOCTRL_LOCATOR),wxComboBox)->GetValue().c_str();

			WX::AnimationEffectInfo *effectInfo = mSkill->addAnimationEffectInfo();
			assert (effectInfo);

			effectInfo->setEffectTemplateName(effect);
			effectInfo->setAttachPoint(locator1);

			InitPropertyEditor();
		}

		dlg->Destroy();
	}	
}
void FairySkillEditDialog::OnAddLightButtonDown(wxCommandEvent &e)
{
    if (mSkill)
    {
        WX::AnimationSceneLightInfo *light = mSkill->addAnimationSceneLightInfo();
        assert (light);

        InitPropertyEditor();
    }
}
void FairySkillEditDialog::InitSkillDialog( WX::LogicModel *object, WX::SceneManipulator *sceneManipulator )
{
	mParentDialog = static_cast<ActorAnimationSettingDialog *>(this->GetParent());
	assert ( object && sceneManipulator );

	mDObject = object;
	mSkill = mDObject->getCurrentSkill();

	mSceneManipulator = sceneManipulator;

	if ( mSkill )
		InitPropertyEditor();

	this->SetTitle(mDObject->getCurrentSkill()->getSkillName());
}
void FDetailItemNode::Initialize()
{
	if( ( Customization.HasCustomWidget() && Customization.WidgetDecl->VisibilityAttr.IsBound() )
		|| ( Customization.HasCustomBuilder() && Customization.CustomBuilderRow->RequiresTick() )
		|| ( Customization.HasPropertyNode() && Customization.PropertyRow->RequiresTick() )
		|| ( Customization.HasGroup() && Customization.DetailGroup->RequiresTick() ) )
	{
		// The node needs to be ticked because it has widgets that can dynamically come and go
		bTickable = true;
		ParentCategory.Pin()->AddTickableNode( *this );
	}

	if( Customization.HasPropertyNode() )
	{
		InitPropertyEditor();
	}
	else if( Customization.HasCustomBuilder() )
	{
		InitCustomBuilder();
	}
	else if( Customization.HasGroup() )
	{
		InitGroup();
	}

	if (Customization.PropertyRow.IsValid() && Customization.PropertyRow->GetForceAutoExpansion())
	{
		SetExpansionState(true);
	}

	// Cache the visibility of customizations that can set it
	if( Customization.HasCustomWidget() )
	{	
		CachedItemVisibility = Customization.WidgetDecl->VisibilityAttr.Get();
	}
	else if( Customization.HasPropertyNode() )
	{
		CachedItemVisibility = Customization.PropertyRow->GetPropertyVisibility();
	}
	else if( Customization.HasGroup() )
	{
		CachedItemVisibility = Customization.DetailGroup->GetGroupVisibility();
	}

	const bool bUpdateFilteredNodes = false;
	GenerateChildren( bUpdateFilteredNodes );
}
void FairySkillEditDialog::OnDelButtonDown(wxCommandEvent &e)
{
	if (mSkill)
	{
		wxPGId id = mPropertiesViewer->GetSelectedProperty();

		if ( true == id.IsOk() && false == mPropertiesViewer->IsPropertyEnabled(id) )
		{
			unsigned short index = mPropertiesViewer->GetPropertyIndex(id);

			unsigned short numEffectInfos = mSkill->getNumAnimationEffectInfos();
			unsigned short numRibbons = mSkill->getNumAnimationRibbons();
			unsigned short numSounds = mSkill->getNumAnimationSounds();
            unsigned short numLights = mSkill->getNumAnimationSceneLightInfos();

			if (index > 0 && index <= numEffectInfos)
			{
				mSkill->removeAnimationEffectInfo(index-1);
			}
			else if ( index > numEffectInfos &&
				index <= numEffectInfos + numRibbons )
			{
				mSkill->removeAnimationRibbon(index - numEffectInfos - 1);
			}
			else if ( index > numEffectInfos + numRibbons && 
				index <= numEffectInfos + numRibbons + numSounds )
			{
				mSkill->removeAnimationSound(index - numEffectInfos - numRibbons - 1);
			}
            else if ( index > numEffectInfos + numRibbons  + numSounds&& 
                index <= numEffectInfos + numRibbons + numSounds + numLights)
            {
                mSkill->removeAnimationSceneLightInfo(index - numSounds - numEffectInfos - numRibbons - 1);
            }

			InitPropertyEditor();
		}
	}
}
void FairySkillEditDialog::OnAddSoundButtonDown(wxCommandEvent &e)
{
	if (mSkill)
	{
		//AddEffectInfoDialog *dlg = new AddEffectInfoDialog(this, wxID_ANY,
		//	_("Animation Ribbon"));

		//bool ok = (dlg->ShowModal() == wxID_OK);
		//if(ok)
		//{
		//	Ogre::String locator1 = wxDynamicCast(dlg->FindWindow(feID_COMBOCTRL_LOCATOR),wxComboBox)->GetValue().c_str();

			WX::AnimationSound *sound = mSkill->addAnimationSound();
			assert (sound);

			//ribbon->setAttachPoint(locator1);

			InitPropertyEditor();
		//}

		//dlg->Destroy();
	}
}