本文整理汇总了C++中UMetaData::RemoveFromRoot方法的典型用法代码示例。如果您正苦于以下问题:C++ UMetaData::RemoveFromRoot方法的具体用法?C++ UMetaData::RemoveFromRoot怎么用?C++ UMetaData::RemoveFromRoot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UMetaData
的用法示例。
在下文中一共展示了UMetaData::RemoveFromRoot方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DeleteRedirectors
void FAssetFixUpRedirectors::DeleteRedirectors(TArray<FRedirectorRefs>& RedirectorsToFix) const
{
TArray<UObject*> ObjectsToDelete;
for ( auto RedirectorIt = RedirectorsToFix.CreateIterator(); RedirectorIt; ++RedirectorIt )
{
FRedirectorRefs& RedirectorRefs = *RedirectorIt;
if ( RedirectorRefs.bRedirectorValidForFixup )
{
// Add all redirectors found in this package to the redirectors to delete list.
// All redirectors in this package should be fixed up.
UPackage* RedirectorPackage = RedirectorRefs.Redirector->GetOutermost();
TArray<UObject*> AssetsInRedirectorPackage;
GetObjectsWithOuter(RedirectorPackage, AssetsInRedirectorPackage, /*bIncludeNestedObjects=*/false);
UMetaData* PackageMetaData = NULL;
bool bContainsAtLeastOneOtherAsset = false;
for ( auto ObjIt = AssetsInRedirectorPackage.CreateConstIterator(); ObjIt; ++ObjIt )
{
if ( UObjectRedirector* Redirector = Cast<UObjectRedirector>(*ObjIt) )
{
Redirector->RemoveFromRoot();
ObjectsToDelete.Add(Redirector);
}
else if ( UMetaData* MetaData = Cast<UMetaData>(*ObjIt) )
{
PackageMetaData = MetaData;
}
else
{
bContainsAtLeastOneOtherAsset = true;
}
}
if ( !bContainsAtLeastOneOtherAsset )
{
RedirectorPackage->RemoveFromRoot();
ULinkerLoad* Linker = ULinkerLoad::FindExistingLinkerForPackage(RedirectorPackage);
if ( Linker )
{
Linker->RemoveFromRoot();
}
// @todo we shouldnt be worrying about metadata objects here, ObjectTools::CleanUpAfterSuccessfulDelete should
if ( PackageMetaData )
{
PackageMetaData->RemoveFromRoot();
ObjectsToDelete.Add(PackageMetaData);
}
}
// This redirector will be deleted, NULL the reference here
RedirectorRefs.Redirector = NULL;
}
}
if ( ObjectsToDelete.Num() > 0 )
{
ObjectTools::DeleteObjects(ObjectsToDelete);
}
}
示例2: PrepareToDelete
void FAssetDeleteModel::PrepareToDelete(UObject* InObject)
{
if ( InObject->IsA<UObjectRedirector>() )
{
// Add all redirectors found in this package to the redirectors to delete list.
// All redirectors in this package should be fixed up.
UPackage* RedirectorPackage = InObject->GetOutermost();
TArray<UObject*> AssetsInRedirectorPackage;
GetObjectsWithOuter(RedirectorPackage, AssetsInRedirectorPackage, /*bIncludeNestedObjects=*/false);
UMetaData* PackageMetaData = NULL;
bool bContainsAtLeastOneOtherAsset = false;
for ( auto ObjIt = AssetsInRedirectorPackage.CreateConstIterator(); ObjIt; ++ObjIt )
{
if ( UObjectRedirector* Redirector = Cast<UObjectRedirector>(*ObjIt) )
{
Redirector->RemoveFromRoot();
}
else if ( UMetaData* MetaData = Cast<UMetaData>(*ObjIt) )
{
PackageMetaData = MetaData;
}
else
{
bContainsAtLeastOneOtherAsset = true;
}
}
if ( !bContainsAtLeastOneOtherAsset )
{
RedirectorPackage->RemoveFromRoot();
ULinkerLoad* Linker = ULinkerLoad::FindExistingLinkerForPackage(RedirectorPackage);
if ( Linker )
{
Linker->RemoveFromRoot();
}
// @todo we shouldnt be worrying about metadata objects here, ObjectTools::CleanUpAfterSuccessfulDelete should
if ( PackageMetaData )
{
PackageMetaData->RemoveFromRoot();
PendingDeletes.AddUnique(MakeShareable(new FPendingDelete(PackageMetaData)));
}
}
}
}
示例3: DeleteRedirectors
void FAssetFixUpRedirectors::DeleteRedirectors(TArray<FRedirectorRefs>& RedirectorsToFix, const TArray<UPackage*>& FailedToSave) const
{
TArray<UObject*> ObjectsToDelete;
for ( auto RedirectorIt = RedirectorsToFix.CreateIterator(); RedirectorIt; ++RedirectorIt )
{
FRedirectorRefs& RedirectorRefs = *RedirectorIt;
if ( RedirectorRefs.bRedirectorValidForFixup )
{
bool bAllReferencersFixedUp = true;
for (const auto& ReferencingPackageName : RedirectorRefs.ReferencingPackageNames)
{
if (FailedToSave.ContainsByPredicate([&](UPackage* Package) { return Package->GetFName() == ReferencingPackageName; }))
{
bAllReferencersFixedUp = false;
break;
}
}
if (!bAllReferencersFixedUp)
{
continue;
}
// Add all redirectors found in this package to the redirectors to delete list.
// All redirectors in this package should be fixed up.
UPackage* RedirectorPackage = RedirectorRefs.Redirector->GetOutermost();
TArray<UObject*> AssetsInRedirectorPackage;
GetObjectsWithOuter(RedirectorPackage, AssetsInRedirectorPackage, /*bIncludeNestedObjects=*/false);
UMetaData* PackageMetaData = NULL;
bool bContainsAtLeastOneOtherAsset = false;
for ( auto ObjIt = AssetsInRedirectorPackage.CreateConstIterator(); ObjIt; ++ObjIt )
{
if ( UObjectRedirector* Redirector = Cast<UObjectRedirector>(*ObjIt) )
{
Redirector->RemoveFromRoot();
ObjectsToDelete.Add(Redirector);
}
else if ( UMetaData* MetaData = Cast<UMetaData>(*ObjIt) )
{
PackageMetaData = MetaData;
}
else
{
bContainsAtLeastOneOtherAsset = true;
}
}
if ( !bContainsAtLeastOneOtherAsset )
{
RedirectorPackage->RemoveFromRoot();
// @todo we shouldnt be worrying about metadata objects here, ObjectTools::CleanUpAfterSuccessfulDelete should
if ( PackageMetaData )
{
PackageMetaData->RemoveFromRoot();
ObjectsToDelete.Add(PackageMetaData);
}
}
// This redirector will be deleted, NULL the reference here
RedirectorRefs.Redirector = NULL;
}
}
if ( ObjectsToDelete.Num() > 0 )
{
ObjectTools::DeleteObjects(ObjectsToDelete, false);
}
}