コード例 #1
0
int TorqueCurve::processLine(Ogre::StringVector args, String model)
{
	// if its just one arguments, it must be a known model
	if (args.size() == 1)
		return setTorqueModel(args[0]);

	// we only accept 2 arguments
	if (args.size() != 2)
		return 1;
	// parse the data
	float pointx = StringConverter::parseReal(args[0]);
	float pointy = StringConverter::parseReal(args[1]);
	Vector3 point = Vector3(pointx,pointy,0);

	// find the spline to attach the points
	if (splines.find(model) == splines.end())
		splines[model] = SimpleSpline();

	// attach the points to the spline
	// LOG("curve "+model+" : " + TOSTRING(point));
	splines[model].addPoint(point);

	// special case for custom model:
	// we set it as active curve as well!
	if (model == TorqueCurve::customModel)
		setTorqueModel(TorqueCurve::customModel);

	return 0;
}
コード例 #2
0
ファイル: soundmanagerimp.cpp プロジェクト: Digmaster/openmw
    void SoundManager::startRandomTitle()
    {
        Ogre::StringVector filelist;
        if (mMusicFiles.find(mCurrentPlaylist) == mMusicFiles.end())
        {
            Ogre::StringVector groups = Ogre::ResourceGroupManager::getSingleton().getResourceGroups ();
            for (Ogre::StringVector::iterator it = groups.begin(); it != groups.end(); ++it)
            {
                Ogre::StringVectorPtr resourcesInThisGroup = mResourceMgr.findResourceNames(*it,
                                                                                            "Music/"+mCurrentPlaylist+"/*");
                filelist.insert(filelist.end(), resourcesInThisGroup->begin(), resourcesInThisGroup->end());
            }
            mMusicFiles[mCurrentPlaylist] = filelist;
        }
        else
            filelist = mMusicFiles[mCurrentPlaylist];

        if(!filelist.size())
            return;

        int i = rand()%filelist.size();

        // Don't play the same music track twice in a row
        if (filelist[i] == mLastPlayedMusic)
        {
            i = (i+1) % filelist.size();
        }

        streamMusicFull(filelist[i]);
    }
コード例 #3
0
	const VectorString& Ogre2DataManager::getDataListNames(const std::string& _pattern, bool _fullpath)
	{
		static VectorString result;
		result.clear();

		VectorString search;
		if (mAllGroups)
		{
			Ogre::StringVector sp = Ogre::ResourceGroupManager::getSingleton().getResourceGroups();
			search.reserve(sp.size());
			for (size_t i = 0; i < sp.size(); i++)
				search.push_back(sp[i]);
		}
		else
			search.push_back(mGroup);

		std::vector<Ogre::FileInfoListPtr> pFileInfos;

		int resultSize = 0;
		for (size_t i = 0; i < search.size(); i++)
		{
			Ogre::FileInfoListPtr pFileInfo = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo(search[i], _pattern);
			resultSize += pFileInfo->size();
			if (!pFileInfo->empty())
				pFileInfos.push_back(pFileInfo);
			else
				pFileInfo.setNull();
		}

		result.reserve(resultSize);

		for (size_t i = 0; i < pFileInfos.size(); i++)
		{
			Ogre::FileInfoListPtr pFileInfo = pFileInfos[i];
			for (Ogre::FileInfoList::iterator fi = pFileInfo->begin(); fi != pFileInfo->end(); ++fi )
			{
				if (fi->path.empty())
				{
					bool found = false;
					for (VectorString::iterator iter = result.begin(); iter != result.end(); ++iter)
					{
						if (*iter == fi->filename)
						{
							found = true;
							break;
						}
					}
					if (!found)
					{
						result.push_back(_fullpath ? fi->archive->getName() + "/" + fi->filename : fi->filename);
					}
				}
			}

			pFileInfo.setNull();
		}

		return result;
	}
