fa52124f9c
Formalized the concept of an model's material slots Before, the ModelAsset and MaterialComponent code was conflating the idea of a material slot ID and a default material assignment. The default material asset's sub-ID was being used to uniquely identify the material slot as well. This blocks our ability to use other materials as the default assignment for individual meshes; we are forced to use whatever material that was generated from the source model file (like FBX). With these changes, we separate the concept of a material AssetId and a material slot ID, and store them separately. There is a new ModelMaterialSlot struct to describe each slot, including a unique "StableId". The ModelAsset stores a map of the slots, and each mesh refers to a slot by its StableId. This is a precursor to another task that will optionally disable the auto-conversion of materials from source model files. Also: - These changes also enable material property overrides without having to make an editable material first, which I don't think was supported before. - Removed unused Default.materialtype from the RPI Assets folder. - Encapsulated members in EditorMaterialComponentExporter::ExportItem for better maintainability. See also https://github.com/o3de/o3de-atom-sampleviewer/pull/175 Testing: - Took screenshots of several AtomTest levels with material overrides before making any changes. Compared these after the changes. Test levels included ActorTest_SingleActor, ActorTest_MultipleActors, and two custom levels that used shaderball and multi-mat_mesh-groups_1m_cubes. - Lots of manual fiddling with material component. - Created a white box component and saw that it rendered correctly. - Cherry-picked these changes into Apocalypse's code base and verified with one of their levels. - Ran AtomSampleViewer automated test suite. Some tests failed, but these were failing before my changes.