You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#preflight 6272a74d2f6d177be3c6fdda #rb Matt.Kuhlenschmidt #ROBOMERGE-OWNER: Lauren.Barnes #ROBOMERGE-AUTHOR: lauren.barnes #ROBOMERGE-SOURCE: CL 20057269 via CL 20070159 via CL 20072035 via CL 20072203 #ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v943-19904690) #ROBOMERGE-CONFLICT from-shelf [CL 20105363 by Lauren Barnes 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 "Styling/AppStyle.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 ? FAppStyle::GetBrush("PhysicsAssetEditor.Tree.KinematicBody") : FAppStyle::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
|