コード例 #4
0
ファイル: OFSSceneSerializer.cpp プロジェクト: jacmoe/ogitor
//-----------------------------------------------------------------------------
void Ogitors::COFSSceneSerializer::_upgradeOgsceneFileFrom3To4(TiXmlNode* ogsceneRootNode)
{
    TiXmlElement* element = ogsceneRootNode->FirstChildElement();   

    OFS::OfsPtr& mFile = OgitorsRoot::getSingletonPtr()->GetProjectFile();
    OgitorsSystem *mSystem = OgitorsSystem::getSingletonPtr();

    OFS::FileList list;
    mFile->listFilesRecursive("/", list);

    Ogre::StringVector terFiles;

    for( unsigned int i = 0;i < list.size(); i++ )
    {
        if(list[i].flags && OFS::OFS_FILE)
        {
            if(list[i].name.substr(list[i].name.size() - 4, 4) == ".ogt")
            {
                terFiles.push_back( list[i].name );
            }
        }
    }

    if( terFiles.size() > 0 )
    {
        Ogre::SceneManager *pUpgSM = Ogre::Root::getSingletonPtr()->createSceneManager("OctreeSceneManager", "UpgradeSCM");

        for( unsigned int i = 0;i < terFiles.size(); i++ )
        {
            Ogre::String filenameorig = terFiles[i];
            Ogre::String filenamebackup = filenameorig + ".backup";

            mFile->renameFile( filenameorig.c_str(), filenamebackup.c_str() );

            OFS::OFSHANDLE *filebackup = new OFS::OFSHANDLE();
            OFS::OFSHANDLE *fileorig = new OFS::OFSHANDLE();

            mFile->createFile(*fileorig, filenameorig.c_str());
            mFile->openFile(*filebackup, filenamebackup.c_str(), OFS::OFS_READ);

            {
                OgreTerrainConverter conv;

                Ogre::DataStreamPtr stream_in = Ogre::DataStreamPtr(OGRE_NEW OfsDataStream(mFile, filebackup));
                Ogre::DataStreamPtr stream_out = Ogre::DataStreamPtr(OGRE_NEW OfsDataStream(mFile, fileorig));
                Ogre::DataStreamPtr compressStream(OGRE_NEW Ogre::DeflateStream(filenameorig, stream_in));
                Ogre::StreamSerialiser ser_in(compressStream);
                Ogre::StreamSerialiser ser_out(stream_out);

                conv.Upgrade( ser_in, ser_out );
            }
        }

        Ogre::Root::getSingletonPtr()->destroySceneManager(pUpgSM);
    }
}
コード例 #5
0
/**----------------------------------------------------------------------------
    Add nxJoint actuator to the scene

    \param nxJoint (NxRevoluteJoint *)
    \return (void)
-----------------------------------------------------------------------------*/
void Actuators::addActuator(Joint* joint)
{
	double Kp = 0, Ti = 0, Td = 0;
	int type = 0;

	// get controller data from userData
	NxJointDesc* desc = NULL;
	joint->getDesc(&desc);

	//if (joint->getFlags()&NX_RJF_MOTOR_ENABLED)
	if (desc->userData != NULL)
	{
		Ogre::StringVector s = Ogre::StringConverter::parseStringVector(Ogre::String((char*)desc->userData));
		s.size() > 0 ? Kp = Ogre::StringConverter::parseReal(s[0]) : Kp = 0.1;
		s.size() > 1 ? Ti = Ogre::StringConverter::parseReal(s[1]) : Ti = 0;
		s.size() > 2 ? Td = Ogre::StringConverter::parseReal(s[2]) : Td = 0.1;
		s.size() > 3 ? type = Ogre::StringConverter::parseInt(s[3]) : type = 0;
	}
	else
	{
		if (joint->getType() == NX_JOINT_D6)
		{
			NxD6JointDesc* descD6 = dynamic_cast<NxD6JointDesc*>(desc);

			if (descD6->twistDrive.driveType == NX_D6JOINT_DRIVE_POSITION)
			{
				type = 1;
			}
		}

	}

	Sensor<double, Joint>* sensor;

	switch (type)
	{
		case 0:
			sensor = new SensorVelocity(joint);
			break;
		case 1:
			sensor = new SensorPosition(joint);
			break;
		case 2:
			sensor = new SensorTorque(joint);
			break;
		default:
			throw Exception("Unknown sensor for controller", "actuators");
	}


	Controller<double>* controllerPID = new ControllerPID(Kp, Ti, Td, 0);
	boost::shared_ptr<Actuator > actuator(new ActuatorPID(joint, controllerPID, sensor));
	mActuators.push_back(actuator);

}
コード例 #6
0
int PlayState::interpretConsoleCommand(const MyGUI::UString & command)
{
    /* This method must be redone in a different way */

    std::string sCommand = (std::string)command;
    Ogre::StringVector splitStrings = Ogre::StringUtil::split(sCommand, " ", 4);
    std::string s = splitStrings.front();
    if(s.compare("close")==0) {
        notifyWindowButtonPressed(mConsoleWindow, s);
    } else if(s.compare("pause")==0) {
        pauseGame();
    } else if(s.compare("quit")==0) {
        mContinue = false;
    } else if(s.compare("push")==0 && splitStrings.size()>=5 ) {

        if(mActors.find(splitStrings[1]) != mActors.end()) {
            OgreBulletDynamics::RigidBody* body = mActors[splitStrings[1]]->getBody();
            if(body) {
                Vector3 dir = Vector3(atof(splitStrings[2].c_str()),atof(splitStrings[3].c_str()),atof(splitStrings[4].c_str()));
                body->getBulletObject()->activate();
                body->applyImpulse(dir*50,Vector3(0, 0.05, 0));
            } else {
                return 0;
            }
        }
    } else if(s.compare("move")==0 && splitStrings.size()>=5) {
        Actor *actor = mActors[splitStrings[1]];
        if (actor) {

            btTransform transform;
            transform.setIdentity();
            transform.setOrigin(OgreBulletCollisions::OgreBtConverter::to(Vector3(atof(splitStrings[2].c_str()),atof(splitStrings[3].c_str()),atof(splitStrings[4].c_str()))));
            actor->getBody()->getBulletRigidBody()->clearForces();
            actor->getBody()->getBulletRigidBody()->setLinearVelocity(btVector3(0,0,0));
            actor->getBody()->getBulletRigidBody()->setAngularVelocity(btVector3(0,0,0));
            actor->getBody()->getBulletRigidBody()->setWorldTransform(transform);
        } else {
            return 0;
        }
    } else if(s.compare("debug")==0) {
        if(splitStrings.size()<2) {
            alterPlayState(DEBUG);
        } else if(splitStrings[1].compare("off")==0) {
            alterPlayState(NORMAL);
        }
    } else if(s.compare("win")==0) {
        GameManager::getSingletonPtr()->changeState(WinState::getInstance());
        return -1;
    } else {
        return 0;
    }
    return 1;
}
コード例 #7
0
ファイル: MmOptimiseTool.cpp プロジェクト: xubingyue/Ogitor
	//------------------------------------------------------------------------
	void OptimiseTool::doInvoke(const OptionList& toolOptions,
		const Ogre::StringVector& inFileNames, const Ogre::StringVector& outFileNamesArg)
	{
		// Name count has to match, else we have no way to figure out how to apply output
		// names to input files.
		if (!(outFileNamesArg.empty() || inFileNames.size() == outFileNamesArg.size()))
		{
			fail("number of output files must match number of input files.");
		}

		mPosTolerance = mNormTolerance = mUVTolerance = 1e-06f;
		mKeepIdentityTracks = OptionsUtil::isOptionSet(toolOptions, "keep-identity-tracks");
		for (OptionList::const_iterator it = toolOptions.begin(); it != toolOptions.end(); ++it)
		{
			if (it->first == "tolerance")
			{
				mPosTolerance = mNormTolerance = mUVTolerance = static_cast<float>(any_cast<Real>(it->second));
			}
			else if (it->first == "pos_tolerance")
			{
				mPosTolerance = static_cast<float>(any_cast<Real>(it->second));
			}
			else if (it->first == "norm_tolerance")
			{
				mNormTolerance = static_cast<float>(any_cast<Real>(it->second));
			}
			else if (it->first == "uv_tolerance")
			{
				mUVTolerance = static_cast<float>(any_cast<Real>(it->second));
			}
		}


		StringVector outFileNames = outFileNamesArg.empty() ? inFileNames : outFileNamesArg;

		// Process the meshes
		for (size_t i = 0, end = inFileNames.size(); i < end; ++i)
		{
			if (StringUtil::endsWith(inFileNames[i], ".mesh", true))
			{
				processMeshFile(inFileNames[i], outFileNames[i]);
			}
			else if (StringUtil::endsWith(inFileNames[i], ".skeleton", true))
			{
				processSkeletonFile(inFileNames[i], outFileNames[i]);
			}
			else
			{
				warn("unrecognised name ending for file " + inFileNames[i]);
				warn("file skipped.");
			}
		}
	}
