// OgreBatchConverter.cpp : Defines the entry point for the console application. // #include #include #include #include using namespace Urho3D; SharedPtr context(new Context()); SharedPtr fileSystem(new FileSystem(context)); int main(int argc, char** argv) { // Take in account args and place on OgreImporter args const Vector& args = ParseArguments(argc, argv); Vector files; String currentDir = fileSystem->GetCurrentDir(); // Try to execute OgreImporter from same directory as this executable String ogreImporterName = fileSystem->GetProgramDir() + "OgreImporter"; printf("\n\nOgreBatchConverter requires OgreImporter.exe on same directory"); printf("\nSearching Ogre file in Xml format in %s\n" ,currentDir.CString()); fileSystem->ScanDir(files, currentDir, "*.xml", SCAN_FILES, true); printf("\nFound %d files\n", files.Size()); #ifdef WIN32 if (files.Size()) fileSystem->SystemCommand("pause"); #endif for (unsigned i = 0 ; i < files.Size(); i++) { Vector cmdArgs; cmdArgs.Push(files[i]); cmdArgs.Push(ReplaceExtension(files[i], ".mdl")); cmdArgs.Push(args); String cmdPreview = ogreImporterName; for (unsigned j = 0; j < cmdArgs.Size(); j++) cmdPreview += " " + cmdArgs[j]; printf("\n%s", cmdPreview.CString()); fileSystem->SystemRun(ogreImporterName, cmdArgs); } printf("\nExit\n"); #ifdef WIN32 fileSystem->SystemCommand("pause"); #endif return 0; }