Files
UnrealEngineUWP/Engine/Source/Editor/SubobjectDataInterface/Private/InheritedSubobjectData.cpp
ben hoffman 26f716014e Add IsInheritedComponent override to FInheritedSubobjectData to get it to correctly return true.
#jira UE-115689
#jira UE-115692
#rb trivial
#rnx
#preflight 609eebf022cce000010a0d06

[CL 16337265 by ben hoffman in ue5-main branch]
2021-05-14 18:33:04 -04:00

68 lines
1.6 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "InheritedSubobjectData.h"
#include "Kismet2/ComponentEditorUtils.h"
FInheritedSubobjectData::FInheritedSubobjectData(UObject* ContextObject, const FSubobjectDataHandle& ParentHandle, const bool InbIsInheritedSCS)
: FSubobjectData(ContextObject, ParentHandle)
, bIsInheritedSCS(InbIsInheritedSCS)
{
}
bool FInheritedSubobjectData::IsNativeComponent() const
{
if (const UActorComponent* Template = GetComponentTemplate())
{
return Template->CreationMethod == EComponentCreationMethod::Native && GetSCSNode() == nullptr;
}
return false;
}
bool FInheritedSubobjectData::CanEdit() const
{
if(IsComponent())
{
if(IsInstancedInheritedComponent())
{
const UActorComponent* Template = GetComponentTemplate();
return (Template ? Template->IsEditableWhenInherited() : false);
}
else if (!IsNativeComponent())
{
USCS_Node* SCS_Node = GetSCSNode();
return (SCS_Node != nullptr);
}
else if (const UActorComponent* ComponentTemplate = GetComponentTemplate())
{
return FComponentEditorUtils::GetPropertyForEditableNativeComponent(ComponentTemplate) != nullptr;
}
}
return FSubobjectData::CanEdit();
}
bool FInheritedSubobjectData::CanDelete() const
{
if(IsNativeComponent() || IsInheritedSCSNode() || IsDefaultSceneRoot() || IsInstancedInheritedComponent())
{
return false;
}
return true;
}
bool FInheritedSubobjectData::IsInheritedComponent() const
{
if(GetComponentTemplate() != nullptr)
{
return true;
}
return false;
}
bool FInheritedSubobjectData::IsInheritedSCSNode() const
{
return bIsInheritedSCS;
}