コード例 #8
0
ファイル: DotSceneLoader.cpp プロジェクト: lubosz/Collage
void DotSceneLoader::processPagedGeometry(rapidxml::xml_node<>* XMLNode) {
	Ogre::String filename = "../Projects/SampleScene3/" + getAttrib(XMLNode,
			"fileName");
	Ogre::String model = getAttrib(XMLNode, "model");
// Ogre::Real pagesize = getAttribReal(XMLNode, "pageSize");
// Ogre::Real batchdistance = getAttribReal(XMLNode, "batchDistance");
// Ogre::Real impostordistance = getAttribReal(XMLNode, "impostorDistance");
// Ogre::Vector4 bounds = Ogre::StringConverter::parseVector4(getAttrib(
//   XMLNode, "bounds"));

	std::ifstream stream(filename.c_str());

	if (!stream.is_open())
		return;

	Ogre::StringVector list;

	char res[128];

	PGInstanceList mInstanceList;

	while (!stream.eof()) {
		stream.getline(res, 128);
		Ogre::String resStr(res);

//  ParseStringVector(resStr, list);

		if (list.size() == 3) {
			PGInstanceInfo info;

			info.pos = Ogre::StringConverter::parseVector3(list[0]);
			info.scale = Ogre::StringConverter::parseReal(list[1]);
			info.yaw = Ogre::StringConverter::parseReal(list[2]);

			mInstanceList.push_back(info);
		} else if (list.size() == 4) {
			PGInstanceInfo info;

			info.pos = Ogre::StringConverter::parseVector3(list[1]);
			info.scale = Ogre::StringConverter::parseReal(list[2]);
			info.yaw = Ogre::StringConverter::parseReal(list[3]);

			mInstanceList.push_back(info);
		}
	}

	stream.close();

// if (model != "") {
//    Ogre::Entity *mEntityHandle = mSceneMgr->createEntity(model + ".mesh");
//  }
}
コード例 #9
0
 void OgitorsScriptConsole::addFunction(std::string &arg)
 {
     Ogre::StringVector result = mInterpreter->addFunction(console_str, arg);
     OGRE_LOCK_AUTO_MUTEX;
     for(unsigned int i = 0;i < result.size();i++)
         mOutput.push_back(result[i]);
 }
