Exemplo n.º 1
0
wxPGId
ObjectPropertyEditor::AddPropertyRecursive(wxPGProperty* property)
{
    wxString::size_type pos = property->GetName().find_last_of('.');
    if (pos == wxString::npos)
        return mPropertiesViewer->Append(property);

    wxString name = property->GetName().substr(0, pos);
    wxPGId id = mPropertiesViewer->GetPropertyByName(wxPGNameConv(name));
    if (!id.IsOk())
    {
        wxString label = mPropertyManager->GetLabelFromName(name);
        id = AddPropertyRecursive(wxCustomProperty(label, name));
        mPropertiesViewer->DisableProperty(id);
    }
    wxASSERT(wxStrcmp(wxPGIdToPtr(id)->GetClassName(), wxT("wxCustomProperty")) == 0);

    return mPropertiesViewer->AppendIn(id, property);
}
Exemplo n.º 2
0
void WXEffectEditDialog::InitEffectDialog( Fairy::Effect *effect, Fairy::SceneManipulator *sceneManipulator )
{
	assert ( effect && sceneManipulator );

	mEffect = effect;
	mSceneManipulator = sceneManipulator;

	mPropertiesViewer->Freeze();
	mPropertiesViewer->GetGrid()->Clear();

	// 设置element的属性
	for ( size_t i=0; i < mEffect->getNumElements(); ++i )
	{
		Fairy::EffectElement *element = mEffect->getElement(i);
		assert (element);

		wxPGId id =	mPropertiesViewer->Append( wxCustomProperty(element->getType().c_str()) );

		if ( id.IsOk() )
		{
			mPropertiesViewer->DisableProperty(id);
			const Ogre::ParameterList &paraList = element->getParameters();

			for ( size_t paraCount=0; paraCount < paraList.size(); ++paraCount )
			{
				mPropertiesViewer->AppendIn( id, CreateProperty(paraList[paraCount], element) );
			}
		}		
	}

	// 设置effect属性
	const Ogre::ParameterList &effectParaList = effect->getParameters();

	for ( size_t paraCount=0; paraCount < effectParaList.size(); ++paraCount )
	{
		mPropertiesViewer->Append( CreateProperty(effectParaList[paraCount], effect) );
	}

	mPropertiesViewer->Thaw();
	mPropertiesViewer->ExpandAll();
	mPropertiesViewer->Refresh();
}
void FairySkillEditDialog::InitPropertyEditor(void)
{
	// 更新模板
	WX::Skill *skill = WX::EffectManager::getSingleton().getSkill(mSkill->getSkillName());

	*skill = *mSkill;

	mPropertiesViewer->Freeze();
	mPropertiesViewer->GetGrid()->Clear();

	wxPGId id =	mPropertiesViewer->Append( wxCustomProperty("Basic Setting") );

	wxPGId itemId;

	if ( id.IsOk() )
	{
		mPropertiesViewer->DisableProperty(id);

		mPropertiesViewer->SetPropertyColour(id, *wxBLUE);

		const Ogre::ParameterList &paraList = mSkill->getParameters();

		for ( size_t paraCount=0; paraCount < paraList.size(); ++paraCount )
		{
			Ogre::String value = mSkill->getParameter(paraList[paraCount].name);

			itemId = mPropertiesViewer->AppendIn( id, CreateProperty(paraList[paraCount], value) );
			mPropertiesViewer->SetPropertyColourToDefault(itemId);
		}
	}

	// 设置effect属性
	for ( unsigned short i=0; i < mSkill->getNumAnimationEffectInfos(); ++i )
	{
		WX::AnimationEffectInfo *effectInfo = mSkill->getAnimationEffectInfo(i);

		assert (effectInfo);

		Ogre::String effectIndexStr = "Effect Info " + Ogre::StringConverter::toString(i);

		wxPGId id =	mPropertiesViewer->Append( wxCustomProperty(effectIndexStr.c_str()) );

		wxPGId itemId;

		if ( id.IsOk() )
		{
			mPropertiesViewer->DisableProperty(id);
			
			mPropertiesViewer->SetPropertyColour(id, *wxRED);

			const Ogre::ParameterList &paraList = effectInfo->getParameters();

			for ( size_t paraCount=0; paraCount < paraList.size(); ++paraCount )
			{
				Ogre::String value = effectInfo->getParameter(paraList[paraCount].name);

				itemId = mPropertiesViewer->AppendIn( id, CreateProperty(paraList[paraCount], value) );
				mPropertiesViewer->SetPropertyColourToDefault(itemId);
			}
		}		
	}

	for ( unsigned short i=0; i < mSkill->getNumAnimationRibbons(); ++i )
	{
		WX::AnimationRibbon *ribbon = mSkill->getAnimationRibbon(i);

		assert (ribbon);

		Ogre::String ribbonIndexStr = "Ribbon " + Ogre::StringConverter::toString(i);

		wxPGId id =	mPropertiesViewer->Append( wxCustomProperty(ribbonIndexStr.c_str()) );

		wxPGId itemId;

		if ( id.IsOk() )
		{
			mPropertiesViewer->DisableProperty(id);

			mPropertiesViewer->SetPropertyColour(id, *wxGREEN);

			const Ogre::ParameterList &paraList = ribbon->getParameters();

			for ( size_t paraCount=0; paraCount < paraList.size(); ++paraCount )
			{
				Ogre::String value = ribbon->getParameter(paraList[paraCount].name);

				itemId = mPropertiesViewer->AppendIn( id, CreateProperty(paraList[paraCount], value) );
				mPropertiesViewer->SetPropertyColourToDefault(itemId);
			}
		}		
	}

	for ( unsigned short i=0; i < mSkill->getNumAnimationSounds(); ++i )
	{
		WX::AnimationSound *sound = mSkill->getAnimationSound(i);

		assert (sound);

		Ogre::String soundIndexStr = "Sound " + Ogre::StringConverter::toString(i);

		wxPGId id =	mPropertiesViewer->Append( wxCustomProperty(soundIndexStr.c_str()) );

		wxPGId itemId;

		if ( id.IsOk() )
		{
			mPropertiesViewer->DisableProperty(id);

			mPropertiesViewer->SetPropertyColour(id, *wxCYAN);

			const Ogre::ParameterList &paraList = sound->getParameters();

			for ( size_t paraCount=0; paraCount < paraList.size(); ++paraCount )
			{
				Ogre::String value = sound->getParameter(paraList[paraCount].name);

				itemId = mPropertiesViewer->AppendIn( id, CreateProperty(paraList[paraCount], value) );
				mPropertiesViewer->SetPropertyColourToDefault(itemId);
			}
		}		
	}

    for ( unsigned short i=0; i < mSkill->getNumAnimationSceneLightInfos(); ++i )
    {
        WX::AnimationSceneLightInfo *light = mSkill->getAnimationSceneLightInfo(i);

        assert (light);

        Ogre::String lightIndexStr = "SceneLight " + Ogre::StringConverter::toString(i);

        wxPGId id =	mPropertiesViewer->Append( wxCustomProperty(lightIndexStr.c_str()) );

        wxPGId itemId;

        if ( id.IsOk() )
        {
            mPropertiesViewer->DisableProperty(id);

            mPropertiesViewer->SetPropertyColour(id, *wxCYAN);

            const Ogre::ParameterList &paraList = light->getParameters();

            for ( size_t paraCount=0; paraCount < paraList.size(); ++paraCount )
            {
                Ogre::String value = light->getParameter(paraList[paraCount].name);

                itemId = mPropertiesViewer->AppendIn( id, CreateProperty(paraList[paraCount], value) );
                mPropertiesViewer->SetPropertyColourToDefault(itemId);
            }
        }		
    }

	mPropertiesViewer->Thaw();
	mPropertiesViewer->ExpandAll();
	mPropertiesViewer->Refresh();
}