#include <EditorComponentAdapter.h>
Inherits AzToolsFramework::Components::EditorComponentBase.
Public Member Functions | |
AZ_RTTI ((EditorComponentAdapter, "{2F5A3669-FFE9-4CD7-B9E2-7FC8100CF1A2}", TController, TRuntimeComponent, TConfiguration), EditorComponentBase) | |
EditorComponentAdapter (const TConfiguration &configuration) | |
void | Init () override |
void | Activate () override |
void | Deactivate () override |
void | BuildGameEntity (AZ::Entity *gameEntity) override |
Public Member Functions inherited from AzToolsFramework::Components::EditorComponentBase | |
AZ_RTTI (EditorComponentBase, "{D5346BD4-7F20-444E-B370-327ACD03D4A0}", AZ::Component) | |
EditorComponentBase () | |
void | SetDirty () |
virtual void | Init () override |
virtual void | Activate () override |
virtual void | Deactivate () override |
void | OnAfterEntitySet () override final |
void | SetSerializedIdentifier (AZStd::string serializedIdentifier) override final |
AZStd::string | GetSerializedIdentifier () const override final |
AZ::TransformInterface * | GetTransform () const |
AZ::Transform | GetWorldTM () const |
AZ::Transform | GetLocalTM () const |
bool | IsSelected () const |
virtual void | BuildGameEntity (AZ::Entity *) |
virtual void | SetPrimaryAsset (const AZ::Data::AssetId &) |
virtual void | AddContextMenuActions (QMenu *) |
Static Public Member Functions | |
static void | GetProvidedServices (AZ::ComponentDescriptor::DependencyArrayType &services) |
static void | GetIncompatibleServices (AZ::ComponentDescriptor::DependencyArrayType &services) |
static void | GetRequiredServices (AZ::ComponentDescriptor::DependencyArrayType &services) |
static void | GetDependentServices (AZ::ComponentDescriptor::DependencyArrayType &services) |
Static Public Member Functions inherited from AzToolsFramework::Components::EditorComponentBase | |
static void | Reflect (AZ::ReflectContext *context) |
Static Protected Member Functions | |
static void | Reflect (AZ::ReflectContext *context) |
Protected Attributes | |
TController | m_controller |
EditorComponentAdapter is a utility base class that provides a consistent pattern for implementing components that operate in the editor but may need to share code in different contexts like the launcher.
EditorComponentAdapter achieves this by delegating to a controller class that implements common behavior instead of duplicating code between multiple components.
To use the EditorComponentAdapter, 3 classes are required:
The concrete component extends the adapter and implements behavior which is unique to the component.
TController can handle any common functionality between the runtime and editor component and is where most of the code for the component will live
TConfiguration is where any data that needs to be serialized out should live.
TController must implement certain functions to conform to the template. These functions mirror those in AZ::Component and must be accesible to any adapter that follows this pattern:
In addition, certain functions will optionally be called if they are available:
It is recommended that TController handle the SerializeContext, but the editor components handle the EditContext. TController can friend itself to the editor component to make this work if required.
|
overridevirtual |
Gets the transform component and selection component of the entity that the component belongs to, if the entity has them. Overrides AZ::Component::Activate().
Important: Components derived from EditorComponentBase must call the Activate() function of the base class.
Reimplemented from AzToolsFramework::Components::EditorComponentBase.
|
overridevirtual |
Override this function to create one or more game components to represent your editor component in runtime.
Important: If your entity has a game component, you must implement this function.
This function is called by the slice builder. Any game components that you create should be attached to the game entity that is provided to this function. If you do not need to create a game component, you do not need to override this function. The provided component to the gameEntity is dynamically generated and owned by the gameEntity and should be deallocated appropriately.
gameEntity | A pointer to the game entity. |
Reimplemented from AzToolsFramework::Components::EditorComponentBase.
|
overridevirtual |
Sets the component's pointers to the transform component and selection component to null. Overrides AZ::Component::Deactivate().
Important: Components derived from EditorComponentBase must call the Deactivate() function of the base class.
Reimplemented from AzToolsFramework::Components::EditorComponentBase.
|
overridevirtual |
Initializes the component's resources. Overrides AZ::Component::Init().
Important: Components derived from EditorComponentBase must call the Init() function of the base class.
(Optional) You can override this function to initialize resources that the component needs.
Reimplemented from AzToolsFramework::Components::EditorComponentBase.