You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
The default color for curves is now a darker gray instead of White since the selection color is White. The blue channel for Z and B channels is now brighter because it was too dark on the dark background. #jira UE-149063 #rb andrew.rodham, matt.hoffman #preflight 6288345c95170b5599ffc30e [CL 20335878 by Max Chen in ue5-main branch]
92 lines
3.1 KiB
C++
92 lines
3.1 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "SCurveViewerPanel.h"
|
|
#include "Rendering/DrawElements.h"
|
|
#include "CurveDrawInfo.h"
|
|
#include "Styling/AppStyle.h"
|
|
#include "Misc/Attribute.h"
|
|
#include "CurveEditorScreenSpace.h"
|
|
#include "Views/SInteractiveCurveEditorView.h"
|
|
|
|
#define LOCTEXT_NAMESPACE "SCurveViewerPanel"
|
|
|
|
namespace CurveViewerConstants
|
|
{
|
|
static bool bAntiAliasCurves = true;
|
|
}
|
|
|
|
void SCurveViewerPanel::Construct(const FArguments& InArgs, TSharedRef<FCurveEditor> InCurveEditor)
|
|
{
|
|
WeakCurveEditor = InCurveEditor;
|
|
CurveThickness = InArgs._CurveThickness;
|
|
|
|
InCurveEditor->SetView(SharedThis(this));
|
|
|
|
for (const TPair<FCurveModelID, TUniquePtr<FCurveModel>>& CurvePair : InCurveEditor->GetCurves())
|
|
{
|
|
CurveInfoByID.Add(CurvePair.Key);
|
|
}
|
|
|
|
SetClipping(EWidgetClipping::ClipToBounds);
|
|
}
|
|
|
|
void SCurveViewerPanel::Tick(const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime)
|
|
{
|
|
CachedDrawParams.Reset();
|
|
GetCurveDrawParams(CachedDrawParams);
|
|
}
|
|
|
|
int32 SCurveViewerPanel::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyCullingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const
|
|
{
|
|
const ESlateDrawEffect DrawEffects = ShouldBeEnabled(bParentEnabled) ? ESlateDrawEffect::None : ESlateDrawEffect::DisabledEffect;
|
|
|
|
DrawCurves(AllottedGeometry, OutDrawElements, LayerId, InWidgetStyle, DrawEffects);
|
|
|
|
return LayerId + CurveViewConstants::ELayerOffset::Last;
|
|
}
|
|
|
|
void SCurveViewerPanel::DrawCurves(const FGeometry& AllottedGeometry, FSlateWindowElementList& OutDrawElements, int32 BaseLayerId, const FWidgetStyle& InWidgetStyle, ESlateDrawEffect DrawEffects) const
|
|
{
|
|
const FPaintGeometry PaintGeometry = AllottedGeometry.ToPaintGeometry();
|
|
|
|
for (const FCurveDrawParams& Params : CachedDrawParams)
|
|
{
|
|
FSlateDrawElement::MakeLines(
|
|
OutDrawElements,
|
|
BaseLayerId + CurveViewConstants::ELayerOffset::Curves,
|
|
PaintGeometry,
|
|
Params.InterpolatingPoints,
|
|
DrawEffects,
|
|
Params.Color,
|
|
CurveViewerConstants::bAntiAliasCurves,
|
|
CurveThickness.Get()
|
|
);
|
|
|
|
if (Params.bKeyDrawEnabled)
|
|
{
|
|
for (int32 PointIndex = 0; PointIndex < Params.Points.Num(); PointIndex++)
|
|
{
|
|
const FCurvePointInfo& Point = Params.Points[PointIndex];
|
|
const FKeyDrawInfo& PointDrawInfo = Params.GetKeyDrawInfo(Point.Type, PointIndex);
|
|
|
|
const int32 KeyLayerId = BaseLayerId + Point.LayerBias + CurveViewConstants::ELayerOffset::Keys;
|
|
FLinearColor PointTint = PointDrawInfo.Tint.IsSet() ? PointDrawInfo.Tint.GetValue() : Params.Color;
|
|
|
|
// Brighten and saturate the points a bit so they pop
|
|
FLinearColor HSV = PointTint.LinearRGBToHSV();
|
|
HSV.G = FMath::Clamp(HSV.G * 1.1f, 0.f, 255.f);
|
|
HSV.B = FMath::Clamp(HSV.B * 2.f, 0.f, 255.f);
|
|
PointTint = HSV.HSVToLinearRGB();
|
|
|
|
FPaintGeometry PointGeometry = AllottedGeometry.ToPaintGeometry(
|
|
Point.ScreenPosition - (PointDrawInfo.ScreenSize * 0.5f),
|
|
PointDrawInfo.ScreenSize
|
|
);
|
|
|
|
FSlateDrawElement::MakeBox(OutDrawElements, KeyLayerId, PointGeometry, PointDrawInfo.Brush, DrawEffects, PointTint );
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
#undef LOCTEXT_NAMESPACE |