Files
UnrealEngineUWP/Engine/Source/Editor/PhysicsAssetEditor/Private/SkeletonTreePhysicsItem.cpp
nick brett 7e1eab27e2 [UE][Feature] RBAN Better Debug Draw - 2nd attempt
- Added Debug Visualization of physics bodies and constraints for RBAN nodes in AnimBP editor
- Added checkboxes to filter debug Visualization to Phat skeleton tree
- Created a new PhysicsAssetRenderSettings class that incorporates the debug rendering and filtering settings from Phat
- Created a new PhysicsAssetRenderUtilities namespace that incorporates the debug rendering and filtering code from Phat
- Synchronize debug visualization of physics bodies and constraints between Phat and AnimBP editors

oringinaly submitted as cl-19242421 but failed on non-unity build so backed out

#rb [at]Chris.Caulfield, [at]Thomas.Sarkanen, [at]Cedric.Caillaud
#preflight 6221e57d335298c3145112d1

#ROBOMERGE-OWNER: nick.brett
#ROBOMERGE-AUTHOR: nick.brett
#ROBOMERGE-SOURCE: CL 19283727 via CL 19295417 via CL 19304854 via CL 19304870
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v926-19321884)

[CL 19347122 by nick brett in ue5-main branch]
2022-03-10 21:02:14 -05:00

75 lines
2.6 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "SkeletonTreePhysicsItem.h"
#include "Widgets/Text/STextBlock.h"
#include "Widgets/Images/SImage.h"
#include "Widgets/Input/SCheckBox.h"
#include "EditorStyleSet.h"
#include "PhysicsAssetRenderUtils.h"
#define LOCTEXT_NAMESPACE "FSkeletonTreePhysicsItem"
FSkeletonTreePhysicsItem::FSkeletonTreePhysicsItem(class UPhysicsAsset* const InPhysicsAsset, const TSharedRef<class ISkeletonTree>& InSkeletonTree)
: FSkeletonTreeItem(InSkeletonTree)
, PhysicsAssetPathNameHash(UPhysicsAssetRenderUtilities::GetPathNameHash(InPhysicsAsset))
{}
void FSkeletonTreePhysicsItem::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(GetBrush())
];
Box->AddSlot()
.AutoWidth()
.Padding(2, 0, 0, 0)
[
SNew(STextBlock)
.ColorAndOpacity(this, &FSkeletonTreePhysicsItem::GetTextColor)
.Text(FText::FromName(GetRowItemName()))
.HighlightText(FilterText)
.Font(FEditorStyle::GetFontStyle("PhysicsAssetEditor.Tree.Font"))
.ToolTipText(GetNameColumnToolTip())
];
}
TSharedRef< SWidget > FSkeletonTreePhysicsItem::GenerateWidgetForDataColumn(const FName& DataColumnName, FIsSelected InIsSelected)
{
if (DataColumnName == ISkeletonTree::DebugVisualizationOptionsName())
{
// Create a widget that displays an open/closed eye icon when the body is shown/hidden in the viewport debug draw.
return SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
.AutoWidth()
.HAlign(HAlign_Left)
[
SNew(SCheckBox)
.ToolTipText(LOCTEXT("SkeletonTreePhysicsItemVisibilityCheckBoxToolTip", "Click to toggle visibility of debug draw for this item"))
.OnCheckStateChanged(this, &FSkeletonTreePhysicsItem::OnToggleItemDisplayed)
.IsChecked(this, &FSkeletonTreePhysicsItem::IsItemDisplayed)
.CheckedHoveredImage(FEditorStyle::GetBrush("Level.VisibleIcon16x"))
.CheckedImage(FEditorStyle::GetBrush("Level.VisibleIcon16x"))
.CheckedPressedImage(FEditorStyle::GetBrush("Level.VisibleIcon16x"))
.UncheckedHoveredImage(FEditorStyle::GetBrush("Level.NotVisibleIcon16x"))
.UncheckedImage(FEditorStyle::GetBrush("Level.NotVisibleIcon16x"))
.UncheckedPressedImage(FEditorStyle::GetBrush("Level.NotVisibleIcon16x"))
];
}
return SNullWidget::NullWidget;
}
FPhysicsAssetRenderSettings* FSkeletonTreePhysicsItem::GetRenderSettings() const
{
return UPhysicsAssetRenderUtilities::GetSettings(PhysicsAssetPathNameHash);
}
#undef LOCTEXT_NAMESPACE