本文整理汇总了C++中UPaperSprite::IsValidLowLevel方法的典型用法代码示例。如果您正苦于以下问题:C++ UPaperSprite::IsValidLowLevel方法的具体用法?C++ UPaperSprite::IsValidLowLevel怎么用?C++ UPaperSprite::IsValidLowLevel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UPaperSprite
的用法示例。
在下文中一共展示了UPaperSprite::IsValidLowLevel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ExecuteCreateFlipbook
void FSpriteAssetTypeActions::ExecuteCreateFlipbook(TArray<TWeakObjectPtr<UPaperSprite>> Objects)
{
FAssetToolsModule& AssetToolsModule = FModuleManager::GetModuleChecked<FAssetToolsModule>("AssetTools");
FContentBrowserModule& ContentBrowserModule = FModuleManager::LoadModuleChecked<FContentBrowserModule>("ContentBrowser");
TArray<UPaperSprite*> AllSprites;
for (auto ObjIt = Objects.CreateConstIterator(); ObjIt; ++ObjIt)
{
UPaperSprite *Object = (*ObjIt).Get();
if (Object && Object->IsValidLowLevel())
{
AllSprites.Add(Object);
}
}
TMap<FString, TArray<UPaperSprite*> > SpriteFlipbookMap;
FPaperFlipbookHelpers::ExtractFlipbooksFromSprites(/*out*/SpriteFlipbookMap, AllSprites, TArray<FString>());
TArray<UObject*> ObjectsToSync;
if (SpriteFlipbookMap.Num() > 0)
{
GWarn->BeginSlowTask(NSLOCTEXT("Paper2D", "Paper2D_CreateFlipbooks", "Creating flipbooks from selection"), true, true);
int Progress = 0;
int TotalProgress = SpriteFlipbookMap.Num();
// Create the flipbook
bool bOneFlipbookCreated = SpriteFlipbookMap.Num() == 1;
for (auto Iter : SpriteFlipbookMap)
{
GWarn->UpdateProgress(Progress++, TotalProgress);
const FString& FlipbookName = Iter.Key;
TArray<UPaperSprite*> Sprites = Iter.Value;
const FString SpritePathName = AllSprites[0]->GetOutermost()->GetPathName();
const FString LongPackagePath = FPackageName::GetLongPackagePath(AllSprites[0]->GetOutermost()->GetPathName());
const FString NewFlipBookDefaultPath = LongPackagePath + TEXT("/") + FlipbookName;
FString DefaultSuffix;
FString AssetName;
FString PackageName;
UPaperFlipbookFactory* FlipbookFactory = NewObject<UPaperFlipbookFactory>();
for (int32 SpriteIndex = 0; SpriteIndex < Sprites.Num(); ++SpriteIndex)
{
UPaperSprite* Sprite = Sprites[SpriteIndex];
FPaperFlipbookKeyFrame* KeyFrame = new (FlipbookFactory->KeyFrames) FPaperFlipbookKeyFrame();
KeyFrame->Sprite = Sprite;
KeyFrame->FrameRun = 1;
}
AssetToolsModule.Get().CreateUniqueAssetName(NewFlipBookDefaultPath, /*out*/ DefaultSuffix, /*out*/ PackageName, /*out*/ AssetName);
const FString PackagePath = FPackageName::GetLongPackagePath(PackageName);
if (bOneFlipbookCreated)
{
ContentBrowserModule.Get().CreateNewAsset(AssetName, PackagePath, UPaperFlipbook::StaticClass(), FlipbookFactory);
}
else
{
if (UObject* NewAsset = AssetToolsModule.Get().CreateAsset(AssetName, PackagePath, UPaperFlipbook::StaticClass(), FlipbookFactory))
{
ObjectsToSync.Add(NewAsset);
}
}
if (GWarn->ReceivedUserCancel())
{
break;
}
}
GWarn->EndSlowTask();
if (ObjectsToSync.Num() > 0)
{
ContentBrowserModule.Get().SyncBrowserToAssets(ObjectsToSync);
}
}
}