Files
UnrealEngineUWP/Engine/Source/Editor/DetailCustomizations/Private/SkeletonNotifyDetails.cpp
Ben Marsh 20bf0eb6a1 Updating copyright notices to 2017 (copying from //Tasks/UE4/Dev-Copyright-2017).
#rb none
#lockdown Nick.Penwarden

[CL 3226823 by Ben Marsh in Main branch]
2016-12-08 08:52:44 -05:00

74 lines
2.3 KiB
C++

// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
#include "SkeletonNotifyDetails.h"
#include "Fonts/SlateFontInfo.h"
#include "Widgets/DeclarativeSyntaxSupport.h"
#include "Widgets/Text/STextBlock.h"
#include "Widgets/Views/STableViewBase.h"
#include "Widgets/Views/STableRow.h"
#include "Widgets/Views/SListView.h"
#include "Animation/EditorSkeletonNotifyObj.h"
#include "DetailLayoutBuilder.h"
#include "DetailWidgetRow.h"
#include "IDetailPropertyRow.h"
#include "DetailCategoryBuilder.h"
#include "IDetailsView.h"
#define LOCTEXT_NAMESPACE "SkeletonNotifyDetails"
TSharedRef<IDetailCustomization> FSkeletonNotifyDetails::MakeInstance()
{
return MakeShareable( new FSkeletonNotifyDetails );
}
void FSkeletonNotifyDetails::CustomizeDetails( IDetailLayoutBuilder& DetailBuilder )
{
IDetailCategoryBuilder& Category = DetailBuilder.EditCategory("Skeleton Notify", LOCTEXT("SkeletonNotifyCategoryName", "Skeleton Notify") );
const FSlateFontInfo DetailFontInfo = IDetailLayoutBuilder::GetDetailFont();
Category.AddProperty("Name").DisplayName( LOCTEXT("SkeletonNotifyName", "Notify Name") );
TSharedPtr<IPropertyHandle> InPropertyHandle = DetailBuilder.GetProperty("AnimationNames");
TArray< TWeakObjectPtr<UObject> > SelectedObjects = DetailBuilder.GetDetailsView().GetSelectedObjects();
UEditorSkeletonNotifyObj* EdObj = NULL;
for(int i = 0; i < SelectedObjects.Num(); ++i)
{
UObject* Obj = SelectedObjects[0].Get();
EdObj = Cast<UEditorSkeletonNotifyObj>(Obj);
if(EdObj)
{
break;
}
}
if(EdObj)
{
Category.AddCustomRow(LOCTEXT("AnimationsLabel","Animations"))
.NameContent()
[
SNew(STextBlock)
.ToolTipText(LOCTEXT("Animations_Tooltip", "List of animations that reference this notify"))
.Text( LOCTEXT("AnimationsLabel","Animations") )
.Font( DetailFontInfo )
]
.ValueContent()
[
SNew(SListView<TSharedPtr<FString>>)
.ListItemsSource(&EdObj->AnimationNames)
.OnGenerateRow(this, &FSkeletonNotifyDetails::MakeAnimationRow)
];
}
}
TSharedRef< ITableRow > FSkeletonNotifyDetails::MakeAnimationRow( TSharedPtr<FString> Item, const TSharedRef< STableViewBase >& OwnerTable )
{
return SNew(STableRow<TSharedPtr<FString>>, OwnerTable)
[
SNew(STextBlock).Text(FText::FromString(*Item.Get()))
];
}
#undef LOCTEXT_NAMESPACE