本文整理汇总了C++中TWeakObjectPtr::IsValid方法的典型用法代码示例。如果您正苦于以下问题:C++ TWeakObjectPtr::IsValid方法的具体用法?C++ TWeakObjectPtr::IsValid怎么用?C++ TWeakObjectPtr::IsValid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TWeakObjectPtr
的用法示例。
在下文中一共展示了TWeakObjectPtr::IsValid方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PinName
FString UK2Node_Tunnel::CreateUniquePinName(FString InSourcePinName) const
{
if (GetClass() == UK2Node_Tunnel::StaticClass())
{
// When dealing with a tunnel node that is not a sub class (macro/collapsed graph entry and result), attempt to find the paired node and find a valid name between the two
TWeakObjectPtr<UK2Node_EditablePinBase> TunnelEntry;
TWeakObjectPtr<UK2Node_EditablePinBase> TunnelResult;
FBlueprintEditorUtils::GetEntryAndResultNodes(GetGraph(), TunnelEntry, TunnelResult);
if (TunnelEntry.IsValid() && TunnelResult.IsValid())
{
FString PinName(InSourcePinName);
int32 Index = 1;
while (TunnelEntry.Get()->FindPin(PinName) != nullptr || TunnelResult.Get()->FindPin(PinName) != nullptr)
{
++Index;
PinName = InSourcePinName + FString::FromInt(Index);
}
return PinName;
}
}
return Super::CreateUniquePinName(InSourcePinName);
}
示例2: operator
FORCEINLINE bool operator()( const TWeakObjectPtr< UObject >& Lhs, const TWeakObjectPtr< UObject >& Rhs ) const
{
const bool LhsObjectValid = Lhs.IsValid();
if ( !LhsObjectValid )
{
return true;
}
const bool RhsObjectValid = Rhs.IsValid();
if ( !RhsObjectValid )
{
return false;
}
const UStruct* const PropertyTargetType = Property->GetOwnerStruct();
const UClass* const LhsClass = Lhs->GetClass();
if ( !LhsClass->IsChildOf( PropertyTargetType ) )
{
return true;
}
const UClass* const RhsClass = Rhs->GetClass();
if ( !RhsClass->IsChildOf( PropertyTargetType ) )
{
return false;
}
typename UPropertyType::TCppType LhsValue = Property->GetPropertyValue_InContainer(Lhs.Get());
typename UPropertyType::TCppType RhsValue = Property->GetPropertyValue_InContainer(Rhs.Get());
return ComparePropertyValue( LhsValue, RhsValue );
}
示例3: DrawSnappingHelpers
void FVertexSnappingImpl::DrawSnappingHelpers(const FSceneView* View,FPrimitiveDrawInterface* PDI)
{
if( ActorVertsToDraw.IsValid() )
{
float PointSize = View->IsPerspectiveProjection() ? 4.0f : 5.0f;
DrawSnapVertices( ActorVertsToDraw.Get(), PointSize, PDI );
}
for( auto It = ActorVertsToFade.CreateIterator(); It; ++It )
{
TWeakObjectPtr<AActor> Actor = It.Key();
double FadeStart = It.Value();
if( Actor.IsValid() )
{
float PointSize = View->IsPerspectiveProjection() ? 4.0f : 5.0f;
if( FApp::GetCurrentTime()-FadeStart <= VertexSnappingConstants::FadeTime )
{
PointSize = FMath::Lerp( PointSize, 0.0f, (FApp::GetCurrentTime()-FadeStart)/VertexSnappingConstants::FadeTime );
DrawSnapVertices( Actor.Get(), PointSize, PDI );
}
}
if( !Actor.IsValid() || FApp::GetCurrentTime()-FadeStart > VertexSnappingConstants::FadeTime )
{
It.RemoveCurrent();
}
}
}
示例4: OnNavigateToObject
void FBPProfilerStat::OnNavigateToObject()
{
switch(ObjectContext.GetType())
{
case EScriptInstrumentation::Class:
{
break;
}
case EScriptInstrumentation::Instance:
{
break;
}
case EScriptInstrumentation::Event:
case EScriptInstrumentation::Function:
case EScriptInstrumentation::Branch:
case EScriptInstrumentation::Macro:
default:
{
TWeakObjectPtr<const UObject> ObjectPtr = ObjectContext.GetObjectPtr();
if (ObjectPtr.IsValid())
{
FKismetEditorUtilities::BringKismetToFocusAttentionOnObject(ObjectPtr.Get());
}
break;
}
}
}
示例5: ImportAllCulturesForTargetFromOneSky
void FOneSkyLocalizationServiceProvider::ImportAllCulturesForTargetFromOneSky(TWeakObjectPtr<ULocalizationTarget> LocalizationTarget, bool bIsTargetSet)
{
check(LocalizationTarget.IsValid());
if (!bIsTargetSet)
{
GWarn->BeginSlowTask(LOCTEXT("ImportingFromLocalizationService", "Importing Latest from Localization Service..."), true);
}
FString EngineOrGamePath = LocalizationTarget->IsMemberOfEngineTargetSet() ? "Engine" : "Game";
for (FCultureStatistics CultureStats : LocalizationTarget->Settings.SupportedCulturesStatistics)
{
ILocalizationServiceProvider& Provider = ILocalizationServiceModule::Get().GetProvider();
TSharedRef<FDownloadLocalizationTargetFile, ESPMode::ThreadSafe> DownloadTargetFileOp = ILocalizationServiceOperation::Create<FDownloadLocalizationTargetFile>();
DownloadTargetFileOp->SetInTargetGuid(LocalizationTarget->Settings.Guid);
DownloadTargetFileOp->SetInLocale(CultureStats.CultureName);
// Put the intermediary .po files in a temporary directory in Saved for now
FString Path = FPaths::ProjectSavedDir() / "Temp" / EngineOrGamePath / LocalizationTarget->Settings.Name / CultureStats.CultureName / LocalizationTarget->Settings.Name + ".po";
FPaths::MakePathRelativeTo(Path, *FPaths::ProjectDir());
DownloadTargetFileOp->SetInRelativeOutputFilePathAndName(Path);
FilesDownloadingForImportFromOneSky.Add(Path);
IPlatformFile &PlatformFile = FPlatformFileManager::Get().GetPlatformFile();
// Delete this file if it exists so we don't accidentally import old data
PlatformFile.DeleteFile(*Path);
auto OperationCompleteDelegate = FLocalizationServiceOperationComplete::CreateRaw(this, &FOneSkyLocalizationServiceProvider::ImportCultureForTargetFromOneSky_Callback, bIsTargetSet);
Provider.Execute(DownloadTargetFileOp, TArray<FLocalizationServiceTranslationIdentifier>(), ELocalizationServiceOperationConcurrency::Asynchronous, OperationCompleteDelegate);
}
}
示例6: RemoveInvalidObjects
void SDetailsView::RemoveInvalidObjects()
{
TArray< TWeakObjectPtr< UObject > > ResetArray;
bool bAllFound = true;
for(const TSharedPtr<FComplexPropertyNode>& ComplexRootNode : RootPropertyNodes)
{
FObjectPropertyNode* RootPropertyNode = ComplexRootNode->AsObjectNode();
if(RootPropertyNode)
{
for(TPropObjectIterator Itor(RootPropertyNode->ObjectIterator()); Itor; ++Itor)
{
TWeakObjectPtr<UObject> Object = *Itor;
if(Object.IsValid() && !Object->IsPendingKill())
{
ResetArray.Add(Object);
}
else
{
bAllFound = false;
}
}
}
}
if (!bAllFound)
{
SetObjectArrayPrivate(ResetArray);
}
}
示例7: RemoveActorFromStats
void FLayers::RemoveActorFromStats( const TWeakObjectPtr< ULayer >& Layer, const TWeakObjectPtr< AActor >& Actor )
{
if( !Actor.IsValid() )
{
return;
}
UClass* ActorClass = Actor->GetClass();
bool bFoundClassStats = false;
for (int StatsIndex = 0; StatsIndex < Layer->ActorStats.Num() ; StatsIndex++)
{
FLayerActorStats& Stats = Layer->ActorStats[ StatsIndex ];
if( Stats.Type == ActorClass )
{
bFoundClassStats = true;
--Stats.Total;
if( Stats.Total == 0 )
{
Layer->ActorStats.RemoveAt( StatsIndex );
}
break;
}
}
if( bFoundClassStats )
{
LayersChanged.Broadcast( ELayersAction::Modify, Layer, TEXT( "ActorStats" ) );
}
}
示例8: AddActorToStats
void FLayers::AddActorToStats( const TWeakObjectPtr< ULayer >& Layer, const TWeakObjectPtr< AActor >& Actor )
{
if( !Actor.IsValid() )
{
return;
}
UClass* ActorClass = Actor->GetClass();
bool bFoundClassStats = false;
for( auto StatsIt = Layer->ActorStats.CreateIterator(); StatsIt; ++StatsIt )
{
FLayerActorStats& Stats = *StatsIt;
if( Stats.Type == ActorClass )
{
Stats.Total++;
bFoundClassStats = true;
break;
}
}
if( !bFoundClassStats )
{
FLayerActorStats NewActorStats;
NewActorStats.Total = 1;
NewActorStats.Type = ActorClass;
Layer->ActorStats.Add( NewActorStats );
}
LayersChanged.Broadcast( ELayersAction::Modify, Layer, TEXT( "ActorStats" ) );
}
示例9: ModifyOwner
/** Called to modify the owner of the curve */
virtual void ModifyOwner()
{
if (BaseSequence.IsValid())
{
BaseSequence.Get()->Modify(true);
}
}
示例10: TrackingStopped
virtual void TrackingStopped() override
{
if (Widget.IsValid() && Widget->OnTrackingStopped.IsBound())
{
Widget->OnTrackingStopped.Execute(Widget.Get());
}
}
示例11: Tick
void FPropertyTableColumn::Tick()
{
if ( !DataSource->AsPropertyPath().IsValid() )
{
const TSharedRef< IPropertyTable > TableRef = GetTable();
const TWeakObjectPtr< UObject > Object = DataSource->AsUObject();
if ( !Object.IsValid() )
{
TableRef->RemoveColumn( SharedThis( this ) );
}
else
{
const TSharedRef< FObjectPropertyNode > Node = TableRef->GetObjectPropertyNode( Object );
EPropertyDataValidationResult Result = Node->EnsureDataIsValid();
if ( Result == EPropertyDataValidationResult::ObjectInvalid )
{
TableRef->RemoveColumn( SharedThis( this ) );
}
else if ( Result == EPropertyDataValidationResult::ArraySizeChanged )
{
TableRef->RequestRefresh();
}
}
}
}
示例12:
FVisualLogEntry::FVisualLogEntry(float InTimeStamp, FVector InLocation, const UObject* Object, TArray<TWeakObjectPtr<UObject> >* Children)
{
TimeStamp = InTimeStamp;
Location = InLocation;
const AActor* AsActor = Cast<AActor>(Object);
if (AsActor)
{
AsActor->GrabDebugSnapshot(this);
}
if (Children != NULL)
{
TWeakObjectPtr<UObject>* WeakActorPtr = Children->GetData();
for (int32 Index = 0; Index < Children->Num(); ++Index, ++WeakActorPtr)
{
if (WeakActorPtr->IsValid())
{
const AActor* ChildActor = Cast<AActor>(WeakActorPtr->Get());
if (ChildActor)
{
ChildActor->GrabDebugSnapshot(this);
}
}
}
}
}
示例13: TrackingStarted
virtual void TrackingStarted(const struct FInputEventState& InInputState, bool bIsDraggingWidget, bool bNudge) override
{
if (Widget.IsValid() && Widget->OnTrackingStarted.IsBound())
{
Widget->OnTrackingStarted.Execute(FJavascriptInputEventState(InInputState), bIsDraggingWidget, bNudge, Widget.Get());
}
}
示例14: MakeTransactional
/** Called to make curve owner transactional */
virtual void MakeTransactional() override
{
if (BaseSequence.IsValid())
{
BaseSequence.Get()->SetFlags(BaseSequence.Get()->GetFlags() | RF_Transactional);
}
}
示例15: MouseMove
virtual void MouseMove(FViewport* Viewport, int32 x, int32 y) override
{
FEditorViewportClient::MouseMove(Viewport, x, y);
if (Widget.IsValid() && Widget->OnMouseMove.IsBound())
{
Widget->OnMouseMove.Execute(x, y, Widget.Get());
}
}