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::MaterialVersionUpdate::Action Class Reference

Public Types

using ActionDefinition = AZStd::map< AZStd::string, MaterialPropertyValue >
 

Public Member Functions

 AZ_TYPE_INFO (AZ::RPI::MaterialVersionUpdate::Action, "{A1FBEB19-EA05-40F0-9700-57D048DF572B}")
 
 Action (const AZ::Name &operation, const AZStd::initializer_list< AZStd::pair< AZ::Name, MaterialPropertyValue > > &args)
 
 Action (const ActionDefinition &fullActionDefinition)
 
 Action (const AZStd::initializer_list< AZStd::pair< AZStd::string, MaterialPropertyValue > > &fullActionDefinition)
 Initializer list version of Action(ActionDefinition&) to facilitate literal construction in c++ code.
 
void AddArg (const AZ::Name &key, const MaterialPropertyValue &argument)
 
const MaterialPropertyValueGetArg (const AZ::Name &key) const
 
const AZ::Name & GetArgAsName (const AZ::Name &key) const
 
size_t GetArgCount () const
 
bool Validate (AZStd::function< void(const char *)> onError=nullptr) const
 Validates our internal consistency.
 
const AZ::Name & GetOperation () const
 
bool operator== (const Action &other) const
 

Static Public Member Functions

static void Reflect (ReflectContext *context)
 

Static Public Attributes

static const MaterialPropertyValue s_invalidValue = MaterialPropertyValue()
 

Friends

class MaterialVersionUpdate
 

Member Typedef Documentation

◆ ActionDefinition

Generic structure for arbitrary version update actions that maps nicely to json. The operation type is stored as a string under the "op" key. All other entries depend on which "op" is being used, see the Action() constructor for details. Note that we are somewhat hijacking the MaterialPropertyValue class here: not every argument will be an actual material property value, some will be generic strings like the "op" string or they could be property names for example. But when the arg does happen to represent a property value it is convenient to rely on the associated JsonMaterialPropertyValueSerializer to load the value. Since MaterialPropertyValue has the option of holding a string type, we can use it for all cases. Lastly, note that we don't use an unordered_map to keep json deserialization (and the associated unit tests) deterministic.

Constructor & Destructor Documentation

◆ Action() [1/2]

AZ::RPI::MaterialVersionUpdate::Action::Action ( const AZ::Name &  operation,
const AZStd::initializer_list< AZStd::pair< AZ::Name, MaterialPropertyValue > > &  args 
)

Main constructor for creating a material version update Action from within c++ code.

Parameters
operationThe operation type for this action, supported are
  • rename,
  • setValue.
argsThe specific arguments for the chosen operation type:
  • rename operation: {"from":"oldPropertyName", "to":"newPropertyName"},
  • setValue operation: {"name":"myInt", "value":100}. In the case where the property also has 'rename' version updates, any of the names can be used in 'setValue'.

◆ Action() [2/2]

AZ::RPI::MaterialVersionUpdate::Action::Action ( const ActionDefinition fullActionDefinition)

Constructor to facilitate loading from parsed json data. The operation type is given as a string under the "op" key, the remaining items define the operation's arguments as in the main constructor. (e.g. {"op":"rename", "from":"oldPropertyName", "to":"newPropertyName"}).

Member Function Documentation

◆ GetArg()

const MaterialPropertyValue & AZ::RPI::MaterialVersionUpdate::Action::GetArg ( const AZ::Name &  key) const

Get the argument under the given key.

Note
The returned reference becomes invalid when calling AddArg().

◆ GetArgAsName()

const AZ::Name & AZ::RPI::MaterialVersionUpdate::Action::GetArgAsName ( const AZ::Name &  key) const

Efficiently get an AZStd::string value as an AZ::Name.

Note
The returned reference becomes invalid when calling AddArg().

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