本文整理汇总了C++中AssetPtr::Rename方法的典型用法代码示例。如果您正苦于以下问题:C++ AssetPtr::Rename方法的具体用法?C++ AssetPtr::Rename怎么用?C++ AssetPtr::Rename使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AssetPtr
的用法示例。
在下文中一共展示了AssetPtr::Rename方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TickDeserialize
/// Tick the object deserialization process for the given object load request.
///
/// @param[in] pRequest Load request.
///
/// @return True if the deserialization process has completed, false if it still needs time to process.
bool CachePackageLoader::TickDeserialize( LoadRequest* pRequest )
{
HELIUM_ASSERT( pRequest );
HELIUM_ASSERT( !( pRequest->flags & LOAD_FLAG_PRELOADED ) );
HELIUM_ASSERT( !pRequest->spObject );
const Cache::Entry* pCacheEntry = pRequest->pEntry;
HELIUM_ASSERT( pCacheEntry );
// Wait for the template and owner objects to load.
AssetLoader* pAssetLoader = AssetLoader::GetInstance();
HELIUM_ASSERT( pAssetLoader );
if( IsValid( pRequest->ownerLoadIndex ) )
{
size_t ownerLoadId = pRequest->ownerLoadIndex;
if( IsValid( ownerLoadId ) && !pAssetLoader->TryFinishLoad( ownerLoadId, pRequest->spOwner ) )
{
return false;
}
SetInvalid( pRequest->ownerLoadIndex );
if( !pRequest->spOwner )
{
HELIUM_TRACE(
TraceLevels::Error,
"CachePackageLoader: Failed to load owner object for \"%s\".\n",
*pCacheEntry->path.ToString() );
DefaultAllocator().Free( pRequest->pAsyncLoadBuffer );
pRequest->pAsyncLoadBuffer = NULL;
pRequest->flags |= LOAD_FLAG_PRELOADED | LOAD_FLAG_ERROR;
return true;
}
}
Asset* pOwner = pRequest->spOwner;
HELIUM_ASSERT( !pOwner || pOwner->IsFullyLoaded() );
Reflect::ObjectPtr cached_object = Cache::ReadCacheObjectFromBuffer(
pRequest->pPropertyDataBegin,
0,
pRequest->pPropertyDataEnd - pRequest->pPropertyDataBegin,
pRequest->pResolver);
AssetPtr assetPtr = Reflect::AssertCast<Asset>(cached_object);
Asset::RenameParameters params;
params.instanceIndex = -1;
params.name = pCacheEntry->path.GetName();
params.spOwner = pRequest->spOwner;
assetPtr->Rename(params);
pRequest->spObject = assetPtr;
Asset *pObject = assetPtr;
HELIUM_ASSERT( pObject );
if (!cached_object.ReferencesObject())
{
HELIUM_TRACE(
TraceLevels::Error,
"CachePackageLoader: Failed to deserialize object \"%s\".\n",
*pCacheEntry->path.ToString() );
pObject->SetFlags( Asset::FLAG_LINKED );
pObject->ConditionalFinalizeLoad();
pRequest->flags |= LOAD_FLAG_ERROR;
}
else
{
//cached_object->CopyTo(pObject);
if( !pObject->IsDefaultTemplate() )
{
// Load persistent resource data.
Resource* pResource = Reflect::SafeCast< Resource >( pObject );
if( pResource )
{
Reflect::ObjectPtr cached_prd = Cache::ReadCacheObjectFromBuffer(
pRequest->pPersistentResourceDataBegin,
0,
(pRequest->pPersistentResourceDataEnd - pRequest->pPersistentResourceDataBegin),
pRequest->pResolver);
if (!cached_prd.ReferencesObject())
{
HELIUM_TRACE(
TraceLevels::Error,
//.........这里部分代码省略.........