2021-04-23 11:01:15 -04:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
#include "InheritedSubobjectDataFactory.h"
|
|
|
|
|
#include "InheritedSubobjectData.h"
|
2021-05-13 20:44:17 -04:00
|
|
|
#include "Engine/SCS_Node.h" // #TODO_BH We need to remove this when the actual subobject refactor happens
|
2021-04-23 11:01:15 -04:00
|
|
|
|
|
|
|
|
TSharedPtr<FSubobjectData> FInheritedSubobjectDataFactory::CreateSubobjectData(const FCreateSubobjectParams& Params)
|
|
|
|
|
{
|
|
|
|
|
return TSharedPtr<FInheritedSubobjectData>(new FInheritedSubobjectData(Params.Context, Params.ParentHandle, Params.bIsInheritedSCS));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool FInheritedSubobjectDataFactory::ShouldCreateSubobjectData(const FCreateSubobjectParams& Params) const
|
|
|
|
|
{
|
|
|
|
|
if(UActorComponent* Component = Cast<UActorComponent>(Params.Context))
|
|
|
|
|
{
|
|
|
|
|
// Create an inherited subobject data
|
2021-05-13 20:44:17 -04:00
|
|
|
if(Params.bIsInheritedSCS || Component->CreationMethod != EComponentCreationMethod::Instance)
|
2021-04-23 11:01:15 -04:00
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-05-13 20:44:17 -04:00
|
|
|
else if (USCS_Node* SCS = Cast<USCS_Node>(Params.Context))
|
|
|
|
|
{
|
|
|
|
|
if (UActorComponent* Comp = SCS->ComponentTemplate)
|
|
|
|
|
{
|
|
|
|
|
return Comp->CreationMethod != EComponentCreationMethod::Instance;
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-04-23 11:01:15 -04:00
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|