Open 3D Engine AtomLyIntegration Gem 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.
AZ::Render::MaterialComponentRequests Class Referenceabstract

MaterialComponentRequestBus provides an interface to request operations on a MaterialComponent. More...

#include <MaterialComponentBus.h>

Inherits AZ::ComponentBus.

Public Member Functions

virtual MaterialAssignmentMap GetDefaultMaterialMap () const =0
 Get a map representing the default layout and values for all material assignment slots on the source model or object.
 
virtual MaterialAssignmentMap GetDefautMaterialMap () const
 
virtual MaterialAssignmentId FindMaterialAssignmentId (const MaterialAssignmentLodIndex lod, const AZStd::string &label) const =0
 
virtual AZ::Data::AssetId GetDefaultMaterialAssetId (const MaterialAssignmentId &materialAssignmentId) const =0
 
virtual AZStd::string GetMaterialLabel (const MaterialAssignmentId &materialAssignmentId) const =0
 
virtual void SetMaterialMap (const MaterialAssignmentMap &materials)=0
 
virtual const MaterialAssignmentMap & GetMaterialMap () const =0
 
virtual void ClearMaterialMap ()=0
 Clears all overridden materials and properties from the material component.
 
virtual void ClearMaterialsOnModelSlots ()=0
 Clears all overrides from the material component not associated with a specific LOD.
 
virtual void ClearMaterialsOnLodSlots ()=0
 Clears all overrides from the material component associated with a specific LOD.
 
virtual void ClearMaterialsOnInvalidSlots ()=0
 
virtual void ClearMaterialsWithMissingAssets ()=0
 Clears all material overrides referencing material assets that cant' be located.
 
virtual void RepairMaterialsWithMissingAssets ()=0
 
virtual uint32_t RepairMaterialsWithRenamedProperties ()=0
 
virtual void SetMaterialAssetIdOnDefaultSlot (const AZ::Data::AssetId &materialAssetId)=0
 
virtual const AZ::Data::AssetId GetMaterialAssetIdOnDefaultSlot () const =0
 Convenience function to get the current material asset on the default material slot.
 
virtual void ClearMaterialAssetIdOnDefaultSlot ()=0
 Convenience function to clear be over written material has set on the default material slot.
 
virtual void SetMaterialAssetId (const MaterialAssignmentId &materialAssignmentId, const AZ::Data::AssetId &materialAssetId)=0
 
virtual AZ::Data::AssetId GetMaterialAssetId (const MaterialAssignmentId &materialAssignmentId) const =0
 
virtual void ClearMaterialAssetId (const MaterialAssignmentId &materialAssignmentId)=0
 
virtual bool IsMaterialAssetIdOverridden (const MaterialAssignmentId &materialAssignmentId) const =0
 
virtual void SetPropertyValue (const MaterialAssignmentId &materialAssignmentId, const AZStd::string &propertyName, const AZStd::any &value)=0
 
virtual AZStd::any GetPropertyValue (const MaterialAssignmentId &materialAssignmentId, const AZStd::string &propertyName) const =0
 
virtual void ClearPropertyValue (const MaterialAssignmentId &materialAssignmentId, const AZStd::string &propertyName)=0
 
virtual void ClearPropertyValues (const MaterialAssignmentId &materialAssignmentId)=0
 
virtual void ClearAllPropertyValues ()=0
 Clear all property overrides for every material in the material component.
 
virtual void SetPropertyValues (const MaterialAssignmentId &materialAssignmentId, const MaterialPropertyOverrideMap &propertyOverrides)=0
 
virtual MaterialPropertyOverrideMap GetPropertyValues (const MaterialAssignmentId &materialAssignmentId) const =0
 
virtual void SetModelUvOverrides (const MaterialAssignmentId &materialAssignmentId, const AZ::RPI::MaterialModelUvOverrideMap &modelUvOverrides)=0
 
virtual AZ::RPI::MaterialModelUvOverrideMap GetModelUvOverrides (const MaterialAssignmentId &materialAssignmentId) const =0
 
template<typename T >
void SetPropertyValueT (const MaterialAssignmentId &materialAssignmentId, const AZStd::string &propertyName, const T &value)
 Set material property override value with a specific type.
 
