Files
UnrealEngineUWP/Engine/Source/Editor/PhysicsAssetEditor/Private/SkeletonTreePhysicsBodyItem.cpp
Ryan Vance 7c51ff94af Merging //UE4/Dev-Main to Dev-VR (//UE4/Dev-VR)
CL 1 of 8
#rb integration

[CL 4748712 by Ryan Vance in Dev-VR branch]
2019-01-17 18:54:05 -05:00

66 lines
2.0 KiB
C++

// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
#include "SkeletonTreePhysicsBodyItem.h"
#include "Widgets/Text/STextBlock.h"
#include "Widgets/Images/SImage.h"
#include "EditorStyleSet.h"
#define LOCTEXT_NAMESPACE "FSkeletonTreePhysicsBodyItem"
void FSkeletonTreePhysicsBodyItem::GenerateWidgetForNameColumn( TSharedPtr< SHorizontalBox > Box, const TAttribute<FText>& FilterText, FIsSelected InIsSelected )
{
Box->AddSlot()
.AutoWidth()
.Padding(FMargin(0.0f, 1.0f))
[
SNew( SImage )
.ColorAndOpacity(FSlateColor::UseForeground())
.Image(this, &FSkeletonTreePhysicsBodyItem::GetBrush)
];
Box->AddSlot()
.AutoWidth()
.Padding(2, 0, 0, 0)
[
SNew(STextBlock)
.ColorAndOpacity(this, &FSkeletonTreePhysicsBodyItem::GetBodyTextColor)
.Text(FText::FromName(BoneName))
.HighlightText(FilterText)
.Font(FEditorStyle::GetFontStyle("PhysicsAssetEditor.Tree.Font"))
.ToolTipText(FText::Format(LOCTEXT("BodyTooltip", "Aggregate physics body for bone '{0}'. Bodies can consist of multiple shapes."), FText::FromName(BoneName)))
];
}
TSharedRef< SWidget > FSkeletonTreePhysicsBodyItem::GenerateWidgetForDataColumn(const FName& DataColumnName)
{
return SNullWidget::NullWidget;
}
const FSlateBrush* FSkeletonTreePhysicsBodyItem::GetBrush() const
{
return BodySetup->PhysicsType == EPhysicsType::PhysType_Kinematic ? FEditorStyle::GetBrush("PhysicsAssetEditor.Tree.KinematicBody") : FEditorStyle::GetBrush("PhysicsAssetEditor.Tree.Body");
}
FSlateColor FSkeletonTreePhysicsBodyItem::GetBodyTextColor() const
{
FLinearColor Color(1.0f, 1.0f, 1.0f);
const bool bInCurrentProfile = BodySetup->GetCurrentPhysicalAnimationProfileName() == NAME_None || BodySetup->FindPhysicalAnimationProfile(BodySetup->GetCurrentPhysicalAnimationProfileName()) != nullptr;
if (FilterResult == ESkeletonTreeFilterResult::ShownDescendant)
{
Color = FLinearColor::Gray * 0.5f;
}
if(bInCurrentProfile)
{
return FSlateColor(Color);
}
else
{
return FSlateColor(Color.Desaturate(0.5f));
}
}
#undef LOCTEXT_NAMESPACE