3
0

EditorDiffuseGlobalIlluminationComponent.cpp 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 <EditorComponents/EditorDiffuseGlobalIlluminationComponent.h>
  10. namespace AZ
  11. {
  12. namespace Render
  13. {
  14. void EditorDiffuseGlobalIlluminationComponent::Reflect(AZ::ReflectContext* context)
  15. {
  16. BaseClass::Reflect(context);
  17. if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
  18. {
  19. serializeContext->Class<EditorDiffuseGlobalIlluminationComponent, BaseClass>()
  20. ->Version(1);
  21. if (AZ::EditContext* editContext = serializeContext->GetEditContext())
  22. {
  23. editContext->Class<EditorDiffuseGlobalIlluminationComponent>(
  24. "Diffuse Global Illumination", "Diffuse Global Illumination configuration")
  25. ->ClassElement(Edit::ClassElements::EditorData, "")
  26. ->Attribute(Edit::Attributes::Category, "Graphics/Lighting")
  27. ->Attribute(AZ::Edit::Attributes::Icon, "Icons/Components/Component_Placeholder.svg")
  28. ->Attribute(AZ::Edit::Attributes::ViewportIcon, "Icons/Components/Viewport/Component_Placeholder.svg")
  29. ->Attribute(Edit::Attributes::AppearsInAddComponentMenu, AZStd::vector<AZ::Crc32>({ AZ_CRC("Level", 0x9aeacc13) }))
  30. ->Attribute(Edit::Attributes::AutoExpand, true)
  31. ->Attribute(Edit::Attributes::HelpPageURL, "https://")
  32. ;
  33. editContext->Class<DiffuseGlobalIlluminationComponentController>(
  34. "ToneMapperComponentControl", "")
  35. ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
  36. ->Attribute(AZ::Edit::Attributes::AutoExpand, true)
  37. ->DataElement(AZ::Edit::UIHandlers::Default, &DiffuseGlobalIlluminationComponentController::m_configuration, "Configuration", "")
  38. ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
  39. ;
  40. editContext->Class<DiffuseGlobalIlluminationComponentConfig>("DiffuseGlobalIlluminationComponentConfig", "")
  41. ->ClassElement(Edit::ClassElements::EditorData, "")
  42. ->DataElement(Edit::UIHandlers::ComboBox, &DiffuseGlobalIlluminationComponentConfig::m_qualityLevel, "Quality Level", "Quality Level")
  43. ->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
  44. ->EnumAttribute(DiffuseGlobalIlluminationQualityLevel::Low, "Low")
  45. ->EnumAttribute(DiffuseGlobalIlluminationQualityLevel::Medium, "Medium")
  46. ->EnumAttribute(DiffuseGlobalIlluminationQualityLevel::High, "High")
  47. ;
  48. }
  49. }
  50. if (auto behaviorContext = azrtti_cast<BehaviorContext*>(context))
  51. {
  52. behaviorContext->ConstantProperty("EditorDiffuseGlobalIlluminationComponentTypeId", BehaviorConstant(Uuid(EditorDiffuseGlobalIlluminationComponentTypeId)))
  53. ->Attribute(AZ::Script::Attributes::Module, "render")
  54. ->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation);
  55. }
  56. }
  57. EditorDiffuseGlobalIlluminationComponent::EditorDiffuseGlobalIlluminationComponent(const DiffuseGlobalIlluminationComponentConfig& config)
  58. : BaseClass(config)
  59. {
  60. }
  61. u32 EditorDiffuseGlobalIlluminationComponent::OnConfigurationChanged()
  62. {
  63. m_controller.OnConfigChanged();
  64. return Edit::PropertyRefreshLevels::AttributesAndValues;
  65. }
  66. }
  67. }