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]
74 lines
2.6 KiB
C++
74 lines
2.6 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "SkeletonTreePhysicsConstraintItem.h"
|
|
#include "EditorStyleSet.h"
|
|
#include "PhysicsAssetRenderUtils.h"
|
|
|
|
#define LOCTEXT_NAMESPACE "FSkeletonTreePhysicsConstraintItem"
|
|
|
|
FSkeletonTreePhysicsConstraintItem::FSkeletonTreePhysicsConstraintItem(UPhysicsConstraintTemplate* InConstraint, int32 InConstraintIndex, const FName& InBoneName, bool bInIsConstraintOnParentBody, class UPhysicsAsset* const InPhysicsAsset, const TSharedRef<class ISkeletonTree>& InSkeletonTree)
|
|
: FSkeletonTreePhysicsItem(InPhysicsAsset, InSkeletonTree)
|
|
, Constraint(InConstraint)
|
|
, ConstraintIndex(InConstraintIndex)
|
|
, bIsConstraintOnParentBody(bInIsConstraintOnParentBody)
|
|
{
|
|
const FConstraintInstance& ConstraintInstance = Constraint->DefaultInstance;
|
|
FText Label = FText::Format(LOCTEXT("ConstraintNameFormat", "[ {0} -> {1} ] Constraint"), FText::FromName(ConstraintInstance.ConstraintBone2), FText::FromName(ConstraintInstance.ConstraintBone1));
|
|
DisplayName = *Label.ToString();
|
|
}
|
|
|
|
UObject* FSkeletonTreePhysicsConstraintItem::GetObject() const
|
|
{
|
|
return Constraint;
|
|
}
|
|
|
|
void FSkeletonTreePhysicsConstraintItem::OnToggleItemDisplayed(ECheckBoxState InCheckboxState)
|
|
{
|
|
if (FPhysicsAssetRenderSettings* RenderSettings = GetRenderSettings())
|
|
{
|
|
RenderSettings->ToggleShowConstraint(ConstraintIndex);
|
|
}
|
|
}
|
|
|
|
ECheckBoxState FSkeletonTreePhysicsConstraintItem::IsItemDisplayed() const
|
|
{
|
|
if (FPhysicsAssetRenderSettings* RenderSettings = GetRenderSettings())
|
|
{
|
|
return RenderSettings->IsConstraintHidden(ConstraintIndex) ? ECheckBoxState::Unchecked : ECheckBoxState::Checked;
|
|
}
|
|
|
|
return ECheckBoxState::Undetermined;
|
|
}
|
|
|
|
const FSlateBrush* FSkeletonTreePhysicsConstraintItem::GetBrush() const
|
|
{
|
|
return FEditorStyle::GetBrush("PhysicsAssetEditor.Tree.Constraint");
|
|
}
|
|
|
|
FSlateColor FSkeletonTreePhysicsConstraintItem::GetTextColor() const
|
|
{
|
|
const FLinearColor Color(1.0f, 1.0f, 1.0f);
|
|
const bool bInCurrentProfile = Constraint->GetCurrentConstraintProfileName() == NAME_None || Constraint->ContainsConstraintProfile(Constraint->GetCurrentConstraintProfileName());
|
|
if(bInCurrentProfile)
|
|
{
|
|
return FSlateColor(Color);
|
|
}
|
|
else
|
|
{
|
|
return FSlateColor(Color.Desaturate(0.5f));
|
|
}
|
|
}
|
|
|
|
FText FSkeletonTreePhysicsConstraintItem::GetNameColumnToolTip() const
|
|
{
|
|
if (Constraint)
|
|
{
|
|
const FConstraintInstance& ConstraintInstance = Constraint->DefaultInstance;
|
|
return FText::Format(LOCTEXT("ConstraintTooltip", "Constraint linking child body [{0}] to parent body [{1}]"), FText::FromName(ConstraintInstance.ConstraintBone1), FText::FromName(ConstraintInstance.ConstraintBone2));
|
|
}
|
|
|
|
return FText::GetEmpty();
|
|
}
|
|
|
|
#undef LOCTEXT_NAMESPACE
|