EditorGradientWeightModifierComponent.cpp 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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 <PostProcess/GradientWeightModifier/EditorGradientWeightModifierComponent.h>
  9. #include <AtomLyIntegration/CommonFeatures/PostProcess/GradientWeightModifier/GradientWeightModifierComponentConstants.h>
  10. namespace AZ
  11. {
  12. namespace Render
  13. {
  14. void EditorGradientWeightModifierComponent::Reflect(AZ::ReflectContext* context)
  15. {
  16. BaseClass::Reflect(context);
  17. if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
  18. {
  19. serializeContext->Class<EditorGradientWeightModifierComponent, BaseClass>()
  20. ->Version(1);
  21. if (AZ::EditContext* editContext = serializeContext->GetEditContext())
  22. {
  23. editContext->Class<EditorGradientWeightModifierComponent>(
  24. "PostFX Gradient Weight Modifier", "Modifies PostFX override factor based on a gradient signal sampled from an entity")
  25. ->ClassElement(Edit::ClassElements::EditorData, "")
  26. ->Attribute(Edit::Attributes::Category, "Graphics/PostFX")
  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, AZ_CRC_CE("Game"))
  30. ->Attribute(Edit::Attributes::AutoExpand, true)
  31. ->Attribute(Edit::Attributes::HelpPageURL, "https://o3de.org/docs/user-guide/components/reference/atom/postfx-gradient-weight-modifier/")
  32. ;
  33. editContext->Class<GradientWeightModifierComponentController>("GradientWeightModifierComponentController", "")
  34. ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
  35. ->Attribute(AZ::Edit::Attributes::AutoExpand, true)
  36. ->DataElement(AZ::Edit::UIHandlers::Default, &GradientWeightModifierComponentController::m_configuration, "Configuration", "")
  37. ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
  38. ;
  39. editContext->Class<GradientWeightModifierComponentConfig>("GradientWeightModifierComponentConfig", "")
  40. ->DataElement(AZ::Edit::UIHandlers::Default, &GradientWeightModifierComponentConfig::m_gradientSampler, "Gradient Sampler", "Gradient sampler configuration")
  41. ->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
  42. ;
  43. }
  44. }
  45. if (auto behaviorContext = azrtti_cast<BehaviorContext*>(context))
  46. {
  47. behaviorContext->Class<EditorGradientWeightModifierComponent>()->RequestBus("PostFxWeightRequestBus");
  48. behaviorContext->ConstantProperty("EditorGradientWeightModifierComponentTypeId", BehaviorConstant(Uuid(EditorGradientWeightModifierComponentTypeId)))
  49. ->Attribute(AZ::Script::Attributes::Module, "render")
  50. ->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation);
  51. }
  52. }
  53. EditorGradientWeightModifierComponent::EditorGradientWeightModifierComponent(const GradientWeightModifierComponentConfig& config)
  54. : BaseClass(config)
  55. {
  56. }
  57. AZ::u32 EditorGradientWeightModifierComponent::OnConfigurationChanged()
  58. {
  59. return Edit::PropertyRefreshLevels::AttributesAndValues;
  60. }
  61. }
  62. }