本文整理汇总了C++中FStringAssetReference类的典型用法代码示例。如果您正苦于以下问题:C++ FStringAssetReference类的具体用法?C++ FStringAssetReference怎么用?C++ FStringAssetReference使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FStringAssetReference类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FStringAssetReference
void UAssetObjectProperty::ExportTextItem( FString& ValueStr, const void* PropertyValue, const void* DefaultValue, UObject* Parent, int32 PortFlags, UObject* ExportRootScope ) const
{
FAssetPtr& AssetPtr = *(FAssetPtr*)PropertyValue;
FStringAssetReference ID;
UObject *Object = AssetPtr.Get();
if (Object)
{
// Use object in case name has changed.
ID = FStringAssetReference(Object);
}
else
{
ID = AssetPtr.GetUniqueID();
}
if (0 != (PortFlags & PPF_ExportCpp))
{
ValueStr += FString::Printf(TEXT("FStringAssetReference(TEXT(\"%s\"))"), *ID.ToString().ReplaceCharWithEscapedChar());
return;
}
if (!ID.ToString().IsEmpty())
{
ValueStr += ID.ToString();
}
else
{
ValueStr += TEXT("None");
}
}
示例2: AsyncLoadCallback
void FStreamableManager::AsyncLoadCallback(FStringAssetReference Request)
{
FStringAssetReference TargetName = Request;
FStreamable* Existing = StreamableItems.FindRef(TargetName);
UE_LOG(LogStreamableManager, Verbose, TEXT("Stream Complete callback %s"), *TargetName.ToString());
if (!Existing)
{
// hmm, maybe it was redirected by a consolidate
TargetName = ResolveRedirects(TargetName);
Existing = StreamableItems.FindRef(TargetName);
}
if (Existing && Existing->bAsyncLoadRequestOutstanding)
{
Existing->bAsyncLoadRequestOutstanding = false;
if (!Existing->Target)
{
FindInMemory(TargetName, Existing);
}
CheckCompletedRequests(Request, Existing);
}
if (Existing->Target)
{
UE_LOG(LogStreamableManager, Verbose, TEXT(" Found target %s"), *Existing->Target->GetFullName());
}
else
{
// Async load failed to find the object
Existing->bLoadFailed = true;
UE_LOG(LogStreamableManager, Verbose, TEXT(" Failed async load."), *TargetName.ToString());
}
}
示例3: FStringAssetReference
void UAssetObjectProperty::ExportTextItem( FString& ValueStr, const void* PropertyValue, const void* DefaultValue, UObject* Parent, int32 PortFlags, UObject* ExportRootScope ) const
{
FAssetPtr& AssetPtr = *(FAssetPtr*)PropertyValue;
FStringAssetReference ID;
UObject *Object = AssetPtr.Get();
if (Object)
{
// Use object in case name has changed.
ID = FStringAssetReference(Object);
}
else
{
ID = AssetPtr.GetUniqueID();
}
if (!ID.ToString().IsEmpty())
{
ValueStr += ID.ToString();
}
else
{
ValueStr += TEXT("None");
}
}
示例4:
FArchive& FObjectReader::operator<<( class FAssetPtr& AssetPtr )
{
FArchive& Ar = *this;
FStringAssetReference ID;
ID.Serialize(Ar);
AssetPtr = ID;
return Ar;
}
示例5: check
struct FStreamable* FStreamableManager::StreamInternal(FStringAssetReference const& InTargetName)
{
check(IsInGameThread());
UE_LOG(LogStreamableManager, Verbose, TEXT("Asynchronous load %s"), *InTargetName.ToString());
if (FPackageName::IsShortPackageName(InTargetName.ToString()))
{
UE_LOG(LogStreamableManager, Error, TEXT(" Can't load invalid package name %s"), *InTargetName.ToString());
return NULL;
}
FStringAssetReference TargetName = ResolveRedirects(InTargetName);
FStreamable* Existing = StreamableItems.FindRef(TargetName);
if (Existing)
{
if (Existing->bAsyncUnloadRequestOutstanding)
{
// It's valid to have a live pointer if an async loaded object was hard referenced later
check(!Existing->bAsyncLoadRequestOutstanding); // we should not be both loading and unloading
UE_LOG(LogStreamableManager, Verbose, TEXT(" Aborted unload for %s"), *TargetName.ToString());
Existing->bAsyncUnloadRequestOutstanding = false;
check(Existing->Target || Existing->bLoadFailed); // should not be an unload request unless the target is valid
return Existing;
}
if (Existing->bAsyncLoadRequestOutstanding)
{
UE_LOG(LogStreamableManager, Verbose, TEXT(" Already in progress %s"), *TargetName.ToString());
check(!Existing->bAsyncUnloadRequestOutstanding); // we should not be both loading and unloading
check(!Existing->Target); // should not be an load request unless the target is invalid
return Existing; // already have one in process
}
if (Existing->Target)
{
UE_LOG(LogStreamableManager, Verbose, TEXT(" Already Loaded %s"), *TargetName.ToString());
return Existing;
}
}
else
{
Existing = StreamableItems.Add(TargetName, new FStreamable());
}
FindInMemory(TargetName, Existing);
if (!Existing->Target)
{
FString Package = TargetName.ToString();
int32 FirstDot = Package.Find(TEXT("."));
if (FirstDot != INDEX_NONE)
{
Package = Package.Left(FirstDot);
}
Existing->bAsyncLoadRequestOutstanding = true;
LoadPackageAsync(Package,
FLoadPackageAsyncDelegate::CreateStatic(&AsyncLoadCallbackWrapper, new FCallback(TargetName, this))
);
}
return Existing;
}
示例6: HandleAssetDeleted
/** Handles cleaning up an object library if it matches the passed in object */
void UGameplayCueManager::HandleAssetDeleted(UObject *Object)
{
FStringAssetReference StringRefToRemove;
UBlueprint* Blueprint = Cast<UBlueprint>(Object);
if (Blueprint && Blueprint->GeneratedClass)
{
UGameplayCueNotify_Static* StaticCDO = Cast<UGameplayCueNotify_Static>(Blueprint->GeneratedClass->ClassDefaultObject);
AGameplayCueNotify_Actor* ActorCDO = Cast<AGameplayCueNotify_Actor>(Blueprint->GeneratedClass->ClassDefaultObject);
if (StaticCDO || ActorCDO)
{
StringRefToRemove.SetPath(Blueprint->GeneratedClass->GetPathName());
}
}
if (StringRefToRemove.IsValid())
{
TArray<FStringAssetReference> StringRefs;
StringRefs.Add(StringRefToRemove);
check(GlobalCueSet);
GlobalCueSet->RemoveCuesByStringRefs(StringRefs);
OnGameplayCueNotifyAddOrRemove.Broadcast();
}
}
示例7: check
bool FStreamableManager::IsAsyncLoadComplete(FStringAssetReference const& InTargetName)
{
check(IsInGameThread());
FStringAssetReference TargetName = ResolveRedirects(InTargetName);
FStreamable* Existing = StreamableItems.FindRef(TargetName);
UE_LOG(LogStreamableManager, Verbose, TEXT("IsStreamComplete %s -> %d"), *TargetName.ToString(), !Existing || !Existing->bAsyncLoadRequestOutstanding);
return !Existing || !Existing->bAsyncLoadRequestOutstanding;
}
示例8:
FArchive& FDuplicateDataReader::operator<<( FAssetPtr& AssetPtr)
{
FArchive& Ar = *this;
FStringAssetReference ID;
ID.Serialize(Ar);
AssetPtr = ID;
return Ar;
}
示例9: PostInitProperties
void USoundBase::PostInitProperties()
{
Super::PostInitProperties();
const FStringAssetReference DefaultSoundClassName = GetDefault<UAudioSettings>()->DefaultSoundClassName;
if (DefaultSoundClassName.IsValid())
{
SoundClassObject = LoadObject<USoundClass>(NULL, *DefaultSoundClassName.ToString());
}
}
示例10: FixMapAssetRef
// Backwards compat for map strings
void FixMapAssetRef(FStringAssetReference& MapAssetReference)
{
const FString AssetRefStr = MapAssetReference.ToString();
int32 DummyIndex;
if (!AssetRefStr.IsEmpty() && !AssetRefStr.FindLastChar(TEXT('.'), DummyIndex))
{
FString MapName, MapPath;
AssetRefStr.Split(TEXT("/"), &MapPath, &MapName, ESearchCase::IgnoreCase, ESearchDir::FromEnd);
MapAssetReference.SetPath(FString::Printf(TEXT("%s/%s.%s"),*MapPath, *MapName, *MapName));
}
};
示例11: PostInitProperties
void USoundBase::PostInitProperties()
{
Super::PostInitProperties();
if (USoundBase::DefaultSoundClassObject == nullptr)
{
const FStringAssetReference DefaultSoundClassName = GetDefault<UAudioSettings>()->DefaultSoundClassName;
if (DefaultSoundClassName.IsValid())
{
USoundBase::DefaultSoundClassObject = LoadObject<USoundClass>(nullptr, *DefaultSoundClassName.ToString());
}
}
SoundClassObject = USoundBase::DefaultSoundClassObject;
if (USoundBase::DefaultSoundSubmixObject == nullptr)
{
const FStringAssetReference DefaultSoundSubmixName = GetDefault<UAudioSettings>()->DefaultSoundSubmixName;
if (DefaultSoundSubmixName.IsValid())
{
USoundBase::DefaultSoundSubmixObject = LoadObject<USoundSubmix>(nullptr, *DefaultSoundSubmixName.ToString());
}
}
SoundSubmixObject = USoundBase::DefaultSoundSubmixObject;
if (USoundBase::DefaultSoundConcurrencyObject == nullptr)
{
const FStringAssetReference DefaultSoundConcurrencyName = GetDefault<UAudioSettings>()->DefaultSoundConcurrencyName;
if (DefaultSoundConcurrencyName.IsValid())
{
USoundBase::DefaultSoundConcurrencyObject = LoadObject<USoundConcurrency>(nullptr, *DefaultSoundConcurrencyName.ToString());
}
}
SoundConcurrencySettings = USoundBase::DefaultSoundConcurrencyObject;
}
示例12: FStringAssetReference
FArchive& FLinkerSave::operator<<( FAssetPtr& AssetPtr)
{
FStringAssetReference ID;
UObject *Object = AssetPtr.Get();
if (Object)
{
// Use object in case name has changed.
ID = FStringAssetReference(Object);
}
else
{
ID = AssetPtr.GetUniqueID();
}
ID.Serialize(*this);
return *this;
}
示例13: ResolveRedirects
FStringAssetReference FStreamableManager::ResolveRedirects(FStringAssetReference const& Target) const
{
FStringAssetReference const* Redir = StreamableRedirects.Find(Target);
if (Redir)
{
check(Target != *Redir);
UE_LOG(LogStreamableManager, Verbose, TEXT("Redirected %s -> %s"), *Target.ToString(), *Redir->ToString());
return *Redir;
}
return Target;
}
示例14: check
void FPaperJsonSpriteSheetImporter::SetReimportData(const TArray<FString>& ExistingSpriteNames, const TArray< TAssetPtr<class UPaperSprite> >& ExistingSpriteAssetPtrs)
{
check(ExistingSpriteNames.Num() == ExistingSpriteAssetPtrs.Num());
if (ExistingSpriteNames.Num() == ExistingSpriteAssetPtrs.Num())
{
for (int i = 0; i < ExistingSpriteAssetPtrs.Num(); ++i)
{
const TAssetPtr<class UPaperSprite> SpriteAssetPtr = ExistingSpriteAssetPtrs[i];
FStringAssetReference SpriteStringRef = SpriteAssetPtr.ToStringReference();
if (!SpriteStringRef.ToString().IsEmpty())
{
UPaperSprite* LoadedSprite = Cast<UPaperSprite>(StaticLoadObject(UPaperSprite::StaticClass(), nullptr, *SpriteStringRef.ToString(), nullptr, LOAD_None, nullptr));
if (LoadedSprite != nullptr)
{
ExistingSprites.Add(ExistingSpriteNames[i], LoadedSprite);
}
}
}
}
bIsReimporting = true;
}
示例15: HandleAssetAdded
void UGameplayCueManager::HandleAssetAdded(UObject *Object)
{
UBlueprint* Blueprint = Cast<UBlueprint>(Object);
if (Blueprint && Blueprint->GeneratedClass)
{
UGameplayCueNotify_Static* StaticCDO = Cast<UGameplayCueNotify_Static>(Blueprint->GeneratedClass->ClassDefaultObject);
AGameplayCueNotify_Actor* ActorCDO = Cast<AGameplayCueNotify_Actor>(Blueprint->GeneratedClass->ClassDefaultObject);
if (StaticCDO || ActorCDO)
{
if (IsAssetInLoadedPaths(Object))
{
FStringAssetReference StringRef;
StringRef.SetPath(Blueprint->GeneratedClass->GetPathName());
TArray<FGameplayCueReferencePair> CuesToAdd;
if (StaticCDO)
{
CuesToAdd.Add(FGameplayCueReferencePair(StaticCDO->GameplayCueTag, StringRef));
}
else if (ActorCDO)
{
CuesToAdd.Add(FGameplayCueReferencePair(ActorCDO->GameplayCueTag, StringRef));
}
check(GlobalCueSet);
GlobalCueSet->AddCues(CuesToAdd);
OnGameplayCueNotifyAddOrRemove.Broadcast();
}
else
{
VerifyNotifyAssetIsInValidPath(Blueprint->GetOuter()->GetPathName());
}
}
}
}