Removed hardcoded stud style checks.

This commit is contained in:
Leonardo
2021-01-26 14:58:02 -08:00
parent 486cf42fbe
commit fd087a177d
5 changed files with 15 additions and 9 deletions
+5 -5
View File
@@ -624,7 +624,7 @@ lcCommandLineOptions lcApplication::ParseCommandLineOptions()
{
if (ParseColor(Options.StudCylinderColor))
{
if (Options.StudStyle < lcStudStyle::HighContrast)
if (!lcIsHighContrast(Options.StudStyle))
{
Options.StdErr += tr("High contrast stud style is required for the '%1' option but is not enabled.\n").arg(Option);
Options.ParseOK = false;
@@ -635,7 +635,7 @@ lcCommandLineOptions lcApplication::ParseCommandLineOptions()
{
if (ParseColor(Options.PartEdgeColor))
{
if (Options.StudStyle < lcStudStyle::HighContrast)
if (!lcIsHighContrast(Options.StudStyle))
{
Options.StdErr += tr("High contrast stud style is required for the '%1' option but is not enabled.\n").arg(Option);
Options.ParseOK = false;
@@ -646,7 +646,7 @@ lcCommandLineOptions lcApplication::ParseCommandLineOptions()
{
if (ParseColor(Options.BlackEdgeColor))
{
if (Options.StudStyle < lcStudStyle::HighContrast)
if (!lcIsHighContrast(Options.StudStyle))
{
Options.StdErr += tr("High contrast stud style is required for the '%1' option but is not enabled.\n").arg(Option);
Options.ParseOK = false;
@@ -657,7 +657,7 @@ lcCommandLineOptions lcApplication::ParseCommandLineOptions()
{
if (ParseColor(Options.DarkEdgeColor))
{
if (Options.StudStyle < lcStudStyle::HighContrast)
if (!lcIsHighContrast(Options.StudStyle))
{
Options.StdErr += tr("High contrast stud style is required for the '%1' option but is not enabled.\n").arg(Option);
Options.ParseOK = false;
@@ -834,7 +834,7 @@ lcCommandLineOptions lcApplication::ParseCommandLineOptions()
}
}
if (Options.AutomateEdgeColor && Options.StudStyle > lcStudStyle::FlattenedLogo)
if (Options.AutomateEdgeColor && lcIsHighContrast(Options.StudStyle))
{
Options.StdErr += tr("Automate edge color and high contrast stud style cannot be enabled at the same time.\n");
Options.ParseOK = false;
+3 -2
View File
@@ -213,7 +213,8 @@ int lcGetBrickLinkColor(int ColorIndex)
static void lcAdjustStudStyleColors(std::vector<lcColor>& Colors, lcStudStyle StudStyle)
{
const lcPreferences& Preferences = lcGetPreferences();
if (!Preferences.mAutomateEdgeColor && StudStyle != lcStudStyle::HighContrast && StudStyle != lcStudStyle::HighContrastLogo)
if (!Preferences.mAutomateEdgeColor && !lcIsHighContrast(StudStyle))
return;
const float LDIndex = LC_SRGB_TO_LINEAR(Preferences.mPartColorValueLDIndex);
@@ -223,7 +224,7 @@ static void lcAdjustStudStyleColors(std::vector<lcColor>& Colors, lcStudStyle St
for (lcColor& Color : Colors)
{
float ValueLuminescence = lcLuminescenceFromRGBA(Color.Value);
float ValueLuminescence = lcLuminescenceFromSRGB(Color.Value);
if (Preferences.mAutomateEdgeColor)
{
+5
View File
@@ -23,6 +23,11 @@ enum class lcStudStyle
Count
};
inline bool lcIsHighContrast(lcStudStyle StudStyle)
{
return StudStyle == lcStudStyle::HighContrast || StudStyle == lcStudStyle::HighContrastLogo;
}
enum class lcZipFileType
{
Official,
+1 -1
View File
@@ -651,7 +651,7 @@ inline quint32 lcColorFromVector3(const lcVector3& Color)
return LC_RGB(Color[0] * 255, Color[1] * 255, Color[2] * 255);
}
inline float lcLuminescenceFromRGBA(lcVector4& Value)
inline float lcLuminescenceFromSRGB(lcVector4& Value)
{
float r = LC_SRGB_TO_LINEAR(Value[0]);
float g = LC_SRGB_TO_LINEAR(Value[1]);
+1 -1
View File
@@ -561,7 +561,7 @@ void lcQPreferencesDialog::on_AutomateEdgeColor_toggled()
void lcQPreferencesDialog::on_studStyleCombo_currentIndexChanged(int index)
{
ui->HighContrastButton->setEnabled(index > static_cast<int>(lcStudStyle::FlattenedLogo));
ui->HighContrastButton->setEnabled(lcIsHighContrast(static_cast<lcStudStyle>(index)));
}
void lcQPreferencesDialog::AutomateEdgeColor()