コード例 #10
0
 void OgitorsScriptConsole::listFunctions()
 {
     Ogre::StringVector result = mInterpreter->listFunctions(console_str);
     OGRE_LOCK_AUTO_MUTEX;
     for(unsigned int i = 0;i < result.size();i++)
         mOutput.push_back(result[i]);
 }
コード例 #11
0
ファイル: VLogicModel.cpp プロジェクト: asnwerear/VEngine
void VLogicModel::_createBoundingBoxFromExternal()
{
    Ogre::StringVector values = Ogre::StringUtil::split(mExternalBoundingBoxValue, " ");

    if (values.size() != 3)
    {
        OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS,
                    "the bounding box parameter count must be 3!",
                    "LogicModel::_createBoundingBoxFromExternal");

        return;
    }

    Ogre::Real x = Ogre::StringConverter::parseReal(values[0]);
    Ogre::Real y = Ogre::StringConverter::parseReal(values[1]);
    Ogre::Real z = Ogre::StringConverter::parseReal(values[2]);

    Ogre::Vector3 ptMin;
    ptMin.x = -x / 2;
    ptMin.y = 0.0f;
    ptMin.z = -z / 2;

    Ogre::Vector3 ptMax;
    ptMax.x = x / 2;
    ptMax.y = y;
    ptMax.z = z / 2;

    mExternalBoundingBox = new Ogre::AxisAlignedBox(ptMin, ptMax);
}
コード例 #12
0
 void OgitorsScriptConsole::execString(std::string &arg)
 {
     Ogre::StringVector result = mInterpreter->execString(console_str, arg);
     OGRE_LOCK_AUTO_MUTEX;
     mOutput.push_back("Executing : " + arg);
     for(unsigned int i = 0;i < result.size();i++)
         mOutput.push_back(result[i]);
 }
