Open 3D Engine AzToolsFramework API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AzToolsFramework::Components::GenericComponentWrapper Class Reference

#include <GenericComponentWrapper.h>

Inherits AzToolsFramework::Components::EditorComponentBase, and AzFramework::EntityDebugDisplayEventBus::Handler.

Public Member Functions

 AZ_CLASS_ALLOCATOR (GenericComponentWrapper, AZ::SystemAllocator)
 
 AZ_RTTI (GenericComponentWrapper, "{68D358CA-89B9-4730-8BA6-E181DEA28FDE}", EditorComponentBase)
 
 GenericComponentWrapper (const AZ::SerializeContext::ClassData *templateClassData)
 
 GenericComponentWrapper (AZ::Component *templateClass)
 
 GenericComponentWrapper (const GenericComponentWrapper &RHS)
 
 GenericComponentWrapper (GenericComponentWrapper &&RHS)
 
GenericComponentWrapperoperator= (const GenericComponentWrapper &RHS)
 
GenericComponentWrapperoperator= (GenericComponentWrapper &&RHS)
 
const char * GetDisplayName ()
 
const char * GetDisplayDescription ()
 
void Init () override
 
void Activate () override
 
void Deactivate () override
 
AZ::TypeId GetUnderlyingComponentType () const override
 
void DisplayEntityViewport (const AzFramework::ViewportInfo &viewportInfo, AzFramework::DebugDisplayRequests &debugDisplay) override
 
void BuildGameEntity (AZ::Entity *gameEntity) override
 
void SetPrimaryAsset (const AZ::Data::AssetId &assetId) override
 
AZ::ComponentValidationResult ValidateComponentRequirements (const AZ::ImmutableEntityVector &sliceEntities, const AZStd::unordered_set< AZ::Crc32 > &platformTags) const override
 
AZ::Component * GetTemplate () const
 
AZ::Component * ReleaseTemplate ()
 Forget about, and release ownership of, template component.
 
- 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 AZ::ComponentDescriptor * CreateDescriptor ()
 
static void Reflect (AZ::ReflectContext *context)
 
- Static Public Member Functions inherited from AzToolsFramework::Components::EditorComponentBase
static void Reflect (AZ::ReflectContext *context)
 

Protected Attributes

AZ::Component * m_template = nullptr
 
AzFramework::EditorEntityEvents * m_templateEvents = nullptr
 
AZStd::string m_displayName
 
AZStd::string m_displayDescription
 

Detailed Description

GenericComponentWrapper wraps around a component in the editor. It is used to add components without a specialized editor component to an entity.

Member Function Documentation

◆ Activate()

void AzToolsFramework::Components::GenericComponentWrapper::Activate ( )
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.

◆ BuildGameEntity()

void AzToolsFramework::Components::GenericComponentWrapper::BuildGameEntity ( AZ::Entity *  )
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.

Parameters
gameEntityA pointer to the game entity.

Reimplemented from AzToolsFramework::Components::EditorComponentBase.

◆ Deactivate()

void AzToolsFramework::Components::GenericComponentWrapper::Deactivate ( )
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.

◆ Init()

void AzToolsFramework::Components::GenericComponentWrapper::Init ( )
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.

◆ SetPrimaryAsset()

void AzToolsFramework::Components::GenericComponentWrapper::SetPrimaryAsset ( const AZ::Data::AssetId &  )
overridevirtual

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

Parameters
assetIdA reference to the ID of the asset to drag and drop.

Reimplemented from AzToolsFramework::Components::EditorComponentBase.


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