Menu
Lumberyard
C++ API Reference (Version 1.10)

AZ::EditContext::ClassInfo Class Reference

Builder class that reflects class data to the edit context. More...

Public Member Functions

 ~ClassInfo ()
 The destructor. More...
 
ClassInfooperator-> ()
 Returns the current ClassInfo object so that you can continue building it. More...
 
ClassInfoClassElement (Crc32 elementIdCrc, const char *description)
 Enables you to attach one or more attributes to a group of data that you are reflecting to the edit context. More...
 
template<class T >
ClassInfoDataElement (const char *uiId, T memberVariable, const char *name, const char *description)
 Reflects a specific class member variable to the edit context. More...
 
template<class T >
ClassInfoDataElement (Crc32 uiIdCrc, T memberVariable, const char *name, const char *description)
 Reflects a specific class member variable to the edit context. More...
 
template<class T >
ClassInfoDataElement (const char *uiId, T memberVariable)
 Reflects a specific class member variable to the edit context. More...
 
template<class T >
ClassInfoDataElement (Crc32 uiIdCrc, T memberVariable)
 Reflects a specific class member variable to the edit context. More...
 
template<class T >
ClassInfoAttribute (const char *id, T value)
 Adds an attribute to the reflection of the most recent class element or data element. More...
 
template<class T >
ClassInfoAttribute (Crc32 idCrc, T value)
 Adds an attribute to the reflection of the most recent class element or data element. More...
 
template<class T >
ClassInfoEnumAttribute (T value, const char *description)
 A specialized attribute for defining enum values with an associated description. More...
 
template<class T >
ClassInfoElementAttribute (const char *id, T value)
 A specialized attribute, identified by attribute ID, for setting attributes on elements inside a container. More...
 
template<class T >
ClassInfoElementAttribute (Crc32 idCrc, T value)
 A specialized attribute, identified by the CRC of the attribute ID, for setting attributes on elements inside a container. More...
 

Detailed Description

Builder class that reflects class data to the edit context.

You reflect data to the edit context by using a builder pattern to call various functions of this class. You can reflect any number of class elements (logical elements) and data elements (member data). After each element, you can add more information by attaching one or more attributes. Examples of attributes are visibility settings, a minimum value, an icon, and so on.

For an example of how to reflect data to the edit context by calling functions of this class, see the EditContext class description in this guide or Reflecting a Component for Serialization and Editing in the Lumberyard Developer Guide.

Constructor & Destructor Documentation

◆ ~ClassInfo()

AZ::EditContext::ClassInfo::~ClassInfo ( )
inline

The destructor.

Member Function Documentation

◆ Attribute() [1/2]

template<class T >
ClassInfo* AZ::EditContext::ClassInfo::Attribute ( const char *  id,
value 
)

Adds an attribute to the reflection of the most recent class element or data element.

The attribute is identified by an attribute ID. Lumberyard will convert it to CRC. The value of the attribute can be a value type or a function type.

Attributes are more commonly identified by the CRC of the attribute ID. See Attribute(Crc32 idCrc, T value).

Template Parameters
TThe type that the value evaluates to. Depending on the attribute, T can be one of several types: a constant value, a pointer to a member variable or member function of the class you're reflecting, or a pointer to a non-member function (static function or lambda function). For the value type expected by various attributes, see AZ::Edit::Attributes.
Parameters
idA unique ID for the attribute. Lumberyard will convert it to CRC.
valueThe value of the attribute. Attribute values must be copy constructible.
Returns
A pointer to the ClassInfo instance that was updated with this information.

◆ Attribute() [2/2]

template<class T >
ClassInfo* AZ::EditContext::ClassInfo::Attribute ( Crc32  idCrc,
value 
)

Adds an attribute to the reflection of the most recent class element or data element.

The attribute is identified by the CRC of the attribute ID. The value of the attribute can be a value type or a function type.

An example of adding attributes to class and data elements is as follows:

editContext->Class<RagdollComponent>("Ragdoll", "Drives a character using physics instead of animation.")
->Attribute(AZ::Edit::Attributes::Icon, "Editor/Icons/Components/Ragdoll.png")
->DataElement(AZ::Edit::UIHandlers::Default, &RagdollComponent::m_mass, "Mass", "Simulated mass of the ragdoll.")
....
Template Parameters
TThe type that the value evaluates to. Depending on the attribute, T can be one of several types: a constant value, a pointer to a member variable or member function of the class you're reflecting, or a pointer to a non-member function (static function or lambda function). For the value type expected by various attributes, see AZ::Edit::Attributes.
Parameters
uiIdCrcThe CRC32 of the attribute ID. An example is AZ::Edit::UIHandlers::Default. For more examples, see the AZ::Edit::UIHandlers constants that are defined in EditContextConstants.inl.
valueThe value of the attribute. Attribute values must be copy constructible.
Returns
A pointer to the ClassInfo instance that was updated with this information.

◆ ClassElement()

ClassInfo* AZ::EditContext::ClassInfo::ClassElement ( Crc32  elementIdCrc,
const char *  description 
)

Enables you to attach one or more attributes to a group of data that you are reflecting to the edit context.

To attach attributes, follow the ClassElement() call with one or more calls to an Attribute() function. An example is as follows:

