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/Code
santorac a55d94217c
Enable material version updates
Merge pull request #4338 from aws-lumberyard-dev/Atom/rbarrand/MaterialVersionUpdate

## Overview

Added support for automatically updating .material files when the property layout of the .materialtype changes. At this stage, we only support a "rename" operation for renaming or moving material properties. We can add more operations in the future if needed (this will require some improvement to how we represent the data internally, but we can deal with that as the need arises).

It's important to note that we currently have a hybrid dependency model for the material system, where materials can depend on materialtypes as job dependencies (property names are processed at asset build time), or material property names can be stored in the cooked assets (property names are processed and resolved at runtime when loading material assets). This means there are two places where we need to apply material property rename auto-updates: in the tools and in the runtime. So you will find that we have ApplyVersionUpdates() functions in both MaterialSourceData and MaterialAsset. (I hope we can move away from this hybrid approach at some point so this can all be simplified, but that depends on new Asset Processor features we don't have yet).

## Main changes
- Added version and versionUpdates structures for .materialtype files, MaterialTypeSourceData, MaterialTypeAssetCreator, etc.
- The .materialtype version number is now at the top level instead of inside the propertyLayout section, because in the future there are other ways the material type could change besides the property layout which might require version auto-updates. (The AP will fail if the version is found in the old location, and tell the user where it should be moved).
- Added ApplyVersionUpdates() and ApplyPropertyRenames() utility functions to facilitate the auto-updates.
- Updated MaterialTypeSourceData::FindProperty(name) to support renames because it must find the property data while loading .material files in order to resolve property data types.
- These new functions will report warnings when they detect that source files are out of date, and recommend the user update them. The easiest way to do this is open it in the Material Editor and save. (which can be scripted in python if necessary)
- Renamed the .material file format "propertyLayoutVersion" to "materialTypeVersion" which is more accurate. This shouldn't hurt existing data as this field wasn't actually used for anything before.

## Unit test improvements
- The new code is well unit tested.
- MaterialSourceDataTests 
  - Updated to include both a .materialtype file and a MaterialTypeAsset for the test material type. Both are used by the MaterialTypeSourceData class.
  - The default test material type now includes some version update steps; these are only used for version update tests and won't impact the other test functions.
  - Updated the path for storing temp files to disk, to just be in a "temp" folder in the exe path. (Originally they were saved to the gem folder near MaterialSourceDataTests.cpp, but at some point someone changed it to be under the exe folder, so there's no reason to use the full gem path anymore).

## Other changes
- Fixed AzCore Utils WriteFile() to create the file if it doesn't exist already.
- Updated all .materialtype files to have the version number in the new position.
- Fixed AssetSystemStub to normalize asset paths for more reliable lookup in unit tests.
4 years ago
..
Editor Removed legacy ColorGradientCtrl. 4 years ago
Framework Enable material version updates 4 years ago
LauncherUnified LYN-6882 release builds are executing code in asserts (#4305) 4 years ago
Legacy Update all the hardcoded filenames inside the level.pak file to be lowercase now the editor no longer forces them to be lower case. (#4802) 4 years ago
Tools Merge pull request #4807 from aws-lumberyard-dev/GemUIDownload 4 years ago
CMakeLists.txt Shorten copyright headers by splitting into 2 lines (#2213) 4 years ago