Crosshair is back
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -52,3 +52,4 @@ GPF-output/**
|
|||||||
__pycache__/
|
__pycache__/
|
||||||
.clangd-query/
|
.clangd-query/
|
||||||
COMMIT.txt
|
COMMIT.txt
|
||||||
|
CLAUDE.md
|
||||||
|
|||||||
Binary file not shown.
@@ -6,6 +6,8 @@
|
|||||||
#include "Layout/Geometry.h"
|
#include "Layout/Geometry.h"
|
||||||
#include "Widgets/Layout/Anchors.h"
|
#include "Widgets/Layout/Anchors.h"
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
|
#include "Engine/GameViewportClient.h"
|
||||||
|
#include "Slate/SGameLayerManager.h"
|
||||||
#include "Kismet/KismetTextLibrary.h"
|
#include "Kismet/KismetTextLibrary.h"
|
||||||
#include "UObject/UObjectIterator.h"
|
#include "UObject/UObjectIterator.h"
|
||||||
|
|
||||||
@@ -246,17 +248,32 @@ FFormatArgumentData UlxFormatDataLibrary::FormatArgumentDataTransform(const FTra
|
|||||||
|
|
||||||
FFormatArgumentData UlxFormatDataLibrary::FormatArgumentDataGeometry(const FGeometry &AutoConvertedValue, const FString &Name)
|
FFormatArgumentData UlxFormatDataLibrary::FormatArgumentDataGeometry(const FGeometry &AutoConvertedValue, const FString &Name)
|
||||||
{
|
{
|
||||||
FVector2D LocalSize = AutoConvertedValue.GetLocalSize();
|
FVector2D UL = AutoConvertedValue.GetAbsolutePosition();
|
||||||
FVector2D AbsPos = AutoConvertedValue.GetAbsolutePosition();
|
FVector2D LR = AutoConvertedValue.GetAbsolutePositionAtCoordinates(FVector2f(1.0f, 1.0f));
|
||||||
FVector2D AbsSize = AutoConvertedValue.GetAbsoluteSize();
|
if (GEngine && GEngine->GameViewport)
|
||||||
|
{
|
||||||
|
TSharedPtr<IGameLayerManager> GameLayerManager = GEngine->GameViewport->GetGameLayerManager();
|
||||||
|
if (GameLayerManager.IsValid())
|
||||||
|
{
|
||||||
|
const FGeometry ViewportGeometry = GameLayerManager->GetViewportWidgetHostGeometry();
|
||||||
|
const FVector2D ViewportLocalSize = FVector2D(ViewportGeometry.GetLocalSize());
|
||||||
|
FVector2D ViewportPixelSize;
|
||||||
|
GEngine->GameViewport->GetViewportSize(ViewportPixelSize);
|
||||||
|
if (ViewportLocalSize.X > 0.0 && ViewportLocalSize.Y > 0.0)
|
||||||
|
{
|
||||||
|
const FVector2D PixelScale = ViewportPixelSize / ViewportLocalSize;
|
||||||
|
UL = ViewportGeometry.AbsoluteToLocal(UL) * PixelScale;
|
||||||
|
LR = ViewportGeometry.AbsoluteToLocal(LR) * PixelScale;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
FFormatArgumentData Result;
|
FFormatArgumentData Result;
|
||||||
Result.ArgumentValueType = EFormatArgumentType::Text;
|
Result.ArgumentValueType = EFormatArgumentType::Text;
|
||||||
Result.ArgumentName = Name;
|
Result.ArgumentName = Name;
|
||||||
Result.ArgumentValue = FText::Format(
|
Result.ArgumentValue = FText::Format(
|
||||||
INVTEXT("Geom(Local={0}x{1} Abs={2}x{3} Pos={4},{5})"),
|
INVTEXT("UL={0},{1} LR={2},{3}"),
|
||||||
FText::AsNumber(LocalSize.X), FText::AsNumber(LocalSize.Y),
|
FText::AsNumber(UL.X), FText::AsNumber(UL.Y),
|
||||||
FText::AsNumber(AbsSize.X), FText::AsNumber(AbsSize.Y),
|
FText::AsNumber(LR.X), FText::AsNumber(LR.Y));
|
||||||
FText::AsNumber(AbsPos.X), FText::AsNumber(AbsPos.Y));
|
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -312,7 +329,7 @@ void UlxFormatDataLibrary::FormatLogMessageInternal(UObject *Context, ElxFormatL
|
|||||||
double Now = FPlatformTime::Seconds();
|
double Now = FPlatformTime::Seconds();
|
||||||
FString Key = Context->GetClass()->GetName() + TEXT("::") + InPattern;
|
FString Key = Context->GetClass()->GetName() + TEXT("::") + InPattern;
|
||||||
double &Last = LastLogTime.FindOrAdd(Key, 0.0);
|
double &Last = LastLogTime.FindOrAdd(Key, 0.0);
|
||||||
if (Now - Last < 1.0)
|
if (Now - Last < 2.0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user