コード例 #13
0
ファイル: viewer.cpp プロジェクト: profsha/OgreViewer
void Viewer::loadMeshList()
{
    emit clearMesh();
    Ogre::StringVector groups = Ogre::ResourceGroupManager::getSingleton().getResourceGroups();
    for (size_t i = 0; i < groups.size(); i++)
    {
        Ogre::StringVector names = *Ogre::ResourceGroupManager::getSingleton().listResourceNames(groups[i]).get();
        for (size_t j=0; j < names.size(); j++)
        {
            size_t pos = names[j].find(".mesh");
            if (pos <= names[j].size())
            {
                emit sendMeshName(names[j].c_str());
            }
        }
    }
}
コード例 #14
0
//url should be like http://toto.net/index.html -> return toto.net
std::string Downloader::extractHost(const std::string& url)
{
	Ogre::StringVector tmp = Ogre::StringUtil::split(url, "/");
	if (tmp.size() < 2)
		return "";
	else
		return tmp[1];
}
コード例 #15
0
 void OgitorsScriptConsole::testScript(std::string &file)
 {
     Ogre::StringVector result = mInterpreter->compileModule(console_str, file);
     OGRE_LOCK_AUTO_MUTEX;
     mOutput.push_back("Testing Script : " + file);
     for(unsigned int i = 0;i < result.size();i++)
         mOutput.push_back(result[i]);
 }
コード例 #16
0
 void OgitorsScriptConsole::testScript(const char *source)
 {
     Ogre::StringVector result = mInterpreter->compileModule(console_str, source);
     OGRE_LOCK_AUTO_MUTEX;
     mOutput.push_back("Compiling Script...");
     for(unsigned int i = 0;i < result.size();i++)
         mOutput.push_back(result[i]);
 }
コード例 #17
0
    void SoundManager::startRandomTitle()
    {
        Ogre::StringVector filelist;

        Ogre::StringVector groups = Ogre::ResourceGroupManager::getSingleton().getResourceGroups ();
        for (Ogre::StringVector::iterator it = groups.begin(); it != groups.end(); ++it)
        {
            Ogre::StringVectorPtr resourcesInThisGroup = mResourceMgr.findResourceNames(*it,
                                                                                        "Music/"+mCurrentPlaylist+"/*");
            filelist.insert(filelist.end(), resourcesInThisGroup->begin(), resourcesInThisGroup->end());
        }

        if(!filelist.size())
            return;

        int i = rand()%filelist.size();
        streamMusicFull(filelist[i]);
    }
コード例 #18
0
void RoR::SkinManager::ParseSkinAttribute(const std::string& line, SkinDef* skin_def)
{
    Ogre::StringVector params = Ogre::StringUtil::split(line, "\t=,;\n");
    for (unsigned int i=0; i < params.size(); i++)
    {
        Ogre::StringUtil::trim(params[i]);
    }
    Ogre::String& attrib = params[0];
    Ogre::StringUtil::toLowerCase(attrib);

    if (attrib == "replacetexture"  && params.size() == 3) { skin_def->replace_textures.insert(std::make_pair(params[1], params[2])); return; }
    if (attrib == "replacematerial" && params.size() == 3) { skin_def->replace_materials.insert(std::make_pair(params[1], params[2])); return; }
    if (attrib == "preview"         && params.size() >= 2) { skin_def->thumbnail = params[1]; return; }
    if (attrib == "description"     && params.size() >= 2) { skin_def->description = params[1]; return; }
    if (attrib == "authorname"      && params.size() >= 2) { skin_def->author_name = params[1]; return; }
    if (attrib == "authorid"        && params.size() == 2) { skin_def->author_id = PARSEINT(params[1]); return; }
    if (attrib == "guid"            && params.size() >= 2) { skin_def->guid = params[1]; Ogre::StringUtil::trim(skin_def->guid); Ogre::StringUtil::toLowerCase(skin_def->guid); return; }
    if (attrib == "name"            && params.size() >= 2) { skin_def->name = params[1]; Ogre::StringUtil::trim(skin_def->name); return; }
}
コード例 #19
0
std::string Parser::extractGuid(const std::string& url)
{
	Ogre::StringVector tmp = Ogre::StringUtil::split(url, "=");
	if (tmp.size() == 2)
	{
		return tmp[1];
	}
	else
		return "";
}
コード例 #20
0
ファイル: FairySkill.cpp プロジェクト: dodong471520/pap
	//---------------------------------------------------------------------
	void Skill::setShakeTimeFromString(const Ogre::String &shakeTimeStr)
	{
		mShakeTimeArray.clear();

		Ogre::StringVector shakeTimes = Ogre::StringUtil::split(shakeTimeStr);

		for (size_t i=0; i<shakeTimes.size(); ++i)
		{
			mShakeTimeArray.push_back( Ogre::StringConverter::parseReal(shakeTimes[i]) );
		}
	}
