void ProcessRecourcePacker() { Vector<String> & commandLine = Core::Instance()->GetCommandLine(); ResourcePackerScreen * resourcePackerScreen = new ResourcePackerScreen(); String path, lastDir; FileSystem::SplitPath(commandLine[1], path, lastDir); resourcePackerScreen->inputGfxDirectory = FileSystem::RealPath(commandLine[1]);// "/./../../ProjectDataSource/Gfx/"); resourcePackerScreen->outputGfxDirectory = FileSystem::RealPath(resourcePackerScreen->inputGfxDirectory + "/../../Data/" + lastDir); resourcePackerScreen->excludeDirectory = FileSystem::RealPath(resourcePackerScreen->inputGfxDirectory + "/../"); String excludeDirPath, excludeDirLastDir; FileSystem::SplitPath(resourcePackerScreen->excludeDirectory, excludeDirPath, excludeDirLastDir); if (excludeDirLastDir != "DataSource") { printf("[FATAL ERROR: Packer working only inside DataSource directory]"); return; } uint64 elapsedTime = SystemTimer::Instance()->AbsoluteMS(); printf("[Resource Packer Started]\n"); printf("[INPUT DIR] - [%s]\n", resourcePackerScreen->inputGfxDirectory.c_str()); printf("[OUTPUT DIR] - [%s]\n", resourcePackerScreen->outputGfxDirectory.c_str()); printf("[EXCLUDE DIR] - [%s]\n", resourcePackerScreen->excludeDirectory.c_str()); resourcePackerScreen->PackResources(); elapsedTime = SystemTimer::Instance()->AbsoluteMS() - elapsedTime; printf("[Resource Packer Compile Time: %0.3lf seconds]\n", (float64)elapsedTime / 1000.0); SafeRelease(resourcePackerScreen); }
void SpritePackerHelper::Pack() { void *pool = DAVA::QtLayer::Instance()->CreateAutoreleasePool(); String projectPath = EditorSettings::Instance()->GetProjectPath(); String inputDir = projectPath+"DataSource/Gfx/Particles"; String outputDir = projectPath+"Data/Gfx/Particles"; if(!FileSystem::Instance()->IsDirectory(inputDir)) { Logger::Error("[SpritePackerHelper::Pack] inputDir is not directory (%s)", inputDir.c_str()); return; } ResourcePackerScreen * resourcePackerScreen = new ResourcePackerScreen(); bool isChanged = resourcePackerScreen->IsMD5ChangedDir(projectPath+"DataSource/Gfx",inputDir,"particles.md5",true); SafeRelease(resourcePackerScreen); if(!isChanged) { return; } SpritesPacker packer; packer.SetInputDir(inputDir); packer.SetOutputDir(outputDir); packer.Pack(); DAVA::QtLayer::Instance()->ReleaseAutoreleasePool(pool); }
void SpritesPacker::Pack() { FileSystem::Instance()->CreateDirectory(outputDir, true); ResourcePackerScreen * resourcePackerScreen = new ResourcePackerScreen(); CommandLineParser::Instance()->ClearFlags(); //CommandLineParser is used in ResourcePackerScreen resourcePackerScreen->clearProcessDirectory = true; resourcePackerScreen->inputGfxDirectory = inputDir; resourcePackerScreen->outputGfxDirectory = outputDir; resourcePackerScreen->excludeDirectory = "/"+FileSystem::Instance()->RealPath(inputDir + "/../"); resourcePackerScreen->isLightmapsPacking = true; resourcePackerScreen->PackResources(); SafeRelease(resourcePackerScreen); }