You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
o3de/Gems/Atom/Feature/Common/Code/Source/Material
santorac c5b128bec4 First pass at reworking and formalizing the way deferred material asset baking works. The feature basically works but needs more testing.
Before, the material builder was loading the MaterialTypeAsset and doing some processing with it, but was avoiding declaring job dependencies that would cause reprocessing lots of assets when a shader or .materialtype file changes. Reading the asset data isn't safe when not declaring a job dependency (or when declaring a weak job dependency like OrderOnce which is the case here). This caused to several known bugs.

The main change here is it no longer loads the MaterialTypeAsset at all; all other changes flow from there.

The biggest changes (when deferred material processing is enabled) are ...
1) MaterialSourceData no longer loads MaterialTypeAsset. All it really needs is to determine whether a string is an image file reference or an enum value, which is easy to do by just looking for the "." for the extension.
2) MaterialAssetCreator no longer produces a finalized material asset. It no longer uses MaterialAssetCreatorCommon because that only produces a non-finalized MaterialAsset, which has very different needs for the SetPropertyValue function. (We could consider merging MaterialAssetCreatorCommon into MaterialTypeAssetCreator since that's the only subclass at this point). And it doesn't do any validation against the properties layout since that can be done at runtime.
3) Moved processing of enum property values from MaterialSourceData to MaterialAsset::Finalize (this was the only thing being done in the builder that actually needed to read the material type asset data).

Also...
- Updated the MaterialAsset class mostly to clarify and formalize the two different modes it can be in: whether it is finalized or not.
- Merged the separate "IncludeMaterialPropertyNames" registry settings from MaterialConverterSystemComponent and MaterialBuilder into one "FinalizeMaterialAssets" setting used for both.
- Removed MaterialSourceData::ApplyVersionUpdates. Now the flow of data is the same regardless of whether the materials are finalized by the AP or at runtime. Version updates are always applied on the MaterialAsset.
- Added a validation check to MaterialTypeAssetCreator ensuring that once a property is renamed, the old name can never be used again for a new property. This assumption was already made previously, but not formalized, in that Material::FindPropertyIndex does not expect every caller to provide a version number for the material property name, also the material asset's list of raw property names was never versioned. The only way for this to be a safe assumption is to prevent reuse of old names.

Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
..
ConvertEmissiveUnitFunctor.cpp Shorten copyright headers by splitting into 2 lines (#2213) 5 years ago
ConvertEmissiveUnitFunctor.h Shorten copyright headers by splitting into 2 lines (#2213) 5 years ago
ConvertEmissiveUnitFunctorSourceData.cpp Shorten copyright headers by splitting into 2 lines (#2213) 5 years ago
ConvertEmissiveUnitFunctorSourceData.h Shorten copyright headers by splitting into 2 lines (#2213) 5 years ago
DrawListFunctor.cpp Shorten copyright headers by splitting into 2 lines (#2213) 5 years ago
DrawListFunctor.h Gems/Atom 5 years ago
DrawListFunctorSourceData.cpp Shorten copyright headers by splitting into 2 lines (#2213) 5 years ago
DrawListFunctorSourceData.h Gems/Atom 5 years ago
MaterialAssignment.cpp extending conversions from script to other numeric types 4 years ago
MaterialAssignmentId.cpp Fixed the MaterialAssignmentId version converter to properly handle the default material assignment slot. 5 years ago
MaterialAssignmentSerializer.cpp Shorten copyright headers by splitting into 2 lines (#2213) 5 years ago
MaterialAssignmentSerializer.h Shorten copyright headers by splitting into 2 lines (#2213) 5 years ago
MaterialConverterSystemComponent.cpp First pass at reworking and formalizing the way deferred material asset baking works. The feature basically works but needs more testing. 4 years ago
MaterialConverterSystemComponent.h First pass at reworking and formalizing the way deferred material asset baking works. The feature basically works but needs more testing. 4 years ago
SubsurfaceTransmissionParameterFunctor.cpp Shorten copyright headers by splitting into 2 lines (#2213) 5 years ago
SubsurfaceTransmissionParameterFunctor.h Gems/Atom 5 years ago
SubsurfaceTransmissionParameterFunctorSourceData.cpp Shorten copyright headers by splitting into 2 lines (#2213) 5 years ago
SubsurfaceTransmissionParameterFunctorSourceData.h Gems/Atom 5 years ago
Transform2DFunctor.cpp Shorten copyright headers by splitting into 2 lines (#2213) 5 years ago
Transform2DFunctor.h Gems/Atom 5 years ago
Transform2DFunctorSourceData.cpp Shorten copyright headers by splitting into 2 lines (#2213) 5 years ago
Transform2DFunctorSourceData.h Gems/Atom 5 years ago
UseTextureFunctor.cpp Shorten copyright headers by splitting into 2 lines (#2213) 5 years ago
UseTextureFunctor.h Shorten copyright headers by splitting into 2 lines (#2213) 5 years ago
UseTextureFunctorSourceData.cpp Shorten copyright headers by splitting into 2 lines (#2213) 5 years ago
UseTextureFunctorSourceData.h Shorten copyright headers by splitting into 2 lines (#2213) 5 years ago