本文整理汇总了C++中TWeakObjectPtr::GetTimeSeconds方法的典型用法代码示例。如果您正苦于以下问题:C++ TWeakObjectPtr::GetTimeSeconds方法的具体用法?C++ TWeakObjectPtr::GetTimeSeconds怎么用?C++ TWeakObjectPtr::GetTimeSeconds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TWeakObjectPtr
的用法示例。
在下文中一共展示了TWeakObjectPtr::GetTimeSeconds方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetEntryToWrite
FVisualLogEntry* FVisualLogger::GetEntryToWrite(const class UObject* Object, float TimeStamp, ECreateIfNeeded ShouldCreate)
{
FVisualLogEntry* CurrentEntry = nullptr;
UObject * LogOwner = FVisualLogger::FindRedirection(Object);
if (LogOwner == nullptr || (LogOwner != Object && CurrentEntryPerObject.Contains(LogOwner) == false))
{
return nullptr;
}
bool InitializeNewEntry = false;
TWeakObjectPtr<UWorld> World = GetWorld(Object);
if (CurrentEntryPerObject.Contains(LogOwner))
{
CurrentEntry = &CurrentEntryPerObject[LogOwner];
InitializeNewEntry = TimeStamp > CurrentEntry->TimeStamp && ShouldCreate == ECreateIfNeeded::Create;
if (World.IsValid())
{
World->GetTimerManager().ClearTimer(VisualLoggerCleanupTimerHandle);
for (auto& CurrentPair : CurrentEntryPerObject)
{
FVisualLogEntry* Entry = &CurrentPair.Value;
if (Entry->TimeStamp >= 0 && Entry->TimeStamp < TimeStamp)
{
for (auto* Device : OutputDevices)
{
Device->Serialize(CurrentPair.Key, ObjectToNameMap[CurrentPair.Key], ObjectToClassNameMap[CurrentPair.Key], *Entry);
}
Entry->Reset();
}
}
}
}
if (!CurrentEntry)
{
// It's first and only one usage of LogOwner as regular object to get names. We assume once that LogOwner is correct here and only here.
CurrentEntry = &CurrentEntryPerObject.Add(LogOwner);
ObjectToNameMap.Add(LogOwner, LogOwner->GetFName());
ObjectToClassNameMap.Add(LogOwner, *(LogOwner->GetClass()->GetName()));
ObjectToPointerMap.Add(LogOwner, LogOwner);
InitializeNewEntry = true;
}
if (InitializeNewEntry)
{
CurrentEntry->Reset();
CurrentEntry->TimeStamp = TimeStamp;
if (RedirectionMap.Contains(LogOwner))
{
if (ObjectToPointerMap.Contains(LogOwner) && ObjectToPointerMap[LogOwner].IsValid())
{
const class AActor* LogOwnerAsActor = Cast<class AActor>(LogOwner);
if (LogOwnerAsActor)
{
LogOwnerAsActor->GrabDebugSnapshot(CurrentEntry);
}
}
for (auto Child : RedirectionMap[LogOwner])
{
if (Child.IsValid())
{
const class AActor* ChildAsActor = Cast<class AActor>(Child.Get());
if (ChildAsActor)
{
ChildAsActor->GrabDebugSnapshot(CurrentEntry);
}
}
}
}
else
{
const class AActor* ObjectAsActor = Cast<class AActor>(Object);
if (ObjectAsActor)
{
CurrentEntry->Location = ObjectAsActor->GetActorLocation();
ObjectAsActor->GrabDebugSnapshot(CurrentEntry);
}
}
}
if (World.IsValid())
{
//set next tick timer to flush obsolete/old entries
World->GetTimerManager().SetTimer(VisualLoggerCleanupTimerHandle, FTimerDelegate::CreateLambda(
[this, World](){
for (auto& CurrentPair : CurrentEntryPerObject)
{
FVisualLogEntry* Entry = &CurrentPair.Value;
if (Entry->TimeStamp >= 0 && (!World.IsValid() || Entry->TimeStamp < World->GetTimeSeconds())) // CurrentEntry->TimeStamp == -1 means it's not initialized entry information
{
for (auto* Device : OutputDevices)
{
Device->Serialize(CurrentPair.Key, ObjectToNameMap[CurrentPair.Key], ObjectToClassNameMap[CurrentPair.Key], *Entry);
}
Entry->Reset();
}
}
//.........这里部分代码省略.........