// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. #include "PropertyEditorPrivatePCH.h" #include "DetailCustomBuilderRow.h" #include "DetailItemNode.h" #include "CustomChildBuilder.h" FDetailCustomBuilderRow::FDetailCustomBuilderRow( TSharedRef CustomBuilder ) : CustomNodeBuilder( CustomBuilder ) { } void FDetailCustomBuilderRow::Tick( float DeltaTime ) { return CustomNodeBuilder->Tick( DeltaTime ); } bool FDetailCustomBuilderRow::RequiresTick() const { return CustomNodeBuilder->RequiresTick(); } bool FDetailCustomBuilderRow::HasColumns() const { return HeaderRow->HasColumns(); } bool FDetailCustomBuilderRow::ShowOnlyChildren() const { return !HeaderRow->HasAnyContent(); } void FDetailCustomBuilderRow::OnItemNodeInitialized( TSharedRef InTreeNode, TSharedRef InParentCategory, const TAttribute& InIsParentEnabled ) { ParentCategory = InParentCategory; IsParentEnabled = InIsParentEnabled; const bool bUpdateFilteredNodes = true; // Set a delegate on the interface that it will call to rebuild this nodes children FSimpleDelegate OnRegenerateChildren = FSimpleDelegate::CreateSP( InTreeNode, &FDetailItemNode::GenerateChildren, bUpdateFilteredNodes ); CustomNodeBuilder->SetOnRebuildChildren( OnRegenerateChildren ); HeaderRow = MakeShareable( new FDetailWidgetRow ); CustomNodeBuilder->GenerateHeaderRowContent( *HeaderRow ); } FName FDetailCustomBuilderRow::GetCustomBuilderName() const { return CustomNodeBuilder->GetName(); } void FDetailCustomBuilderRow::OnGenerateChildren( FDetailNodeList& OutChildren ) { ChildrenBuilder = MakeShareable( new FCustomChildrenBuilder( ParentCategory.Pin().ToSharedRef() ) ); CustomNodeBuilder->GenerateChildContent( *ChildrenBuilder ); const TArray< FDetailLayoutCustomization >& ChildRows = ChildrenBuilder->GetChildCustomizations(); for( int32 ChildIndex = 0; ChildIndex < ChildRows.Num(); ++ChildIndex ) { TSharedRef ChildNodeItem = MakeShareable( new FDetailItemNode( ChildRows[ChildIndex], ParentCategory.Pin().ToSharedRef(), IsParentEnabled ) ); ChildNodeItem->Initialize(); OutChildren.Add( ChildNodeItem ); } } bool FDetailCustomBuilderRow::IsInitiallyCollapsed() const { return CustomNodeBuilder->InitiallyCollapsed(); } FDetailWidgetRow FDetailCustomBuilderRow::GetWidgetRow() { return *HeaderRow; }