| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- /*
- * 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 <Tools/Components/Editor${Name}Component.h>
- #include <AzFramework/StringFunc/StringFunc.h>
- #include <AzToolsFramework/API/ToolsApplicationAPI.h>
- #include <AzToolsFramework/Entity/EditorEntityInfoBus.h>
- #include <AzToolsFramework/API/EditorAssetSystemAPI.h>
- #include <AzCore/Component/Entity.h>
- #include <AzCore/IO/SystemFile.h>
- namespace ${Name}
- {
- void Editor${Name}Component::Reflect(AZ::ReflectContext* context)
- {
- BaseClass::Reflect(context);
- if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
- {
- serializeContext->Class<Editor${Name}Component, BaseClass>()
- ;
- if (AZ::EditContext* editContext = serializeContext->GetEditContext())
- {
- editContext->Class<Editor${Name}Component>(
- "${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<AZ::BehaviorContext*>(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;
- }
- }
- }
|