Files
UnrealEngineUWP/Engine/Source/Developer/ToolWidgets/Private/SSegmentedTimelineView.cpp
lucas dower eb486822e9 Add Pose Watch support to the Rewind Debugger
* Recording an instance of an anim blueprint with the Animation Blueprint Editor debug object attached will now trace all active Pose Watches.
* Pose Watches have separate tracks with regions shown for when that pose is evaluated in the anim graph.

#rb keith.yerex
#preflight 62fcf32ae64b1a51092d9976
#jira none

[CL 21424758 by lucas dower in ue5-main branch]
2022-08-17 10:18:44 -04:00

62 lines
2.5 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "SSegmentedTimelineView.h"
#include "Rendering/DrawElements.h"
#include "SSimpleTimeSlider.h"
#define LOCTEXT_NAMESPACE "SSegmentedTimelineView"
void SSegmentedTimelineView::Construct(const SSegmentedTimelineView::FArguments& InArgs)
{
ViewRange = InArgs._ViewRange;
FillColor = InArgs._FillColor;
DesiredSize = InArgs._DesiredSize;
SegmentData = InArgs._SegmentData;
}
int32 SSegmentedTimelineView::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyCullingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const
{
int32 NewLayer = PaintBlock(AllottedGeometry, MyCullingRect, OutDrawElements, LayerId, InWidgetStyle, bParentEnabled);
return FMath::Max(NewLayer, SCompoundWidget::OnPaint(Args, AllottedGeometry, MyCullingRect, OutDrawElements, NewLayer, InWidgetStyle, ShouldBeEnabled(bParentEnabled)));
}
FVector2D SSegmentedTimelineView::ComputeDesiredSize(float) const
{
return DesiredSize.Get();
}
int32 SSegmentedTimelineView::PaintBlock(const FGeometry& AllottedGeometry, const FSlateRect& MyCullingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const
{
// convert time range to from rewind debugger times to profiler times
TRange<double> DebugTimeRange = ViewRange.Get();
FLinearColor Color = FillColor.Get();
SSimpleTimeSlider::FScrubRangeToScreen RangeToScreen(DebugTimeRange, AllottedGeometry.GetLocalSize());
FVector2D Size = AllottedGeometry.GetLocalSize();
if (TSharedPtr<FSegmentData> SegmentDataPtr = SegmentData.Get())
{
for (const TRange<double>& SegmentRange : SegmentDataPtr->Segments)
{
double LowerBound = SegmentRange.HasLowerBound() ? SegmentRange.GetLowerBoundValue() : 0;
double UpperBound = SegmentRange.HasUpperBound() ? SegmentRange.GetUpperBoundValue() : Size.X;
float BoxMin = FMath::Max(0, RangeToScreen.InputToLocalX(LowerBound));
float BoxMax = FMath::Min(Size.X, RangeToScreen.InputToLocalX(UpperBound));
FPaintGeometry BoxGeometry = AllottedGeometry.ToPaintGeometry(FVector2D(BoxMin, 1), FVector2D(BoxMax - BoxMin, Size.Y - 2), 1);
const FSlateBrush* Brush = FAppStyle::GetBrush("Sequencer.SectionArea.Background");
FSlateDrawElement::MakeBox(OutDrawElements, LayerId, BoxGeometry, Brush, ESlateDrawEffect::None, Color);
}
++LayerId;
}
return LayerId;
}
#undef LOCTEXT_NAMESPACE