Commit Graph

24 Commits (0a3b59f4a036529064aeedbf4708fc418bb65c2b)

Author SHA1 Message Date
santorac a789d7b762 Minor code cleanup.
Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
santorac 57989c35db Changed material builder to not fail on warnings.
The main reason for this is to give consistent results between the AP and Material Editor, where a placholder texture can be used if a texture is missing. Otherwise, you could get a placeholder texture in Material Editor and stale data in the runtime; this inconsistency would be confusing.
As a consequence, it is possible for example that the user could mess up the name of a property in a .material file and not notice the problem because it is now a warning instead of an error. If warnings-as-errors is desirable, you can enable the new "/O3DE/Atom/RPI/MaterialBuilder/WarningsAsErrors" registry setting.

Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
santorac f27203a5fa Updated Material Editor to use the available default fallback images to visually indicate a missing texture.
Material Editor also warns the user when saving a material that is populated with fallback image references.
Factored out the path strings for the default images to ImateSystemInterface.h.

Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
santorac cd28d210ab Working on making Material Editor able to open materials that have missing textures.
Made it a warning instead of an error when MaterialAssetCreator can't find a texture.
Updated the Material Editor's MaterialDocument class to not elevate warnings to errors.
Material Editor uses new features in TraceRecorder to show a message dialog when warnings are detected so the user is notified of the missing texture.

Next I will work on making MaterialAssetCreator put a "missing" texture in place of the requested one.

Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
Guthrie Adams f0b4eb1712 update comment and error message
Signed-off-by: Guthrie Adams <guthadam@amazon.com>
4 years ago
Guthrie Adams 791d11c8f9 Fix parent material loading
Signed-off-by: Guthrie Adams <guthadam@amazon.com>
4 years ago
Guthrie Adams 5afd701e23 updated comments and error messages
Signed-off-by: Guthrie Adams <guthadam@amazon.com>
4 years ago
Guthrie Adams c0acbe7bd4 Changed how asset creator generates the asset instance. Instead of finding or creating the asset in the asset manager, one is directly instantiated and only added to the asset manager after creation is complete. This allows for reuse of previously loaded asset ids and will replace or “reload” a pre-existing asset with the newly created one. This also sends although correct notifications.
Changed material document to load a source data are for the parent material as well.  It was also a previously loading the parent material products asset which would be out of date compared to the source data.
Changed material document to track source file dependency changes instead of product asset changes.
Fixed a bug or copy paste error in the document manager that was using the same container to track documents the modified externally and from other dependency changes.
Returning source data dependencies when creating a material asset from source.

Signed-off-by: Guthrie Adams <guthadam@amazon.com>
4 years ago
santorac 48f3bb7d7a Fixed missing initialization of ShaderCollection::Item::m_renderStatesOverlay.
This RenderStates is used to override the values in the final draw packet, if the values are valid; it's supposed to be initialized to invalid values, but it wasn't. So the depth compare function was getting set to Less instead of GreaterEqual. This wasn't a problem when using serialized assets from disk, because the deserialization uses the default constructor which did initialize m_renderStatesOverlay. No all Item constructors initialize m_renderStatesOverlay.

Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
Signed-off-by: Guthrie Adams <guthadam@amazon.com>
4 years ago
Guthrie Adams 0724403f90 adding ifdef to compare loading vs creating material type assets
Signed-off-by: Guthrie Adams <guthadam@amazon.com>
4 years ago
Guthrie Adams 30120b9626 cleanup and setting asset preload flags
Signed-off-by: Guthrie Adams <guthadam@amazon.com>
4 years ago
Guthrie Adams 898b1811e0 material editor loads source data
Signed-off-by: Guthrie Adams <guthadam@amazon.com>
4 years ago
santorac 0f60d37fec Fixed a bug where material version updates didn't support moving a property from one group to another.
Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
santorac f4d5a75574 Fixed an issue where the wrong version number was being reported in a warning message. It showed the latest version instead of the original version number.
Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
santorac dfcf88265b Fixed a MaterialBuilder issue where material version updates were incorrectly reporting failure in some cases.
Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
santorac 1633ced656 Reports warnings when a material version auto update is applied, notifying the user they should update their source data.
Also improved the MaterialAssetTests UpgradeMaterialAsset() to focus on testing the inputs and outputs of the class rather than the private internal data.

Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
santorac a0b1dec929 Added support for material version updates in MaterialSourceData. This is necessary for tools like Material Editor and Asset Processor to work with the latest property names.
- Added MaterialSourceData::ApplyVersionUpdates() for updating the properties. This should be called by tools after loading the MaterialSourceData. (But can be omitted if a tool wants to read the data exactly as it appears in the .material file).
- Updated MaterialTypeSourceData::FindProperty to support applying version update renames, including a ApplyPropertyRenames utility function, which are necessary for MaterialSourceData to be able to find the necessary property definitons while loading.
- Added a new context struct to JsonMaterialPropertyValueSerializer for passing down the material type version number, to help with applying property renames.
- 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.
- Updated Material Editor to again store the material type version number in .material files.

