PresetInfoPopup.cpp 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include "PresetInfoPopup.h"
  9. #include <Source/Editor/ui_PresetInfoPopup.h>
  10. #include <BuilderSettings/PresetSettings.h>
  11. #include <QLabel>
  12. #include <QString>
  13. namespace ImageProcessingAtomEditor
  14. {
  15. using namespace ImageProcessingAtom;
  16. // Help functions to convert enum to strings
  17. static const char* RGBWeightToString(RGBWeight weight)
  18. {
  19. static const char* RGBWeightNames[] = { "Uniform", "Luminance", "CIEXYZ" };
  20. AZ_Assert(weight <= RGBWeight::ciexyz, "Invalid RGBWeight!");
  21. return RGBWeightNames[(int)weight];
  22. }
  23. static const char* ColorSpaceToString(ColorSpace colorSpace)
  24. {
  25. static const char* colorSpaceNames[] = { "Linear", "sRGB", "Auto" };
  26. AZ_Assert(colorSpace <= ColorSpace::autoSelect, "Invalid ColorSpace!");
  27. return colorSpaceNames[(int)colorSpace];
  28. }
  29. static const char* MipGenTypeToString(MipGenType mipGenType)
  30. {
  31. static const char* mipGenTypeNames[] = { "Point", "Box", "Triangle", "Quadratic", "Gaussian", "BlackmanHarris", "KaiserSinc" };
  32. AZ_Assert(mipGenType <= MipGenType::kaiserSinc, "Invalid MipGenType!");
  33. return mipGenTypeNames[(int)mipGenType];
  34. }
  35. static const char* CubemapFilterTypeToString(CubemapFilterType cubemapFilterType)
  36. {
  37. static const char* cubemapFilterTypeNames[] = { "Disc", "Cone", "Cosine", "Gaussian", "CosinePower", "GGX" };
  38. AZ_Assert(cubemapFilterType <= CubemapFilterType::ggx, "Invalid CubemapFilterType!");
  39. return cubemapFilterTypeNames[(int)cubemapFilterType];
  40. }
  41. PresetInfoPopup::PresetInfoPopup(const PresetSettings* presetSettings, QWidget* parent /*= nullptr*/)
  42. : AzQtComponents::StyledDialog(parent, Qt::Dialog | Qt::Popup)
  43. , m_ui(new Ui::PresetInfoPopup)
  44. {
  45. m_ui->setupUi(this);
  46. RefreshPresetInfoLabel(presetSettings);
  47. }
  48. PresetInfoPopup::~PresetInfoPopup()
  49. {
  50. }
  51. void PresetInfoPopup::RefreshPresetInfoLabel(const PresetSettings* presetSettings)
  52. {
  53. QString presetInfoText = "";
  54. if (!presetSettings)
  55. {
  56. presetInfoText = "Invalid Preset!";
  57. m_ui->infoLabel->setText(presetInfoText);
  58. return;
  59. }
  60. presetInfoText += QString("UUID: %1\n").arg(presetSettings->m_uuid.ToString<AZStd::string>().c_str());
  61. presetInfoText += QString("Name: %1\n").arg(presetSettings->m_name.GetCStr());
  62. presetInfoText += QString("Generate IBL Only: %1\n").arg(presetSettings->m_generateIBLOnly ? "True" : "False");
  63. presetInfoText += QString("RGB Weight: %1\n").arg(RGBWeightToString(presetSettings->m_rgbWeight));
  64. presetInfoText += QString("Source ColorSpace: %1\n").arg(ColorSpaceToString(presetSettings->m_srcColorSpace));
  65. presetInfoText += QString("Destination ColorSpace: %1\n").arg(ColorSpaceToString(presetSettings->m_destColorSpace));
  66. presetInfoText += QString("FileMasks: ");
  67. int i = 0;
  68. for (auto& mask : presetSettings->m_fileMasks)
  69. {
  70. presetInfoText += i > 0 ? ", " : "";
  71. presetInfoText += mask.c_str();
  72. i++;
  73. }
  74. presetInfoText += "\n";
  75. presetInfoText += QString("Suppress Engine Reduce: %1\n").arg(presetSettings->m_suppressEngineReduce ? "True" : "False");
  76. presetInfoText += QString("Discard Alpha: %1\n").arg(presetSettings->m_discardAlpha ? "True" : "False");
  77. presetInfoText += QString("Is Color Chart: %1\n").arg(presetSettings->m_isColorChart ? "True" : "False");
  78. presetInfoText += QString("High Pass Mip: %1\n").arg(presetSettings->m_highPassMip);
  79. presetInfoText += QString("Gloss From Normal: %1\n").arg(presetSettings->m_glossFromNormals);
  80. presetInfoText += QString("Use Legacy Gloss: %1\n").arg(presetSettings->m_isLegacyGloss ? "True" : "False");
  81. presetInfoText += QString("Mip Re-normalize: %1\n").arg(presetSettings->m_isMipRenormalize ? "True" : "False");
  82. presetInfoText += QString("Resident Mips Number: %1\n").arg(presetSettings->m_numResidentMips);
  83. presetInfoText += QString("Swizzle: %1\n").arg(presetSettings->m_swizzle.c_str());
  84. if (presetSettings->m_cubemapSetting)
  85. {
  86. presetInfoText += QString("[Cubemap Settings]\n");
  87. presetInfoText += QString("Filter: %1\n").arg(CubemapFilterTypeToString(presetSettings->m_cubemapSetting->m_filter));
  88. presetInfoText += QString("Angle: %1\n").arg(presetSettings->m_cubemapSetting->m_angle);
  89. presetInfoText += QString("Mip Angle: %1\n").arg(presetSettings->m_cubemapSetting->m_mipAngle);
  90. presetInfoText += QString("Mip Slope: %1\n").arg(presetSettings->m_cubemapSetting->m_mipSlope);
  91. presetInfoText += QString("Edge Fixup: %1\n").arg(presetSettings->m_cubemapSetting->m_edgeFixup);
  92. presetInfoText += QString("Generate IBL Specular: %1\n").arg(presetSettings->m_cubemapSetting->m_generateIBLSpecular ? "True" : "False");
  93. presetInfoText += QString("IBL Specular Preset: %1\n").arg(presetSettings->m_cubemapSetting->m_iblSpecularPreset.GetCStr());
  94. presetInfoText += QString("Generate IBL Diffuse: %1\n").arg(presetSettings->m_cubemapSetting->m_generateIBLDiffuse ? "True" : "False");
  95. presetInfoText += QString("IBL Diffuse Preset: %1\n").arg(presetSettings->m_cubemapSetting->m_iblDiffusePreset.GetCStr());
  96. presetInfoText += QString("Requires Convolve: %1\n").arg(presetSettings->m_cubemapSetting->m_requiresConvolve ? "True" : "False");
  97. presetInfoText += QString("SubId: %1\n").arg(presetSettings->m_cubemapSetting->m_subId);
  98. }
  99. if (presetSettings->m_mipmapSetting)
  100. {
  101. presetInfoText += QString("[MipMapSetting]\n");
  102. presetInfoText += QString("Type: %1\n").arg(MipGenTypeToString(presetSettings->m_mipmapSetting->m_type));
  103. }
  104. m_ui->infoLabel->setText(presetInfoText);
  105. }
  106. }//namespace ImageProcessingAtomEditor
  107. #include <Source/Editor/moc_PresetInfoPopup.cpp>