当前位置: 首页>>代码示例>>C++>>正文


C++ DataStreamPtr::getLine方法代码示例

本文整理汇总了C++中ogre::DataStreamPtr::getLine方法的典型用法代码示例。如果您正苦于以下问题:C++ DataStreamPtr::getLine方法的具体用法?C++ DataStreamPtr::getLine怎么用?C++ DataStreamPtr::getLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ogre::DataStreamPtr的用法示例。


在下文中一共展示了DataStreamPtr::getLine方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: _parseElement

/** 解析特效元素 */
void VEffectManager::_parseElement(const VString &type, Ogre::DataStreamPtr &stream, VEffect *effect)
{
	VEffectElement *element = createElement(type);
	assert(element != VNULL);

	effect->addElement(element);

	Ogre::String line;

	while (!stream->eof())
	{
		line = stream->getLine();
		++mParsingLineNumber;

		if (!(line.empty() || line.substr(0, 2) == "//"))
		{
			// 跳过空行和注释行
			if (line == "}")
			{
				break;
			}
			else
			{
				_parseElementAttrib(line, element);
			}
		}
	}
}
开发者ID:asnwerear,项目名称:VEngine,代码行数:29,代码来源:VEffectManager.cpp

示例2: _parseAnimSound

/** 解析animation sound */
void VEffectManager::_parseAnimSound(Ogre::DataStreamPtr &stream, VSkill *skill)
{
	assert(skill != VNULL);

	VAnimationSound *sound = skill->addAnimationSound();
	assert(sound != VNULL);

	Ogre::String line;

	while (!stream->eof())
	{
		line = stream->getLine();
		++mParsingLineNumber;

		if (!(line.empty() || line.substr(0, 2) == "//"))
		{
			if (line == "}")
			{
				break;
			}
			else
			{
				_parseAnimSoundAttrib(line, sound);
			}
		}
	}
}
开发者ID:asnwerear,项目名称:VEngine,代码行数:28,代码来源:VEffectManager.cpp

示例3: while

void RoR::SkinManager::parseScript(Ogre::DataStreamPtr& stream, const Ogre::String& groupName)
{
    SkinDef* skin_def = nullptr;
    bool     skin_is_new = true;
    try
    {
        while(!stream->eof())
        {
            std::string line = RoR::Utils::SanitizeUtf8String(stream->getLine());

            // Ignore blanks & comments
            if (!line.length() || line.substr(0, 2) == "//")
            {
                continue;
            }

            if (!skin_def)
            {
                // No current skin -- So first valid data should be skin name
                Ogre::StringUtil::trim(line);
                auto search = m_skins.find(line);
                if (search != m_skins.end())
                {
                    skin_def = search->second;
                    skin_is_new = false;
                }
                else
                {
                    skin_def = new SkinDef;
                    skin_def->name = line;
                    skin_is_new = true;
                }
                stream->skipLine("{");
            }
            else
            {
                // Already in skin
                if (line == "}")
                {
                    if (skin_is_new)
                        m_skins.insert(std::make_pair(skin_def->name, skin_def));
                    skin_def = nullptr;// Finished
                }
                else
                {
                    this->ParseSkinAttribute(line, skin_def);
                }
            }
        }
    }
    catch (Ogre::ItemIdentityException)
    {
        // this catches duplicates -> to be ignored
        // this happens since we load the full skin data off the cache, so we don't need
        // to re-add it to the SkinManager
        return;
    }
}
开发者ID:disloyalpick,项目名称:rigs-of-rods,代码行数:58,代码来源:SkinManager.cpp

示例4: _skipToNextOpenBrace

/** 跳到下一个左大括号 */
void VEffectManager::_skipToNextOpenBrace(Ogre::DataStreamPtr &stream)
{
	Ogre::String line = "";

	while (!stream->eof() && line != "{")
	{
		line = stream->getLine();
		++mParsingLineNumber;
	}
}
开发者ID:asnwerear,项目名称:VEngine,代码行数:11,代码来源:VEffectManager.cpp

