123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- /*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
- #include <PostProcess/ChromaticAberration/EditorChromaticAberrationComponent.h>
- #include <AzCore/RTTI/BehaviorContext.h>
- namespace AZ
- {
- namespace Render
- {
- void EditorChromaticAberrationComponent::Reflect(AZ::ReflectContext* context)
- {
- BaseClass::Reflect(context);
- if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
- {
- serializeContext->Class<EditorChromaticAberrationComponent, BaseClass>()->Version(0);
- if (AZ::EditContext* editContext = serializeContext->GetEditContext())
- {
- editContext->Class<EditorChromaticAberrationComponent>("Chromatic Aberration", "Controls the Chromatic Aberration")
- ->ClassElement(Edit::ClassElements::EditorData, "")
- ->Attribute(Edit::Attributes::Category, "Graphics/PostFX")
- ->Attribute(
- AZ::Edit::Attributes::Icon, "Icons/Components/Component_Placeholder.svg") // [GFX TODO ATOM-2672][PostFX] need to create icons for PostProcessing.
- ->Attribute(
- AZ::Edit::Attributes::ViewportIcon,
- "Icons/Components/Viewport/Component_Placeholder.svg") // [GFX TODO ATOM-2672][PostFX] need to create icons for PostProcessing.
- ->Attribute(Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC_CE("Game"))
- ->Attribute(Edit::Attributes::AutoExpand, true)
- ->Attribute(
- Edit::Attributes::HelpPageURL,
- "https://o3de.org/docs/user-guide/components/reference/atom/ChromaticAberration/") // [TODO ATOM-2672][PostFX] need create page for PostProcessing.
- ;
- editContext->Class<ChromaticAberrationComponentController>("ChromaticAberrationComponentController", "")
- ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
- ->Attribute(AZ::Edit::Attributes::AutoExpand, true)
- ->DataElement(AZ::Edit::UIHandlers::Default, &ChromaticAberrationComponentController::m_configuration, "Configuration", "")
- ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly);
- editContext->Class<ChromaticAberrationComponentConfig>("ChromaticAberrationComponentConfig", "")
- ->DataElement(
- Edit::UIHandlers::CheckBox, &ChromaticAberrationComponentConfig::m_enabled, "Enable Chromatic Aberration", "Enable Chromatic Aberration.")
- ->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
- ->DataElement(AZ::Edit::UIHandlers::Slider, &ChromaticAberrationComponentConfig::m_strength, "Strength", "Strength of effect")
- ->Attribute(AZ::Edit::Attributes::Min, 0.0f)
- ->Attribute(AZ::Edit::Attributes::Max, 1.0f)
- ->Attribute(AZ::Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
- ->Attribute(Edit::Attributes::ReadOnly, &ChromaticAberrationComponentConfig::ArePropertiesReadOnly)
- ->DataElement(
- AZ::Edit::UIHandlers::Slider, &ChromaticAberrationComponentConfig::m_blend, "Blend", "Factor for additive blending with original image")
- ->Attribute(AZ::Edit::Attributes::Min, 0.0f)
- ->Attribute(AZ::Edit::Attributes::Max, 1.0f)
- ->Attribute(AZ::Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
- ->Attribute(Edit::Attributes::ReadOnly, &ChromaticAberrationComponentConfig::ArePropertiesReadOnly)
- // Overrides
- ->ClassElement(AZ::Edit::ClassElements::Group, "Overrides")
- ->Attribute(AZ::Edit::Attributes::AutoExpand, false)
- // Auto-gen editor context settings for overrides
- #define EDITOR_CLASS ChromaticAberrationComponentConfig
- #include <Atom/Feature/ParamMacros/StartOverrideEditorContext.inl>
- #include <Atom/Feature/PostProcess/ChromaticAberration/ChromaticAberrationParams.inl>
- #include <Atom/Feature/ParamMacros/EndParams.inl>
- #undef EDITOR_CLASS
- ;
- }
- }
- if (auto behaviorContext = azrtti_cast<BehaviorContext*>(context))
- {
- behaviorContext->Class<EditorChromaticAberrationComponent>()->RequestBus("ChromaticAberrationRequestBus");
- behaviorContext
- ->ConstantProperty("EditorChromaticAberrationComponentTypeId", BehaviorConstant(Uuid(ChromaticAberration::EditorChromaticAberrationComponentTypeId)))
- ->Attribute(AZ::Script::Attributes::Module, "render")
- ->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation);
- }
- }
- EditorChromaticAberrationComponent::EditorChromaticAberrationComponent(const ChromaticAberrationComponentConfig& config)
- : BaseClass(config)
- {
- }
- u32 EditorChromaticAberrationComponent::OnConfigurationChanged()
- {
- m_controller.OnConfigChanged();
- return Edit::PropertyRefreshLevels::AttributesAndValues;
- }
- } // namespace Render
- } // namespace AZ
|