Files
UnrealEngineUWP/Engine/Source/Editor/SubobjectDataInterface/Private/InheritedSubobjectDataFactory.cpp
ben hoffman 1ef77ebb6f Fix Subobject Data Factories not creating inherited subobject data in situations where a USCS_Node was added via the SimpleConstruction Script
#jira UE-115590
#rb trivial
#rnx
#preflight 609db5abcbf9a40001cff7e1

[CL 16323283 by ben hoffman in ue5-main branch]
2021-05-13 20:44:17 -04:00

31 lines
1.0 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "InheritedSubobjectDataFactory.h"
#include "InheritedSubobjectData.h"
#include "Engine/SCS_Node.h" // #TODO_BH We need to remove this when the actual subobject refactor happens
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
if(Params.bIsInheritedSCS || Component->CreationMethod != EComponentCreationMethod::Instance)
{
return true;
}
}
else if (USCS_Node* SCS = Cast<USCS_Node>(Params.Context))
{
if (UActorComponent* Comp = SCS->ComponentTemplate)
{
return Comp->CreationMethod != EComponentCreationMethod::Instance;
}
}
return false;
}