// Copyright Epic Games, Inc. All Rights Reserved. #include "SDetailTableRowBase.h" #include "PropertyHandleImpl.h" const float SDetailTableRowBase::ScrollBarPadding = 16.0f; int32 SDetailTableRowBase::GetIndentLevelForBackgroundColor() const { int32 IndentLevel = 0; if (OwnerTablePtr.IsValid()) { // every item is in a category, but we don't want to show an indent for "top-level" properties IndentLevel = GetIndentLevel() - 1; } TSharedPtr DetailTreeNode = OwnerTreeNode.Pin(); if (DetailTreeNode.IsValid() && DetailTreeNode->GetDetailsView() != nullptr && DetailTreeNode->GetDetailsView()->ContainsMultipleTopLevelObjects()) { // if the row is in a multiple top level object display (eg. Project Settings), don't display an indent for the initial level --IndentLevel; } return FMath::Max(0, IndentLevel); } bool SDetailTableRowBase::IsScrollBarVisible(TWeakPtr OwnerTableViewWeak) { TSharedPtr OwnerTableView = OwnerTableViewWeak.Pin(); if (OwnerTableView.IsValid()) { return OwnerTableView->GetScrollbarVisibility() == EVisibility::Visible; } return false; } TArray> SDetailTableRowBase::GetPropertyNodes(const bool& bRecursive) const { TArray> PropertyHandles = GetPropertyHandles(bRecursive); TArray> PropertyNodes; PropertyNodes.Reserve(PropertyHandles.Num()); for (const TSharedPtr& PropertyHandle : PropertyHandles) { if (PropertyHandle->IsValidHandle()) { PropertyNodes.Add(StaticCastSharedPtr(PropertyHandle)->GetPropertyNode()); } } return PropertyNodes; } TArray> SDetailTableRowBase::GetPropertyHandles(const bool& bRecursive) const { TFunction&, TArray>&)> AppendPropertyHandles; AppendPropertyHandles = [&AppendPropertyHandles, bRecursive] (const TSharedPtr& InParent, TArray>& OutPropertyHandles) { // Parent in first call is actually parent of this row, so these are the nodes for this row TArray> ChildNodes; InParent->GetChildren(ChildNodes, true); if (ChildNodes.IsEmpty() || !bRecursive) { return false; } OutPropertyHandles.Reserve(OutPropertyHandles.Num() + ChildNodes.Num()); for (const TSharedRef& ChildNode : ChildNodes) { // @fixme: this won't return when there's multiple properties in a single row, or the row is custom TSharedPtr ChildPropertyHandle = ChildNode->CreatePropertyHandle(); if (ChildPropertyHandle.IsValid() && ChildPropertyHandle->IsValidHandle()) { OutPropertyHandles.Add(ChildPropertyHandle); } AppendPropertyHandles(ChildNode, OutPropertyHandles); } return true; }; TArray> PropertyHandles; if (const TSharedPtr OwnerTreeNodePtr = OwnerTreeNode.Pin()) { AppendPropertyHandles(OwnerTreeNodePtr, PropertyHandles); } PropertyHandles.Remove(nullptr); return PropertyHandles; }