本文整理汇总了C++中Asset::IsPackage方法的典型用法代码示例。如果您正苦于以下问题:C++ Asset::IsPackage方法的具体用法?C++ Asset::IsPackage怎么用?C++ Asset::IsPackage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Asset
的用法示例。
在下文中一共展示了Asset::IsPackage方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetChildren
unsigned int ProjectViewModel::GetChildren( const wxDataViewItem& item, wxDataViewItemArray& items ) const
{
int count = 0;
Asset *pAsset = NULL;
if (!item.IsOk())
{
ForciblyFullyLoadedPackageManager::GetStaticInstance()->ForceFullyLoadRootPackages();
pAsset = Asset::GetFirstTopLevelAsset();
}
else
{
Asset* pParentAsset = static_cast< Asset* >( item.GetID() );
if ( pParentAsset->IsPackage() )
{
ForciblyFullyLoadedPackageManager::GetStaticInstance()->ForceFullyLoadPackage( pParentAsset->GetPath() );
}
pAsset = pParentAsset->GetFirstChild();
}
while (pAsset)
{
//if ( m_AssetsInTree.Insert( pAsset ).Second() )
{
items.Add( wxDataViewItem( pAsset ) );
++count;
}
pAsset = pAsset->GetNextSibling();
}
return count;
}
示例2: GetAttr
bool ProjectViewModel::GetAttr( const wxDataViewItem& item, unsigned int column, wxDataViewItemAttr& attr ) const
{
if ( !item.IsOk() )
{
return false;
}
Asset *node = static_cast< Asset* >( item.GetID() );
HELIUM_ASSERT( node );
// bold the entry if the node is active
attr.SetBold( node->IsPackage() );
if ( node->GetAllFlagsSet( Asset::FLAG_EDITOR_FORCIBLY_LOADED ) )
{
attr.SetColour( *wxBLACK );
}
else
{
attr.SetColour( *wxLIGHT_GREY );
}
// italicize the entry if it is modified
attr.SetItalic( node->GetAllFlagsSet( Asset::FLAG_CHANGED_SINCE_LOADED ) );
if ( node->GetAllFlagsSet( Asset::FLAG_CHANGED_SINCE_LOADED ) )
{
attr.SetColour( *wxRED );
}
return true;
}
示例3: OnLoadForEdit
void ProjectPanel::OnLoadForEdit( 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() );
if (pAsset && pAsset->IsPackage())
{
ForciblyFullyLoadedPackageManager::GetStaticInstance()->ForceFullyLoadPackage(pAsset->GetPath());
}
}
}
示例4: TryFinishLoadObject
/// @copydoc PackageLoader::TryFinishLoadObject()
bool CachePackageLoader::TryFinishLoadObject( size_t requestId, AssetPtr& rspObject )
{
HELIUM_ASSERT( requestId < m_loadRequests.GetSize() );
HELIUM_ASSERT( m_loadRequests.IsElementValid( requestId ) );
LoadRequest* pRequest = m_loadRequests[ requestId ];
HELIUM_ASSERT( pRequest );
if( !( pRequest->flags & LOAD_FLAG_PRELOADED ) )
{
return false;
}
// Sync on template and owner dependencies.
AssetLoader* pAssetLoader = AssetLoader::GetInstance();
HELIUM_ASSERT( pAssetLoader );
if( IsValid( pRequest->ownerLoadIndex ) )
{
size_t linkLoadId = pRequest->ownerLoadIndex;
if( IsValid( linkLoadId ) && !pAssetLoader->TryFinishLoad( linkLoadId, pRequest->spOwner ) )
{
return false;
}
SetInvalid( pRequest->ownerLoadIndex );
}
rspObject = pRequest->spObject;
Asset* pObject = rspObject;
if( pObject && ( pRequest->flags & LOAD_FLAG_ERROR ) )
{
pObject->SetFlags( Asset::FLAG_BROKEN );
}
if ( pObject->IsPackage() )
{
Package *pPackage = Reflect::AssertCast<Package>( pObject );
pPackage->SetLoader( this );
}
pRequest->spObject.Release();
HELIUM_ASSERT( IsInvalid( pRequest->asyncLoadId ) );
HELIUM_ASSERT( !pRequest->pAsyncLoadBuffer );
//pRequest->spTemplate.Release();
pRequest->spOwner.Release();
HELIUM_ASSERT( IsInvalid( pRequest->ownerLoadIndex ) );
//HELIUM_ASSERT( IsInvalid( pRequest->templateLoadIndex ) );
HELIUM_ASSERT( pObject || pRequest->pEntry );
HELIUM_TRACE(
TraceLevels::Debug,
"CachePackageLoader::TryFinishLoadObject(): Load request for \"%s\" (ID: %" PRIuSZ ") synced.\n",
*( pObject ? pObject->GetPath() : pRequest->pEntry->path ).ToString(),
requestId );
m_loadRequests.Remove( requestId );
m_loadRequestPool.Release( pRequest );
return true;
}
示例5: Rename
/// Modify the name, owner, or instance index of this object.
///
/// @param[in] rParameters Object rename parameters.
///
/// @return True if this object was renamed successfully, false if not.
///
/// @see GetName(), GetOwner(), GetInstanceIndex()
bool Asset::Rename( const RenameParameters& rParameters )
{
Name name = rParameters.name;
Asset* pOwner = rParameters.spOwner;
uint32_t instanceIndex = rParameters.instanceIndex;
HELIUM_TRACE(
TraceLevels::Debug,
TXT("Asset::Rename(): Renaming object \"%s\" to \"%s\" (Old Owner: \"%s\". New Owner: \"%s\".)\n"),
*m_name,
*rParameters.name,
m_spOwner.ReferencesObject() ? *m_spOwner->GetPath().ToString() : TXT("[none]"),
rParameters.spOwner.ReferencesObject() ? *rParameters.spOwner->GetPath().ToString() : TXT("[none]"));
// Only allow setting an empty name if no owner or instance index are given and this object has no children.
if( name.IsEmpty() )
{
HELIUM_ASSERT( !pOwner );
HELIUM_ASSERT( IsInvalid( instanceIndex ) );
if( pOwner || IsValid( instanceIndex ) )
{
HELIUM_TRACE(
TraceLevels::Error,
( TXT( "Asset::Rename(): Objects cannot have name information cleared if being assigned an " )
TXT( "owner or instance index.\n" ) ) );
return false;
}
HELIUM_ASSERT( !m_wpFirstChild );
if( m_wpFirstChild )
{
HELIUM_TRACE(
TraceLevels::Error,
TXT( "Asset::Rename(): Cannot clear name information for objects with children.\n" ) );
return false;
}
}
// Don't allow setting the owner to ourself.
if( pOwner == this )
{
HELIUM_TRACE( TraceLevels::Error, TXT( "Asset::Rename(): Cannot set the owner of an object to itself.\n" ) );
return false;
}
// Don't allow setting the owner to an object with no name information.
if( pOwner && pOwner->m_name.IsEmpty() )
{
HELIUM_TRACE(
TraceLevels::Error,
TXT( "Asset::Rename(): Cannot set the owner of an object to an object with no path information.\n" ) );
return false;
}
if( IsPackage() )
{
// Don't allow package objects to be children of non-package objects.
if( pOwner && !pOwner->IsPackage() )
{
HELIUM_TRACE(
TraceLevels::Error,
TXT( "Asset::Rename(): Cannot set a non-package as the owner of a package.\n" ) );
return false;
}
// Don't allow instance indexing for packages.
if( IsValid( instanceIndex ) )
{
HELIUM_TRACE(
TraceLevels::Error,
TXT( "Asset::Rename(): Instance indexing not supported for packages.\n" ) );
return false;
}
}
// Don't need to do anything if the name, owner, and instance index are not changing.
if( name == m_name &&
pOwner == m_spOwner &&
( instanceIndex == m_instanceIndex || ( instanceIndex == INSTANCE_INDEX_AUTO && IsValid( m_instanceIndex ) ) ) )
{
return true;
}
// Hold onto a reference to the current owner until we return from this function. This is done in case this object
// has the last strong reference to it, in which case we would encounter a deadlock if clearing its reference while
// we still have a write lock on the object list (object destruction also requires acquiring a write lock).
AssetPtr spOldOwner = m_spOwner;
//.........这里部分代码省略.........