本文整理汇总了C++中Package::GetLoader方法的典型用法代码示例。如果您正苦于以下问题:C++ Package::GetLoader方法的具体用法?C++ Package::GetLoader怎么用?C++ Package::GetLoader使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Package
的用法示例。
在下文中一共展示了Package::GetLoader方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetSourceAsset
const FilePath *Helium::Asset::GetAssetFileSystemPath()
{
HELIUM_ASSERT( !m_path.IsEmpty() );
FilePath filePath;
Asset *pSourceAsset = GetSourceAsset();
if (pSourceAsset)
{
Package *pPackage = Reflect::SafeCast<Package>( pSourceAsset->GetOwner() );
if ( pPackage )
{
PackageLoader *pLoader = pPackage->GetLoader();
HELIUM_ASSERT( pLoader->HasAssetFileState() );
if ( pLoader )
{
return &pLoader->GetAssetFileSystemPath( pSourceAsset->GetPath() );
}
}
}
return NULL;
}
示例2: GetAssetFileTimestamp
int64_t AssetLoader::GetAssetFileTimestamp( const AssetPath &path )
{
Package *pPackage = Asset::Find<Package>( path.GetParent() );
HELIUM_ASSERT( pPackage );
PackageLoader *pLoader = pPackage->GetLoader();
HELIUM_ASSERT( pLoader );
return pLoader->GetAssetFileSystemTimestamp( path );
}
示例3: GetOwningPackage
bool Helium::Asset::SaveAsset()
{
Package *pPackage = GetOwningPackage();
if ( pPackage )
{
PackageLoader *pLoader = pPackage->GetLoader();
if ( pLoader )
{
pLoader->SaveAsset( this );
return true;
}
}
return false;
}
示例4: OnSave
void ProjectPanel::OnSave( wxCommandEvent& event )
{
wxDataViewItemArray selection;
int numSelected = m_DataViewCtrl->GetSelections( selection );
for (int i = 0; i < numSelected; ++i)
{
Asset *pAsset = static_cast<Asset *>( selection[i].GetID() );
Package *pPackage = pAsset->GetOwningPackage();
HELIUM_ASSERT( pPackage );
PackageLoader *pPackageLoader = pPackage->GetLoader();
HELIUM_ASSERT( pPackageLoader );
pPackageLoader->SaveAsset( pAsset );
}
}
示例5: TickPreload
//.........这里部分代码省略.........
AssetPtr spParentPackage;
if( IsValid( m_parentPackageLoadId ) )
{
AssetLoader* pAssetLoader = AssetLoader::GetStaticInstance();
HELIUM_ASSERT( pAssetLoader );
if( !pAssetLoader->TryFinishLoad( m_parentPackageLoadId, spParentPackage ) )
{
return;
}
SetInvalid( m_parentPackageLoadId );
// Package loading should not fail. If it does, this is a sign of a potentially serious issue.
HELIUM_ASSERT( spParentPackage );
}
// Everything beyond this point "finalizes" the package preload, so stop here if we aren't ready to go
if (!bAllFileRequestsDone)
{
return;
}
// Create the package object if it does not yet exist.
Package* pPackage = m_spPackage;
if( !pPackage )
{
HELIUM_ASSERT( spParentPackage ? !m_packagePath.GetParent().IsEmpty() : m_packagePath.GetParent().IsEmpty() );
HELIUM_VERIFY( Asset::Create< Package >( m_spPackage, m_packagePath.GetName(), spParentPackage ) );
pPackage = m_spPackage;
HELIUM_ASSERT( pPackage );
pPackage->SetLoader( this );
}
HELIUM_ASSERT( pPackage->GetLoader() == this );
FilePath packageDirectoryPath;
if ( !FileLocations::GetDataDirectory( packageDirectoryPath ) )
{
HELIUM_TRACE( TraceLevels::Error, TXT( "LoosePackageLoader::TickPreload(): Could not get data directory.\n" ) );
return;
}
packageDirectoryPath += m_packagePath.ToFilePathString().GetData();
packageDirectoryPath += TXT("/");
DirectoryIterator packageDirectory( packageDirectoryPath );
for( ; !packageDirectory.IsDone(); packageDirectory.Next() )
{
const DirectoryIteratorItem& item = packageDirectory.GetItem();
if ( !item.m_Path.IsFile() )
{
continue;
}
Name objectName( item.m_Path.Filename().c_str() );
String objectNameString( item.m_Path.Filename().c_str() );
size_t objectIndex = FindObjectByName( objectName );
if( objectIndex != Invalid< size_t >() )
{
m_objects[ objectIndex ].fileTimeStamp = Helium::Max(
m_objects[ objectIndex ].fileTimeStamp,
static_cast< int64_t >( packageDirectory.GetItem().m_ModTime ) );
示例6: Initialize
/// Initialize this package loader.
///
/// @param[in] packagePath Asset path of the package to load.
///
/// @return True if this loader was initialized successfully, false if not.
///
/// @see Shutdown()
bool LoosePackageLoader::Initialize( AssetPath packagePath )
{
Shutdown();
// Make sure the path represents a package.
if( packagePath.IsEmpty() )
{
HELIUM_TRACE( TraceLevels::Error, TXT( "LoosePackageLoader::Initialize(): Empty package path specified.\n" ) );
return false;
}
HELIUM_TRACE(
TraceLevels::Debug,
TXT( "LoosePackageLoader::Initialize(): Initializing loader for package \"%s\".\n" ),
*packagePath.ToString() );
if( !packagePath.IsPackage() )
{
HELIUM_TRACE(
TraceLevels::Error,
TXT( "LoosePackageLoader::Initialize(): \"%s\" does not represent a package path.\n" ),
*packagePath.ToString() );
return false;
}
// Store the package path.
m_packagePath = packagePath;
// Attempt to locate the specified package if it already happens to exist.
m_spPackage = Asset::Find< Package >( packagePath );
Package* pPackage = m_spPackage;
if( pPackage )
{
if( pPackage->GetLoader() )
{
HELIUM_TRACE(
TraceLevels::Error,
TXT( "LoosePackageLoader::Initialize(): Package \"%s\" already has a loader.\n" ),
*packagePath.ToString() );
m_spPackage.Release();
return false;
}
pPackage->SetLoader( this );
}
else
{
// Make sure we don't have a name clash with a non-package object.
AssetPtr spObject( Asset::FindObject( packagePath ) );
if( spObject )
{
HELIUM_ASSERT( !spObject->IsPackage() );
HELIUM_TRACE(
TraceLevels::Error,
( TXT( "PackageLoader::Initialize(): Package loader cannot be initialized for \"%s\", as an " )
TXT( "object with the same name exists that is not a package.\n" ) ),
*packagePath.ToString() );
return false;
}
}
// Build the package file path. If the package is a user configuration package, use the user data directory,
// otherwise use the global data directory.
Config& rConfig = Config::GetStaticInstance();
FilePath dataDirectory;
if ( !FileLocations::GetDataDirectory( dataDirectory ) )
{
HELIUM_TRACE(
TraceLevels::Error,
TXT( "PackageLoader::Initialize(): Could not obtain user data directory." ) );
return false;
}
// Set up to read the TOC (which may not exist)
//SetInvalid( m_packageTocFileSize );
// First do this check without a trailing "/" so that FilePath has to actually look at the file system
FilePath package_dir = dataDirectory + packagePath.ToFilePathString().GetData();
if (!package_dir.Exists())
{
// Some packages like types or uninitialized user config packages may not exist on file system
m_packageDirPath = package_dir + TXT("/");
return true;
}
//.........这里部分代码省略.........