std::string DetailsColumn::Size( const Helium::FilePath& path ) { Status status; status.Read( path.Get().c_str() ); int64_t size = status.m_Size; std::stringstream printSize; if ( size == 0 ) { printSize << "0 KB"; } else if ( size <= 1024 ) { printSize << "1 KB"; } else { size = size / 1024; printSize << size << " KB"; } return printSize.str().c_str(); }
std::string DetailsColumn::FilePath( const Helium::FilePath& path ) { return path.Get(); }
void* ThumbnailLoader::LoadThread::Entry() { #ifdef HELIUM_ASSERT_ENABLED bool emptyQueuePollingCheck = false; #endif while ( true ) { m_Loader.m_Signal.Decrement(); if ( m_Loader.m_Quit ) { break; } #ifdef VIEWPORT_REFACTOR // the device is gone, our glorious benefactor is probably cleaning up IDirect3DDevice9* device = m_Loader.m_DeviceManager->GetD3DDevice(); if ( !device ) { // You should stop this thread before letting go of the window that // owns the device. HELIUM_BREAK(); break; } // while the device is lost, just wait for it to come back while ( device->TestCooperativeLevel() != D3D_OK ) { if ( m_Loader.m_Quit ) { break; } wxThread::Sleep( 100 ); continue; } #endif if ( m_Loader.m_Quit ) { break; } Helium::FilePath path; { Helium::Locker< Helium::OrderedSet< Helium::FilePath > >::Handle queue( m_Loader.m_FileQueue ); if ( !queue->Empty() ) { #ifdef HELIUM_ASSERT_ENABLED emptyQueuePollingCheck = false; #endif path = queue->Front(); } else { // if you hit this then the bookkeeping of the counting semaphore is broken HELIUM_ASSERT( !emptyQueuePollingCheck ); #ifdef HELIUM_ASSERT_ENABLED emptyQueuePollingCheck = true; #endif continue; } queue->Remove( path ); } ResultArgs args; args.m_Path = path; args.m_Cancelled = false; #ifdef VIEWPORT_REFACTOR if ( SceneGraph::IsSupportedTexture( path.Get() ) ) { IDirect3DTexture9* texture = NULL; if ( texture = LoadTexture( device, path.Get() ) ) { ThumbnailPtr thumbnail = new Thumbnail( m_Loader.m_DeviceManager, texture ); args.m_Textures.push_back( thumbnail ); } } else #endif { #pragma TODO( "When we store the thumbnail in the asset file, fix this." ) if ( path.Extension() == TXT( "HeliumEntity" ) ) { FilePath thumbnailPath( path.Directory() + path.Basename() + TXT( "_thumbnail.png" ) ); if ( thumbnailPath.Exists() ) { #ifdef VIEWPORT_REFACTOR IDirect3DTexture9* texture = NULL; if ( texture = LoadTexture( device, thumbnailPath.Get() ) ) { ThumbnailPtr thumbnail = new Thumbnail( m_Loader.m_DeviceManager, texture ); args.m_Textures.push_back( thumbnail ); } #endif } } // Include the color map of a shader as a possible thumbnail image else if ( path.Extension() == TXT( "HeliumShader" ) ) { #ifdef VIEWPORT_REFACTOR if ( colorMap->GetContentPath().Exists() && SceneGraph::IsSupportedTexture( colorMap->GetContentPath().Get() ) ) { IDirect3DTexture9* texture = NULL; if ( texture = LoadTexture( device, colorMap->GetContentPath().Get() ) ) { ThumbnailPtr thumbnail = new Thumbnail( m_Loader.m_DeviceManager, texture ); args.m_Textures.push_back( thumbnail ); } } #endif } else if ( path.Extension() == TXT( "HeliumTexture" ) ) { #ifdef VIEWPORT_REFACTOR if ( textureAsset->GetContentPath().Exists() && SceneGraph::IsSupportedTexture( textureAsset->GetContentPath().Get() ) ) { IDirect3DTexture9* texture = NULL; if ( texture = LoadTexture( device, textureAsset->GetContentPath().Get() ) ) { ThumbnailPtr thumbnail = new Thumbnail( m_Loader.m_DeviceManager, texture ); args.m_Textures.push_back( thumbnail ); } } #endif } } m_Loader.m_Result.Raise( args ); } return NULL; }