EditorLookModificationComponent.cpp 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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 <AzCore/RTTI/BehaviorContext.h>
  9. #include <PostProcess/LookModification/EditorLookModificationComponent.h>
  10. namespace AZ
  11. {
  12. namespace Render
  13. {
  14. void EditorLookModificationComponent::Reflect(AZ::ReflectContext* context)
  15. {
  16. BaseClass::Reflect(context);
  17. if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
  18. {
  19. serializeContext->Class<EditorLookModificationComponent, BaseClass>()
  20. ->Version(1);
  21. if (AZ::EditContext* editContext = serializeContext->GetEditContext())
  22. {
  23. editContext->Class<EditorLookModificationComponent>(
  24. "Look Modification", "The look modification process.")
  25. ->ClassElement(Edit::ClassElements::EditorData, "")
  26. ->Attribute(Edit::Attributes::Category, "Graphics/PostFX")
  27. ->Attribute(AZ::Edit::Attributes::Icon, "Icons/Components/Component_Placeholder.svg") // [GFX TODO ATOM-2672][PostFX] need to create icons for PostProcessing.
  28. ->Attribute(AZ::Edit::Attributes::ViewportIcon, "Icons/Components/Viewport/Component_Placeholder.svg") // [GFX TODO ATOM-2672][PostFX] need to create icons for PostProcessing.
  29. ->Attribute(Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC_CE("Game"))
  30. ->Attribute(Edit::Attributes::AutoExpand, true)
  31. ->Attribute(Edit::Attributes::HelpPageURL, "https://www.o3de.org/docs/user-guide/components/reference/atom/look-modification/") // [TODO ATOM-2672][PostFX] need to create page for PostProcessing.
  32. ;
  33. editContext->Class<LookModificationComponentController>(
  34. "LookModificationComponentControl", "")
  35. ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
  36. ->Attribute(AZ::Edit::Attributes::AutoExpand, true)
  37. ->DataElement(AZ::Edit::UIHandlers::Default, &LookModificationComponentController::m_configuration, "Configuration", "")
  38. ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
  39. ;
  40. editContext->Class<LookModificationComponentConfig>("LookModificationComponentConfig", "")
  41. ->DataElement(Edit::UIHandlers::CheckBox,
  42. &LookModificationComponentConfig::m_enabled,
  43. "Enable look modification",
  44. "Enable look modification.")
  45. ->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
  46. ->DataElement(AZ::Edit::UIHandlers::Default, &LookModificationComponentConfig::m_colorGradingLut, "Color Grading LUT", "Color grading LUT")
  47. ->ClassElement(Edit::ClassElements::EditorData, "")
  48. ->DataElement(Edit::UIHandlers::ComboBox,
  49. &LookModificationComponentConfig::m_shaperPresetType, "Shaper Type", "Shaper Type.")
  50. ->EnumAttribute(ShaperPresetType::None, "None")
  51. ->EnumAttribute(ShaperPresetType::LinearCustomRange, "Linear Custom Range")
  52. ->EnumAttribute(ShaperPresetType::Log2_48Nits, "Log2 48 nits")
  53. ->EnumAttribute(ShaperPresetType::Log2_1000Nits, "Log2 1000 nits")
  54. ->EnumAttribute(ShaperPresetType::Log2_2000Nits, "Log2 2000 nits")
  55. ->EnumAttribute(ShaperPresetType::Log2_4000Nits, "Log2 4000 nits")
  56. ->EnumAttribute(ShaperPresetType::Log2CustomRange, "Log2 Custom Range")
  57. ->EnumAttribute(ShaperPresetType::PqSmpteSt2084, "PQ (SMPTE ST 2084)")
  58. ->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::EntireTree)
  59. ->DataElement(AZ::Edit::UIHandlers::Slider, &LookModificationComponentConfig::m_customMinExposure, "Minimum Exposure", "The minimum exposure this LUT supports. Values smaller than this will be clamped to 0.")
  60. ->Attribute(AZ::Edit::Attributes::Min, -50.0f)
  61. ->Attribute(AZ::Edit::Attributes::Max, 0.0f)
  62. ->Attribute(AZ::Edit::Attributes::SoftMin, -20.0f)
  63. ->Attribute(AZ::Edit::Attributes::SoftMax, 0.0f)
  64. ->Attribute(Edit::Attributes::Visibility, &LookModificationComponentConfig::IsUsingCustomShaper)
  65. ->Attribute(AZ::Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
  66. ->DataElement(AZ::Edit::UIHandlers::Slider, &LookModificationComponentConfig::m_customMaxExposure, "Maximum Exposure", "The maximum exposure this LUT supports. Values larger than this will be clamped.")
  67. ->Attribute(AZ::Edit::Attributes::Min, 0.0f)
  68. ->Attribute(AZ::Edit::Attributes::Max, 50.0f)
  69. ->Attribute(AZ::Edit::Attributes::SoftMin, 0.0f)
  70. ->Attribute(AZ::Edit::Attributes::SoftMax, 20.0f)
  71. ->Attribute(Edit::Attributes::Visibility, &LookModificationComponentConfig::IsUsingCustomShaper)
  72. ->Attribute(AZ::Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
  73. ->DataElement(AZ::Edit::UIHandlers::Slider, &LookModificationComponentConfig::m_colorGradingLutIntensity, "LUT Intensity", "Blend intensity of this LUT.")
  74. ->Attribute(AZ::Edit::Attributes::Min, 0.0f)
  75. ->Attribute(AZ::Edit::Attributes::Max, 1.0f)
  76. ->Attribute(AZ::Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
  77. ->Attribute(Edit::Attributes::ReadOnly, &LookModificationComponentConfig::ArePropertiesReadOnly)
  78. ->DataElement(AZ::Edit::UIHandlers::Slider, &LookModificationComponentConfig::m_colorGradingLutOverride, "LUT Override", "Blend intensity of this LUT.")
  79. ->Attribute(AZ::Edit::Attributes::Min, 0.0f)
  80. ->Attribute(AZ::Edit::Attributes::Max, 1.0f)
  81. ->Attribute(AZ::Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
  82. ->Attribute(Edit::Attributes::ReadOnly, &LookModificationComponentConfig::ArePropertiesReadOnly)
  83. // Overrides
  84. ->ClassElement(AZ::Edit::ClassElements::Group, "Overrides")
  85. ->Attribute(AZ::Edit::Attributes::AutoExpand, false)
  86. // Auto-gen editor context settings for overrides
  87. #define EDITOR_CLASS LookModificationComponentConfig
  88. #include <Atom/Feature/ParamMacros/StartOverrideEditorContext.inl>
  89. #include <Atom/Feature/PostProcess/LookModification/LookModificationParams.inl>
  90. #include <Atom/Feature/ParamMacros/EndParams.inl>
  91. #undef EDITOR_CLASS
  92. ;
  93. }
  94. }
  95. if (auto behaviorContext = azrtti_cast<BehaviorContext*>(context))
  96. {
  97. behaviorContext->Class<EditorLookModificationComponent>()->RequestBus("LookModificationRequestBus");
  98. behaviorContext->ConstantProperty("EditorLookModificationComponentTypeId", BehaviorConstant(Uuid(EditorLookModificationComponentTypeId)))
  99. ->Attribute(AZ::Script::Attributes::Module, "render")
  100. ->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation);
  101. }
  102. }
  103. EditorLookModificationComponent::EditorLookModificationComponent(const LookModificationComponentConfig& config)
  104. : BaseClass(config)
  105. {
  106. }
  107. u32 EditorLookModificationComponent::OnConfigurationChanged()
  108. {
  109. m_controller.OnConfigChanged();
  110. return Edit::PropertyRefreshLevels::AttributesAndValues;
  111. }
  112. }
  113. }