| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- /*
- * 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/PaniniProjection/EditorPaniniProjectionComponent.h>
- #include <AzCore/RTTI/BehaviorContext.h>
- namespace AZ
- {
- namespace Render
- {
- void EditorPaniniProjectionComponent::Reflect(AZ::ReflectContext* context)
- {
- BaseClass::Reflect(context);
- if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
- {
- serializeContext->Class<EditorPaniniProjectionComponent, BaseClass>()->Version(0);
- if (AZ::EditContext* editContext = serializeContext->GetEditContext())
- {
- editContext->Class<EditorPaniniProjectionComponent>("Panini Projection", "Controls the Panini Projection")
- ->ClassElement(Edit::ClassElements::EditorData, "")
- ->Attribute(Edit::Attributes::Category, "Graphics/PostFX")
- ->Attribute(
- AZ::Edit::Attributes::Icon, "Icons/Components/Component_Placeholder.svg") // Create better icons for this effect
- ->Attribute(
- AZ::Edit::Attributes::ViewportIcon,
- "Icons/Components/Viewport/Component_Placeholder.svg") // Create better icons for this effect
- ->Attribute(Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game", 0x232b318c))
- ->Attribute(Edit::Attributes::AutoExpand, true)
- ->Attribute(
- Edit::Attributes::HelpPageURL,
- "https://o3de.org/docs/user-guide/components/reference/atom/PaniniProjection/") // Create documentation page for this effect
- ;
- editContext->Class<PaniniProjectionComponentController>("PaniniProjectionComponentController", "")
- ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
- ->Attribute(AZ::Edit::Attributes::AutoExpand, true)
- ->DataElement(AZ::Edit::UIHandlers::Default, &PaniniProjectionComponentController::m_configuration, "Configuration", "")
- ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly);
- editContext->Class<PaniniProjectionComponentConfig>("PaniniProjectionComponentConfig", "")
- ->DataElement(
- Edit::UIHandlers::CheckBox, &PaniniProjectionComponentConfig::m_enabled, "Enable Panini Projection", "Enable Panini Projection.")
- ->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
- ->DataElement(AZ::Edit::UIHandlers::Slider, &PaniniProjectionComponentConfig::m_depth, "Depth", "Depth of focal point")
- ->Attribute(AZ::Edit::Attributes::Min, 0.0f)
- ->Attribute(AZ::Edit::Attributes::SoftMax, 10.f)
- ->Attribute(AZ::Edit::Attributes::Max, 100.f)
- ->Attribute(AZ::Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
- ->Attribute(Edit::Attributes::ReadOnly, &PaniniProjectionComponentConfig::ArePropertiesReadOnly)
- // Overrides
- ->ClassElement(AZ::Edit::ClassElements::Group, "Overrides")
- ->Attribute(AZ::Edit::Attributes::AutoExpand, false)
- // Auto-gen editor context settings for overrides
- #define EDITOR_CLASS PaniniProjectionComponentConfig
- #include <Atom/Feature/ParamMacros/StartOverrideEditorContext.inl>
- #include <Atom/Feature/PostProcess/PaniniProjection/PaniniProjectionParams.inl>
- #include <Atom/Feature/ParamMacros/EndParams.inl>
- #undef EDITOR_CLASS
- ;
- }
- }
- if (auto behaviorContext = azrtti_cast<BehaviorContext*>(context))
- {
- behaviorContext->Class<EditorPaniniProjectionComponent>()->RequestBus("PaniniProjectionRequestBus");
- behaviorContext
- ->ConstantProperty("EditorPaniniProjectionComponentTypeId", BehaviorConstant(Uuid(PaniniProjection::EditorPaniniProjectionComponentTypeId)))
- ->Attribute(AZ::Script::Attributes::Module, "render")
- ->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation);
- }
- }
- EditorPaniniProjectionComponent::EditorPaniniProjectionComponent(const PaniniProjectionComponentConfig& config)
- : BaseClass(config)
- {
- }
- u32 EditorPaniniProjectionComponent::OnConfigurationChanged()
- {
- m_controller.OnConfigChanged();
- return Edit::PropertyRefreshLevels::AttributesAndValues;
- }
- } // namespace Render
- } // namespace AZ
|