template<typename T >
GetPropertyValueT (const MaterialAssignmentId &materialAssignmentId, const AZStd::string &propertyName) const
 Get material property override value with a specific type.
 

Detailed Description

MaterialComponentRequestBus provides an interface to request operations on a MaterialComponent.

Member Function Documentation

◆ ClearMaterialAssetId()

virtual void AZ::Render::MaterialComponentRequests::ClearMaterialAssetId ( const MaterialAssignmentId materialAssignmentId)
pure virtual

Removes the material asset associated with the material assignment ID

Parameters
materialAssignmentIdID of material slot.

◆ ClearMaterialsOnInvalidSlots()

virtual void AZ::Render::MaterialComponentRequests::ClearMaterialsOnInvalidSlots ( )
pure virtual

Clear all material overrides from the material component mapped to material assignment IDs that do not match the current material layout. This is usually used for clearing materials leftover between model changes or moving the material component from one entity to another.

◆ ClearPropertyValue()

virtual void AZ::Render::MaterialComponentRequests::ClearPropertyValue ( const MaterialAssignmentId materialAssignmentId,
const AZStd::string &  propertyName 
)
pure virtual

Clear any property override associated with the material assignment ID and property name.

Parameters
materialAssignmentIdID of material slot.
propertyNameName of the property being cleared.

◆ ClearPropertyValues()

virtual void AZ::Render::MaterialComponentRequests::ClearPropertyValues ( const MaterialAssignmentId materialAssignmentId)
pure virtual

Clear all property overrides associated with the material assignment ID.

Parameters
materialAssignmentIdID of material slot.

◆ FindMaterialAssignmentId()

virtual MaterialAssignmentId AZ::Render::MaterialComponentRequests::FindMaterialAssignmentId ( const MaterialAssignmentLodIndex  lod,
const AZStd::string &  label 
) const
pure virtual

Search for a material assignment ID matching the lod and label parameters

Parameters
lodIndex of the LOD to be searched for the material assignment ID. -1 is used to search the default material and model material slots.
labelSubstring used to look up a material assignment ID with a matching label.
Returns
The corresponding material assignment ID is found, otherwise DefaultMaterialAssignmentId.

◆ GetDefaultMaterialAssetId()

virtual AZ::Data::AssetId AZ::Render::MaterialComponentRequests::GetDefaultMaterialAssetId ( const MaterialAssignmentId materialAssignmentId) const
pure virtual

Get the material asset associated with the source model or object prior to overrides being applied.

Parameters
materialAssignmentIdID of material assignment slot for which the information is being requested.
Returns
Default asset ID associated with the material assignment ID, otherwise an invalid asset ID.

◆ GetMaterialAssetId()

virtual AZ::Data::AssetId AZ::Render::MaterialComponentRequests::GetMaterialAssetId ( const MaterialAssignmentId materialAssignmentId) const
pure virtual

Retrieve the material asset associated with the material assignment ID

Parameters
materialAssignmentIdID of material slot.
Returns
The current material asset ID is found, otherwise invalid asset ID .

◆ GetMaterialLabel()

virtual AZStd::string AZ::Render::MaterialComponentRequests::GetMaterialLabel ( const MaterialAssignmentId materialAssignmentId) const
pure virtual

Get the material asset associated with the source model or object prior to overrides being applied.

Parameters
materialAssignmentIdID of material assignment slot for which the information is being requested.
Returns
String corresponding to the display name of the material slot.

◆ GetMaterialMap()

virtual const MaterialAssignmentMap & AZ::Render::MaterialComponentRequests::GetMaterialMap ( ) const
pure virtual

Returns all materials and properties used by the material component.

Returns
Map of material assigned data including materials, property overrides, and other parameters.

◆ GetModelUvOverrides()

virtual AZ::RPI::MaterialModelUvOverrideMap AZ::Render::MaterialComponentRequests::GetModelUvOverrides ( const MaterialAssignmentId materialAssignmentId) const
pure virtual

Get Model UV overrides for a specific material assignment

Parameters
materialAssignmentIdID of material slot.
Returns
Map of remapped UV channels.

