Open 3D Engine Atom 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::RPI::MaterialSourceData Class Referencefinal

This is a simple data structure for serializing in/out material source files. More...

#include <MaterialSourceData.h>

Public Types

enum class  ApplyVersionUpdatesResult { Failed , NoUpdates , UpdatesApplied }
 
using PropertyValueMap = AZStd::unordered_map< Name, MaterialPropertyValue >
 

Public Member Functions

 AZ_TYPE_INFO (AZ::RPI::MaterialSourceData, "{B8881D92-DF9F-4552-9F22-FF4421C45D9A}")
 
void UpgradeLegacyFormat ()
 
void SetPropertyValue (const Name &propertyId, const MaterialPropertyValue &value)
 
const MaterialPropertyValueGetPropertyValue (const Name &propertyId) const
 
const PropertyValueMap & GetPropertyValues () const
 
bool HasPropertyValue (const Name &propertyId) const
 
void RemovePropertyValue (const Name &propertyId)
 
Outcome< Data::Asset< MaterialAsset > > CreateMaterialAsset (Data::AssetId assetId, const AZStd::string &materialSourceFilePath, bool elevateWarnings=true) const
 
Outcome< Data::Asset< MaterialAsset > > CreateMaterialAssetFromSourceData (Data::AssetId assetId, AZStd::string_view materialSourceFilePath="", bool elevateWarnings=true, MaterialUtils::ImportedJsonFiles *sourceDependencies=nullptr) const
 

Static Public Member Functions

static void Reflect (ReflectContext *context)
 
static MaterialSourceData CreateAllPropertyDefaultsMaterial (const Data::Asset< MaterialTypeAsset > &materialType, const AZStd::string &materialTypeSourcePath)
 Creates a MaterialSourceData object that includes the default values for every possible property in the material type.
 

Public Attributes

AZStd::string m_description
 
AZStd::string m_materialType
 The material type that defines the interface and behavior of the material.
 
AZStd::string m_parentMaterial
 The immediate parent of this material.
 
uint32_t m_materialTypeVersion = MaterialAsset::UnspecifiedMaterialTypeVersion
 The version of the material type that was used to configure this material.
 

Static Public Attributes

static constexpr const char Extension [] = "material"
 

Detailed Description

This is a simple data structure for serializing in/out material source files.

Member Function Documentation

◆ CreateMaterialAsset()

Outcome< Data::Asset< MaterialAsset > > AZ::RPI::MaterialSourceData::CreateMaterialAsset ( Data::AssetId  assetId,
const AZStd::string &  materialSourceFilePath,
bool  elevateWarnings = true 
) const

Creates a MaterialAsset from the MaterialSourceData content.

Parameters
assetIdID for the MaterialAsset
materialSourceFilePathIndicates the path of the .material file that the MaterialSourceData represents. Used for resolving file-relative paths.
processingModeIndicates whether to finalize the material asset using data from the MaterialTypeAsset.
elevateWarningsIndicates whether to treat warnings as errors

◆ CreateMaterialAssetFromSourceData()

Outcome< Data::Asset< MaterialAsset > > AZ::RPI::MaterialSourceData::CreateMaterialAssetFromSourceData ( Data::AssetId  assetId,
AZStd::string_view  materialSourceFilePath = "",
bool  elevateWarnings = true,
MaterialUtils::ImportedJsonFiles *  sourceDependencies = nullptr 
) const

Creates a MaterialAsset from the MaterialSourceData content.

Parameters
assetIdID for the MaterialAsset
materialSourceFilePathIndicates the path of the .material file that the MaterialSourceData represents. Used for resolving file-relative paths.
elevateWarningsIndicates whether to treat warnings as errors
sourceDependenciesif not null, will be populated with a set of all of the loaded material and material type paths

◆ UpgradeLegacyFormat()

void AZ::RPI::MaterialSourceData::UpgradeLegacyFormat ( )

If the data was loaded from an old format file (i.e. where "properties" was a tree with property values nested under groups), this converts to the new format where properties are stored in a flat list.


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