Exemple #1
0
void ResourcesPage::onCommandMenuSelected( wxCommandEvent& event )
{
	int id = event.GetId();

	const ResourceHandle& handle = getResourceFromTreeId( menuItemId );
	Resource* res = handle.Resolve();

	const String& fullPath = getResourceFullPath(res);

	switch(id)
	{
	case ID_ResourceMenu_Open:
	{
		wxLaunchDefaultApplication(fullPath);
		break;
	}
	case ID_ResourceMenu_Browse:
	{
#if 0
		SHELLEXECUTEINFOA info;
		info.cbSize = sizeof(SHELLEXECUTEINFOA);
        info.fMask = 0;
        info.hwnd = nullptr;
        info.lpParameters = nullptr;
        info.lpDirectory = nullptr;
        info.nShow = SW_MAXIMIZE;
        info.hInstApp = nullptr;
		info.lpVerb = "explore";
		info.lpFile = fullPath.c_str();
		
		if( !ShellExecuteExA(&info) )
			return;
#endif
		wxString command = wxString("explorer.exe /select,") + fullPath;
		executeCommand(command);
		break;
	}
	case ID_ResourceMenu_VCS_Update:
	{
		wxString command = getTortoiseBaseCommand(res, "update");
		executeCommand(command);
		break;
	}
	case ID_ResourceMenu_VCS_Commit:
	{
		wxString command = getTortoiseBaseCommand(res, "commit");
		executeCommand(command);
		break;
	}
	case ID_ResourceMenu_VCS_ShowLog:
	{
		wxString command = getTortoiseBaseCommand(res, "log");
		executeCommand(command);
		break;
	} }
}
Exemple #2
0
static wxString getTortoiseBaseCommand(const ResourcePtr& res, const String& operation)
{
	wxString command("TortoiseProc.exe");
	command.Append(" /command:");
	command.Append(operation);
	command.Append(" /path:\"");
	command.Append(getResourceFullPath(res));
	command.Append("\"");

	return command;
}
	bool CResourceGroupManager::getMaterialFilePath(const std::string& materialName, std::string& filepath) const
	{
		auto it = mMaterialNameAndFileNameIndexMapping.find(materialName);
		if (it != mMaterialNameAndFileNameIndexMapping.end())
		{
			u32 index = it->second;
			const std::string& filename = mMaterialFileNames[index];
			if (getResourceFullPath(filename, filepath, ERFT_MATERIAL_XML))
				return true;
		}
		return false;
	}
	bool CResourceGroupManager::getPipelineFilePath(const std::string& pipelineName, std::string& filepath) const
	{
		auto it = mPipelineNameAndFileNameIndexMapping.find(pipelineName);
		if (it != mPipelineNameAndFileNameIndexMapping.end())
		{
			u32 index = it->second;
			const std::string& filename = mPipelineFileNames[index];
			if (getResourceFullPath(filename, filepath, ERFT_PIPELINE_XML))
				return true;
		}
		return false;
	}
