/* * 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 #include #include #include #include #include #include namespace ${Name} { void Editor${Name}Component::Reflect(AZ::ReflectContext* context) { BaseClass::Reflect(context); if (AZ::SerializeContext* serializeContext = azrtti_cast(context)) { serializeContext->Class() ; if (AZ::EditContext* editContext = serializeContext->GetEditContext()) { editContext->Class( "${Name}", "The ${Name} component") ->ClassElement(AZ::Edit::ClassElements::EditorData, "") ->Attribute(AZ::Edit::Attributes::Category, "Graphics") ->Attribute(AZ::Edit::Attributes::Icon, "Icons/Components/Component_Placeholder.svg") ->Attribute(AZ::Edit::Attributes::ViewportIcon, "Icons/Components/Viewport/Component_Placeholder.svg") ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC_CE("Game")) ->Attribute(AZ::Edit::Attributes::AutoExpand, true) ->Attribute(AZ::Edit::Attributes::HelpPageURL, "") ; } } if (auto behaviorContext = azrtti_cast(context)) { behaviorContext->ConstantProperty(${Name}EditorSystemComponentTypeId, BehaviorConstant(AZ::Uuid(${Name}EditorSystemComponentTypeId))) ->Attribute(AZ::Script::Attributes::Module, "render") ->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation); } } Editor${Name}Component::Editor${Name}Component() { } Editor${Name}Component::Editor${Name}Component(const ${Name}ComponentConfig& config) : BaseClass(config) { } void Editor${Name}Component::Activate() { BaseClass::Activate(); AzFramework::EntityDebugDisplayEventBus::Handler::BusConnect(GetEntityId()); AzToolsFramework::EditorComponentSelectionRequestsBus::Handler::BusConnect(GetEntityId()); AZ::TickBus::Handler::BusConnect(); AzToolsFramework::EditorEntityInfoNotificationBus::Handler::BusConnect(); AZ::u64 entityId = (AZ::u64)GetEntityId(); m_controller.m_configuration.m_entityId = entityId; } void Editor${Name}Component::Deactivate() { AzToolsFramework::EditorEntityInfoNotificationBus::Handler::BusDisconnect(); AZ::TickBus::Handler::BusDisconnect(); AzToolsFramework::EditorComponentSelectionRequestsBus::Handler::BusDisconnect(); AzFramework::EntityDebugDisplayEventBus::Handler::BusDisconnect(); BaseClass::Deactivate(); } void Editor${Name}Component::OnTick([[maybe_unused]] float deltaTime, [[maybe_unused]] AZ::ScriptTimePoint time) { if (!m_controller.m_featureProcessor) { return; } } }