2015-07-06 12:21:20 -04:00
|
|
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
2015-07-22 10:59:40 -04:00
|
|
|
#include "ActorAnimationPrivatePCH.h"
|
|
|
|
|
#include "ActorAnimationObject.h"
|
2015-07-06 12:21:20 -04:00
|
|
|
|
|
|
|
|
|
2015-07-06 16:54:36 -04:00
|
|
|
/* FSequencerPossessedObject interface
|
2015-07-06 12:21:20 -04:00
|
|
|
*****************************************************************************/
|
|
|
|
|
|
2015-07-22 10:59:40 -04:00
|
|
|
UObject* FActorAnimationObject::GetObject() const
|
2015-07-06 12:21:20 -04:00
|
|
|
{
|
|
|
|
|
// get component-less object
|
|
|
|
|
if (ComponentName.IsEmpty())
|
|
|
|
|
{
|
2015-07-06 16:54:36 -04:00
|
|
|
return ObjectOrOwner.Get();
|
2015-07-06 12:21:20 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// get cached component
|
2015-09-09 11:42:52 -04:00
|
|
|
if ((CachedComponent.IsValid()) && (CachedComponent->GetName() == ComponentName))
|
2015-07-06 12:21:20 -04:00
|
|
|
{
|
2015-09-09 11:42:52 -04:00
|
|
|
return CachedComponent.Get();
|
2015-07-06 12:21:20 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CachedComponent = nullptr;
|
|
|
|
|
|
|
|
|
|
// find & cache component
|
2015-07-06 16:54:36 -04:00
|
|
|
UObject* Object = ObjectOrOwner.Get();
|
2015-07-06 12:21:20 -04:00
|
|
|
|
2015-07-06 16:54:36 -04:00
|
|
|
if (Object == nullptr)
|
|
|
|
|
{
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AActor* Owner = Cast<AActor>(Object);
|
|
|
|
|
|
|
|
|
|
if (Owner == nullptr)
|
2015-07-06 12:21:20 -04:00
|
|
|
{
|
|
|
|
|
return Object;
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-06 16:54:36 -04:00
|
|
|
for (UActorComponent* ActorComponent : Owner->GetComponents())
|
2015-07-06 12:21:20 -04:00
|
|
|
{
|
|
|
|
|
if (ActorComponent->GetName() == ComponentName)
|
|
|
|
|
{
|
|
|
|
|
CachedComponent = ActorComponent;
|
|
|
|
|
|
|
|
|
|
return ActorComponent;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// component not found
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|