Files
UnrealEngineUWP/Engine/Source/Runtime/LevelSequence/Private/LevelSequenceObject.cpp
Matthew Griffin bb70b349ce Merging CL 2804086 from //UE4/Release-4.11 to Dev-Main (//UE4/Dev-Main) to isolate copyright update
#lockdown Nick.Penwarden

[CL 2819020 by Matthew Griffin in Main branch]
2016-01-07 08:17:16 -05:00

54 lines
1011 B
C++

// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
#include "LevelSequencePCH.h"
#include "LevelSequenceObject.h"
/* FSequencerPossessedObject interface
*****************************************************************************/
UObject* FLevelSequenceObject::GetObject() const
{
// get component-less object
if (ComponentName.IsEmpty())
{
return ObjectOrOwner.Get();
}
// get cached component
if ((CachedComponent.IsValid()) && (CachedComponent->GetName() == ComponentName))
{
return CachedComponent.Get();
}
CachedComponent = nullptr;
// find & cache component
UObject* Object = ObjectOrOwner.Get();
if (Object == nullptr)
{
return nullptr;
}
AActor* Owner = Cast<AActor>(Object);
if (Owner == nullptr)
{
return Object;
}
for (UActorComponent* ActorComponent : Owner->GetComponents())
{
if (ActorComponent->GetName() == ComponentName)
{
CachedComponent = ActorComponent;
return ActorComponent;
}
}
// component not found
return nullptr;
}