MCPcopy Create free account
hub / github.com/URLab-Sim/UnrealRoboticsLab / ReadColor

Function ReadColor

Source/URLabEditor/Private/MjEditorOpHandlers.cpp:1076–1086  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1074}
1075
1076FColor ReadColor(const TSharedPtr<FJsonObject>& Req, const FColor Default = FColor::Yellow)
1077{
1078 FVector Rgb;
1079 if (!ReadVec3(Req, TEXT("color"), Rgb, FVector(Default.R / 255.0, Default.G / 255.0, Default.B / 255.0)))
1080 return Default;
1081 return FColor(
1082 (uint8)FMath::Clamp((int32)(Rgb.X * 255.0), 0, 255),
1083 (uint8)FMath::Clamp((int32)(Rgb.Y * 255.0), 0, 255),
1084 (uint8)FMath::Clamp((int32)(Rgb.Z * 255.0), 0, 255),
1085 255);
1086}
1087
1088/** Translate wire ttl into (bPersistent, LifeTime) pair UE's DrawDebug*
1089 * helpers expect. ttl > 0: bPersistent=true, lifetime=ttl (auto-expires).

Callers 4

HandleDrawMarkerFunction · 0.85
HandleDrawLineFunction · 0.85
HandleDrawBoxFunction · 0.85
HandleDrawArrowFunction · 0.85

Calls 1

ReadVec3Function · 0.85

Tested by

no test coverage detected