MaterialSourceDataTests updates...
- 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).

MaterialTypeSourceDataTests updates...
- Moved some code that was accidentally added to LoadAllFieldsUsingOldFormat but should have been in LoadAndStoreJson_AllFields.
- Added test cases for unsupported version update operations

Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
hershey5045 4249ceeae7
Add material property names to material assets, disable FBX dependency on materialtype files. (#3408)
* Add material property names to material assets, disable FBX dependency on materialtype files.

Signed-off-by: Robin <rbarrand@amazon.com>

* Add reflection for MaterialAssets. Update member variable comment.

Signed-off-by: Robin <rbarrand@amazon.com>

* Switch cvar to using bus value. Refine comments.

Signed-off-by: Robin <rbarrand@amazon.com>

* Refactor functions and refine comments.

Signed-off-by: Robin <rbarrand@amazon.com>

* Realign property values when material property names are populated.

Signed-off-by: Robin <rbarrand@amazon.com>

* Switch PostLoadInit check to on asset status ready. Add realign property values code to PostLoadInit as well.

Signed-off-by: Robin <rbarrand@amazon.com>

* Stash@{1} code.

Signed-off-by: Robin <rbarrand@amazon.com>

* Refactor realignment code into the right places.

Signed-off-by: Robin <rbarrand@amazon.com>

* Remove pragma optmize off.

Signed-off-by: Robin <rbarrand@amazon.com>

* More refactoring.

Signed-off-by: Robin <rbarrand@amazon.com>

* Refactor comments and remove code no longer needed.

Signed-off-by: Robin <rbarrand@amazon.com>

* Refactor comments and remove unused include.

Signed-off-by: Robin <rbarrand@amazon.com>

* Comment refactor, corrected some code.

Signed-off-by: Robin <rbarrand@amazon.com>

Co-authored-by: Robin <rbarrand@amazon.com>
4 years ago
chcurran 88121f3bb4 move JsonUtils to AzCore
Signed-off-by: chcurran <82187351+carlitosan@users.noreply.github.com>
4 years ago
chcurran 5044204839 Move JsonUtils.h for support of SC serialization
Signed-off-by: chcurran <82187351+carlitosan@users.noreply.github.com>
4 years ago
Steve Pham 38261d0800
Shorten copyright headers by splitting into 2 lines (#2213)
* Updated all copyright headers to split the longer original copyright line into 2 shorter lines

Signed-off-by: Steve Pham <spham@amazon.com>
4 years ago
Steve Pham b4a2edec6a
Final update copyright headers to reference license files at the repo root (#1693)
* Final update copyright headers to reference license files at the repo root

Signed-off-by: spham <spham@amazon.com>

* Fix copyright validator unit tests to support the stale O3DE header scenario

Signed-off-by: spham <spham@amazon.com>
5 years ago
Steve Pham 70042fcdcd
O3DE Copyright Updates for Linux Foundation (#1504) 5 years ago
alexpete a10351f38d Initial commit 5 years ago