本文整理汇总了C++中TInlineComponentArray类的典型用法代码示例。如果您正苦于以下问题:C++ TInlineComponentArray类的具体用法?C++ TInlineComponentArray怎么用?C++ TInlineComponentArray使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TInlineComponentArray类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FClassThumbnailScene
bool UClassThumbnailRenderer::CanVisualizeAsset(UObject* Object)
{
if (ThumbnailScene == nullptr)
{
ThumbnailScene = new FClassThumbnailScene();
}
UClass* Class = Cast<UClass>(Object);
// Only visualize actor based classes
if (Class && Class->IsChildOf(AActor::StaticClass()))
{
// Try to find any visible primitive components in the class' CDO
AActor* CDO = Class->GetDefaultObject<AActor>();
TInlineComponentArray<UActorComponent*> Components;
CDO->GetComponents(Components);
for (auto CompIt = Components.CreateConstIterator(); CompIt; ++CompIt)
{
if (ThumbnailScene->IsValidComponentForVisualization(*CompIt))
{
return true;
}
}
}
return false;
}
示例2: DestroyConstructedComponents
//* Destroys the constructed components.
void AActor::DestroyConstructedComponents()
{
// Remove all existing components
TInlineComponentArray<UActorComponent*> PreviouslyAttachedComponents;
GetComponents(PreviouslyAttachedComponents);
// We need the hierarchy to be torn down in attachment order, so do a quick sort
PreviouslyAttachedComponents.Remove(nullptr);
PreviouslyAttachedComponents.Sort([](UActorComponent& A, UActorComponent& B)
{
if (USceneComponent* BSC = Cast<USceneComponent>(&B))
{
if (BSC->AttachParent == &A)
{
return false;
}
}
return true;
});
for (UActorComponent* Component : PreviouslyAttachedComponents)
{
if (Component)
{
bool bDestroyComponent = false;
if (Component->IsCreatedByConstructionScript())
{
bDestroyComponent = true;
}
else
{
UActorComponent* OuterComponent = Component->GetTypedOuter<UActorComponent>();
while (OuterComponent)
{
if (OuterComponent->IsCreatedByConstructionScript())
{
bDestroyComponent = true;
break;
}
OuterComponent = OuterComponent->GetTypedOuter<UActorComponent>();
}
}
if (bDestroyComponent)
{
if (Component == RootComponent)
{
RootComponent = NULL;
}
Component->DestroyComponent();
// Rename component to avoid naming conflicts in the case where we rerun the SCS and name the new components the same way.
FName const NewBaseName( *(FString::Printf(TEXT("TRASH_%s"), *Component->GetClass()->GetName())) );
FName const NewObjectName = MakeUniqueObjectName(this, GetClass(), NewBaseName);
Component->Rename(*NewObjectName.ToString(), this, REN_ForceNoResetLoaders|REN_DontCreateRedirectors|REN_NonTransactional);
}
}
}
}
示例3: DrawComponentVisualizersHUD
void UUnrealEdEngine::DrawComponentVisualizersHUD(const FViewport* Viewport, const FSceneView* View, FCanvas* Canvas)
{
// Iterate over all selected actors
for (FSelectionIterator It(GetSelectedActorIterator()); It; ++It)
{
AActor* Actor = Cast<AActor>(*It);
if (Actor != NULL)
{
// Then iterate over components of that actor
TInlineComponentArray<UActorComponent*> Components;
Actor->GetComponents(Components);
for (int32 CompIdx = 0; CompIdx<Components.Num(); CompIdx++)
{
UActorComponent* Comp = Components[CompIdx];
if (Comp->IsRegistered())
{
// Try and find a visualizer
TSharedPtr<FComponentVisualizer> Visualizer = FindComponentVisualizer(Comp->GetClass());
if (Visualizer.IsValid())
{
Visualizer->DrawVisualizationHUD(Comp, Viewport, View, Canvas);
}
}
}
}
}
}
示例4: GetSequencer
USkeleton* FAnimationTrackEditor::AcquireSkeletonFromObjectGuid(const FGuid& Guid)
{
TArray<UObject*> OutObjects;
GetSequencer()->GetRuntimeObjects(GetSequencer()->GetFocusedMovieSceneInstance(), Guid, OutObjects);
USkeleton* Skeleton = NULL;
for (int32 i = 0; i < OutObjects.Num(); ++i)
{
AActor* Actor = Cast<AActor>(OutObjects[i]);
if (Actor != NULL)
{
TInlineComponentArray<USkeletalMeshComponent*> SkeletalMeshComponents;
Actor->GetComponents(SkeletalMeshComponents);
for (int32 j = 0; j <SkeletalMeshComponents.Num(); ++j)
{
USkeletalMeshComponent* SkeletalMeshComp = SkeletalMeshComponents[j];
if (SkeletalMeshComp->SkeletalMesh && SkeletalMeshComp->SkeletalMesh->Skeleton)
{
// @todo Multiple actors, multiple components
check(!Skeleton);
Skeleton = SkeletalMeshComp->SkeletalMesh->Skeleton;
}
}
}
}
return Skeleton;
}
示例5: SetActorSelectionFlags
void UUnrealEdEngine::SetActorSelectionFlags (AActor* InActor)
{
TInlineComponentArray<UActorComponent*> Components;
InActor->GetComponents(Components);
//for every component in the actor
for(int32 ComponentIndex = 0; ComponentIndex < Components.Num(); ComponentIndex++)
{
UActorComponent* Component = Components[ComponentIndex];
if (Component->IsRegistered())
{
// If we have a 'child actor' component, want to update its visible selection state
UChildActorComponent* ChildActorComponent = Cast<UChildActorComponent>(Component);
if(ChildActorComponent != NULL && ChildActorComponent->ChildActor != NULL)
{
SetActorSelectionFlags(ChildActorComponent->ChildActor);
}
UPrimitiveComponent* PrimComponent = Cast<UPrimitiveComponent>(Component);
if(PrimComponent != NULL && PrimComponent->IsRegistered())
{
PrimComponent->PushSelectionToProxy();
}
UDecalComponent* DecalComponent = Cast<UDecalComponent>(Component);
if(DecalComponent != NULL)// && DecalComponent->IsRegistered())
{
DecalComponent->PushSelectionToProxy();
}
}
}
}
示例6: FMessageLog
void AActor::CheckForErrors()
{
if ( GetClass()->HasAnyClassFlags(CLASS_Deprecated) )
{
FFormatNamedArguments Arguments;
Arguments.Add(TEXT("ActorName"), FText::FromString(GetName()));
FMessageLog("MapCheck").Warning()
->AddToken(FUObjectToken::Create(this))
->AddToken(FTextToken::Create(FText::Format(LOCTEXT( "MapCheck_Message_ActorIsObselete_Deprecated", "{ActorName} : Obsolete and must be removed! (Class is deprecated)" ), Arguments) ))
->AddToken(FMapErrorToken::Create(FMapErrors::ActorIsObselete));
return;
}
if ( GetClass()->HasAnyClassFlags(CLASS_Abstract) )
{
FFormatNamedArguments Arguments;
Arguments.Add(TEXT("ActorName"), FText::FromString(GetName()));
FMessageLog("MapCheck").Warning()
->AddToken(FUObjectToken::Create(this))
->AddToken(FTextToken::Create(FText::Format(LOCTEXT( "MapCheck_Message_ActorIsObselete_Abstract", "{ActorName} : Obsolete and must be removed! (Class is abstract)" ), Arguments) ))
->AddToken(FMapErrorToken::Create(FMapErrors::ActorIsObselete));
return;
}
UPrimitiveComponent* PrimComp = Cast<UPrimitiveComponent>(RootComponent);
if( PrimComp && (PrimComp->Mobility != EComponentMobility::Movable) && PrimComp->BodyInstance.bSimulatePhysics)
{
FFormatNamedArguments Arguments;
Arguments.Add(TEXT("ActorName"), FText::FromString(GetName()));
FMessageLog("MapCheck").Warning()
->AddToken(FUObjectToken::Create(this))
->AddToken(FTextToken::Create(FText::Format(LOCTEXT( "MapCheck_Message_StaticPhysNone", "{ActorName} : Static object with bSimulatePhysics set to true" ), Arguments) ))
->AddToken(FMapErrorToken::Create(FMapErrors::StaticPhysNone));
}
if( RootComponent && FMath::IsNearlyZero( GetRootComponent()->RelativeScale3D.X * GetRootComponent()->RelativeScale3D.Y * GetRootComponent()->RelativeScale3D.Z ) )
{
FFormatNamedArguments Arguments;
Arguments.Add(TEXT("ActorName"), FText::FromString(GetName()));
FMessageLog("MapCheck").Error()
->AddToken(FUObjectToken::Create(this))
->AddToken(FTextToken::Create(FText::Format(LOCTEXT( "MapCheck_Message_InvalidDrawscale", "{ActorName} : Invalid DrawScale/DrawScale3D" ), Arguments) ))
->AddToken(FMapErrorToken::Create(FMapErrors::InvalidDrawscale));
}
// Route error checking to components.
TInlineComponentArray<UActorComponent*> Components;
GetComponents(Components);
for ( int32 ComponentIndex = 0 ; ComponentIndex < Components.Num() ; ++ComponentIndex )
{
UActorComponent* ActorComponent = Components[ ComponentIndex ];
if (ActorComponent->IsRegistered())
{
ActorComponent->CheckForErrors();
}
}
}
示例7: RemoveViewFromActorViewVisibility
void FLayers::RemoveViewFromActorViewVisibility( FLevelEditorViewportClient* ViewportClient )
{
const int32 ViewIndex = ViewportClient->ViewIndex;
// get the bit for the view index
uint64 ViewBit = ((uint64)1 << ViewIndex);
// get all bits under that that we want to keep
uint64 KeepBits = ViewBit - 1;
// Iterate over all actors, looking for actors in the specified layers.
for( FActorIterator It(ViewportClient->GetWorld()) ; It ; ++It )
{
const TWeakObjectPtr< AActor > Actor = *It;
if( !IsActorValidForLayer( Actor ) )
{
continue;
}
// remember original bits
uint64 OriginalHiddenViews = Actor->HiddenEditorViews;
uint64 Was = Actor->HiddenEditorViews;
// slide all bits higher than ViewIndex down one since the view is being removed from Editor
uint64 LowBits = Actor->HiddenEditorViews & KeepBits;
// now slide the top bits down by ViewIndex + 1 (chopping off ViewBit)
uint64 HighBits = Actor->HiddenEditorViews >> (ViewIndex + 1);
// then slide back up by ViewIndex, which will now have erased ViewBit, as well as leaving 0 in the low bits
HighBits = HighBits << ViewIndex;
// put it all back together
Actor->HiddenEditorViews = LowBits | HighBits;
// reregister if we changed the visibility bits, as the rendering thread needs them
if (OriginalHiddenViews == Actor->HiddenEditorViews)
{
continue;
}
// Find all registered primitive components and update the scene proxy with the actors updated visibility map
TInlineComponentArray<UPrimitiveComponent*> Components;
Actor->GetComponents(Components);
for( int32 ComponentIdx = 0; ComponentIdx < Components.Num(); ++ComponentIdx )
{
UPrimitiveComponent* PrimitiveComponent = Components[ComponentIdx];
if (PrimitiveComponent->IsRegistered())
{
// Push visibility to the render thread
PrimitiveComponent->PushEditorVisibilityToProxy( Actor->HiddenEditorViews );
}
}
}
}
示例8: GetPreviewActor
void FSCSEditorViewportClient::Tick(float DeltaSeconds)
{
FEditorViewportClient::Tick(DeltaSeconds);
// Register the selection override delegate for the preview actor's components
TSharedPtr<SSCSEditor> SCSEditor = BlueprintEditorPtr.Pin()->GetSCSEditor();
AActor* PreviewActor = GetPreviewActor();
if (PreviewActor != nullptr)
{
TInlineComponentArray<UPrimitiveComponent*> PrimitiveComponents;
PreviewActor->GetComponents(PrimitiveComponents);
for (int32 CompIdx = 0; CompIdx < PrimitiveComponents.Num(); ++CompIdx)
{
UPrimitiveComponent* PrimComponent = PrimitiveComponents[CompIdx];
if (!PrimComponent->SelectionOverrideDelegate.IsBound())
{
SCSEditor->SetSelectionOverride(PrimComponent);
}
}
}
else
{
InvalidatePreview(false);
}
if ( PreviewActor != LastPreviewActor.Get() || PreviewActor == nullptr || IsRealtime() )
{
LastPreviewActor = PreviewActor;
Invalidate();
RefreshPreviewBounds();
}
// Tick the preview scene world.
if (!GIntraFrameDebuggingGameThread)
{
// Ensure that the preview actor instance is up-to-date for component editing (e.g. after compiling the Blueprint, the actor may be reinstanced outside of this class)
if(PreviewActor != BlueprintEditorPtr.Pin()->GetBlueprintObj()->SimpleConstructionScript->GetComponentEditorActorInstance())
{
BlueprintEditorPtr.Pin()->GetBlueprintObj()->SimpleConstructionScript->SetComponentEditorActorInstance(PreviewActor);
}
// Allow full tick only if preview simulation is enabled and we're not currently in an active SIE or PIE session
if(bIsSimulateEnabled && GEditor->PlayWorld == NULL && !GEditor->bIsSimulatingInEditor)
{
PreviewScene->GetWorld()->Tick(IsRealtime() ? LEVELTICK_All : LEVELTICK_TimeOnly, DeltaSeconds);
}
else
{
PreviewScene->GetWorld()->Tick(IsRealtime() ? LEVELTICK_ViewportsOnly : LEVELTICK_TimeOnly, DeltaSeconds);
}
}
}
示例9: HideActorComponents
void USceneCaptureComponent::HideActorComponents(AActor* InActor)
{
if (InActor)
{
TInlineComponentArray<UPrimitiveComponent*> PrimitiveComponents;
InActor->GetComponents(PrimitiveComponents);
for (int32 ComponentIndex = 0, NumComponents = PrimitiveComponents.Num(); ComponentIndex < NumComponents; ++ComponentIndex)
{
HiddenComponents.AddUnique(PrimitiveComponents[ComponentIndex]);
}
}
}
示例10: Invalidate
void FSCSEditorViewportClient::ProcessClick(class FSceneView& View, class HHitProxy* HitProxy, FKey Key, EInputEvent Event, uint32 HitX, uint32 HitY)
{
if(HitProxy)
{
if(HitProxy->IsA(HInstancedStaticMeshInstance::StaticGetType()))
{
HInstancedStaticMeshInstance* InstancedStaticMeshInstanceProxy = ( ( HInstancedStaticMeshInstance* )HitProxy );
TSharedPtr<ISCSEditorCustomization> Customization = BlueprintEditorPtr.Pin()->CustomizeSCSEditor(InstancedStaticMeshInstanceProxy->Component);
if(Customization.IsValid() && Customization->HandleViewportClick(AsShared(), View, HitProxy, Key, Event, HitX, HitY))
{
Invalidate();
}
}
else if(HitProxy->IsA(HActor::StaticGetType()))
{
HActor* ActorProxy = (HActor*)HitProxy;
AActor* PreviewActor = GetPreviewActor();
if(ActorProxy && ActorProxy->Actor && ActorProxy->Actor == PreviewActor && ActorProxy->PrimComponent != NULL)
{
TInlineComponentArray<USceneComponent*> SceneComponents;
ActorProxy->Actor->GetComponents(SceneComponents);
for(auto CompIt = SceneComponents.CreateConstIterator(); CompIt; ++CompIt)
{
USceneComponent* CompInstance = *CompIt;
TSharedPtr<ISCSEditorCustomization> Customization = BlueprintEditorPtr.Pin()->CustomizeSCSEditor(CompInstance);
if (Customization.IsValid() && Customization->HandleViewportClick(AsShared(), View, HitProxy, Key, Event, HitX, HitY))
{
break;
}
if (CompInstance == ActorProxy->PrimComponent)
{
const bool bIsCtrlKeyDown = Viewport->KeyState(EKeys::LeftControl) || Viewport->KeyState(EKeys::RightControl);
if (BlueprintEditorPtr.IsValid())
{
// Note: This will find and select any node associated with the component instance that's attached to the proxy (including visualizers)
BlueprintEditorPtr.Pin()->FindAndSelectSCSEditorTreeNode(CompInstance, bIsCtrlKeyDown);
}
break;
}
}
}
Invalidate();
}
// Pass to component vis manager
//GUnrealEd->ComponentVisManager.HandleProxyForComponentVis(HitProxy);
}
}
示例11: GetPropertyByNameRecurse
static UProperty *GetPropertyByName( UClass *InClass, const FName &Name )
{
if ( InClass == NULL )
return NULL;
UProperty *Property = GetPropertyByNameRecurse( InClass, Name.ToString() );
if ( Property != NULL )
{
return Property;
}
AActor *AsActor = Cast<AActor>(InClass->ClassDefaultObject);
if ( AsActor != NULL )
{
FString ComponentPropertyName = Name.ToString();
int32 SplitIndex = 0;
if ( ComponentPropertyName.FindChar( '.', SplitIndex ) )
{
//FString ComponentName = ComponentPropertyName.LeftChop(SplitIndex);
ComponentPropertyName = ComponentPropertyName.RightChop(SplitIndex+1);
TInlineComponentArray<UActorComponent*> ActorComponents;
AsActor->GetComponents(ActorComponents);
for ( auto ComponentIt = ActorComponents.CreateIterator(); ComponentIt; ++ComponentIt )
{
UActorComponent *Component = *ComponentIt;
check( Component != NULL );
/*
if ( Component->GetName() != ComponentName )
{
continue;
}
*/
Property = GetPropertyByNameRecurse( Component->GetClass(), ComponentPropertyName );
if ( Property != NULL )
{
return Property;
}
}
}
}
return NULL;
}
示例12: IsActorValidForMaterialApplication
/**
* Determines if the provided actor is capable of having a material applied to it.
*
* @param TargetActor Actor to check for the validity of material application
*
* @return true if the actor is valid for material application; false otherwise
*/
bool FActorFactoryAssetProxy::IsActorValidForMaterialApplication( AActor* TargetActor )
{
bool bIsValid = false;
//@TODO: PAPER2D: Extend this to support non mesh components (or make sprites a mesh component)
// Check if the actor has a mesh or fog volume density. If so, it can likely have
// a material applied to it. Otherwise, it cannot.
if ( TargetActor )
{
TInlineComponentArray<UMeshComponent*> MeshComponents;
TargetActor->GetComponents(MeshComponents);
bIsValid = (MeshComponents.Num() > 0);
}
return bIsValid;
}
示例13: GetSelectedComponents
void UUnrealEdEngine::SelectComponent(UActorComponent* Component, bool bInSelected, bool bNotify, bool bSelectEvenIfHidden)
{
// Don't do any work if the component's selection state matches the target selection state
const bool bComponentSelected = GetSelectedComponents()->IsSelected(Component);
if (( bComponentSelected && !bInSelected ) || ( !bComponentSelected && bInSelected ))
{
if (bInSelected)
{
UE_LOG(LogEditorSelectUtils, Verbose, TEXT("Selected Component: %s"), *Component->GetClass()->GetName());
}
else
{
UE_LOG(LogEditorSelectUtils, Verbose, TEXT("Deselected Component: %s"), *Component->GetClass()->GetName());
}
GetSelectedComponents()->Select(Component, bInSelected);
// Make sure the override delegate is bound properly
auto SceneComponent = Cast<USceneComponent>(Component);
if (SceneComponent)
{
FComponentEditorUtils::BindComponentSelectionOverride(SceneComponent, true);
}
// Update the selection visualization
AActor* ComponentOwner = Component->GetOwner();
if (ComponentOwner != nullptr)
{
TInlineComponentArray<UPrimitiveComponent*> PrimitiveComponents;
ComponentOwner->GetComponents(PrimitiveComponents);
for (int32 Idx = 0; Idx < PrimitiveComponents.Num(); ++Idx)
{
PrimitiveComponents[Idx]->PushSelectionToProxy();
}
}
if (bNotify)
{
NoteSelectionChange();
}
}
}
示例14: ProcessNewComponentArray
void UActorRecording::ProcessNewComponentArray(TInlineComponentArray<USceneComponent*>& ProspectiveComponents) const
{
// Only iterate as far as the current size of the array (it may grow inside the loop)
int32 LastIndex = ProspectiveComponents.Num();
for(int32 Index = 0; Index < LastIndex; ++Index)
{
USceneComponent* NewComponent = ProspectiveComponents[Index];
USceneComponent* Parent = ProspectiveComponents[Index]->GetAttachParent();
while (Parent)
{
TWeakObjectPtr<USceneComponent> WeakParent(Parent);
if (TrackedComponents.Contains(WeakParent) || ProspectiveComponents.Contains(Parent) || Parent->GetOwner() != NewComponent->GetOwner())
{
break;
}
else
{
ProspectiveComponents.Add(Parent);
}
Parent = Parent->GetAttachParent();
}
}
// Sort parent first, to ensure that attachments get added properly
TMap<USceneComponent*, int32> AttachmentDepths;
for (USceneComponent* Component : ProspectiveComponents)
{
AttachmentDepths.Add(Component, GetAttachmentDepth(Component));
}
ProspectiveComponents.Sort(
[&](USceneComponent& A, USceneComponent& B)
{
return *AttachmentDepths.Find(&A) < *AttachmentDepths.Find(&B);
}
);
}
示例15: DrawSnapVertices
static void DrawSnapVertices( AActor* Actor, float PointSize, FPrimitiveDrawInterface* PDI )
{
TInlineComponentArray<UActorComponent*> Components;
Actor->GetComponents(Components);
// Get the closest vertex on each component
for( int32 ComponentIndex = 0; ComponentIndex < Components.Num(); ++ComponentIndex )
{
TSharedPtr<FVertexIterator> VertexGetter = MakeVertexIterator( Cast<UPrimitiveComponent>( Components[ComponentIndex] ) );
if( VertexGetter.IsValid() )
{
FVertexIterator& VertexGetterRef = *VertexGetter;
for( ; VertexGetterRef; ++VertexGetterRef )
{
PDI->DrawPoint( VertexGetterRef.Position(), VertexSnappingConstants::VertexHelperColor, PointSize, SDPG_World );
}
}
else
{
PDI->DrawPoint( Actor->GetActorLocation(), VertexSnappingConstants::VertexHelperColor, PointSize, SDPG_World );
}
}
}