You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
o3de/Gems/AtomLyIntegration/CommonFeatures/Code/Source/PostProcess/GradientWeightModifier/EditorGradientWeightModifie...

74 lines
3.7 KiB
C++

/*
* Copyright (c) Contributors to the Open 3D Engine Project
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include <PostProcess/GradientWeightModifier/EditorGradientWeightModifierComponent.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/GradientWeightModifier/GradientWeightModifierComponentConstants.h>
namespace AZ
{
namespace Render
{
void EditorGradientWeightModifierComponent::Reflect(AZ::ReflectContext* context)
{
BaseClass::Reflect(context);
if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<EditorGradientWeightModifierComponent, BaseClass>()
->Version(1);
if (AZ::EditContext* editContext = serializeContext->GetEditContext())
{
editContext->Class<EditorGradientWeightModifierComponent>(
"PostFX Gradient Weight Modifier", "Modifies PostFX override factor based on a gradient signal sampled from an entity")
->ClassElement(Edit::ClassElements::EditorData, "")
->Attribute(Edit::Attributes::Category, "Atom")
->Attribute(AZ::Edit::Attributes::Icon, "Icons/Components/Component_Placeholder.svg")
->Attribute(AZ::Edit::Attributes::ViewportIcon, "Icons/Components/Viewport/Component_Placeholder.png")
->Attribute(Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game", 0x232b318c))
->Attribute(Edit::Attributes::AutoExpand, true)
->Attribute(Edit::Attributes::HelpPageURL, "")
;
editContext->Class<GradientWeightModifierComponentController>("GradientWeightModifierComponentController", "")
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
->DataElement(AZ::Edit::UIHandlers::Default, &GradientWeightModifierComponentController::m_configuration, "Configuration", "")
->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
;
editContext->Class<GradientWeightModifierComponentConfig>("GradientWeightModifierComponentConfig", "")
->DataElement(AZ::Edit::UIHandlers::Default, &GradientWeightModifierComponentConfig::m_gradientSampler, "Gradient Sampler", "Gradient sampler configuration")
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
;
}
}
if (auto behaviorContext = azrtti_cast<BehaviorContext*>(context))
{
behaviorContext->Class<EditorGradientWeightModifierComponent>()->RequestBus("PostFxWeightRequestBus");
behaviorContext->ConstantProperty("EditorGradientWeightModifierComponentTypeId", BehaviorConstant(Uuid(EditorGradientWeightModifierComponentTypeId)))
->Attribute(AZ::Script::Attributes::Module, "render")
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation);
}
}
EditorGradientWeightModifierComponent::EditorGradientWeightModifierComponent(const GradientWeightModifierComponentConfig& config)
: BaseClass(config)
{
}
AZ::u32 EditorGradientWeightModifierComponent::OnConfigurationChanged()
{
return Edit::PropertyRefreshLevels::AttributesAndValues;
}
}
}