示例5: parseScript

void AudioScriptLoader::parseScript(Ogre::DataStreamPtr& dataStream, const Ogre::String& groupName)
{
	Ogre::String line;
	bool nextIsOpenBrace = false;

	mScriptContext.mSection = ASS_NONE;
	mScriptContext.mSection= ASS_NONE;
	mScriptContext.mSound.setNull();
	mScriptContext.mLineNo = 0;
	mScriptContext.mFileName=dataStream->getName();
	mScriptContext.mGroupName=groupName;

	Logger::getInstance()->log("About to start parsing sound script "+dataStream->getName());

	while(!dataStream->eof())
	{
		line = dataStream->getLine();
		mScriptContext.mLineNo++;

		// DEBUG LINE
		//Logger::getInstance()->log("About to attempt line(#" +
		//	Ogre::StringConverter::toString(mScriptContext.mLineNo) + "): " + line);

		// Ignore comments & blanks
		if (!(line.length() == 0 || line.substr(0,2) == "//"))
		{
			if (nextIsOpenBrace)
			{
				// NB, parser will have changed context already
				if (line != "{")
				{
					logParseError("Expecting '{' but got " +
						line + " instead.", mScriptContext);
				}
				nextIsOpenBrace = false;
			}
			else
			{
				nextIsOpenBrace = parseLine(line);
			}

		}
	}

	// Check all braces were closed
	if (mScriptContext.mSection != ASS_NONE)
	{
		logParseError("Unexpected end of file.", mScriptContext);
	}

	// Make sure we invalidate our context shared pointer (don't wanna hold on)
	mScriptContext.mSound.setNull();
}
开发者ID:juanjmostazo,项目名称:once-upon-a-night,代码行数:53,代码来源:AudioScriptLoader.cpp

示例6: UnloadMaterials

void UnloadMaterials(const std::string& filename)
{
    if (filename.empty())
    {
        Ogre::LogManager::getSingleton().logMessage("Filename is empty.");
        return;
    }
 
    Ogre::DataStreamPtr stream = Ogre::ResourceGroupManager::getSingleton().openResource(filename);
    if(!stream.isNull())
    {
        try
        {
            while(!stream->eof())
            {
                std::string line = stream->getLine();
                StringUtil::trim(line);
 
                ///
                /// UNLOAD MATERIALS
                ///
                if (StringUtil::startsWith(line, "material"))
                {
                    Ogre::vector<Ogre::String>::type vec = StringUtil::split(line," \t:");
                    bool skipFirst = true;
                    for (Ogre::vector<Ogre::String>::type::iterator it = vec.begin(); it < vec.end(); ++it)
                    {
                        if (skipFirst)
                        {
                            skipFirst = false;
                            continue;
                        }
                        std::string match = (*it);
                        StringUtil::trim(match);
                        if (!match.empty())
                        {
                            UnloadResource(Ogre::MaterialManager::getSingletonPtr(), match);
                            break;
                        }
                    }
                }
            }
        }
        catch (Ogre::Exception &e)
        {
            StringUtil::StrStreamType msg;
            msg << "Exception: FILE: " << __FILE__ << " LINE: " << __LINE__ << " DESC: " << e.getFullDescription() << std::endl;
            Ogre::LogManager::getSingleton().logMessage(msg.str());
        }
    }
    stream->close();
}
开发者ID:rbaravalle,项目名称:Pysys,代码行数:52,代码来源:ReloadMaterial.cpp

示例7: LOG

