mirror of
https://github.com/leozide/leocad
synced 2024-12-27 21:58:37 +01:00
Merge pull request #611 from trevorsandy/AUTOMATE_EDGE_COLOURS
Automate edge colours
This commit is contained in:
commit
486cf42fbe
10 changed files with 284 additions and 148 deletions
|
@ -58,8 +58,8 @@ void lcPreferences::LoadDefaults()
|
||||||
mPreviewViewSphereSize = lcGetProfileInt(LC_PROFILE_PREVIEW_VIEW_SPHERE_SIZE);
|
mPreviewViewSphereSize = lcGetProfileInt(LC_PROFILE_PREVIEW_VIEW_SPHERE_SIZE);
|
||||||
mPreviewViewSphereLocation = static_cast<lcViewSphereLocation>(lcGetProfileInt(LC_PROFILE_PREVIEW_VIEW_SPHERE_LOCATION));
|
mPreviewViewSphereLocation = static_cast<lcViewSphereLocation>(lcGetProfileInt(LC_PROFILE_PREVIEW_VIEW_SPHERE_LOCATION));
|
||||||
mDrawPreviewAxis = lcGetProfileInt(LC_PROFILE_PREVIEW_DRAW_AXES);
|
mDrawPreviewAxis = lcGetProfileInt(LC_PROFILE_PREVIEW_DRAW_AXES);
|
||||||
mStudColor = lcGetProfileInt(LC_PROFILE_STUD_COLOR);
|
mStudCylinderColor = lcGetProfileInt(LC_PROFILE_STUD_CYLINDER_COLOR);
|
||||||
mStudEdgeColor = lcGetProfileInt(LC_PROFILE_STUD_EDGE_COLOR);
|
mPartEdgeColor = lcGetProfileInt(LC_PROFILE_PART_EDGE_COLOR);
|
||||||
mBlackEdgeColor = lcGetProfileInt(LC_PROFILE_BLACK_EDGE_COLOR);
|
mBlackEdgeColor = lcGetProfileInt(LC_PROFILE_BLACK_EDGE_COLOR);
|
||||||
mDarkEdgeColor = lcGetProfileInt(LC_PROFILE_DARK_EDGE_COLOR);
|
mDarkEdgeColor = lcGetProfileInt(LC_PROFILE_DARK_EDGE_COLOR);
|
||||||
mPartEdgeContrast = lcGetProfileFloat(LC_PROFILE_PART_EDGE_CONTRAST);
|
mPartEdgeContrast = lcGetProfileFloat(LC_PROFILE_PART_EDGE_CONTRAST);
|
||||||
|
@ -110,8 +110,8 @@ void lcPreferences::SaveDefaults()
|
||||||
lcSetProfileInt(LC_PROFILE_PREVIEW_VIEW_SPHERE_SIZE, mPreviewViewSphereSize);
|
lcSetProfileInt(LC_PROFILE_PREVIEW_VIEW_SPHERE_SIZE, mPreviewViewSphereSize);
|
||||||
lcSetProfileInt(LC_PROFILE_PREVIEW_VIEW_SPHERE_LOCATION, static_cast<int>(mPreviewViewSphereLocation));
|
lcSetProfileInt(LC_PROFILE_PREVIEW_VIEW_SPHERE_LOCATION, static_cast<int>(mPreviewViewSphereLocation));
|
||||||
lcSetProfileInt(LC_PROFILE_PREVIEW_DRAW_AXES, mDrawPreviewAxis);
|
lcSetProfileInt(LC_PROFILE_PREVIEW_DRAW_AXES, mDrawPreviewAxis);
|
||||||
lcSetProfileInt(LC_PROFILE_STUD_COLOR, mStudColor);
|
lcSetProfileInt(LC_PROFILE_STUD_CYLINDER_COLOR, mStudCylinderColor);
|
||||||
lcSetProfileInt(LC_PROFILE_STUD_EDGE_COLOR, mStudEdgeColor);
|
lcSetProfileInt(LC_PROFILE_PART_EDGE_COLOR, mPartEdgeColor);
|
||||||
lcSetProfileInt(LC_PROFILE_BLACK_EDGE_COLOR, mBlackEdgeColor);
|
lcSetProfileInt(LC_PROFILE_BLACK_EDGE_COLOR, mBlackEdgeColor);
|
||||||
lcSetProfileInt(LC_PROFILE_DARK_EDGE_COLOR, mDarkEdgeColor);
|
lcSetProfileInt(LC_PROFILE_DARK_EDGE_COLOR, mDarkEdgeColor);
|
||||||
lcSetProfileFloat(LC_PROFILE_PART_EDGE_CONTRAST, mPartEdgeContrast);
|
lcSetProfileFloat(LC_PROFILE_PART_EDGE_CONTRAST, mPartEdgeContrast);
|
||||||
|
@ -366,6 +366,13 @@ lcCommandLineOptions lcApplication::ParseCommandLineOptions()
|
||||||
Options.Viewpoint = lcViewpoint::Count;
|
Options.Viewpoint = lcViewpoint::Count;
|
||||||
Options.FadeStepsColor = mPreferences.mFadeStepsColor;
|
Options.FadeStepsColor = mPreferences.mFadeStepsColor;
|
||||||
Options.HighlightColor = mPreferences.mHighlightNewPartsColor;
|
Options.HighlightColor = mPreferences.mHighlightNewPartsColor;
|
||||||
|
Options.StudCylinderColor = mPreferences.mStudCylinderColor;
|
||||||
|
Options.PartEdgeColor = mPreferences.mPartEdgeColor;
|
||||||
|
Options.BlackEdgeColor = mPreferences.mBlackEdgeColor;
|
||||||
|
Options.DarkEdgeColor = mPreferences.mDarkEdgeColor;
|
||||||
|
Options.PartEdgeContrast = mPreferences.mPartEdgeContrast;
|
||||||
|
Options.PartColorValueLDIndex = mPreferences.mPartColorValueLDIndex;
|
||||||
|
Options.AutomateEdgeColor = mPreferences.mAutomateEdgeColor;
|
||||||
|
|
||||||
QStringList Arguments = arguments();
|
QStringList Arguments = arguments();
|
||||||
|
|
||||||
|
@ -613,6 +620,76 @@ lcCommandLineOptions lcApplication::ParseCommandLineOptions()
|
||||||
Options.ParseOK = false;
|
Options.ParseOK = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (Option == QLatin1String("-scc") || Option == QLatin1String("--stud-cylinder-color"))
|
||||||
|
{
|
||||||
|
if (ParseColor(Options.StudCylinderColor))
|
||||||
|
{
|
||||||
|
if (Options.StudStyle < lcStudStyle::HighContrast)
|
||||||
|
{
|
||||||
|
Options.StdErr += tr("High contrast stud style is required for the '%1' option but is not enabled.\n").arg(Option);
|
||||||
|
Options.ParseOK = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (Option == QLatin1String("-ec") || Option == QLatin1String("--edge-color"))
|
||||||
|
{
|
||||||
|
if (ParseColor(Options.PartEdgeColor))
|
||||||
|
{
|
||||||
|
if (Options.StudStyle < lcStudStyle::HighContrast)
|
||||||
|
{
|
||||||
|
Options.StdErr += tr("High contrast stud style is required for the '%1' option but is not enabled.\n").arg(Option);
|
||||||
|
Options.ParseOK = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (Option == QLatin1String("-bec") || Option == QLatin1String("--black-edge-color"))
|
||||||
|
{
|
||||||
|
if (ParseColor(Options.BlackEdgeColor))
|
||||||
|
{
|
||||||
|
if (Options.StudStyle < lcStudStyle::HighContrast)
|
||||||
|
{
|
||||||
|
Options.StdErr += tr("High contrast stud style is required for the '%1' option but is not enabled.\n").arg(Option);
|
||||||
|
Options.ParseOK = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (Option == QLatin1String("-dec") || Option == QLatin1String("--dark-edge-color"))
|
||||||
|
{
|
||||||
|
if (ParseColor(Options.DarkEdgeColor))
|
||||||
|
{
|
||||||
|
if (Options.StudStyle < lcStudStyle::HighContrast)
|
||||||
|
{
|
||||||
|
Options.StdErr += tr("High contrast stud style is required for the '%1' option but is not enabled.\n").arg(Option);
|
||||||
|
Options.ParseOK = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (Option == QLatin1String("-aec") || Option == QLatin1String("--automate-edge-color"))
|
||||||
|
{
|
||||||
|
Options.AutomateEdgeColor = true;
|
||||||
|
}
|
||||||
|
else if (Option == QLatin1String("-cc") || Option == QLatin1String("--color-contrast"))
|
||||||
|
{
|
||||||
|
if (ParseFloat(Options.PartEdgeContrast, 0.0f, 1.0f))
|
||||||
|
{
|
||||||
|
if (!Options.AutomateEdgeColor)
|
||||||
|
{
|
||||||
|
Options.StdErr += tr("Automate edge color is required for the '%1' option but is not enabled.\n").arg(Option);
|
||||||
|
Options.ParseOK = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (Option == QLatin1String("-ldv") || Option == QLatin1String("--light-dark-value"))
|
||||||
|
{
|
||||||
|
if (ParseFloat(Options.PartColorValueLDIndex, 0.0f, 1.0f))
|
||||||
|
{
|
||||||
|
if (!Options.AutomateEdgeColor)
|
||||||
|
{
|
||||||
|
Options.StdErr += tr("Automate edge color is required for the '%1' option but is not enabled.\n").arg(Option);
|
||||||
|
Options.ParseOK = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (Option == QLatin1String("--fade-steps"))
|
else if (Option == QLatin1String("--fade-steps"))
|
||||||
Options.FadeSteps = true;
|
Options.FadeSteps = true;
|
||||||
else if (Option == QLatin1String("--no-fade-steps"))
|
else if (Option == QLatin1String("--no-fade-steps"))
|
||||||
|
@ -734,6 +811,13 @@ lcCommandLineOptions lcApplication::ParseCommandLineOptions()
|
||||||
Options.StdOut += tr(" --shading <wireframe|flat|default|full>: Select shading mode for rendering.\n");
|
Options.StdOut += tr(" --shading <wireframe|flat|default|full>: Select shading mode for rendering.\n");
|
||||||
Options.StdOut += tr(" --line-width <width>: Set the with of the edge lines.\n");
|
Options.StdOut += tr(" --line-width <width>: Set the with of the edge lines.\n");
|
||||||
Options.StdOut += tr(" --aa-samples <count>: AntiAliasing sample size (1, 2, 4, or 8).\n");
|
Options.StdOut += tr(" --aa-samples <count>: AntiAliasing sample size (1, 2, 4, or 8).\n");
|
||||||
|
Options.StdOut += tr(" -scc, --stud-cylinder-color <#AARRGGBB>: High contrast stud cylinder color.\n");
|
||||||
|
Options.StdOut += tr(" -ec, --edge-color <#AARRGGBB>: High contrast edge color.\n");
|
||||||
|
Options.StdOut += tr(" -bec, --black-edge-color <#AARRGGBB>: High contrast edge color for black parts.\n");
|
||||||
|
Options.StdOut += tr(" -dec, --dark-edge-color <#AARRGGBB>: High contrast edge color for dark color parts.\n");
|
||||||
|
Options.StdOut += tr(" -aec, --automate-edge-color: Enable automatically adjusted edge colors.\n");
|
||||||
|
Options.StdOut += tr(" -cc, --color-contrast <float>: Color contrast value between 0.0 and 1.0.\n");
|
||||||
|
Options.StdOut += tr(" -ldv, --light-dark-value <float>: Light/Dark color value between 0.0 and 1.0.\n");
|
||||||
Options.StdOut += tr(" -obj, --export-wavefront <outfile.obj>: Export the model to Wavefront OBJ format.\n");
|
Options.StdOut += tr(" -obj, --export-wavefront <outfile.obj>: Export the model to Wavefront OBJ format.\n");
|
||||||
Options.StdOut += tr(" -3ds, --export-3ds <outfile.3ds>: Export the model to 3D Studio 3DS format.\n");
|
Options.StdOut += tr(" -3ds, --export-3ds <outfile.3ds>: Export the model to 3D Studio 3DS format.\n");
|
||||||
Options.StdOut += tr(" -dae, --export-collada <outfile.dae>: Export the model to COLLADA DAE format.\n");
|
Options.StdOut += tr(" -dae, --export-collada <outfile.dae>: Export the model to COLLADA DAE format.\n");
|
||||||
|
@ -750,6 +834,12 @@ lcCommandLineOptions lcApplication::ParseCommandLineOptions()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Options.AutomateEdgeColor && Options.StudStyle > lcStudStyle::FlattenedLogo)
|
||||||
|
{
|
||||||
|
Options.StdErr += tr("Automate edge color and high contrast stud style cannot be enabled at the same time.\n");
|
||||||
|
Options.ParseOK = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!Options.CameraName.isEmpty())
|
if (!Options.CameraName.isEmpty())
|
||||||
{
|
{
|
||||||
if (Options.Viewpoint != lcViewpoint::Count)
|
if (Options.Viewpoint != lcViewpoint::Count)
|
||||||
|
@ -849,6 +939,14 @@ lcStartupMode lcApplication::Initialize(const QList<QPair<QString, bool>>& Libra
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mPreferences.mStudCylinderColor = Options.StudCylinderColor;
|
||||||
|
mPreferences.mPartEdgeColor = Options.PartEdgeColor;
|
||||||
|
mPreferences.mBlackEdgeColor = Options.BlackEdgeColor;
|
||||||
|
mPreferences.mDarkEdgeColor = Options.DarkEdgeColor;
|
||||||
|
mPreferences.mPartEdgeContrast = Options.PartEdgeContrast;
|
||||||
|
mPreferences.mPartColorValueLDIndex = Options.PartColorValueLDIndex;
|
||||||
|
mPreferences.mAutomateEdgeColor = Options.AutomateEdgeColor;
|
||||||
|
|
||||||
lcGetPiecesLibrary()->SetStudStyle(Options.StudStyle, false);
|
lcGetPiecesLibrary()->SetStudStyle(Options.StudStyle, false);
|
||||||
|
|
||||||
if (!SaveAndExit)
|
if (!SaveAndExit)
|
||||||
|
@ -1161,8 +1259,8 @@ void lcApplication::ShowPreferencesDialog()
|
||||||
bool AAChanged = CurrentAASamples != Options.AASamples;
|
bool AAChanged = CurrentAASamples != Options.AASamples;
|
||||||
bool StudStyleChanged = CurrentStudStyle != Options.StudStyle;
|
bool StudStyleChanged = CurrentStudStyle != Options.StudStyle;
|
||||||
bool AutomateEdgeColorChanged = Options.Preferences.mAutomateEdgeColor != mPreferences.mAutomateEdgeColor;
|
bool AutomateEdgeColorChanged = Options.Preferences.mAutomateEdgeColor != mPreferences.mAutomateEdgeColor;
|
||||||
AutomateEdgeColorChanged |= Options.Preferences.mStudColor != mPreferences.mStudColor;
|
AutomateEdgeColorChanged |= Options.Preferences.mStudCylinderColor != mPreferences.mStudCylinderColor;
|
||||||
AutomateEdgeColorChanged |= Options.Preferences.mStudEdgeColor != mPreferences.mStudEdgeColor;
|
AutomateEdgeColorChanged |= Options.Preferences.mPartEdgeColor != mPreferences.mPartEdgeColor;
|
||||||
AutomateEdgeColorChanged |= Options.Preferences.mBlackEdgeColor != mPreferences.mBlackEdgeColor;
|
AutomateEdgeColorChanged |= Options.Preferences.mBlackEdgeColor != mPreferences.mBlackEdgeColor;
|
||||||
AutomateEdgeColorChanged |= Options.Preferences.mDarkEdgeColor != mPreferences.mDarkEdgeColor;
|
AutomateEdgeColorChanged |= Options.Preferences.mDarkEdgeColor != mPreferences.mDarkEdgeColor;
|
||||||
AutomateEdgeColorChanged |= Options.Preferences.mPartEdgeContrast != mPreferences.mPartEdgeContrast;
|
AutomateEdgeColorChanged |= Options.Preferences.mPartEdgeContrast != mPreferences.mPartEdgeContrast;
|
||||||
|
|
|
@ -73,8 +73,8 @@ public:
|
||||||
lcViewSphereLocation mPreviewViewSphereLocation;
|
lcViewSphereLocation mPreviewViewSphereLocation;
|
||||||
int mDrawPreviewAxis;
|
int mDrawPreviewAxis;
|
||||||
|
|
||||||
quint32 mStudColor;
|
quint32 mStudCylinderColor;
|
||||||
quint32 mStudEdgeColor;
|
quint32 mPartEdgeColor;
|
||||||
quint32 mBlackEdgeColor;
|
quint32 mBlackEdgeColor;
|
||||||
quint32 mDarkEdgeColor;
|
quint32 mDarkEdgeColor;
|
||||||
float mPartEdgeContrast;
|
float mPartEdgeContrast;
|
||||||
|
@ -100,6 +100,7 @@ struct lcCommandLineOptions
|
||||||
bool SetHighlightColor;
|
bool SetHighlightColor;
|
||||||
bool FadeSteps;
|
bool FadeSteps;
|
||||||
bool ImageHighlight;
|
bool ImageHighlight;
|
||||||
|
bool AutomateEdgeColor;
|
||||||
int ImageWidth;
|
int ImageWidth;
|
||||||
int ImageHeight;
|
int ImageHeight;
|
||||||
int AASamples;
|
int AASamples;
|
||||||
|
@ -109,8 +110,14 @@ struct lcCommandLineOptions
|
||||||
lcVector3 CameraPosition[3];
|
lcVector3 CameraPosition[3];
|
||||||
lcVector2 CameraLatLon;
|
lcVector2 CameraLatLon;
|
||||||
float FoV;
|
float FoV;
|
||||||
|
float PartEdgeContrast;
|
||||||
|
float PartColorValueLDIndex;
|
||||||
lcVector2 ZPlanes;
|
lcVector2 ZPlanes;
|
||||||
lcViewpoint Viewpoint;
|
lcViewpoint Viewpoint;
|
||||||
|
quint32 StudCylinderColor;
|
||||||
|
quint32 PartEdgeColor;
|
||||||
|
quint32 BlackEdgeColor;
|
||||||
|
quint32 DarkEdgeColor;
|
||||||
quint32 FadeStepsColor;
|
quint32 FadeStepsColor;
|
||||||
quint32 HighlightColor;
|
quint32 HighlightColor;
|
||||||
QString ImageName;
|
QString ImageName;
|
||||||
|
|
|
@ -213,21 +213,21 @@ int lcGetBrickLinkColor(int ColorIndex)
|
||||||
static void lcAdjustStudStyleColors(std::vector<lcColor>& Colors, lcStudStyle StudStyle)
|
static void lcAdjustStudStyleColors(std::vector<lcColor>& Colors, lcStudStyle StudStyle)
|
||||||
{
|
{
|
||||||
const lcPreferences& Preferences = lcGetPreferences();
|
const lcPreferences& Preferences = lcGetPreferences();
|
||||||
|
if (!Preferences.mAutomateEdgeColor && StudStyle != lcStudStyle::HighContrast && StudStyle != lcStudStyle::HighContrastLogo)
|
||||||
|
return;
|
||||||
|
|
||||||
const float LDIndex = LC_SRGB_TO_LINEAR(Preferences.mPartColorValueLDIndex);
|
const float LDIndex = LC_SRGB_TO_LINEAR(Preferences.mPartColorValueLDIndex);
|
||||||
|
const lcVector4 Edge = lcVector4FromColor(Preferences.mPartEdgeColor);
|
||||||
|
const lcVector4 DarkEdge = lcVector4FromColor(Preferences.mDarkEdgeColor);
|
||||||
|
const lcVector4 BlackEdge = lcVector4FromColor(Preferences.mBlackEdgeColor);
|
||||||
|
|
||||||
if (Preferences.mAutomateEdgeColor)
|
for (lcColor& Color : Colors)
|
||||||
{
|
{
|
||||||
for (lcColor& Color : Colors)
|
float ValueLuminescence = lcLuminescenceFromRGBA(Color.Value);
|
||||||
|
|
||||||
|
if (Preferences.mAutomateEdgeColor)
|
||||||
{
|
{
|
||||||
if (Color.Code == 4242)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
float EdgeLuminescence = 0.0f;
|
float EdgeLuminescence = 0.0f;
|
||||||
float r = LC_SRGB_TO_LINEAR(Color.Value[0]);
|
|
||||||
float g = LC_SRGB_TO_LINEAR(Color.Value[1]);
|
|
||||||
float b = LC_SRGB_TO_LINEAR(Color.Value[2]);
|
|
||||||
|
|
||||||
float ValueLuminescence = 0.2126f * r + 0.7152f * g + 0.0722f * b;
|
|
||||||
|
|
||||||
if (ValueLuminescence > LDIndex)
|
if (ValueLuminescence > LDIndex)
|
||||||
EdgeLuminescence = ValueLuminescence - (ValueLuminescence * Preferences.mPartEdgeContrast);
|
EdgeLuminescence = ValueLuminescence - (ValueLuminescence * Preferences.mPartEdgeContrast);
|
||||||
|
@ -238,26 +238,17 @@ static void lcAdjustStudStyleColors(std::vector<lcColor>& Colors, lcStudStyle St
|
||||||
|
|
||||||
Color.Edge = lcVector4(EdgeLuminescence, EdgeLuminescence, EdgeLuminescence, 1.0f);
|
Color.Edge = lcVector4(EdgeLuminescence, EdgeLuminescence, EdgeLuminescence, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (StudStyle != lcStudStyle::HighContrast && StudStyle != lcStudStyle::HighContrastLogo)
|
|
||||||
return;
|
|
||||||
|
|
||||||
const lcVector4 Edge = lcVector4FromColor(Preferences.mStudEdgeColor);
|
|
||||||
const lcVector4 DarkEdge = lcVector4FromColor(Preferences.mDarkEdgeColor);
|
|
||||||
const lcVector4 BlackEdge = lcVector4FromColor(Preferences.mBlackEdgeColor);
|
|
||||||
|
|
||||||
for (lcColor& Color : Colors)
|
|
||||||
{
|
|
||||||
const lcVector4 FillColor = Color.Value * 255.0f;
|
|
||||||
if (30.0f * FillColor[0] + 59.0f * FillColor[1] + 11.0f * FillColor[2] <= 3600.0f)
|
|
||||||
Color.Edge = DarkEdge;
|
|
||||||
else if (Color.Code == 0)
|
|
||||||
Color.Edge = BlackEdge;
|
|
||||||
else
|
else
|
||||||
Color.Edge = Edge;
|
{
|
||||||
|
if (Color.Code == 4242)
|
||||||
|
continue;
|
||||||
|
else if (Color.Code == 0)
|
||||||
|
Color.Edge = BlackEdge;
|
||||||
|
else if (ValueLuminescence < LDIndex)
|
||||||
|
Color.Edge = DarkEdge;
|
||||||
|
else
|
||||||
|
Color.Edge = Edge;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -355,7 +346,7 @@ static std::vector<lcColor> lcParseColorFile(lcFile& File)
|
||||||
Color.Group = LC_COLORGROUP_SPECIAL;
|
Color.Group = LC_COLORGROUP_SPECIAL;
|
||||||
}
|
}
|
||||||
else if (!strcmp(Token, "CHROME") || !strcmp(Token, "PEARLESCENT") || !strcmp(Token, "RUBBER") ||
|
else if (!strcmp(Token, "CHROME") || !strcmp(Token, "PEARLESCENT") || !strcmp(Token, "RUBBER") ||
|
||||||
!strcmp(Token, "MATTE_METALIC") || !strcmp(Token, "METAL") || !strcmp(Token, "LUMINANCE"))
|
!strcmp(Token, "MATTE_METALIC") || !strcmp(Token, "METAL") || !strcmp(Token, "LUMINANCE"))
|
||||||
{
|
{
|
||||||
Color.Group = LC_COLORGROUP_SPECIAL;
|
Color.Group = LC_COLORGROUP_SPECIAL;
|
||||||
}
|
}
|
||||||
|
@ -468,17 +459,17 @@ bool lcLoadColorFile(lcFile& File, lcStudStyle StudStyle)
|
||||||
if (!FoundStud)
|
if (!FoundStud)
|
||||||
{
|
{
|
||||||
const lcPreferences& Preferences = lcGetPreferences();
|
const lcPreferences& Preferences = lcGetPreferences();
|
||||||
lcColor StudColor;
|
lcColor StudCylinderColor;
|
||||||
|
|
||||||
StudColor.Code = 4242;
|
StudCylinderColor.Code = 4242;
|
||||||
StudColor.Translucent = false;
|
StudCylinderColor.Translucent = false;
|
||||||
StudColor.Group = LC_NUM_COLORGROUPS;
|
StudCylinderColor.Group = LC_NUM_COLORGROUPS;
|
||||||
StudColor.Value = lcVector4FromColor(Preferences.mStudColor);
|
StudCylinderColor.Value = lcVector4FromColor(Preferences.mStudCylinderColor);
|
||||||
StudColor.Edge = lcVector4FromColor(Preferences.mStudEdgeColor);
|
StudCylinderColor.Edge = lcVector4FromColor(Preferences.mPartEdgeColor);
|
||||||
strcpy(StudColor.Name, "Stud Style Black");
|
strcpy(StudCylinderColor.Name, "Stud Cylinder Color");
|
||||||
strcpy(StudColor.SafeName, "Stud_Style_Black");
|
strcpy(StudCylinderColor.SafeName, "Stud_Cylinder_Color");
|
||||||
|
|
||||||
Colors.push_back(StudColor);
|
Colors.push_back(StudCylinderColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (lcColor& Color : gColorList)
|
for (lcColor& Color : gColorList)
|
||||||
|
|
|
@ -4,41 +4,46 @@
|
||||||
lcAutomateEdgeColorDialog::lcAutomateEdgeColorDialog(QWidget* Parent, bool ShowHighContrastDialog)
|
lcAutomateEdgeColorDialog::lcAutomateEdgeColorDialog(QWidget* Parent, bool ShowHighContrastDialog)
|
||||||
:QDialog(Parent)
|
:QDialog(Parent)
|
||||||
{
|
{
|
||||||
mStudColor = lcGetPreferences().mStudColor;
|
const lcPreferences& Preferences = lcGetPreferences();
|
||||||
mStudEdgeColor = lcGetPreferences().mStudEdgeColor;
|
mStudCylinderColor = Preferences.mStudCylinderColor;
|
||||||
mBlackEdgeColor = lcGetPreferences().mBlackEdgeColor;
|
mPartEdgeColor = Preferences.mPartEdgeColor;
|
||||||
mDarkEdgeColor = lcGetPreferences().mDarkEdgeColor;
|
mBlackEdgeColor = Preferences.mBlackEdgeColor;
|
||||||
|
mDarkEdgeColor = Preferences.mDarkEdgeColor;
|
||||||
mPartEdgeContrast = lcGetPreferences().mPartEdgeContrast;
|
mPartEdgeContrast = Preferences.mPartEdgeContrast;
|
||||||
mPartColorValueLDIndex = lcGetPreferences().mPartColorValueLDIndex;
|
mPartColorValueLDIndex = Preferences.mPartColorValueLDIndex;
|
||||||
|
|
||||||
setWindowTitle(tr("Color Preferences"));
|
setWindowTitle(tr("Color Preferences"));
|
||||||
QVBoxLayout* MainLayout = new QVBoxLayout(this);
|
QVBoxLayout* MainLayout = new QVBoxLayout(this);
|
||||||
|
|
||||||
QGroupBox* EdgeSettingsBox = new QGroupBox(tr("Edge Colors"), this);
|
QGroupBox* EdgeSettingsBox = new QGroupBox(tr("Edge Colors"), this);
|
||||||
EdgeSettingsBox->setVisible(!ShowHighContrastDialog);
|
|
||||||
MainLayout->addWidget(EdgeSettingsBox);
|
MainLayout->addWidget(EdgeSettingsBox);
|
||||||
QGridLayout* EdgeSettingsLayout = new QGridLayout(EdgeSettingsBox);
|
QGridLayout* EdgeSettingsLayout = new QGridLayout(EdgeSettingsBox);
|
||||||
EdgeSettingsBox->setLayout(EdgeSettingsLayout);
|
EdgeSettingsBox->setLayout(EdgeSettingsLayout);
|
||||||
|
|
||||||
QLabel* PartEdgeContrastLabel = new QLabel(tr("Contrast:"), this);
|
int LDIndexRow = 0;
|
||||||
PartEdgeContrast = new QLabel(this);
|
PartEdgeContrast = nullptr;
|
||||||
PartEdgeContrastSlider = new QSlider(Qt::Horizontal, this);
|
PartEdgeContrastSlider = nullptr;
|
||||||
PartEdgeContrastSlider->setRange(0, 100);
|
if (!ShowHighContrastDialog)
|
||||||
PartEdgeContrastSlider->setValue(mPartEdgeContrast * 100);
|
{
|
||||||
PartEdgeContrastSlider->setToolTip(tr("Set the amount of contrast - 0.50 is midway."));
|
LDIndexRow = 1;
|
||||||
connect(PartEdgeContrastSlider, SIGNAL(valueChanged(int)), this, SLOT(SliderValueChanged(int)));
|
QLabel* PartEdgeContrastLabel = new QLabel(tr("Contrast:"), this);
|
||||||
emit PartEdgeContrastSlider->valueChanged(PartEdgeContrastSlider->value());
|
PartEdgeContrast = new QLabel(this);
|
||||||
|
PartEdgeContrastSlider = new QSlider(Qt::Horizontal, this);
|
||||||
|
PartEdgeContrastSlider->setRange(0, 100);
|
||||||
|
PartEdgeContrastSlider->setValue(mPartEdgeContrast * 100);
|
||||||
|
PartEdgeContrastSlider->setToolTip(tr("Set the amount of contrast - 0.50 is midway."));
|
||||||
|
connect(PartEdgeContrastSlider, SIGNAL(valueChanged(int)), this, SLOT(SliderValueChanged(int)));
|
||||||
|
emit PartEdgeContrastSlider->valueChanged(PartEdgeContrastSlider->value());
|
||||||
|
|
||||||
ResetPartEdgeContrastButton = new QToolButton(this);
|
ResetPartEdgeContrastButton = new QToolButton(this);
|
||||||
ResetPartEdgeContrastButton->setText(tr("..."));
|
ResetPartEdgeContrastButton->setText(tr("Reset"));
|
||||||
ResetPartEdgeContrastButton->setToolTip(tr("Reset"));
|
connect(ResetPartEdgeContrastButton, SIGNAL(clicked()), this, SLOT(ResetSliderButtonClicked()));
|
||||||
connect(ResetPartEdgeContrastButton, SIGNAL(clicked()), this, SLOT(ResetSliderButtonClicked()));
|
|
||||||
|
|
||||||
EdgeSettingsLayout->addWidget(PartEdgeContrastLabel,0,0);
|
EdgeSettingsLayout->addWidget(PartEdgeContrastLabel,0,0);
|
||||||
EdgeSettingsLayout->addWidget(PartEdgeContrastSlider,0,1);
|
EdgeSettingsLayout->addWidget(PartEdgeContrastSlider,0,1);
|
||||||
EdgeSettingsLayout->addWidget(PartEdgeContrast,0,2);
|
EdgeSettingsLayout->addWidget(PartEdgeContrast,0,2);
|
||||||
EdgeSettingsLayout->addWidget(ResetPartEdgeContrastButton,0,3);
|
EdgeSettingsLayout->addWidget(ResetPartEdgeContrastButton,0,3);
|
||||||
|
}
|
||||||
|
|
||||||
QLabel* PartColorValueLDIndexLabel = new QLabel(tr("Light/Dark Value:"), this);
|
QLabel* PartColorValueLDIndexLabel = new QLabel(tr("Light/Dark Value:"), this);
|
||||||
PartColorValueLDIndex = new QLabel(this);
|
PartColorValueLDIndex = new QLabel(this);
|
||||||
|
@ -50,20 +55,19 @@ lcAutomateEdgeColorDialog::lcAutomateEdgeColorDialog(QWidget* Parent, bool ShowH
|
||||||
emit PartColorValueLDIndexSlider->valueChanged(PartColorValueLDIndexSlider->value());
|
emit PartColorValueLDIndexSlider->valueChanged(PartColorValueLDIndexSlider->value());
|
||||||
|
|
||||||
ResetPartColorValueLDIndexButton = new QToolButton(this);
|
ResetPartColorValueLDIndexButton = new QToolButton(this);
|
||||||
ResetPartColorValueLDIndexButton->setText(tr("..."));
|
ResetPartColorValueLDIndexButton->setText(tr("Reset"));
|
||||||
ResetPartColorValueLDIndexButton->setToolTip(tr("Reset"));
|
|
||||||
connect(ResetPartColorValueLDIndexButton, SIGNAL(clicked()), this, SLOT(ResetSliderButtonClicked()));
|
connect(ResetPartColorValueLDIndexButton, SIGNAL(clicked()), this, SLOT(ResetSliderButtonClicked()));
|
||||||
|
|
||||||
EdgeSettingsLayout->addWidget(PartColorValueLDIndexLabel,1,0);
|
EdgeSettingsLayout->addWidget(PartColorValueLDIndexLabel,LDIndexRow,0);
|
||||||
EdgeSettingsLayout->addWidget(PartColorValueLDIndexSlider,1,1);
|
EdgeSettingsLayout->addWidget(PartColorValueLDIndexSlider,LDIndexRow,1);
|
||||||
EdgeSettingsLayout->addWidget(PartColorValueLDIndex,1,2);
|
EdgeSettingsLayout->addWidget(PartColorValueLDIndex,LDIndexRow,2);
|
||||||
EdgeSettingsLayout->addWidget(ResetPartColorValueLDIndexButton,1,3);
|
EdgeSettingsLayout->addWidget(ResetPartColorValueLDIndexButton,LDIndexRow,3);
|
||||||
|
|
||||||
QGroupBox* StudColorBox = new QGroupBox(tr("High Contrast Studs"), this);
|
QGroupBox* HighContrastColorBox = new QGroupBox(tr("High Contrast"), this);
|
||||||
StudColorBox->setVisible(ShowHighContrastDialog);
|
HighContrastColorBox->setVisible(ShowHighContrastDialog);
|
||||||
MainLayout->addWidget(StudColorBox);
|
MainLayout->addWidget(HighContrastColorBox);
|
||||||
QGridLayout* StudColorLayout = new QGridLayout(StudColorBox);
|
QGridLayout* HighContrastColorLayout = new QGridLayout(HighContrastColorBox);
|
||||||
StudColorBox->setLayout(StudColorLayout);
|
HighContrastColorBox->setLayout(HighContrastColorLayout);
|
||||||
|
|
||||||
auto SetButtonPixmap = [](quint32 Color, QToolButton* Button)
|
auto SetButtonPixmap = [](quint32 Color, QToolButton* Button)
|
||||||
{
|
{
|
||||||
|
@ -74,33 +78,31 @@ lcAutomateEdgeColorDialog::lcAutomateEdgeColorDialog(QWidget* Parent, bool ShowH
|
||||||
Button->setToolTip(ButtonColor.name().toUpper());
|
Button->setToolTip(ButtonColor.name().toUpper());
|
||||||
};
|
};
|
||||||
|
|
||||||
QLabel* StudColorLabel = new QLabel(tr("Stud Color:"), this);
|
QLabel* StudCylinderColorLabel = new QLabel(tr("Stud Cylinder Color:"), this);
|
||||||
StudColorButton = new QToolButton(this);
|
StudCylinderColorButton = new QToolButton(this);
|
||||||
SetButtonPixmap(mStudColor, StudColorButton);
|
SetButtonPixmap(mStudCylinderColor, StudCylinderColorButton);
|
||||||
connect(StudColorButton, SIGNAL(clicked()), this, SLOT(ColorButtonClicked()));
|
connect(StudCylinderColorButton, SIGNAL(clicked()), this, SLOT(ColorButtonClicked()));
|
||||||
|
|
||||||
ResetStudColorButton = new QToolButton(this);
|
ResetStudCylinderColorButton = new QToolButton(this);
|
||||||
ResetStudColorButton->setText(tr("..."));
|
ResetStudCylinderColorButton->setText(tr("Reset"));;
|
||||||
ResetStudColorButton->setToolTip(tr("Reset"));
|
connect(ResetStudCylinderColorButton, SIGNAL(clicked()), this, SLOT(ResetColorButtonClicked()));
|
||||||
connect(ResetStudColorButton, SIGNAL(clicked()), this, SLOT(ResetColorButtonClicked()));
|
|
||||||
|
|
||||||
StudColorLayout->addWidget(StudColorLabel,0,0);
|
HighContrastColorLayout->addWidget(StudCylinderColorLabel,0,0);
|
||||||
StudColorLayout->addWidget(StudColorButton,0,1);
|
HighContrastColorLayout->addWidget(StudCylinderColorButton,0,1);
|
||||||
StudColorLayout->addWidget(ResetStudColorButton,0,2);
|
HighContrastColorLayout->addWidget(ResetStudCylinderColorButton,0,2);
|
||||||
|
|
||||||
QLabel* StudEdgeColorLabel = new QLabel(tr("Stud Edge Color:"), this);
|
QLabel* PartEdgeColorLabel = new QLabel(tr("Parts Edge Color:"), this);
|
||||||
StudEdgeColorButton = new QToolButton(this);
|
PartEdgeColorButton = new QToolButton(this);
|
||||||
SetButtonPixmap(mStudEdgeColor, StudEdgeColorButton);
|
SetButtonPixmap(mPartEdgeColor, PartEdgeColorButton);
|
||||||
connect(StudEdgeColorButton, SIGNAL(clicked()), this, SLOT(ColorButtonClicked()));
|
connect(PartEdgeColorButton, SIGNAL(clicked()), this, SLOT(ColorButtonClicked()));
|
||||||
|
|
||||||
ResetStudEdgeColorButton = new QToolButton(this);
|
ResetPartEdgeColorButton = new QToolButton(this);
|
||||||
ResetStudEdgeColorButton->setText(tr("..."));
|
ResetPartEdgeColorButton->setText(tr("Reset"));
|
||||||
ResetStudEdgeColorButton->setToolTip(tr("Reset"));
|
connect(ResetPartEdgeColorButton, SIGNAL(clicked()), this, SLOT(ResetColorButtonClicked()));
|
||||||
connect(ResetStudEdgeColorButton, SIGNAL(clicked()), this, SLOT(ResetColorButtonClicked()));
|
|
||||||
|
|
||||||
StudColorLayout->addWidget(StudEdgeColorLabel,1,0);
|
HighContrastColorLayout->addWidget(PartEdgeColorLabel,1,0);
|
||||||
StudColorLayout->addWidget(StudEdgeColorButton,1,1);
|
HighContrastColorLayout->addWidget(PartEdgeColorButton,1,1);
|
||||||
StudColorLayout->addWidget(ResetStudEdgeColorButton,1,2);
|
HighContrastColorLayout->addWidget(ResetPartEdgeColorButton,1,2);
|
||||||
|
|
||||||
QLabel* BlackEdgeColorLabel = new QLabel(tr("Black Parts Edge Color:"), this);
|
QLabel* BlackEdgeColorLabel = new QLabel(tr("Black Parts Edge Color:"), this);
|
||||||
BlackEdgeColorButton = new QToolButton(this);
|
BlackEdgeColorButton = new QToolButton(this);
|
||||||
|
@ -108,13 +110,12 @@ lcAutomateEdgeColorDialog::lcAutomateEdgeColorDialog(QWidget* Parent, bool ShowH
|
||||||
connect(BlackEdgeColorButton, SIGNAL(clicked()), this, SLOT(ColorButtonClicked()));
|
connect(BlackEdgeColorButton, SIGNAL(clicked()), this, SLOT(ColorButtonClicked()));
|
||||||
|
|
||||||
ResetBlackEdgeColorButton = new QToolButton(this);
|
ResetBlackEdgeColorButton = new QToolButton(this);
|
||||||
ResetBlackEdgeColorButton->setText(tr("..."));
|
ResetBlackEdgeColorButton->setText(tr("Reset"));
|
||||||
ResetBlackEdgeColorButton->setToolTip(tr("Reset"));
|
|
||||||
connect(ResetBlackEdgeColorButton, SIGNAL(clicked()), this, SLOT(ResetColorButtonClicked()));
|
connect(ResetBlackEdgeColorButton, SIGNAL(clicked()), this, SLOT(ResetColorButtonClicked()));
|
||||||
|
|
||||||
StudColorLayout->addWidget(BlackEdgeColorLabel,2,0);
|
HighContrastColorLayout->addWidget(BlackEdgeColorLabel,2,0);
|
||||||
StudColorLayout->addWidget(BlackEdgeColorButton,2,1);
|
HighContrastColorLayout->addWidget(BlackEdgeColorButton,2,1);
|
||||||
StudColorLayout->addWidget(ResetBlackEdgeColorButton,2,2);
|
HighContrastColorLayout->addWidget(ResetBlackEdgeColorButton,2,2);
|
||||||
|
|
||||||
QLabel* DarkEdgeColorLabel = new QLabel(tr("Dark Parts Edge Color:"), this);
|
QLabel* DarkEdgeColorLabel = new QLabel(tr("Dark Parts Edge Color:"), this);
|
||||||
DarkEdgeColorButton = new QToolButton(this);
|
DarkEdgeColorButton = new QToolButton(this);
|
||||||
|
@ -122,13 +123,12 @@ lcAutomateEdgeColorDialog::lcAutomateEdgeColorDialog(QWidget* Parent, bool ShowH
|
||||||
connect(DarkEdgeColorButton, SIGNAL(clicked()), this, SLOT(ColorButtonClicked()));
|
connect(DarkEdgeColorButton, SIGNAL(clicked()), this, SLOT(ColorButtonClicked()));
|
||||||
|
|
||||||
ResetDarkEdgeColorButton = new QToolButton(this);
|
ResetDarkEdgeColorButton = new QToolButton(this);
|
||||||
ResetDarkEdgeColorButton->setText(tr("..."));
|
ResetDarkEdgeColorButton->setText(tr("Reset"));
|
||||||
ResetDarkEdgeColorButton->setToolTip(tr("Reset"));
|
|
||||||
connect(ResetDarkEdgeColorButton, SIGNAL(clicked()), this, SLOT(ResetColorButtonClicked()));
|
connect(ResetDarkEdgeColorButton, SIGNAL(clicked()), this, SLOT(ResetColorButtonClicked()));
|
||||||
|
|
||||||
StudColorLayout->addWidget(DarkEdgeColorLabel,3,0);
|
HighContrastColorLayout->addWidget(DarkEdgeColorLabel,3,0);
|
||||||
StudColorLayout->addWidget(DarkEdgeColorButton,3,1);
|
HighContrastColorLayout->addWidget(DarkEdgeColorButton,3,1);
|
||||||
StudColorLayout->addWidget(ResetDarkEdgeColorButton,3,2);
|
HighContrastColorLayout->addWidget(ResetDarkEdgeColorButton,3,2);
|
||||||
|
|
||||||
QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
|
QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
|
||||||
MainLayout->addWidget(buttonBox);
|
MainLayout->addWidget(buttonBox);
|
||||||
|
@ -159,23 +159,22 @@ void lcAutomateEdgeColorDialog::ColorButtonClicked()
|
||||||
quint32* Color = nullptr;
|
quint32* Color = nullptr;
|
||||||
QColorDialog::ColorDialogOptions DialogOptions;
|
QColorDialog::ColorDialogOptions DialogOptions;
|
||||||
|
|
||||||
if (Button == StudColorButton)
|
if (Button == StudCylinderColorButton)
|
||||||
{
|
{
|
||||||
Title = tr("Select Stud Color");
|
Title = tr("Select Stud Cylinder Color");
|
||||||
Color = &mStudColor;
|
Color = &mStudCylinderColor;
|
||||||
}
|
}
|
||||||
else if (Button == StudEdgeColorButton)
|
else if (Button == PartEdgeColorButton)
|
||||||
{
|
{
|
||||||
Title = tr("Select Stud Edge Color");
|
Title = tr("Select Part Edge Color");
|
||||||
Color = &mStudEdgeColor;
|
Color = &mPartEdgeColor;
|
||||||
}
|
}
|
||||||
else if (Button == BlackEdgeColorButton)
|
else if (Button == BlackEdgeColorButton)
|
||||||
{
|
{
|
||||||
if (lcGetPreferences().mAutomateEdgeColor)
|
if (lcGetPreferences().mAutomateEdgeColor)
|
||||||
{
|
{
|
||||||
QMessageBox msgBox;
|
QMessageBox msgBox;
|
||||||
msgBox.setText("Automate edge colour appears to be enabled.<br>"
|
msgBox.setText("Automate edge color appears to be enabled.<br>Black parts edge color will not be accessible.<br>Do you want to continue ?");
|
||||||
"Black parts edge color setting will not be accessible.");
|
|
||||||
if (msgBox.exec() != QMessageBox::Accepted)
|
if (msgBox.exec() != QMessageBox::Accepted)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -187,8 +186,7 @@ void lcAutomateEdgeColorDialog::ColorButtonClicked()
|
||||||
if (lcGetPreferences().mAutomateEdgeColor)
|
if (lcGetPreferences().mAutomateEdgeColor)
|
||||||
{
|
{
|
||||||
QMessageBox msgBox;
|
QMessageBox msgBox;
|
||||||
msgBox.setText("Automate edge colour appears to be enabled.<br>"
|
msgBox.setText("Automate edge color appears to be enabled.<br>Dark parts edge color will not be accessible.<br>Do you want to continue ?");
|
||||||
"Dark parts edge color setting will not be accessible.");
|
|
||||||
if (msgBox.exec() != QMessageBox::Accepted)
|
if (msgBox.exec() != QMessageBox::Accepted)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -218,12 +216,10 @@ void lcAutomateEdgeColorDialog::ResetSliderButtonClicked()
|
||||||
if (sender() == ResetPartEdgeContrastButton)
|
if (sender() == ResetPartEdgeContrastButton)
|
||||||
{
|
{
|
||||||
PartEdgeContrastSlider->setValue(0.5f * 100);
|
PartEdgeContrastSlider->setValue(0.5f * 100);
|
||||||
emit PartEdgeContrastSlider->valueChanged(PartEdgeContrastSlider->value());
|
|
||||||
}
|
}
|
||||||
else if (sender() == ResetPartColorValueLDIndexButton)
|
else if (sender() == ResetPartColorValueLDIndexButton)
|
||||||
{
|
{
|
||||||
PartColorValueLDIndexSlider->setValue(0.5f * 100);
|
PartColorValueLDIndexSlider->setValue(0.5f * 100);
|
||||||
emit PartColorValueLDIndexSlider->valueChanged(PartColorValueLDIndexSlider->value());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,23 +229,23 @@ void lcAutomateEdgeColorDialog::ResetColorButtonClicked()
|
||||||
QPixmap Pix(12, 12);
|
QPixmap Pix(12, 12);
|
||||||
QColor ResetColor;
|
QColor ResetColor;
|
||||||
|
|
||||||
if (sender() == ResetStudColorButton)
|
if (sender() == ResetStudCylinderColorButton)
|
||||||
{
|
{
|
||||||
Color = &mStudColor;
|
Color = &mStudCylinderColor;
|
||||||
*Color = LC_RGBA(27, 42, 52, 255);
|
*Color = LC_RGBA(27, 42, 52, 255);
|
||||||
ResetColor = QColor(LC_RGBA_RED(*Color), LC_RGBA_GREEN(*Color), LC_RGBA_BLUE(*Color), LC_RGBA_ALPHA(*Color));
|
ResetColor = QColor(LC_RGBA_RED(*Color), LC_RGBA_GREEN(*Color), LC_RGBA_BLUE(*Color), LC_RGBA_ALPHA(*Color));
|
||||||
Pix.fill(ResetColor);
|
Pix.fill(ResetColor);
|
||||||
StudColorButton->setIcon(Pix);
|
StudCylinderColorButton->setIcon(Pix);
|
||||||
StudColorButton->setToolTip(ResetColor.name().toUpper());
|
StudCylinderColorButton->setToolTip(ResetColor.name().toUpper());
|
||||||
}
|
}
|
||||||
else if (sender() == ResetStudEdgeColorButton)
|
else if (sender() == ResetPartEdgeColorButton)
|
||||||
{
|
{
|
||||||
Color = &mStudEdgeColor;
|
Color = &mPartEdgeColor;
|
||||||
*Color = LC_RGBA(0, 0, 0, 255);
|
*Color = LC_RGBA(0, 0, 0, 255);
|
||||||
ResetColor = QColor(LC_RGBA_RED(*Color), LC_RGBA_GREEN(*Color), LC_RGBA_BLUE(*Color), LC_RGBA_ALPHA(*Color));
|
ResetColor = QColor(LC_RGBA_RED(*Color), LC_RGBA_GREEN(*Color), LC_RGBA_BLUE(*Color), LC_RGBA_ALPHA(*Color));
|
||||||
Pix.fill(ResetColor);
|
Pix.fill(ResetColor);
|
||||||
StudEdgeColorButton->setIcon(Pix);
|
PartEdgeColorButton->setIcon(Pix);
|
||||||
StudEdgeColorButton->setToolTip(ResetColor.name().toUpper());
|
PartEdgeColorButton->setToolTip(ResetColor.name().toUpper());
|
||||||
}
|
}
|
||||||
else if (sender() == ResetBlackEdgeColorButton)
|
else if (sender() == ResetBlackEdgeColorButton)
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,8 +7,8 @@ class lcAutomateEdgeColorDialog : public QDialog
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
lcAutomateEdgeColorDialog(QWidget *Parent, bool ShowHighContrastDialog);
|
lcAutomateEdgeColorDialog(QWidget *Parent, bool ShowHighContrastDialog);
|
||||||
quint32 mStudColor;
|
quint32 mStudCylinderColor;
|
||||||
quint32 mStudEdgeColor;
|
quint32 mPartEdgeColor;
|
||||||
quint32 mDarkEdgeColor;
|
quint32 mDarkEdgeColor;
|
||||||
quint32 mBlackEdgeColor;
|
quint32 mBlackEdgeColor;
|
||||||
float mPartEdgeContrast;
|
float mPartEdgeContrast;
|
||||||
|
@ -30,13 +30,13 @@ protected:
|
||||||
QToolButton* ResetPartEdgeContrastButton;
|
QToolButton* ResetPartEdgeContrastButton;
|
||||||
QToolButton* ResetPartColorValueLDIndexButton;
|
QToolButton* ResetPartColorValueLDIndexButton;
|
||||||
|
|
||||||
QToolButton* StudColorButton;
|
QToolButton* StudCylinderColorButton;
|
||||||
QToolButton* StudEdgeColorButton;
|
QToolButton* PartEdgeColorButton;
|
||||||
QToolButton* BlackEdgeColorButton;
|
QToolButton* BlackEdgeColorButton;
|
||||||
QToolButton* DarkEdgeColorButton;
|
QToolButton* DarkEdgeColorButton;
|
||||||
|
|
||||||
QToolButton* ResetStudColorButton;
|
QToolButton* ResetStudCylinderColorButton;
|
||||||
QToolButton* ResetStudEdgeColorButton;
|
QToolButton* ResetPartEdgeColorButton;
|
||||||
QToolButton* ResetBlackEdgeColorButton;
|
QToolButton* ResetBlackEdgeColorButton;
|
||||||
QToolButton* ResetDarkEdgeColorButton;
|
QToolButton* ResetDarkEdgeColorButton;
|
||||||
};
|
};
|
||||||
|
|
|
@ -651,6 +651,15 @@ inline quint32 lcColorFromVector3(const lcVector3& Color)
|
||||||
return LC_RGB(Color[0] * 255, Color[1] * 255, Color[2] * 255);
|
return LC_RGB(Color[0] * 255, Color[1] * 255, Color[2] * 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline float lcLuminescenceFromRGBA(lcVector4& Value)
|
||||||
|
{
|
||||||
|
float r = LC_SRGB_TO_LINEAR(Value[0]);
|
||||||
|
float g = LC_SRGB_TO_LINEAR(Value[1]);
|
||||||
|
float b = LC_SRGB_TO_LINEAR(Value[2]);
|
||||||
|
|
||||||
|
return 0.2126f * r + 0.7152f * g + 0.0722f * b;
|
||||||
|
}
|
||||||
|
|
||||||
inline lcVector3 lcMul(const lcVector3& a, const lcMatrix33& b)
|
inline lcVector3 lcMul(const lcVector3& a, const lcMatrix33& b)
|
||||||
{
|
{
|
||||||
return b.r[0] * a[0] + b.r[1] * a[1] + b.r[2] * a[2];
|
return b.r[0] * a[0] + b.r[1] * a[1] + b.r[2] * a[2];
|
||||||
|
|
|
@ -140,8 +140,8 @@ static lcProfileEntry gProfileEntries[LC_NUM_PROFILE_KEYS] =
|
||||||
lcProfileEntry("Settings", "PreviewViewSphereLocation", (int)lcViewSphereLocation::TopRight), // LC_PROFILE_PREVIEW_VIEW_SPHERE_LOCATION
|
lcProfileEntry("Settings", "PreviewViewSphereLocation", (int)lcViewSphereLocation::TopRight), // LC_PROFILE_PREVIEW_VIEW_SPHERE_LOCATION
|
||||||
lcProfileEntry("Settings", "DrawPreviewAxis", 0), // LC_PROFILE_PREVIEW_DRAW_AXES
|
lcProfileEntry("Settings", "DrawPreviewAxis", 0), // LC_PROFILE_PREVIEW_DRAW_AXES
|
||||||
|
|
||||||
lcProfileEntry("Settings", "StudColor", LC_RGBA(27, 42, 52, 255)), // LC_PROFILE_STUD_COLOR
|
lcProfileEntry("Settings", "StudCylinderColor", LC_RGBA(27, 42, 52, 255)), // LC_PROFILE_STUD_CYLINDER_COLOR
|
||||||
lcProfileEntry("Settings", "StudEdgeColor", LC_RGBA(0, 0, 0, 255)), // LC_PROFILE_STUD_EDGE_COLOR
|
lcProfileEntry("Settings", "PartEdgeColor", LC_RGBA(0, 0, 0, 255)), // LC_PROFILE_PART_EDGE_COLOR
|
||||||
lcProfileEntry("Settings", "BlackEdgeColor", LC_RGBA(255, 255, 255, 255)), // LC_PROFILE_BLACK_EDGE_COLOR
|
lcProfileEntry("Settings", "BlackEdgeColor", LC_RGBA(255, 255, 255, 255)), // LC_PROFILE_BLACK_EDGE_COLOR
|
||||||
lcProfileEntry("Settings", "DarkEdgeColor", LC_RGBA(27, 42, 52, 255)), // LC_PROFILE_DARK_EDGE_COLOR
|
lcProfileEntry("Settings", "DarkEdgeColor", LC_RGBA(27, 42, 52, 255)), // LC_PROFILE_DARK_EDGE_COLOR
|
||||||
lcProfileEntry("Settings", "PartEdgeContrast", 0.5f), // LC_PROFILE_PART_EDGE_CONTRAST
|
lcProfileEntry("Settings", "PartEdgeContrast", 0.5f), // LC_PROFILE_PART_EDGE_CONTRAST
|
||||||
|
|
|
@ -88,8 +88,8 @@ enum LC_PROFILE_KEY
|
||||||
LC_PROFILE_PREVIEW_VIEW_SPHERE_LOCATION,
|
LC_PROFILE_PREVIEW_VIEW_SPHERE_LOCATION,
|
||||||
LC_PROFILE_PREVIEW_DRAW_AXES,
|
LC_PROFILE_PREVIEW_DRAW_AXES,
|
||||||
|
|
||||||
LC_PROFILE_STUD_COLOR,
|
LC_PROFILE_STUD_CYLINDER_COLOR,
|
||||||
LC_PROFILE_STUD_EDGE_COLOR,
|
LC_PROFILE_PART_EDGE_COLOR,
|
||||||
LC_PROFILE_BLACK_EDGE_COLOR,
|
LC_PROFILE_BLACK_EDGE_COLOR,
|
||||||
LC_PROFILE_DARK_EDGE_COLOR,
|
LC_PROFILE_DARK_EDGE_COLOR,
|
||||||
LC_PROFILE_PART_EDGE_CONTRAST,
|
LC_PROFILE_PART_EDGE_CONTRAST,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
.TH LEOCAD 1 "20 January 2021"
|
.TH LEOCAD 1 "26 January 2021"
|
||||||
.\" NAME should be all caps, SECTION should be 1-8, maybe w/ subsection
|
.\" NAME should be all caps, SECTION should be 1-8, maybe w/ subsection
|
||||||
.\" other params are allowed: see man(7), man(1)
|
.\" other params are allowed: see man(7), man(1)
|
||||||
.SH NAME
|
.SH NAME
|
||||||
|
@ -68,7 +68,7 @@ Sets the active camera to \fIcamera\fR.
|
||||||
.TP
|
.TP
|
||||||
\fB\-ss \fIid\fR,\ \fB\-\-stud\-style\ \fIid
|
\fB\-ss \fIid\fR,\ \fB\-\-stud\-style\ \fIid
|
||||||
.br
|
.br
|
||||||
Set the stud style. Valid values 0=No style, 1=LDraw single wire, 2=LDraw double wire, 3=LDraw raised floating, 4=LDraw raised rounded, 5=LDraw subtle rounded, 6=LEGO no logo, 7=LEGO single wire. Stud style 1 - 5 require stud logo primitives which are in the unofficial parts library from \fILDraw.org\fR.
|
Set the stud style. Valid values 0=Plain, 1=Thin Lines Logo, 2=Outline Logo, 3=Sharp Top Logo, 4=Rounded Top Logo, 5=Flattened Logo, 6=High Contrast, 7=High Contrast with Logo.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-viewpoint \fRfront\ |\ back\ |\ left\ |\ right\ |\ top\ |\ bottom\ |\ home
|
\fB\-\-viewpoint \fRfront\ |\ back\ |\ left\ |\ right\ |\ top\ |\ bottom\ |\ home
|
||||||
|
@ -136,6 +136,41 @@ Set the with of the edge lines.
|
||||||
.BI "\-\-aa\-samples " count
|
.BI "\-\-aa\-samples " count
|
||||||
AntiAliasing sample size (1, 2, 4, or 8).
|
AntiAliasing sample size (1, 2, 4, or 8).
|
||||||
|
|
||||||
|
.TP
|
||||||
|
\fB\-scc \fI#AARRGGBB\fR,\ \fB\-\-stud\-cylinder\-color\ \fI#AARRGGBB
|
||||||
|
.br
|
||||||
|
High contrast stud cylinder color.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
\fB\-ec \fI#AARRGGBB\fR,\ \fB\-\-edge\-color\ \fI#AARRGGBB
|
||||||
|
.br
|
||||||
|
High contrast edge color.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
\fB\-bec \fI#AARRGGBB\fR,\ \fB\-\-black\-edge\-color\ \fI#AARRGGBB
|
||||||
|
.br
|
||||||
|
High contrast edge color for black parts.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
\fB\-dec \fI#AARRGGBB\fR,\ \fB\-\-dark\-edge\-color\ \fI#AARRGGBB
|
||||||
|
.br
|
||||||
|
High contrast edge color for dark color parts.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
\fB\-aec,\ \fB\-\-automate\-edge\-color
|
||||||
|
.br
|
||||||
|
Enable automatically adjusted edge colors.\
|
||||||
|
|
||||||
|
.TP
|
||||||
|
\fB\-cc \fIfloat\fR,\ \fB\-\-color\-contrast\ \ffloat
|
||||||
|
.br
|
||||||
|
Set the near and far clipping planes used to render images (1 <= \fInear\fR < \fIfar\fR).
|
||||||
|
|
||||||
|
.TP
|
||||||
|
\fB\-ldv \fIfloat\fR,\ \fB\-\-light\-dark\-value\ \ffloat
|
||||||
|
.br
|
||||||
|
Set the value to indicate a light or dark color.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fB\-obj \fR[\fIoutfile.obj\fR]
|
\fB\-obj \fR[\fIoutfile.obj\fR]
|
||||||
.br
|
.br
|
||||||
|
|
|
@ -569,8 +569,8 @@ void lcQPreferencesDialog::AutomateEdgeColor()
|
||||||
lcAutomateEdgeColorDialog Dialog(this, sender() == ui->HighContrastButton);
|
lcAutomateEdgeColorDialog Dialog(this, sender() == ui->HighContrastButton);
|
||||||
if (Dialog.exec() == QDialog::Accepted)
|
if (Dialog.exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
mOptions->Preferences.mStudColor = Dialog.mStudColor;
|
mOptions->Preferences.mStudCylinderColor = Dialog.mStudCylinderColor;
|
||||||
mOptions->Preferences.mStudEdgeColor = Dialog.mStudEdgeColor;
|
mOptions->Preferences.mPartEdgeColor = Dialog.mPartEdgeColor;
|
||||||
mOptions->Preferences.mBlackEdgeColor = Dialog.mBlackEdgeColor;
|
mOptions->Preferences.mBlackEdgeColor = Dialog.mBlackEdgeColor;
|
||||||
mOptions->Preferences.mDarkEdgeColor = Dialog.mDarkEdgeColor;
|
mOptions->Preferences.mDarkEdgeColor = Dialog.mDarkEdgeColor;
|
||||||
mOptions->Preferences.mPartEdgeContrast = Dialog.mPartEdgeContrast;
|
mOptions->Preferences.mPartEdgeContrast = Dialog.mPartEdgeContrast;
|
||||||
|
|
Loading…
Reference in a new issue