Files
UnrealEngineUWP/Engine/Source/Editor/SubobjectDataInterface/Private/InheritedSubobjectData.cpp
bryan sefcik 8cc129f2b6 IWYU Pass 1 - Engine/Source/Editor/...
#jira
#preflight 6306736ac85b7fef22be7751

[CL 21558583 by bryan sefcik in ue5-main branch]
2022-08-24 22:45:13 -04:00

64 lines
1.6 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "InheritedSubobjectData.h"
#include "ComponentInstanceDataCache.h"
#include "Components/ActorComponent.h"
#include "Kismet2/ComponentEditorUtils.h"
class USCS_Node;
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(IsInheritedComponent() || (IsDefaultSceneRoot() && SceneRootHasDefaultName()) || (GetSCSNode() != nullptr && IsInstancedInheritedComponent()) || IsChildActorSubtreeObject())
{
return false;
}
return true;
}
bool FInheritedSubobjectData::IsInheritedSCSNode() const
{
return bIsInheritedSCS;
}