void RoR::SkidmarkConfig::LoadDefaultSkidmarkDefs()
{
    LOG("[RoR] Loading skidmarks.cfg...");
    Ogre::String group = "";
    try
    {
        group = Ogre::ResourceGroupManager::getSingleton().findGroupContainingResource("skidmarks.cfg");
        if (group.empty())
        {
            LOG("[RoR] Failed to load skidmarks.cfg (file not found)");
            return;
        }

        Ogre::DataStreamPtr ds = Ogre::ResourceGroupManager::getSingleton().openResource("skidmarks.cfg", group);
        Ogre::String line = "";
        Ogre::String currentModel = "";

        while (!ds->eof())
        {
            line = RoR::Utils::SanitizeUtf8String(ds->getLine());
            Ogre::StringUtil::trim(line);

            if (line.empty() || line[0] == ';')
                continue;

            Ogre::StringVector args = Ogre::StringUtil::split(line, ",");

            if (args.size() == 1)
            {
                currentModel = line;
                continue;
            }

            // process the line if we got a model
            if (!currentModel.empty())
                this->ProcessSkidmarkConfLine(args, currentModel);
        }
    }
    catch (...)
    {
        LOG("[RoR] Error loading skidmarks.cfg (unknown error)");
        m_models.clear(); // Delete anything we might have loaded
        return;
    }
    LOG("[RoR] skidmarks.cfg loaded OK");
}
开发者ID:Speciesx,项目名称:rigs-of-rods,代码行数:46,代码来源:Skidmark.cpp

示例8: _loadLanguage

	void LanguageManager::_loadLanguage(const Ogre::DataStreamPtr& stream, bool _user)
	{
		std::string read;
		while (false == stream->eof()) {
			read = stream->getLine (false);
			if (read.empty()) continue;

			size_t pos = read.find_first_of(" \t");
			if (_user) {
				if (pos == std::string::npos) mUserMapLanguage[read] = "";
				else mUserMapLanguage[read.substr(0, pos)] = read.substr(pos+1, std::string::npos);
			}
			else {
				if (pos == std::string::npos) mMapLanguage[read] = "";
				else mMapLanguage[read.substr(0, pos)] = read.substr(pos+1, std::string::npos);
			}
		};
	}
开发者ID:venkatarajasekhar,项目名称:viper,代码行数:18,代码来源:MyGUI_LanguageManager.cpp

示例9: ReloadMaterial

