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::ScriptEditorComponent Class Reference

Inherits AzToolsFramework::Components::EditorComponentBase, and AZ::Data::AssetBus::Handler.

Classes

struct  ElementInfo
 

Public Member Functions

void Init () override
 
void Activate () override
 
void Deactivate () override
 
void BuildGameEntity (AZ::Entity *gameEntity) override
 
void SetPrimaryAsset (const AZ::Data::AssetId &) override
 
const AZ::Data::Asset< AZ::ScriptAsset > & GetScript () const
 
void SetScript (const AZ::Data::Asset< AZ::ScriptAsset > &script)
 
void OnAssetReady (AZ::Data::Asset< AZ::Data::AssetData > asset) override
 Resets the property to it's default value. (TODO)
 
void OnAssetReloaded (AZ::Data::Asset< AZ::Data::AssetData > asset) override
 
void OnAssetError (AZ::Data::Asset< AZ::Data::AssetData > asset) override
 
void LaunchLuaEditor (const AZ::Data::AssetId &, const AZ::Data::AssetType &)
 
void LoadScript ()
 
- 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 Reflect (AZ::ReflectContext *context)
 
static bool DoComponentsMatch (const ScriptEditorComponent *thisComponent, const ScriptEditorComponent *otherComponent)
 
- Static Public Member Functions inherited from AzToolsFramework::Components::EditorComponentBase
static void Reflect (AZ::ReflectContext *context)
 

Protected Member Functions

 ScriptEditorComponent (const ScriptEditorComponent &)=delete
 
void LoadProperties ()
 
void LoadProperties (AZ::ScriptDataContext &sdc, AzFramework::ScriptPropertyGroup &group)
 
void RemovedOldProperties (AzFramework::ScriptPropertyGroup &group)
 
void SortProperties (AzFramework::ScriptPropertyGroup &group)
 
bool LoadAttribute (AZ::ScriptDataContext &sdc, int valueIndex, const char *name, AZ::Edit::ElementData &ed, AZ::ScriptProperty *prop)
 
bool LoadDefaultAsset (AZ::ScriptDataContext &sdc, int valueIndex, const char *name, AzFramework::ScriptPropertyGroup &group, ElementInfo &elementInfo)
 
bool LoadDefaultEntityRef (AZ::ScriptDataContext &sdc, int valueIndex, const char *name, AzFramework::ScriptPropertyGroup &group, ElementInfo &elementInfo)
 
void ClearDataElements ()
 
AZ::u32 ScriptHasChanged ()
 
bool LoadEnumValuesDouble (AZ::ScriptDataContext &sdc, int valueIndex, AZ::Edit::ElementData &ed)
 
bool LoadEnumValuesString (AZ::ScriptDataContext &sdc, int valueIndex, AZ::Edit::ElementData &ed)
 
const AZ::Edit::ElementData * GetDataElement (const void *element, const AZ::Uuid &typeUuid) const
 
const char * CacheString (const char *str)
 

Static Protected Member Functions

static const AZ::Edit::ElementData * GetScriptPropertyEditData (const void *handlerPtr, const void *elementPtr, const AZ::Uuid &elementType)
 

Protected Attributes

AZStd::unordered_map< const void *, AZStd::string > m_cachedStrings
 
AZStd::unordered_map< const void *, ElementInfom_dataElements
 
AzFramework::ScriptComponent m_scriptComponent
 
AZ::Data::Asset< AZ::ScriptAsset > m_scriptAsset
 
AZStd::string m_customName
 

Member Function Documentation

◆ Activate()

void AzToolsFramework::Components::ScriptEditorComponent::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::ScriptEditorComponent::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::ScriptEditorComponent::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::ScriptEditorComponent::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::ScriptEditorComponent::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.

Member Data Documentation

◆ m_cachedStrings

AZStd::unordered_map<const void*, AZStd::string> AzToolsFramework::Components::ScriptEditorComponent::m_cachedStrings
protected
  • TODO Make editor global as we can chase them across multiple areas

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