◆ GetPropertyValue()

virtual AZStd::any AZ::Render::MaterialComponentRequests::GetPropertyValue ( const MaterialAssignmentId materialAssignmentId,
const AZStd::string &  propertyName 
) const
pure virtual

Get the current value of a material property wrapped by an AZStd::any

Parameters
materialAssignmentIdID of material slot.
propertyNameName of the property being requested.
Returns
Value of the property is located, otherwise an empty AZStd::any.

◆ GetPropertyValues()

virtual MaterialPropertyOverrideMap AZ::Render::MaterialComponentRequests::GetPropertyValues ( const MaterialAssignmentId materialAssignmentId) const
pure virtual

Retrieves a map of all property values associated with the material assignment ID.

Parameters
materialAssignmentIdID of material slot.
Returns
Map of all property values.

◆ IsMaterialAssetIdOverridden()

virtual bool AZ::Render::MaterialComponentRequests::IsMaterialAssetIdOverridden ( const MaterialAssignmentId materialAssignmentId) const
pure virtual

Check if the material slot contains an explicit material asset override

Parameters
materialAssignmentIdID of material slot.
Returns
true if a valid material asset has been assigned.

◆ RepairMaterialsWithMissingAssets()

virtual void AZ::Render::MaterialComponentRequests::RepairMaterialsWithMissingAssets ( )
pure virtual

Updates all material overrides referencing material assets that can't be located to instead point to a default material asset.

◆ RepairMaterialsWithRenamedProperties()

virtual uint32_t AZ::Render::MaterialComponentRequests::RepairMaterialsWithRenamedProperties ( )
pure virtual

Remaps material property overrides that have been renamed since they were assigned.

Returns
the number of properties that were updated

◆ SetMaterialAssetId()

virtual void AZ::Render::MaterialComponentRequests::SetMaterialAssetId ( const MaterialAssignmentId materialAssignmentId,
const AZ::Data::AssetId &  materialAssetId 
)
pure virtual

Assign a material asset to the slot corresponding to material assignment ID

Parameters
materialAssignmentIdID of material slot that the material will be assigned to.
materialAssetIdMaterial asset that will be assigned to the material slot.

◆ SetMaterialAssetIdOnDefaultSlot()

virtual void AZ::Render::MaterialComponentRequests::SetMaterialAssetIdOnDefaultSlot ( const AZ::Data::AssetId &  materialAssetId)
pure virtual

Convenience function to set the overridden material asset on the default material slot.

Parameters
materialAssetIdMaterial asset that will be assigned to the default material slot.

◆ SetMaterialMap()

virtual void AZ::Render::MaterialComponentRequests::SetMaterialMap ( const MaterialAssignmentMap &  materials)
pure virtual

Replaces all material and property overrides with whatever is contained in the provided map.

Parameters
materialsMap of material assignment data including materials, property overrides, and other parameters.

◆ SetModelUvOverrides()

virtual void AZ::Render::MaterialComponentRequests::SetModelUvOverrides ( const MaterialAssignmentId materialAssignmentId,
const AZ::RPI::MaterialModelUvOverrideMap &  modelUvOverrides 
)
pure virtual

Set Model UV overrides for a specific material assignment

Parameters
materialAssignmentIdID of material slot.
modelUvOverridesMap of remapped UV channels.

◆ SetPropertyValue()

virtual void AZ::Render::MaterialComponentRequests::SetPropertyValue ( const MaterialAssignmentId materialAssignmentId,
const AZStd::string &  propertyName,
const AZStd::any &  value 
)
pure virtual

Set a material property override value wrapped by an AZStd::any

Parameters
materialAssignmentIdID of material slot.
propertyNameName of the property being assigned.
valueValue to be assigned to the specified property.

◆ SetPropertyValues()

virtual void AZ::Render::MaterialComponentRequests::SetPropertyValues ( const MaterialAssignmentId materialAssignmentId,
const MaterialPropertyOverrideMap &  propertyOverrides 
)
pure virtual

Replaces all property overrides associated with the material assignment ID.

Parameters
materialAssignmentIdID of material slot.
propertyOverridesMap of all property values being assigned.

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