本文整理汇总了C++中TWeakObjectPtr类的典型用法代码示例。如果您正苦于以下问题:C++ TWeakObjectPtr类的具体用法?C++ TWeakObjectPtr怎么用?C++ TWeakObjectPtr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TWeakObjectPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateActorAllViewsVisibility
void FLayers::UpdateActorAllViewsVisibility( const TWeakObjectPtr< AActor >& Actor )
{
uint64 OriginalHiddenViews = Actor->HiddenEditorViews;
for ( int32 ViewIndex = 0; ViewIndex < Editor->LevelViewportClients.Num(); ++ViewIndex )
{
// don't have this reattach, as we can do it once for all views
UpdateActorViewVisibility(Editor->LevelViewportClients[ViewIndex], Actor, false);
}
// reregister if we changed the visibility bits, as the rendering thread needs them
if (OriginalHiddenViews != Actor->HiddenEditorViews)
{
return;
}
Actor->MarkComponentsRenderStateDirty();
// redraw all viewports if the actor
for (int32 ViewIndex = 0; ViewIndex < Editor->LevelViewportClients.Num(); ViewIndex++)
{
// make sure we redraw all viewports
Editor->LevelViewportClients[ViewIndex]->Invalidate();
}
}
示例2: Generate
void FLightingBuildInfoStatsPage::Generate( TArray< TWeakObjectPtr<UObject> >& OutObjects ) const
{
if(Entries.Num())
{
for( auto It = Entries.CreateConstIterator(); It; ++It )
{
TWeakObjectPtr<ULightingBuildInfo> Entry = *It;
if(Entry.IsValid())
{
ULightingBuildInfo* NewObject = DuplicateObject<ULightingBuildInfo>(Entry.Get(), Entry->GetOuter());
NewObject->AddToRoot();
OutObjects.Add( NewObject );
}
}
}
}
示例3:
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Operations on selected actors.
//
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
TArray< TWeakObjectPtr< AActor > > FLayers::GetSelectedActors() const
{
// Unfortunately, the batch selection operation is not entirely effective
// and the result can be that the iterator becomes invalid when adding an actor to a layer
// due to unintended selection change notifications being fired.
TArray< TWeakObjectPtr< AActor > > CurrentlySelectedActors;
for( FSelectionIterator It( Editor->GetSelectedActorIterator() ); It; ++It )
{
const TWeakObjectPtr< AActor > Actor = static_cast< AActor* >( *It );
checkSlow( Actor->IsA(AActor::StaticClass()) );
CurrentlySelectedActors.Add( Actor );
}
return CurrentlySelectedActors;
}
示例4: FindIconNameForActor
FName FClassIconFinder::FindIconNameForActor( const TWeakObjectPtr<AActor>& InActor )
{
// Actor specific overrides to normal per-class icons
AActor* Actor = InActor.Get();
FName BrushName = NAME_None;
if ( Actor )
{
ABrush* Brush = Cast< ABrush >( Actor );
if ( Brush )
{
if (Brush_Add == Brush->BrushType)
{
BrushName = TEXT( "ClassIcon.BrushAdditive" );
}
else if (Brush_Subtract == Brush->BrushType)
{
BrushName = TEXT( "ClassIcon.BrushSubtractive" );
}
}
// Actor didn't specify an icon - fallback on the class icon
if ( BrushName.IsNone() )
{
BrushName = FindIconNameForClass( Actor->GetClass() );
}
}
else
{
// If the actor reference is NULL it must have been deleted
BrushName = TEXT( "ClassIcon.Deleted" );
}
return BrushName;
}
示例5: GetPlaceholderAsUObject
//------------------------------------------------------------------------------
int32 FLinkerPlaceholderBase::ResolvePlaceholderPropertyValues(UObject* NewObjectValue)
{
int32 ResolvedTotal = 0;
UObject* ThisAsUObject = GetPlaceholderAsUObject();
for (auto& ReferencingPair : ReferencingContainers)
{
TWeakObjectPtr<UObject> ContainerPtr = ReferencingPair.Key;
if (!ContainerPtr.IsValid())
{
continue;
}
UObject* Container = ContainerPtr.Get();
for (const UObjectProperty* Property : ReferencingPair.Value)
{
#if USE_DEFERRED_DEPENDENCY_CHECK_VERIFICATION_TESTS
check(Property->GetOwnerClass() == Container->GetClass());
#endif // USE_DEFERRED_DEPENDENCY_CHECK_VERIFICATION_TESTS
TArray<const UProperty*> PropertyChain;
LinkerPlaceholderObjectImpl::BuildPropertyChain(Property, PropertyChain);
const UProperty* OutermostProperty = PropertyChain.Last();
uint8* OutermostAddress = OutermostProperty->ContainerPtrToValuePtr<uint8>((uint8*)Container, /*ArrayIndex =*/0);
int32 ResolvedCount = LinkerPlaceholderObjectImpl::ResolvePlaceholderValues(PropertyChain, PropertyChain.Num() - 1, OutermostAddress, ThisAsUObject, NewObjectValue);
ResolvedTotal += ResolvedCount;
#if USE_DEFERRED_DEPENDENCY_CHECK_VERIFICATION_TESTS
// we expect that (because we have had ReferencingProperties added)
// there should be at least one reference that is resolved... if
// there were none, then a property could have changed its value
// after it was set to this
//
// NOTE: this may seem it can be resolved by properties removing
// themselves from ReferencingProperties, but certain
// properties may be the inner of a UArrayProperty (meaning
// there could be multiple references per property)... we'd
// have to inc/decrement a property ref-count to resolve that
// scenario
check(ResolvedCount > 0);
#endif // USE_DEFERRED_DEPENDENCY_CHECK_VERIFICATION_TESTS
}
}
return ResolvedTotal;
}
示例6: PurgeKilledObjects
// Purges any objects marked pending kill from the object list
void FObjectPropertyNode::PurgeKilledObjects()
{
// Purge any objects that are marked pending kill from the object list
for (int32 Index = 0; Index < Objects.Num(); )
{
TWeakObjectPtr<UObject> Object = Objects[Index];
if ( !Object.IsValid() || Object->HasAnyFlags(RF_PendingKill) )
{
Objects.RemoveAt(Index, 1);
}
else
{
++Index;
}
}
}
示例7: Validate
void UAblAbilityTaskDependencyValidator::Validate(const TWeakObjectPtr<UAblAbilityTaskValidatorContext>& Context, const TWeakObjectPtr<const UAblAbilityTask>& Task) const
{
const TArray<UAblAbilityTask*>& AllTasks = Context->GetAbility()->GetTasks();
for (const UAblAbilityTask* CurrentTask : AllTasks)
{
HasCircularDependency(Context, CurrentTask, CurrentTask);
}
}
示例8:
void UK2Node_MacroInstance::FindInContentBrowser(TWeakObjectPtr<UK2Node_MacroInstance> MacroInstance)
{
if ( MacroInstance.IsValid() )
{
UEdGraph* InstanceMacroGraph = MacroInstance.Get()->MacroGraphReference.GetGraph();
if ( InstanceMacroGraph )
{
UBlueprint* BlueprintToSync = FBlueprintEditorUtils::FindBlueprintForGraph(InstanceMacroGraph);
if ( BlueprintToSync )
{
TArray<UObject*> ObjectsToSync;
ObjectsToSync.Add( BlueprintToSync );
GEditor->SyncBrowserToObjects(ObjectsToSync);
}
}
}
}
示例9: GetNodeComment
// Called by the EditableText widget to get the current comment for the node
static FString GetNodeComment(TWeakObjectPtr<UEdGraphNode> NodeWeakPtr)
{
if (UEdGraphNode* SelectedNode = NodeWeakPtr.Get())
{
return SelectedNode->NodeComment;
}
return FString();
}
示例10: ExecuteFindMaterials
void FAssetTypeActions_Texture::ExecuteFindMaterials(TWeakObjectPtr<UTexture> Object)
{
auto Texture = Object.Get();
if ( Texture )
{
// @todo AssetTypeActions Implement FindMaterials using the asset registry.
}
}
示例11: Update
void FMovieSceneActorReferenceTrackInstance::Update(EMovieSceneUpdateData& UpdateData, const TArray<TWeakObjectPtr<UObject>>& RuntimeObjects, class IMovieScenePlayer& Player, FMovieSceneSequenceInstance& SequenceInstance )
{
// TODO: Support default values.
FGuid ActorReferenceGuid;
if( ActorReferenceTrack->Eval( UpdateData.Position, UpdateData.LastPosition, ActorReferenceGuid ) )
{
AActor* CurrentActor = nullptr;
if (GuidToActorCache.Contains(ActorReferenceGuid))
{
TWeakObjectPtr<AActor> CachedActor = *GuidToActorCache.Find(ActorReferenceGuid);
if (CachedActor.IsValid())
{
CurrentActor = CachedActor.Get();
}
}
if (CurrentActor == nullptr)
{
TArray<TWeakObjectPtr<UObject>> RuntimeObjectsForGuid;
Player.GetRuntimeObjects(SequenceInstance.AsShared(), ActorReferenceGuid, RuntimeObjectsForGuid);
if (RuntimeObjectsForGuid.Num() == 1)
{
AActor* ActorForGuid = Cast<AActor>(RuntimeObjectsForGuid[0].Get());
if (ActorForGuid != nullptr)
{
CurrentActor = ActorForGuid;
if (CurrentActor != nullptr)
{
GuidToActorCache.Add(ActorReferenceGuid, CurrentActor);
}
}
}
}
if (CurrentActor != nullptr)
{
for (auto ObjectPtr : RuntimeObjects)
{
UObject* Object = ObjectPtr.Get();
PropertyBindings->CallFunction<AActor*>(Object, &CurrentActor);
}
}
}
}
示例12: GetTireFrictionScale
float UPhysicalMaterial::GetTireFrictionScale( TWeakObjectPtr<UTireType> TireType )
{
float Scale = (TireType != NULL) ? TireType->GetFrictionScale() : 1.0f;
Scale *= TireFrictionScale;
for ( int32 i = TireFrictionScales.Num() - 1; i >= 0; --i )
{
if ( TireFrictionScales[i].TireType == TireType.Get() )
{
Scale *= TireFrictionScales[i].FrictionScale;
break;
}
}
return Scale;
}
示例13: GetObjectDisplayName
FString SObjectNameEditableTextBox::GetObjectDisplayName(TWeakObjectPtr<UObject> Object)
{
FString Result;
if(Object.IsValid())
{
UObject* ObjectPtr = Object.Get();
if (ObjectPtr->IsA(AActor::StaticClass()))
{
Result = ((AActor*)ObjectPtr)->GetActorLabel();
}
else
{
Result = ObjectPtr->GetName();
}
}
return Result;
}
示例14: Super
UExporter::UExporter(const class FPostConstructInitializeProperties& PCIP)
: Super(PCIP)
{
if ( HasAnyFlags(RF_ClassDefaultObject) )
{
TWeakObjectPtr<UExporter> DefaultExporterObj(this);
TWeakObjectPtr<UExporter>* PreviousObj = RegisteredExporters.Find(DefaultExporterObj);
if(!PreviousObj)
{
RegisteredExporters.Add(DefaultExporterObj);
}
else if(!PreviousObj->IsValid())
{
RegisteredExporters.Remove(*PreviousObj);
RegisteredExporters.Add(DefaultExporterObj);
}
}
}
示例15: EnsureLayerExists
bool FLayers::InitializeNewActorLayers( const TWeakObjectPtr< AActor >& Actor )
{
if( !IsActorValidForLayer( Actor ) )
{
return false;
}
for( auto LayerNameIt = Actor->Layers.CreateConstIterator(); LayerNameIt; ++LayerNameIt )
{
const FName LayerName = *LayerNameIt;
TWeakObjectPtr< ULayer > Layer = EnsureLayerExists( LayerName );
Layer->Modify();
AddActorToStats( Layer, Actor);
}
return Actor->Layers.Num() > 0;
}