From 523d87bbe7c76ffbdc74ee49b5977a66055bea0d Mon Sep 17 00:00:00 2001 From: Gargaj Date: Thu, 7 Aug 2014 08:22:47 +0200 Subject: [PATCH] use 0..fileSize as progress metric (easier for loaders) --- code/Importer.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/code/Importer.cpp b/code/Importer.cpp index 0a817476a..9cfb5be46 100644 --- a/code/Importer.cpp +++ b/code/Importer.cpp @@ -640,16 +640,21 @@ const aiScene* Importer::ReadFile( const char* _pFile, unsigned int pFlags) } } + // Get file size for progress handler + IOStream * fileIO = pimpl->mIOHandler->Open( pFile ); + uint32_t fileSize = fileIO->FileSize(); + pimpl->mIOHandler->Close( fileIO ); + // Dispatch the reading to the worker class for this format DefaultLogger::get()->info("Found a matching importer for this file format"); - pimpl->mProgressHandler->UpdateFileRead( 0, 1 ); + pimpl->mProgressHandler->UpdateFileRead( 0, fileSize ); if (profiler) { profiler->BeginRegion("import"); } pimpl->mScene = imp->ReadFile( this, pFile, pimpl->mIOHandler); - pimpl->mProgressHandler->UpdateFileRead( 1, 1 ); + pimpl->mProgressHandler->UpdateFileRead( fileSize, fileSize ); if (profiler) { profiler->EndRegion("import");