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


C++ DataManager::addFileSearchPath方法代码示例

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


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

示例1: readInMotionSequences

void MotionGraphController::readInMotionSequences()
{
	cout << "reading motion Sequences" << endl;
	namespace fs = ::boost::filesystem;

	fs::path p(BVH_MOTION_FILE_PATHMOTIONS);
	if (!exists(p))    // does p actually exist?
		cout << "doesn't exist" << endl;
	fs::directory_iterator end_itr;

	// cycle through the directory
	for (fs::directory_iterator itr(p); itr != end_itr; ++itr)
	{
		// If it's not a directory, list it. If you want to list directories too, just remove this check.
		if (is_regular_file(itr->path())) {
			// assign current file name to current_file and echo it out to the console.
			string current_file = itr->path().string();
			current_file = itr->path().filename().string();

			cout << current_file << endl;

			DataManager dataman;
			dataman.addFileSearchPath(BVH_MOTION_FILE_PATHMOTIONS);
			char* BVH_filename = NULL;
			string character_BVH2(current_file);
			try
			{
				BVH_filename = dataman.findFile(character_BVH2.c_str());
				if (BVH_filename == NULL)
				{
					logout << "AnimationControl::loadCharacters: Unable to find character BVH file <" << character_BVH2 << ">. Aborting load." << endl;
					throw BasicException("ABORT");
				}
				pair<Skeleton*, MotionSequence*> read_result;
				try
				{
					read_result = data_manager.readBVH(BVH_filename);
				}
				catch (const DataManagementException& dme)
				{
					logout << "AnimationControl::loadCharacters: Unable to load character data files. Aborting load." << endl;
					logout << "   Failure due to " << dme.msg << endl;
					throw BasicException("ABORT");
				}

				Skeleton* skel = read_result.first;
				MotionSequence * ms = read_result.second;
				
				std::string x = current_file;
				char *y = new char[x.length() + 1];
				std::strcpy(y, x.c_str());
				//set the ID aka filename
				ms->setId(y);
				delete[] y;

				//scale each motion sequence once
				ms->scaleChannel(CHANNEL_ID(0, CT_TX), character_size_scale);
				ms->scaleChannel(CHANNEL_ID(0, CT_TY), character_size_scale);
				ms->scaleChannel(CHANNEL_ID(0, CT_TZ), character_size_scale);

				MotionSequenceContainer test;
				test.MS = ms;
				test.SeqID = current_file;
				MsVector.push_back(test);
				cout << "done loading:  "<<current_file << MsVector.size() << endl;
			}
			catch (BasicException& e) { cout << e.msg << endl; }
		}
	}
	cout << "the size of the vector is : " << MsVector.size() << endl;
}
开发者ID:camcow,项目名称:SKAstart,代码行数:71,代码来源:MotionGraphController.cpp


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