3
0

EditorSpecularReflectionsComponent.cpp 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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 <SpecularReflections/EditorSpecularReflectionsComponent.h>
  10. namespace AZ
  11. {
  12. namespace Render
  13. {
  14. void EditorSpecularReflectionsComponent::Reflect(AZ::ReflectContext* context)
  15. {
  16. BaseClass::Reflect(context);
  17. if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
  18. {
  19. serializeContext->Class<EditorSpecularReflectionsComponent, BaseClass>()
  20. ->Version(1);
  21. if (AZ::EditContext* editContext = serializeContext->GetEditContext())
  22. {
  23. editContext->Class<EditorSpecularReflectionsComponent>(
  24. "Specular Reflections", "Specular Reflections 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<SpecularReflectionsComponentController>(
  34. "SpecularReflectionsComponentControl", "")
  35. ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
  36. ->Attribute(AZ::Edit::Attributes::AutoExpand, true)
  37. ->DataElement(AZ::Edit::UIHandlers::Default, &SpecularReflectionsComponentController::m_configuration, "Configuration", "")
  38. ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
  39. ;
  40. editContext->Class<SpecularReflectionsComponentSSRConfig>("Screen Space Reflections (SSR)", "Screen Space Reflections (SSR) Configuration")
  41. ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
  42. ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
  43. ->Attribute(AZ::Edit::Attributes::AutoExpand, true)
  44. ->DataElement(AZ::Edit::UIHandlers::Default, &SpecularReflectionsComponentSSRConfig::m_options, "SSR Options", "")
  45. ->Attribute(AZ::Edit::Attributes::AutoExpand, true)
  46. ;
  47. editContext->Class<SpecularReflectionsComponentConfig>("Specular Reflections Component", "Configures specular reflection options for the level")
  48. ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
  49. ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
  50. ->Attribute(AZ::Edit::Attributes::AutoExpand, true)
  51. ->DataElement(AZ::Edit::UIHandlers::Default, &SpecularReflectionsComponentConfig::m_ssr, "SSR configuration", "")
  52. ->Attribute(AZ::Edit::Attributes::AutoExpand, true)
  53. ;
  54. }
  55. }
  56. if (auto behaviorContext = azrtti_cast<BehaviorContext*>(context))
  57. {
  58. behaviorContext->ConstantProperty("EditorSpecularReflectionsComponentTypeId", BehaviorConstant(Uuid(EditorSpecularReflectionsComponentTypeId)))
  59. ->Attribute(AZ::Script::Attributes::Module, "render")
  60. ->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation);
  61. }
  62. }
  63. EditorSpecularReflectionsComponent::EditorSpecularReflectionsComponent(const SpecularReflectionsComponentConfig& config)
  64. : BaseClass(config)
  65. {
  66. }
  67. u32 EditorSpecularReflectionsComponent::OnConfigurationChanged()
  68. {
  69. m_controller.OnConfigChanged();
  70. return Edit::PropertyRefreshLevels::AttributesAndValues;
  71. }
  72. }
  73. }