コード例 #1
0
ファイル: WXEffectEditDialog.cpp プロジェクト: gitrider/wxsj2
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();
}
コード例 #2
0
ファイル: WXEffectEditDialog.cpp プロジェクト: gitrider/wxsj2
void WXEffectEditDialog::saveEffect(Fairy::Effect *effect, const Ogre::String &templateName, std::ofstream &of)
{
	assert (effect);

	of << "\n";
	of << "effect " << templateName << "\n";
	of << "{";


	for ( size_t i=0; i < effect->getNumElements(); ++i )
	{
		Fairy::EffectElement *element = effect->getElement(i);
		assert (element);

		of << "\n";
		of << "\telement " << element->getType() << "\n";
		of << "\t{\n";

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

		for ( size_t paraCount=0; paraCount < paraList.size(); ++paraCount )
		{
			of << "\t\t" << paraList[paraCount].name << "\t" << element->getParameter( paraList[paraCount].name ) << "\n";
		}		

		of << "\t}\n";
	}

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

	for ( size_t paraCount=0; paraCount < paraList.size(); ++paraCount )
	{
		of << "\n\t" << paraList[paraCount].name << "\t" << effect->getParameter( paraList[paraCount].name ) << "\n";
	}	

	of << "}\n";
}