コード例 #21
0
ファイル: FairySkill.cpp プロジェクト: dodong471520/pap
	//---------------------------------------------------------------------
	void Skill::setBreakTimeFromString(const Ogre::String &breakTimeStr)
	{
		mBreakTimeArray.clear();

		Ogre::StringVector breakTimes = Ogre::StringUtil::split(breakTimeStr);

		for (size_t i=0; i<breakTimes.size(); ++i)
		{
			mBreakTimeArray.push_back( Ogre::StringConverter::parseReal(breakTimes[i]) );
		}
	}
コード例 #22
0
ファイル: SkinManager.cpp プロジェクト: Bob-Z/rigs-of-rods
void SkinManager::ParseSkinAttribute(const String& line, Skin *pSkin)
{
	Ogre::StringVector params = StringUtil::split(line, "\t=,;\n");
	for (unsigned int i=0; i < params.size(); i++)
	{
		StringUtil::trim(params[i]);
	}
	String& attrib = params[0];
	StringUtil::toLowerCase(attrib);

	if      (attrib == "replacetexture"     && params.size() == 3) pSkin->addTextureReplace(params[1], params[2]);
	if      (attrib == "replacematerial"    && params.size() == 3) pSkin->addMaterialReplace(params[1], params[2]);
	else if (attrib == "preview"            && params.size() >= 2) pSkin->thumbnail = params[1];
	else if (attrib == "description"        && params.size() >= 2) pSkin->description = params[1];
	else if (attrib == "authorname"         && params.size() >= 2) pSkin->authorName = params[1];
	else if (attrib == "authorid"           && params.size() == 2) pSkin->authorID = PARSEINT(params[1]);
	else if (attrib == "guid"               && params.size() >= 2) pSkin->guid = params[1];
	else if (attrib == "name"               && params.size() >= 2) pSkin->name = params[1];

	StringUtil::trim(pSkin->name);
}
コード例 #23
0
ファイル: WXEffectEditDialog.cpp プロジェクト: gitrider/wxsj2
void
SaveAsEffectDialog::OnInitDialog(wxInitDialogEvent &e)
{
	wxDialog::OnInitDialog(e);

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

	wxStaticText *item1 = new wxStaticText( this, ID_TEXT, wxT("Script File"), wxDefaultPosition, wxDefaultSize, 0 );
	item0->Add( item1, 0, wxALIGN_CENTER|wxALL, 5 );

	wxString *strs2 = (wxString*) NULL;
	wxComboBox *item2 = new wxComboBox( this, ID_COMBO_SAVE_AS_EFFECT, wxT(""), wxDefaultPosition, wxSize(200,-1), 0, strs2, wxCB_DROPDOWN );
	item0->Add( item2, 0, wxALIGN_CENTER|wxALL, 5 );

	wxStaticText *item3 = new wxStaticText( this, ID_TEXT, wxT("Template Name"), wxDefaultPosition, wxDefaultSize, 0 );
	item0->Add( item3, 0, wxALIGN_CENTER|wxALL, 5 );

	wxTextCtrl *item4 = new wxTextCtrl( this, ID_TEXTCTRL_SAVE_AS_EFFECT, wxT(""), wxDefaultPosition, wxSize(200,-1), 0 );
	item0->Add( item4, 0, wxALIGN_CENTER|wxALL, 5 );

	wxButton *item5 = new wxButton( this, wxID_OK, wxT("OK"), wxDefaultPosition, wxDefaultSize, 0 );
	item0->Add( item5, 0, wxALIGN_CENTER|wxALL, 5 );

	wxButton *item6 = new wxButton( this, wxID_CANCEL, wxT("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
	item0->Add( item6, 0, wxALIGN_CENTER|wxALL, 5 );

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

	Ogre::StringVector loadedScripts;
	Fairy::EffectManager::getSingleton().getLoadedScripts( loadedScripts );

	for ( size_t i=0; i<loadedScripts.size(); ++i )
	{
		if (loadedScripts[i] != "EmptyEffect.effect")
			item2->AppendString(loadedScripts[i]);
	}

	Ogre::String fileName = Fairy::EffectManager::getSingleton().getFileNameByTemplateName(mEffect->getTemplateName());

	if ( fileName == "EmptyEffect.effect" )
		item2->SetSelection(0);
	else
		item2->SetValue(fileName);

	mComboBox = item2;

	if (mEffect->getTemplateName() != "EffectEmpty")
		item4->SetValue(mEffect->getTemplateName());

	mTextCtrl = item4;
}
コード例 #24
0
	void MeshMergeTool::doInvoke(const OptionList& toolOptions,
			const Ogre::StringVector& inFileNames,
			const Ogre::StringVector& outFileNames)
	{
		if (outFileNames.size() != 1)
		{
			fail("Exactly one output file must be specified.");
			return;
		}
		else if (inFileNames.size() == 0)
		{
			fail("No input files specified.");
			return;
		}

		StatefulMeshSerializer* meshSer = OgreEnvironment::getSingleton().getMeshSerializer();
		StatefulSkeletonSerializer* skelSer =
			OgreEnvironment::getSingleton().getSkeletonSerializer();
		for (Ogre::StringVector::const_iterator it = inFileNames.begin();
			it != inFileNames.end(); ++it)
		{
			MeshPtr curMesh = meshSer->loadMesh(*it);
			if (!curMesh.isNull())
			{
				if (curMesh->hasSkeleton() && SkeletonManager::getSingleton().getByName(
					curMesh->getSkeletonName()).isNull())
				{
					skelSer->loadSkeleton(curMesh->getSkeletonName());
				}
				addMesh(curMesh);
			}
			else
			{
				warn("Skipped: Mesh " + *it + " cannnot be loaded.");
			}
		}
		Ogre::String outputfile = *outFileNames.begin();
		meshSer->exportMesh(merge(outputfile).getPointer(), outputfile);
	}
コード例 #25
0
    static Ogre::Plane parsePlane(const Ogre::String& val)
    {
		Ogre::StringVector vec = Ogre::StringUtil::split(val, "|");

        if (vec.size() != 2)
        {
            return Ogre::Plane(Ogre::Vector3::UNIT_Z, 0);
        }
        else
        {
            return Ogre::Plane(Ogre::StringConverter::parseVector3(vec[0]),
                               Ogre::StringConverter::parseReal(vec[1]));
        }
    }
コード例 #26
0
//---------------------------------------------------------------------------------
void OgitorsClipboardManager::addTemplatesFromFiles(Ogre::StringVector filenames, bool isGeneralScope)
{
    Ogre::String fname;
    
    for(unsigned int i = 0;i < filenames.size();i++)
    {
        if(isGeneralScope)
            fname = OgitorsUtils::QualifyPath(filenames[i]);
        else
            fname = filenames[i];

        addTemplateFromFile(fname, isGeneralScope);
    }
}
コード例 #27
0
ファイル: VLogicModel.cpp プロジェクト: asnwerear/VEngine
void VLogicModel::_setScaleFactor(const VString &value)
{
    Ogre::StringVector values = Ogre::StringUtil::split(value, " ");

    if (values.size() != 3)
    {
        OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS,
                    "the scale factor parameter count must be 3!",
                    "LogicModel::_setScaleFactor");
        return;
    }

    setScale(Ogre::StringConverter::parseVector3(value));
}
コード例 #28
0
//----------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------
ScriptViewWidget::ScriptViewWidget(QWidget *parent) : QWidget(parent)
{
    treeWidget = new ScriptTreeWidget(this);

    QVBoxLayout *boxlayout = new QVBoxLayout(this);
    boxlayout->setMargin(0);
    boxlayout->addWidget(treeWidget);

    generalCategory = new QTreeWidgetItem((QTreeWidget*)0, QStringList(tr("General Scripts")));
#if OGRE_PLATFORM == OGRE_PLATFORM_LINUX
    QString iconpath(OgitorsUtils::QualifyPath("/usr/share/qtOgitor/Plugins/Icons/project.svg").c_str());
#else
    QString iconpath(OgitorsUtils::QualifyPath("../Plugins/Icons/project.svg").c_str());
#endif
    generalCategory->setIcon(0, QIcon(iconpath));
    QFont fnt = generalCategory->font(0);
    fnt.setBold(true);
    generalCategory->setFont(0, fnt);

    treeWidget->addTopLevelItem(generalCategory);

    projectCategory = new QTreeWidgetItem((QTreeWidget*)0, QStringList(tr("Project Scripts")));
    projectCategory->setIcon(0, QIcon(iconpath));
    projectCategory->setFont(0, fnt);

    treeWidget->addTopLevelItem(projectCategory);

#if defined(Q_WS_X11)
    Ogre::String filefilter = OgitorsUtils::QualifyPath("/usr/share/qtOgitor/Scripts/*.as");
#else
    Ogre::String filefilter = OgitorsUtils::QualifyPath("../Scripts/*.as");
#endif

    QTreeWidgetItem* scriptitem = 0;
    Ogre::StringVector list;
    OgitorsSystem::getSingletonPtr()->GetFileList(filefilter, list);

    for(unsigned int i = 0;i < list.size();i++)
    {
        Ogre::String filename = list[i];
        Ogre::String scriptname = OgitorsUtils::ExtractFileName(list[i]);
        scriptitem = new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString(scriptname.c_str())));
        scriptitem->setWhatsThis(0, QString(filename.c_str()));
        scriptitem->setIcon(0, QIcon(":/icons/script2.svg"));
        generalCategory->addChild(scriptitem);
    }

    Ogitors::EventManager::getSingletonPtr()->connectEvent(EventManager::LOAD_STATE_CHANGE, this, true, 0, true, 0, EVENT_CALLBACK(ScriptViewWidget, onSceneLoadStateChange));
}
コード例 #29
0
ファイル: VEffectManager.cpp プロジェクト: asnwerear/VEngine
/** 解析skill属性 */
void VEffectManager::_parseSkillAttrib(const VString &line, VSkill *skill)
{
	Ogre::StringVector vecparams = Ogre::StringUtil::split(line, "\t ", 1);

	if (vecparams.size() != 2)
	{
		_logErrorInfo("the number of parameters must be 2!", line, "VEffectManager::_parseSkillAttrib");
		return;
	}

	if (!skill->setParameter(vecparams[0], vecparams[1]))
	{
		_logErrorInfo("Bad skill attribute line", line, "VEffectManager::_parseSkillAttrib");
	}
}
コード例 #30
0
ファイル: VEffectManager.cpp プロジェクト: asnwerear/VEngine
/** 解析animation sound属性 */
void VEffectManager::_parseAnimSoundAttrib(const VString &line, VAnimationSound *sound)
{
	Ogre::StringVector vecparams = Ogre::StringUtil::split(line, "\t ");

	if (vecparams.size() != 2)
	{
		_logErrorInfo("the number of parameters must be 2!", line, "VEffectManager::_parseAnimSoundAttrib");
		return;
	}

	if (!sound->setParameter(vecparams[0], vecparams[1]))
	{
		_logErrorInfo("Bad Anim Sound attribute line", line, "VEffectManager::_parseAnimSoundAttrib");
	}
}