Noticing a weirld behavior with ColorPicker today:
Whenever I change the color using hex value, the color changes to some other value every time I unfocus the control
poked around the code and the culprit seems to be here:
void SColorPicker::HandleHexInputTextCommitted( const FText& Text, ETextCommit::Type CommitType )
{
if ((CommitType == ETextCommit::OnEnter) || (CommitType == ETextCommit::OnUserMovedFocus))
{
SetNewTargetColorRGB(FColor::FromHex(Text.ToString()), false);
}
}
it implicitly converts FColor to FLinearColor, but the function will do gamma correction on the value passed in
// FColor->FLinearColor conversion.
FLinearColor::FLinearColor(const class FColor& C)
{
R = PowOneOver255Table[C.R];
G = PowOneOver255Table[C.G];
B = PowOneOver255Table[C.B];
A = float(C.A) * OneOver255;
}
I didn’t find a function that does the conversion without gamma correction, but following seems to work
FColor color = FColor::FromHex(Text.ToString());
FLinearColor linearColor;
linearColor.R = color.R / 255.0f;
linearColor.G = color.G / 255.0f;
linearColor.B = color.B / 255.0f;
linearColor.A = color.A / 255.0f;
SetNewTargetColorRGB(linearColor, false);
I didn’t find anything relating to this issue, has this been reported?
maybe I’ll check the 4.3 preview tomorrow and see if the issue is still there