Menu
Lumberyard
C++ API Reference (Version 1.10)

AzToolsFramework::Components::EditorComponentBase Class Reference

Open 3D Engine (O3DE), the successor to Lumberyard, is now available in Developer Preview. Download O3DE or visit the AWS Game Tech blog to learn more.

A base class for all editor components. More...

Inherits AZ::Component .

Public Member Functions

AZ_RTTI ( EditorComponentBase , "{D5346BD4-7F20-444E-B370-327ACD03D4A0}", AZ::Component)
Adds run-time type information to the component. More...
EditorComponentBase ()
Creates an instance of this class. More...
void SetDirty ()
Sets a flag on the entire entity to indicate that the entity's properties were modified. More...
virtual void Init () override
Initializes the component's resources. More...
virtual void Activate () override
Gets the transform component and selection component of the entity that the component belongs to, if the entity has them. More...
virtual void Deactivate () override
Sets the component's pointers to the transform component and selection component to null. More...
AZ::TransformInterface * GetTransform () const
Gets the transform interface of the entity that the component belongs to, if the entity has a transform component. More...
SelectionComponent * GetSelection () const
Gets the selection component of the entity that the component belongs to, if the entity has a selection component. More...
AZ::Transform GetWorldTM () const
Gets the world transform of the entity that the component belongs to, if the entity has a transform component. More...
AZ::Transform GetLocalTM () const
Gets the local transform of the entity that the component belongs to, if the entity has a transform component. More...
bool IsSelected () const
Identifies whether the component is selected in the editor. More...
bool IsPrimarySelection () const
Identifies whether the component is the primary selection in the editor. More...
bool HasSelectionComponent () const
Determines if the entity that the component belongs to has a selection component. More...
virtual void BuildGameEntity ( AZ::Entity *)
Override this function to create one or more game components to represent your editor component in runtime. More...
virtual void FinishedBuildingGameEntity ( AZ::Entity *)
Called by the slice builder after the game entity is saved, right before deleting the game entity. More...
virtual void SetPrimaryAsset (const AZ::Data::AssetId &)
Implement this function to support dragging and dropping an asset onto this component. More...
- Public Member Functions inherited from AZ::Component
AZ_RTTI ( AZ::Component , "{EDFCB2CF-F75D-43BE-B26B-F35821B29247}")
Adds run-time type information to the component. More...
Component ()
Initializes a component's internals. More...
virtual ~Component ()
Destroys a component. More...
Entity * GetEntity () const
Returns a pointer to the entity. More...
EntityId GetEntityId () const
Returns the entity ID if the component is attached to an entity. More...
ComponentId GetId () const
Returns the component ID, which is valid only when the component is attached to an entity. More...
void SetId (const ComponentId &id)
Sets the component ID. More...

Static Public Member Functions

static void Reflect ( AZ::ReflectContext *context)
Reflects component data into a variety of contexts (script, serialize, edit, and so on). More...

Friends

class EditorEntityActionComponent
class EditorDisabledCompositionComponent
class EditorPendingCompositionComponent

Additional Inherited Members

- Protected Member Functions inherited from AZ::Component
void SetEntity ( Entity *entity)
Sets the current entity. More...
- Static Protected Member Functions inherited from AZ::Component
static void ReflectInternal ( ReflectContext *reflection)
Reflects the Component class. More...
- Protected Attributes inherited from AZ::Component
Entity * m_entity
Reference to the entity that owns the component. The value is null if the component is not attached to an entity. More...
ComponentId m_id
A component ID that is unique for an entity. This component ID is not unique across all entities. More...

Detailed Description

A base class for all editor components.

Derive from this class to create a version of a component to use in the editor, as opposed to the version of the component that is used during runtime.

Important: Game components must not inherit from EditorComponentBase . To create one or more game components to represent your editor component in runtime, use BuildGameEntity() .

To learn more about editor components, see the Lumberyard User Guide .

Constructor & Destructor Documentation

EditorComponentBase()

AzToolsFramework::Components::EditorComponentBase::EditorComponentBase ( )

Creates an instance of this class.

Member Function Documentation

Activate()

virtual void AzToolsFramework::Components::EditorComponentBase::Activate ( )
override virtual

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.

Implements AZ::Component .

AZ_RTTI()

AzToolsFramework::Components::EditorComponentBase::AZ_RTTI ( EditorComponentBase ,
"{D5346BD4-7F20-444E-B370-327ACD03D4A0}" ,
AZ::Component
)

Adds run-time type information to the component.

BuildGameEntity()

