You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
- 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]
75 lines
2.4 KiB
C++
75 lines
2.4 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "SkeletonTreePhysicsBodyItem.h"
|
|
#include "EditorStyleSet.h"
|
|
#include "PhysicsAssetRenderUtils.h"
|
|
#include "PhysicsEngine/PhysicsAsset.h"
|
|
|
|
#define LOCTEXT_NAMESPACE "FSkeletonTreePhysicsBodyItem"
|
|
|
|
FSkeletonTreePhysicsBodyItem::FSkeletonTreePhysicsBodyItem(USkeletalBodySetup* InBodySetup, int32 InBodySetupIndex, const FName& InBoneName, bool bInHasBodySetup, bool bInHasShapes, class UPhysicsAsset* const InPhysicsAsset, const TSharedRef<class ISkeletonTree>& InSkeletonTree)
|
|
: FSkeletonTreePhysicsItem(InPhysicsAsset, InSkeletonTree)
|
|
, BodySetup(InBodySetup)
|
|
, BodySetupIndex(InBodySetupIndex)
|
|
, bHasBodySetup(bInHasBodySetup)
|
|
, bHasShapes(bInHasShapes)
|
|
{
|
|
DisplayName = InBoneName;
|
|
}
|
|
|
|
UObject* FSkeletonTreePhysicsBodyItem::GetObject() const
|
|
{
|
|
return BodySetup;
|
|
}
|
|
|
|
void FSkeletonTreePhysicsBodyItem::OnToggleItemDisplayed(ECheckBoxState InCheckboxState)
|
|
{
|
|
if (FPhysicsAssetRenderSettings* RenderSettings = GetRenderSettings())
|
|
{
|
|
RenderSettings->ToggleShowBody(BodySetupIndex);
|
|
}
|
|
}
|
|
|
|
ECheckBoxState FSkeletonTreePhysicsBodyItem::IsItemDisplayed() const
|
|
{
|
|
if (FPhysicsAssetRenderSettings* RenderSettings = GetRenderSettings())
|
|
{
|
|
return RenderSettings->IsBodyHidden(BodySetupIndex) ? ECheckBoxState::Unchecked : ECheckBoxState::Checked;
|
|
}
|
|
|
|
return ECheckBoxState::Undetermined;
|
|
}
|
|
|
|
const FSlateBrush* FSkeletonTreePhysicsBodyItem::GetBrush() const
|
|
{
|
|
return BodySetup->PhysicsType == EPhysicsType::PhysType_Kinematic ? FEditorStyle::GetBrush("PhysicsAssetEditor.Tree.KinematicBody") : FEditorStyle::GetBrush("PhysicsAssetEditor.Tree.Body");
|
|
}
|
|
|
|
FSlateColor FSkeletonTreePhysicsBodyItem::GetTextColor() 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));
|
|
}
|
|
}
|
|
|
|
FText FSkeletonTreePhysicsBodyItem::GetNameColumnToolTip() const
|
|
{
|
|
return FText::Format(LOCTEXT("BodyTooltip", "Aggregate physics body for bone '{0}'. Bodies can consist of multiple shapes."), FText::FromName(GetRowItemName()));
|
|
}
|
|
|
|
#undef LOCTEXT_NAMESPACE
|