void ReloadMaterial(const std::string& materialName, const std::string& groupName, const std::string& filename, bool parseMaterialScript)
{
    if (materialName.empty())
    {
        Ogre::LogManager::getSingleton().logMessage("Material name is empty.");
        return;
    }
 
    if (groupName.empty())
    {
        Ogre::LogManager::getSingleton().logMessage("Group name is empty.");
        return;
    }
 
    if (filename.empty())
    {
        Ogre::LogManager::getSingleton().logMessage("Filename is empty.");
        return;
    }
 
    UnloadMaterials(filename);
    UnloadVertexPrograms(filename);
    UnloadFragmentPrograms(filename);
 
    if (parseMaterialScript)
    {
        Ogre::DataStreamPtr stream = Ogre::ResourceGroupManager::getSingleton().openResource(filename);
        if(!stream.isNull())
        {
            try
            {
                Ogre::MaterialManager::getSingleton().parseScript(stream, groupName);
                Ogre::MaterialPtr materialPtr = Ogre::MaterialManager::getSingleton().getByName(materialName);
                if (!materialPtr.isNull())
                {
                    materialPtr->compile();
                    materialPtr->load();
                }
            }
            catch (Ogre::Exception &e)
            {
                StringUtil::StrStreamType msg;
                msg << "Exception: FILE: " << __FILE__ << " LINE: " << __LINE__ << " DESC: " << e.getFullDescription() << std::endl;
                Ogre::LogManager::getSingleton().logMessage(msg.str());
            }
        }
        stream->close();
 
        ///
        /// RELOAD MATERIAL SCRIPT CONTENTS
        ///
        stream = Ogre::ResourceGroupManager::getSingleton().openResource(filename);
        if(!stream.isNull())
        {
            try
            {
                ///
                /// RELOAD ALL MATERIAL CONTENTS IN FILE
                ///
                while(!stream->eof())
                {
                    std::string line = stream->getLine();
                    StringUtil::trim(line);
                    ///
                    /// RELOAD MATERIALS
                    ///
                    if (StringUtil::startsWith(line, "material"))
                    {
                        Ogre::vector<Ogre::String>::type vec = StringUtil::split(line," \t:");
                        bool skipFirst = true;
                        for (Ogre::vector<Ogre::String>::type::iterator it = vec.begin(); it < vec.end(); ++it)
                        {
                            if (skipFirst)
                            {
                                skipFirst = false;
                                continue;
                            }
                            std::string match = (*it);
                            StringUtil::trim(match);
                            if (!match.empty())
                            {
                                LoadResource(Ogre::MaterialManager::getSingletonPtr(), match, groupName);
                                break;
                            }
                        }
                    }
                    ///
                    /// RELOAD VERTEX PROGRAMS
                    ///
                    if (StringUtil::startsWith(line, "vertex_program") && !StringUtil::startsWith(line, "vertex_program_ref"))
                    {
                        Ogre::vector<Ogre::String>::type vec = StringUtil::split(line," \t");
                        bool skipFirst = true;
                        for (Ogre::vector<Ogre::String>::type::iterator it = vec.begin(); it < vec.end(); ++it)
                        {
                            if (skipFirst)
                            {
                                skipFirst = false;
                                continue;
                            }
//.........这里部分代码省略.........
开发者ID:rbaravalle,项目名称:Pysys,代码行数:101,代码来源:ReloadMaterial.cpp

示例10: DeserializeFromData

bool OgreParticleAsset::DeserializeFromData(const u8 *data, size_t numBytes, bool allowAsynchronous)
{
    RemoveTemplates();
    references.clear();

    if (!data)
    {
        LogError("Null source asset data pointer");
        return false;
    }
    if (numBytes == 0)
    {
        LogError("Zero sized particle system asset");
        return false;
    }

    // Detected template names
    StringVector new_templates;

    std::vector<u8> tempData(data, data + numBytes);
#include "DisableMemoryLeakCheck.h"
    Ogre::DataStreamPtr dataPtr = Ogre::DataStreamPtr(new Ogre::MemoryDataStream(&tempData[0], numBytes));
#include "EnableMemoryLeakCheck.h"
    try
    {
        int brace_level = 0;
        bool skip_until_next = false;
        int skip_brace_level = 0;
        // Parsed/modified script
        std::ostringstream output;

        while(!dataPtr->eof())
        {
            Ogre::String line = dataPtr->getLine();
            // Skip empty lines & comments
            if ((line.length()) && (line.substr(0, 2) != "//"))
            {
                // Split line to components
                std::vector<Ogre::String> line_vec;
#if OGRE_VERSION_MAJOR == 1 && OGRE_VERSION_MINOR == 6 
                line_vec = Ogre::StringUtil::split(line, "\t ");
#else
                Ogre::vector<Ogre::String>::type vec = Ogre::StringUtil::split(line,"\t ");
                int size = vec.size();
                line_vec.resize(size);

                for(int i = 0; i < size; ++i)
                    line_vec[i] = vec[i];
#endif
                // Process opening/closing braces
                if (!ProcessBraces(line, brace_level))
                {
                    // If not a brace and on level 0, it should be a new particlesystem; replace name with resource ID + ordinal
                    if (brace_level == 0)
                    {
                        line = AssetAPI::SanitateAssetRef(this->Name() + "_" + QString::number(new_templates.size())).toStdString();
                        new_templates.push_back(line);
                        // New script compilers need this
                        line = "particle_system " + line;
                    }
                    else
                    {
                        // Check for ColourImage, which is a risky affector and may easily crash if image can't be loaded
                        if (line_vec[0] == "affector")
                        {
                           if (line_vec.size() >= 2)
                            {
                                if (line_vec[1] == "ColourImage")
                                {
                                    skip_until_next = true;
                                    skip_brace_level = brace_level;
                                }
                            }
                        }
                        // Check for material definition
                        else if (line_vec[0] == "material")
                        {
                            if (line_vec.size() >= 2)
                            {
                                std::string mat_name = line_vec[1];
                                AssetReference assetRef(assetAPI->ResolveAssetRef(Name(), mat_name.c_str()));
                                references.push_back(assetRef);
                                line = "material " + AssetAPI::SanitateAssetRef(assetRef.ref).toStdString();
                            }
                        }
                    }
                    // Write line to the copy
                    if (!skip_until_next)
                    {
                        // Maintain the intendation.
                        int numIntendations = brace_level;
                        if (line.find("{") != std::string::npos)
                            --numIntendations;
                        for(int i = 0; i < numIntendations; ++i)
                            output << "    ";
                        output << line << std::endl;
                    }
                    else
                        LogDebug("Skipping risky particle effect line: " + line);
                }
//.........这里部分代码省略.........
开发者ID:katik,项目名称:naali,代码行数:101,代码来源:OgreParticleAsset.cpp

示例11: open

		bool xmlDocument::open(const Ogre::DataStreamPtr& stream)
		{
			clear();

			mLastErrorFile = stream->getName();
			// это текущая строка для разбора
			std::string line;
			// это строка из файла
			std::string read;
			// текущий узел для разбора
			xmlNodePtr currentNode = 0;

			while (false == stream->eof()) {
				// берем новую строку
				read = stream->getLine (false);
				mLine ++;
				mCol = 0; // потом проверить на многострочных тэгах

				if (read.empty()) continue;

				// текущая строка для разбора и то что еще прочитали
				line += read;

				// крутимся пока в строке есть теги
				while (true) {

					// сначала ищем по угловым скобкам
					size_t start = find(line, '<');
					if (start == line.npos) break;

					size_t end = find(line, '>', start+1);
					if (end == line.npos) break;

					// проверяем на наличее тела
					size_t body = line.find_first_not_of(" \t<");
					if (body < start) {

						std::string body_str = line.substr(0, start);
						// текущий символ
						mCol = body_str.find_first_not_of(" \t");
						utility::trim(body_str);

						if (currentNode != 0) 	currentNode->addBody(body_str);

					}

					// вырезаем наш тэг и парсим
					if (false == parseTag(currentNode, line.substr(start+1, end-start-1))) {
						// ошибка установится внутри
						return false;
					}

					// и обрезаем текущую строку разбора
					line = line.substr(end+1);

				}; // while (true)

			}; // while (!stream.eof())

			if (currentNode) {
				mLastError = xml::errors::XML_ERROR_NON_CLOSE_ALL_TAGS;
				return false;
			}

			return true;
		}
开发者ID:twktheainur,项目名称:vortex-ee,代码行数:66,代码来源:MyGUI_XmlDocument.cpp

示例12: _parseSkillFile

/** 解析*.skill文件 */
void VEffectManager::_parseSkillFile(Ogre::DataStreamPtr &stream)
{
	Ogre::String line;
	VSkill *skill = VNULL;

	Ogre::StringVector vecparams;

	while (!stream->eof())
	{
		line = stream->getLine();
		++mParsingLineNumber;

		if (!(line.empty() || line.substr(0, 2) == "//"))
		{
			if (VNULL == skill)
			{
				vecparams = Ogre::StringUtil::split(line, "\t ");

				if (vecparams[0] != "skill" || vecparams.size() != 2)
				{
					_logErrorInfo("Wrong skill name line", line, "EffectManager::parseSkillFile");

					continue;
				}

				// 创建了一个空的effect
				skill = _createSkillTemplate(vecparams[1]);

				_skipToNextOpenBrace(stream);
			}
			else
			{
				if (line == "}")
				{
					// 解析一个完整的技能
					skill = VNULL;
				}
				else if (line == "AnimEffect")
				{
					_skipToNextOpenBrace(stream);
					_parseAnimEffectInfo(stream, skill);
				}
				else if (line == "Ribbon")
				{
					_skipToNextOpenBrace(stream);
					_parseAnimRibbon(stream, skill);
				}
				else if (line == "SceneLight")
				{
					_skipToNextOpenBrace(stream);
					_parseAnimSceneLight(stream, skill);
				}
				else if (line == "Sound")
				{
					_skipToNextOpenBrace(stream);
					_parseAnimSound(stream, skill);
				}
				else
				{
					// 解析技能属性
					_parseSkillAttrib(line, skill);
				}
			}
		}
	}
}
开发者ID:asnwerear,项目名称:VEngine,代码行数:67,代码来源:VEffectManager.cpp

示例13: _parseEffectFile

/** 解析*.effect文件 */
void VEffectManager::_parseEffectFile(Ogre::DataStreamPtr &stream)
{
	Ogre::String line;
	VEffect *effect = VNULL;
	Ogre::StringVector vecparams;

	while (!stream->eof())
	{
		line = stream->getLine();
		++mParsingLineNumber;

		if (!(line.empty() || line.substr(0, 2) == "//"))
		{
			// 只要不是空行或者注释
			if (VNULL == effect)
			{
				// 一个新特效
				vecparams = Ogre::StringUtil::split(line, "\t ");

				if (vecparams[0] != "effect" || vecparams.size() != 2)
				{
					_logErrorInfo("Bad effect system name line", line, "VEffectManager::_parseEffectFile");
					return;
				}

				// 创建空的effect
				effect = _createEffectTemplate(vecparams[1]);

				_skipToNextOpenBrace(stream);
			}
			else
			{
				if (line == "}")
				{
					// 完整的解析一个特效
					effect = VNULL;
				}
				else if (line.substr(0, 7) == "element")
				{
					// 一个新的特效元素
					vecparams = Ogre::StringUtil::split(line, "\t ");
					
					if (vecparams.size() < 2)
					{
						_logErrorInfo("Bad effect system element line", line, "VEffectManager::_parseEffectFile");
						return;
					}

					_skipToNextOpenBrace(stream);

					// 解析特效元素的参数
					_parseElement(vecparams[1], stream, effect);
				}
				else
				{
					// 解析特效自己的参数
					_parseEffectAttrib(line, effect);
				}
			}
		}
	}
}
开发者ID:asnwerear,项目名称:VEngine,代码行数:63,代码来源:VEffectManager.cpp

示例14: DeserializeFromData

bool OgreParticleAsset::DeserializeFromData(const u8 *data_, size_t numBytes)
{
    RemoveTemplates();
    references_.clear();

    if (!data_)
    {
        OgreRenderer::OgreRenderingModule::LogError("Null source asset data pointer");
        return false;
    }
    if (numBytes == 0)
    {
        OgreRenderer::OgreRenderingModule::LogError("Zero sized particle system asset");
        return false;
    }

    // Detected template names
    StringVector new_templates;

    std::vector<u8> tempData(data_, data_ + numBytes);
#include "DisableMemoryLeakCheck.h"
    Ogre::DataStreamPtr data = Ogre::DataStreamPtr(new Ogre::MemoryDataStream(&tempData[0], numBytes));
#include "EnableMemoryLeakCheck.h"
    try
    {
        int brace_level = 0;
        bool skip_until_next = false;
        int skip_brace_level = 0;
        // Parsed/modified script
        std::ostringstream output;

        while (!data->eof())
        {
            Ogre::String line = data->getLine();
            // Skip empty lines & comments
            if ((line.length()) && (line.substr(0, 2) != "//"))
            {
                // Split line to components
                std::vector<Ogre::String> line_vec;

#if OGRE_VERSION_MAJOR == 1 && OGRE_VERSION_MINOR == 6
                line_vec = Ogre::StringUtil::split(line, "\t ");
#else
                Ogre::vector<Ogre::String>::type vec = Ogre::StringUtil::split(line,"\t ");
                int size = vec.size();
                line_vec.resize(size);

                for (int i = 0; i < size; ++i)
                    line_vec[i] = vec[i];
#endif

                // Check for vector parameters to be modified, so that particle scripts can be authored in typical Ogre coord system
                ModifyVectorParameter(line, line_vec);

                // Process opening/closing braces
                if (!ProcessBraces(line, brace_level))
                {
                    // If not a brace and on level 0, it should be a new particlesystem; replace name with resource ID + ordinal
                    if (brace_level == 0)
                    {
                        line = SanitateAssetIdForOgre(this->Name().toStdString()) + "_" + boost::lexical_cast<std::string>(new_templates.size());
                        new_templates.push_back(line);
                        // New script compilers need this
                        line = "particle_system " + line;
                    }
                    else
                    {
                        // Check for ColourImage, which is a risky affector and may easily crash if image can't be loaded
                        if (line_vec[0] == "affector")
                        {
                            if (line_vec.size() >= 2)
                            {
                                if (line_vec[1] == "ColourImage")
                                {
                                    skip_until_next = true;
                                    skip_brace_level = brace_level;
                                }
                            }
                        }
                        // Check for material definition
                        else if (line_vec[0] == "material")
                        {
                            if (line_vec.size() >= 2)
                            {
                                // Tundra: we only support material refs in particle scripts
                                std::string mat_name = line_vec[1];
                                ///\todo The design of whether the LookupAssetRefToStorage should occur here, or internal to Asset API needs to be revisited.
                                references_.push_back(AssetReference(assetAPI->LookupAssetRefToStorage(mat_name.c_str())));
                                line = "material " + SanitateAssetIdForOgre(mat_name);
                            }
                        }
                    }
                    // Write line to the copy
                    if (!skip_until_next)
                    {
                        output << line << std::endl;
                    }
                    else
                        OgreRenderer::OgreRenderingModule::LogDebug("Skipping risky particle effect line: " + line);
                }
//.........这里部分代码省略.........
开发者ID:rex-test-autoreport,项目名称:naali,代码行数:101,代码来源:OgreParticleAsset.cpp

示例15: LoadRigDefFile

bool Main::LoadRigDefFile(MyGUI::UString const & directory, MyGUI::UString const & filename)
{
	/* CLOSE PREVIOUS RIG */

	if (m_rig != nullptr)
	{
		this->CommandCloseCurrentRig();
	}

	/* LOAD */

	Ogre::DataStreamPtr stream = Ogre::DataStreamPtr();
	Ogre::String resource_group_name("RigEditor_CurrentProject");

	try
	{
		Ogre::ResourceGroupManager::getSingleton().addResourceLocation(directory, "FileSystem", resource_group_name);
		stream = Ogre::ResourceGroupManager::getSingleton().openResource(filename, resource_group_name);
	} 
	catch (Ogre::Exception& e)
	{
		// TODO: Report error to user

		LOG("RigEditor: Failed to retrieve rig file" + filename + ", Ogre::Exception was thrown with message: " + e.what());
		return false;
	}

	/* PARSE */

	LOG("RigEditor: Parsing rig file: " + filename);

	RigDef::Parser parser;
	parser.Prepare();
	while(! stream->eof())
	{
		parser.ParseLine(stream->getLine());
	}
	parser.Finalize();

	RigEditor_LogParserMessages(parser);

	/* VALIDATE */

	LOG("RigEditor: Validating vehicle: " + parser.GetFile()->name);

	RigDef::Validator validator;
	validator.Setup(parser.GetFile());
	bool valid = validator.Validate();

	RigEditor_LogValidatorMessages(validator);

	if (! valid)
	{
		// TODO: Report error to user

		LOG("RigEditor: Validating failed!");
		return false;
	}

	/* BUILD RIG MESH */

	m_rig = new RigEditor::Rig(m_config);
	RigEditor::RigBuildingReport rig_build_report;
	Ogre::SceneNode* parent_scene_node = m_scene_manager->getRootSceneNode();
	m_rig->Build(parser.GetFile(), this, parent_scene_node, &rig_build_report);

	/* SHOW MESH */
    this->OnNewRigCreatedOrLoaded(parent_scene_node);

	LOG(Ogre::String("RigEditor: Finished loading rig, report:\n") + rig_build_report.ToString());

	return true;
}
开发者ID:Bob-Z,项目名称:rigs-of-rods,代码行数:73,代码来源:RigEditor_Main.cpp


注:本文中的ogre::DataStreamPtr::getLine方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。