editContext->Class<AudioProxyComponent>("Audio Proxy", "Enables the entity to interact with audio.")
Parameters
elementIdCrcThe CRC of the ID of the class element type. An example is AZ::Edit::ClassElements::EditorData. For more examples, see the AZ::Edit::ClassElements constants that are defined in EditContextConstants.inl.
descriptionDescriptive text that typically appears in a tool tip in the editor.
Returns
A pointer to the ClassInfo instance that was updated with this information.

◆ DataElement() [1/4]

template<class T >
ClassInfo* AZ::EditContext::ClassInfo::DataElement ( const char *  uiId,
memberVariable,
const char *  name,
const char *  description 
)

Reflects a specific class member variable to the edit context.

Parameters
uiIdThe ID of the user interface control to use. An example is "MyCustomControl". Lumberyard will convert it to CRC. To use the default control, set this parameter to 0.
memberVariableA reference to the member variable to reflect to the edit context.
nameA name to represent the element in the editor. This name does not need to be the same as the name of the member variable that it represents.
descriptionDescriptive text that typically appears in a tool tip in the editor.
Returns
A pointer to the ClassInfo instance that was updated with this information.

◆ DataElement() [2/4]

template<class T >
ClassInfo* AZ::EditContext::ClassInfo::DataElement ( Crc32  uiIdCrc,
memberVariable,
const char *  name,
const char *  description 
)

Reflects a specific class member variable to the edit context.

Parameters
uiIdCrcThe CRC32 of the user interface control to use. An example is AZ::Edit::UIHandlers::Default. For more examples, see the AZ::Edit::UIHandlers constants that are defined in EditContextConstants.inl. To use the default control, set this parameter to 0.
memberVariableA reference to the member variable (element) to reflect to the edit context.
nameA name to represent the element in the editor. This name does not need to be the same as the name of the member variable that it represents.
descriptionDescriptive text that typically appears in a tool tip.
Returns
A pointer to the ClassInfo instance that was updated with this information.

◆ DataElement() [3/4]

template<class T >
ClassInfo* AZ::EditContext::ClassInfo::DataElement ( const char *  uiId,
memberVariable 
)

Reflects a specific class member variable to the edit context.

The name and description are taken from the edit context of T. If T is not registered with the edit context, then both the name description of this data element are set to AzTypeInfo<T>::Name().

Parameters
uiIdThe ID of the user interface control to use. An example is "MyCustomControl". Lumberyard will convert it to CRC. To use the default control, set this parameter to 0.
memberVariableA reference to the member variable (element) to reflect to the edit context.
Returns
A pointer to the ClassInfo instance that was updated with this information.

◆ DataElement() [4/4]

template<class T >
ClassInfo* AZ::EditContext::ClassInfo::DataElement ( Crc32  uiIdCrc,
memberVariable 
)

Reflects a specific class member variable to the edit context.

The name and description are taken from the edit context of T. If T is not registered with the edit context, then both the name description of this data element are set to AzTypeInfo<T>::Name().

Parameters
uiIdCrcThe CRC32 of the user interface control to use. An example is AZ::Edit::UIHandlers::Default. For more examples, see the AZ::Edit::UIHandlers constants that are defined in EditContextConstants.inl. To use the default control, set this parameter to 0.
memberVariableA reference to the member variable (element) to reflect to the edit context.
Returns
A pointer to the ClassInfo instance that was updated with this information.

◆ ElementAttribute() [1/2]

template<class T >
ClassInfo* AZ::EditContext::ClassInfo::ElementAttribute ( const char *  id,
value 
)

A specialized attribute, identified by attribute ID, for setting attributes on elements inside a container.

For example, you can use this to specify a spinbox handler for all elements that are inside a container while only having to specify it once (on the parent container).

Parameters
idA unique ID for the attribute. Lumberyard will convert it to CRC.
valueThe value of the attribute.
Returns
A pointer to the ClassInfo instance that was updated with this information.

◆ ElementAttribute() [2/2]

template<class T >
ClassInfo* AZ::EditContext::ClassInfo::ElementAttribute ( Crc32  idCrc,
value 
)

A specialized attribute, identified by the CRC of the attribute ID, for setting attributes on elements inside a container.

For example, you can use this to specify a spinbox handler for all elements that are inside a container while only having to specify it once (on the parent container).

Parameters
idCrcThe CRC32 of the attribute ID. An example is AZ::Edit::Attributes::Category. For more examples, see the AZ::Edit::Attributes constants that are defined in EditContextConstants.inl.
valueThe value of the attribute.
Returns
A pointer to the ClassInfo instance that was updated with this information.

◆ EnumAttribute()

template<class T >
ClassInfo* AZ::EditContext::ClassInfo::EnumAttribute ( value,
const char *  description 
)

A specialized attribute for defining enum values with an associated description.

This must follow a data element where the enum was used. This function prevents you from having to manually create a pair<value, description> for every reflected enum value.

Parameters
valueThe value of the attribute.
descriptionDescriptive text that typically appears in a tool tip.
Returns
A pointer to the ClassInfo instance that was updated with this information.

◆ operator->()

ClassInfo* AZ::EditContext::ClassInfo::operator-> ( )
inline

Returns the current ClassInfo object so that you can continue building it.


The documentation for this class was generated from the following file:
  • C:/lumberyard-root/dev/Code/Framework/AZCore/AZCore/Serialization/EditContext.h