void MeshSerializerTests::setUp()
{
	errorFactor = 0.05;

	OGRE_DELETE LogManager::getSingletonPtr();
	mLogManager = OGRE_NEW LogManager();
	mLogManager->createLog("MeshWithoutIndexDataTests.log", false);
	mLogManager->setLogDetail(LL_LOW);

	mFSLayer = OGRE_NEW_T(Ogre::FileSystemLayer, Ogre::MEMCATEGORY_GENERAL)(OGRE_VERSION_NAME);

	OGRE_NEW ResourceGroupManager();
	OGRE_NEW LodStrategyManager();
	OGRE_NEW DefaultHardwareBufferManager();
	OGRE_NEW MeshManager();
	OGRE_NEW SkeletonManager();
	ArchiveManager* archiveMgr = OGRE_NEW ArchiveManager();
	archiveMgr->addArchiveFactory(OGRE_NEW FileSystemArchiveFactory());

	MaterialManager* matMgr = OGRE_NEW MaterialManager();
	matMgr->initialise();

	// Load resource paths from config file
	ConfigFile cf;
	String resourcesPath;
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE || OGRE_PLATFORM == OGRE_PLATFORM_WIN32
	resourcesPath = mFSLayer->getConfigFilePath("resources.cfg");
#else
	resourcesPath = mFSLayer->getConfigFilePath("bin/resources.cfg");
#endif

	// Go through all sections & settings in the file
	cf.load(resourcesPath);
	ConfigFile::SectionIterator seci = cf.getSectionIterator();

	String secName, typeName, archName;
	while (seci.hasMoreElements()) {
		secName = seci.peekNextKey();
		ConfigFile::SettingsMultiMap* settings = seci.getNext();
		ConfigFile::SettingsMultiMap::iterator i;
		for (i = settings->begin(); i != settings->end(); ++i) {
			typeName = i->first;
			archName = i->second;
			if (typeName == "FileSystem") {
				ResourceGroupManager::getSingleton().addResourceLocation(
				    archName, typeName, secName);
			}

		}
	}

	mMesh = MeshManager::getSingleton().load("knot.mesh", ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME);

	getResourceFullPath(mMesh, mMeshFullPath);
	if (!copyFile(mMeshFullPath + ".bak", mMeshFullPath)) {
		// If there is no backup, create one.
		copyFile(mMeshFullPath, mMeshFullPath + ".bak");
	}
	mSkeletonFullPath = "";
	mSkeleton = SkeletonManager::getSingleton().load("jaiqua.skeleton", "Popular").staticCast<Skeleton>();
	getResourceFullPath(mSkeleton, mSkeletonFullPath);
	if (!copyFile(mSkeletonFullPath + ".bak", mSkeletonFullPath)) {
		// If there is no backup, create one.
		copyFile(mSkeletonFullPath, mSkeletonFullPath + ".bak");
	}

	mMesh->reload();
#ifdef OGRE_BUILD_COMPONENT_MESHLODGENERATOR
	{
		MeshLodGenerator().generateAutoconfiguredLodLevels(mMesh);
	}
#endif /* ifdef OGRE_BUILD_COMPONENT_MESHLODGENERATOR */
	mOrigMesh = mMesh->clone(mMesh->getName() + ".orig.mesh", mMesh->getGroup());
}
void MeshSerializerTests::testMesh_Version_1_2()
{
	// Exporting legacy Mesh not supported!
	// testMesh(MESH_VERSION_LEGACY);

#ifdef I_HAVE_LOT_OF_FREE_TIME
	// My sandboxing test. Takes a long time to complete!
	// Runs on all meshes and exports all to every Lod version.
	char* groups [] = { "Popular", "General", "Tests" };
	for (int i = 0; i < 3; i++) {
		StringVectorPtr meshes = ResourceGroupManager::getSingleton().findResourceNames(groups[i], "*.mesh");
		StringVector::iterator it, itEnd;
		it = meshes->begin();
		itEnd = meshes->end();
		for (; it != itEnd; it++) {
			try {
				mMesh = MeshManager::getSingleton().load(*it, groups[i]);
			}
			catch(std::exception e)
			{
				// OutputDebugStringA(e.what());
			}
			getResourceFullPath(mMesh, mMeshFullPath);
			if (!copyFile(mMeshFullPath + ".bak", mMeshFullPath)) {
				// If there is no backup, create one.
				copyFile(mMeshFullPath, mMeshFullPath + ".bak");
			}
			mOrigMesh = mMesh->clone(mMesh->getName() + ".orig.mesh", mMesh->getGroup());
			testMesh_XML();
			testMesh(MESH_VERSION_1_10);
			testMesh(MESH_VERSION_1_8);
			testMesh(MESH_VERSION_1_7);
			testMesh(MESH_VERSION_1_4);
			testMesh(MESH_VERSION_1_0);
		}
		meshes = ResourceGroupManager::getSingleton().findResourceNames(groups[i], "*.skeleton");
		it = meshes->begin();
		itEnd = meshes->end();
		for (; it != itEnd; it++) {
			mSkeleton = SkeletonManager::getSingleton().load(*it, groups[i]);
			getResourceFullPath(mSkeleton, mSkeletonFullPath);
			if (!copyFile(mSkeletonFullPath + ".bak", mSkeletonFullPath)) {
				// If there is no backup, create one.
				copyFile(mSkeletonFullPath, mSkeletonFullPath + ".bak");
			}
			SkeletonSerializer skeletonSerializer;
			skeletonSerializer.exportSkeleton(mSkeleton.get(), mSkeletonFullPath, SKELETON_VERSION_1_8);
			mSkeleton->reload();
			skeletonSerializer.exportSkeleton(mSkeleton.get(), mSkeletonFullPath, SKELETON_VERSION_1_0);
			mSkeleton->reload();
		}
	}
#endif /* ifdef I_HAVE_LOT_OF_FREE_TIME */
}