virtual void AzToolsFramework::Components::EditorComponentBase::BuildGameEntity ( AZ::Entity * )
inline virtual

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.

Parameters
gameEntity A pointer to the game entity.

Deactivate()

virtual void AzToolsFramework::Components::EditorComponentBase::Deactivate ( )
override virtual

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.

Implements AZ::Component .

FinishedBuildingGameEntity()

virtual void AzToolsFramework::Components::EditorComponentBase::FinishedBuildingGameEntity ( AZ::Entity * )
inline virtual

Called by the slice builder after the game entity is saved, right before deleting the game entity.

If you want to retain ownership of a component that you gave to the game entity using BuildGameEntity() , remove the component from the game entity here.

Parameters
gameEntity A pointer to the game entity.

GetLocalTM()

AZ::Transform AzToolsFramework::Components::EditorComponentBase::GetLocalTM ( ) const

Gets the local transform of the entity that the component belongs to, if the entity has a transform component.

An entity's local transform is the entity's position relative to its parent entity.

Returns
The local transform, if the entity has one. Otherwise, returns the identity transform, which is the equivalent of no transform.

GetSelection()

SelectionComponent* AzToolsFramework::Components::EditorComponentBase::GetSelection ( ) const

Gets the selection component of the entity that the component belongs to, if the entity has a selection component.

A selection component keeps track of whether the entity is selected in the editor.

Returns
A pointer to the selection component. Might be null if you did not include "SelectionService" in the component's AZ::ComponentDescriptor::GetRequiredServices() .

GetTransform()

AZ::TransformInterface * AzToolsFramework::Components::EditorComponentBase::GetTransform ( ) const

Gets the transform interface of the entity that the component belongs to, if the entity has a transform component.

A transform positions, rotates, and scales an entity in 3D space.

Returns
A pointer to the transform interface. Might be null if you did not include "TransformService" in the component's AZ::ComponentDescriptor::GetRequiredServices() .

GetWorldTM()

AZ::Transform AzToolsFramework::Components::EditorComponentBase::GetWorldTM ( ) const

Gets the world transform of the entity that the component belongs to, if the entity has a transform component.

An entity's world transform is the entity's position within the entire game space.

Returns
The world transform, if the entity has one. Otherwise, returns the identity transform, which is the equivalent of no transform.

HasSelectionComponent()

bool AzToolsFramework::Components::EditorComponentBase::HasSelectionComponent ( ) const
inline

Determines if the entity that the component belongs to has a selection component.

A selection component keeps track of whether the entity is selected in the editor.

Returns
True if the entity has a selection component. Otherwise, false.

Init()

virtual void AzToolsFramework::Components::EditorComponentBase::Init ( )
override virtual

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 AZ::Component .

IsPrimarySelection()

bool AzToolsFramework::Components::EditorComponentBase::IsPrimarySelection ( ) const

Identifies whether the component is the primary selection in the editor.

Returns
True if the component is the primary selection in the editor. Otherwise, false.

IsSelected()

bool AzToolsFramework::Components::EditorComponentBase::IsSelected ( ) const

Identifies whether the component is selected in the editor.

Returns
True if the component is selected in the editor. Otherwise, false.

Reflect()

static void AzToolsFramework::Components::EditorComponentBase::Reflect ( AZ::ReflectContext * context )
static

Reflects component data into a variety of contexts (script, serialize, edit, and so on).

Parameters
context A pointer to the reflection context.

SetDirty()

void AzToolsFramework::Components::EditorComponentBase::SetDirty ( )

Sets a flag on the entire entity to indicate that the entity's properties were modified.

Call this function whenever you alter an entity in an unexpected manner. For example, edits that you make to one entity might affect other entities, so the affected entities need to know that something changed. You do not need to call this function when editing an entity's property in the Property Editor, because that scenario automatically sets the flag. You need to call this function only when your entity's properties are modified outside the Property Editor, such as when a script loops over all lights and alters their radii.

SetPrimaryAsset()

virtual void AzToolsFramework::Components::EditorComponentBase::SetPrimaryAsset ( const AZ::Data::AssetId & )
inline virtual

Implement this function to support dragging and dropping an asset onto this component.

Parameters
assetId A reference to the ID of the asset to drag and drop.

Friends And Related Function Documentation

EditorDisabledCompositionComponent

friend class EditorDisabledCompositionComponent
friend

EditorEntityActionComponent

friend class EditorEntityActionComponent
friend

EditorPendingCompositionComponent

friend class EditorPendingCompositionComponent
friend

The documentation for this class was generated from the following file: