示例#1
0
/////////////////////////////////////////////////////////////////////////////
// Helper function to convert a file ref to an appropriate string 
// representation.
// 
tstring Editor::PathToLabel( const Helium::Path& path, const FilePathOption filePathOption )
{
    tstring filePath = path.Get();

    // Determine whether to show full path or not...
    if ( !filePath.empty() )
    {
        switch ( filePathOption )
        {
        case FilePathOptions::Basename:
            filePath = path.Basename();
            break;

        case FilePathOptions::Filename:
            filePath = path.Filename();
            break;

        case FilePathOptions::PartialPath:
            //FileSystem::StripPrefix( Finder::ProjectAssets(), filePath );
#pragma TODO( "Make this aware of the project root somehow, maybe the application/program options" )
            break;

        case FilePathOptions::FullPath:
            // Do nothing, it's already good to go
            break;
        }
    }

    return filePath;
}
示例#2
0
AssetClassPtr MeshAssetFactory::Create( const Helium::Path& path )
{
    Helium::Path assetPath = path;
    assetPath.ReplaceExtension( TXT( "entity.nrb" ) );

    if ( assetPath.Exists() )
    {
        return AssetClass::LoadAssetClass( assetPath );
    }

    EntityPtr entity = new Entity();
    entity->SetPath( path.Filename() ); // we're dropping this guy relative to the data file

    MeshProcessingComponentPtr meshProcessingComponent = new MeshProcessingComponent();
    entity->SetComponent( meshProcessingComponent );

    try
    {
        Reflect::Archive::ToFile( entity, assetPath );
        entity->SetSerializationPath( assetPath );
    }
    catch( Helium::Exception& )
    {
        delete entity;
        return NULL;
    }

    return entity;
}
示例#3
0
tstring DetailsColumn::Filename( const Helium::Path& path )
{
    return path.Filename();
}