3
0

ResolutionSettingItemWidget.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. #pragma once
  9. #if !defined(Q_MOC_RUN)
  10. #include <QWidget>
  11. #include <AzCore/Memory/SystemAllocator.h>
  12. #include <Editor/EditorCommon.h>
  13. #endif
  14. namespace ImageProcessingAtom
  15. {
  16. class PresetSettings;
  17. }
  18. namespace Ui
  19. {
  20. class ResolutionSettingItemWidget;
  21. }
  22. namespace ImageProcessingAtomEditor
  23. {
  24. enum class ResoultionWidgetType
  25. {
  26. TexturePipeline, //Fully editable
  27. TexturePropety, //Only DownRes is editable
  28. };
  29. class ResolutionSettingItemWidget
  30. : public QWidget
  31. , EditorInternalNotificationBus::Handler
  32. {
  33. Q_OBJECT
  34. public:
  35. AZ_CLASS_ALLOCATOR(ResolutionSettingItemWidget, AZ::SystemAllocator);
  36. explicit ResolutionSettingItemWidget(ResoultionWidgetType type, QWidget* parent = nullptr);
  37. ~ResolutionSettingItemWidget();
  38. void Init(AZStd::string platform, EditorTextureSetting* editorTextureSetting);
  39. public slots:
  40. void OnChangeDownRes(int downRes);
  41. void OnChangeFormat(int index);
  42. protected:
  43. ////////////////////////////////////////////////////////////////////////
  44. //EditorInternalNotificationBus
  45. void OnEditorSettingsChanged(bool needRefresh, const AZStd::string& platform);
  46. ////////////////////////////////////////////////////////////////////////
  47. private:
  48. void SetupFormatComboBox();
  49. void SetupResolutionInfo();
  50. void RefreshUI();
  51. QString GetFinalFormat(const ImageProcessingAtom::PresetName& preset);
  52. QScopedPointer<Ui::ResolutionSettingItemWidget> m_ui;
  53. ResoultionWidgetType m_type;
  54. AZStd::string m_platform;
  55. ImageProcessingAtom::TextureSettings* m_textureSetting;
  56. EditorTextureSetting* m_editorTextureSetting;
  57. const ImageProcessingAtom::PresetSettings* m_preset;
  58. //Cached list of calculated final resolution info based on different reduce levels
  59. AZStd::list<ResolutionInfo> m_resolutionInfos;
  60. //Final reduce level range
  61. unsigned int m_maxReduce;
  62. unsigned int m_minReduce;
  63. };
  64. } //namespace ImageProcessingAtomEditor