Commit Graph

21 Commits (b71e307de57724260e014c100a71ee437ca9d0aa)

Author SHA1 Message Date
Guthrie Adams b71e307de5 Fix issue setting enum values on material component from script
Replaced get and set functions with explicit types with templates
Added special case handling for setting enum values as strings or numbers from script

Signed-off-by: Guthrie Adams <guthadam@amazon.com>
4 years ago
santorac 3c331e00ff Moved the Material Component property override renaming to EditorMaterialComponent via ApplyAutomaticPropertyUpdates.
MaterialAssignment::ApplyProperties() still reports warnings but does not update the m_propertyOverrides.
MaterialAssignment::ApplyProperties() will now skip the old name'd overrides if overrides are present for the new names. I'm not sure if this will ever happen, but it did happen while I had some intermediate changes, so I imagine it could happen again.
I had to update the Material::FindPropertyIndex function to expose information about renames when they occur. This should make it easier for other systems to get (somewhat) automatic benefit from the version update feature.
I also found that there was an issue with material inspector where it wouldn't be initialized the the right override values when renames were present. Now it applies the renames to whatever override data it gets from the Material Component.

Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
santorac c6b209ace0 Made material property auto-rename procedure apply to Material Component at runtime. This ensures that an material property overrides and any gameplay scripts that work with property overrides can get the benefit of the material type version update procedure.
I added an ApplyPropertyRenames function to MaterialTypeAsset very similar to the one in MaterialTypeSourceData.
Updated the MaterialAssignment class to apply any property renames when it discovers the old name doesn't work. This will be written to disk when the level or prefab is saved.

Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
Guthrie Adams 4c9f456ea5 Merge branch 'development' into Atom/guthadam/material_component_supports_property_overrides_without_material_overrides
Signed-off-by: Guthrie Adams <guthadam@amazon.com>

# Conflicts:
#	Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/MaterialComponentController.cpp
4 years ago
Artur K f44169f7fa
Cleanup SerializeContext.h pt.1 (#4264)
* Remove AssetSerializer inclusion from SerializeContext header

Moved a few Reflect methods to new cpp files.

In addition, some preparations for further header dependency reductions.

Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com>

* Fix smoke test lua failures.

Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com>

* Windows build fixes.

Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com>

* Missing license headers

Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com>

* Fix white-space issues.

Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com>

* Code review fix for AzToolsFramework/AssetEditor/AssetEditorBus.h

Co-authored-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com>

* Fix inheritance list wrapping broken by older clang-format

Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com>

Co-authored-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
4 years ago
Guthrie Adams d151e16fc5 RebuildInstance only checks Asset::IsReady
Signed-off-by: Guthrie Adams <guthadam@amazon.com>
4 years ago
Guthrie Adams b0ea4ac389 moved code for applying properties to MaterialAssignment
added lambdas for queuing and updating assets

Signed-off-by: Guthrie Adams <guthadam@amazon.com>
4 years ago
Guthrie Adams ebcf3723f9 Material Component: Can set material property overrides on default materials
No longer need to assign material overrides to set/edit properties in UI or script
Material component will load and use the default material for a slot if no override is assigned

Signed-off-by: Guthrie Adams <guthadam@amazon.com>
4 years ago
santorac 5d3d3b907e Changed a couple function parameters to const&
Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
Guthrie Adams e2eba69d33 updating FindMaterialAssignmentIdInLod to use ModelMaterialSlot
}

Signed-off-by: Guthrie Adams <guthadam@amazon.com>
4 years ago
santorac b407e501e3 Merge branch 'development' into Atom/santorac/OptionalSceneApiMaterialConversion 4 years ago
Chris Santora 14d2e38b90 Refactored how model material slots work in preparation to support more flexible material conversion options for the scene asset pipeline. The material slot IDs are based on the MaterialUid that come from SceneAPI. Since these IDs are also used as the AssetId sub-ID for the converted material assets, the system was just checking the material asset sub-ID to determine the material slot ID. But in order to support certain FBX material conversion options, we needed to break this tie, so the slot ID is separate from the AssetId of the material in that slot. This will allow some other material to be used in the slot, instead of being forced to use one that was generated from the FBX.
Here we inttroduce a new struct ModelMaterialSlot which formalizes the concept of material slot, with an ID, display name, and default material assignment. The ID still comes from the MaterialUid like before. The display name is built-in, rather than being parsed out from the asset file name. And the default material assignment can be any material asset, it doesn't have to come from the FBX (or other scene file).

This commit is just the preliminary set of changes. Cursory testing shows that it works pretty well but more testing is needed (and likely some fixes) before merging.

Here is what's left to do...
Add serialization version converters to preserve prior prefab data.
See if we can get rid of GetLabelByAssetId function only rely on the display name inside ModelMaterialSlot.
I'm not sure if the condition for enabling the "Edit Material Instance..." context menu item is correct.
Test actors
Lots more testing in general

Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
Guthrie Adams ffbeb903c1 Material Component: Add functions to lookup material ids by name
Signed-off-by: Guthrie Adams <guthadam@amazon.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
guthadam 25a114d324 updating includes 5 years ago
guthadam d115eae84a LYN-3871/3872 Added JSON serializer for MaterialAssignment property overrides 5 years ago
guthadam 931a127b7b ATOM-15223 updating material assignment ID to be portable to other models
The bug was reported that copy and paste did not work with the material component.
Copy and paste to take the worked fine.
All of the material assignments/overrides get mapped using the LOD and asset ID of materials provided with the model.
The asset IDs of materials exported by atom builders, using the scene API, are the combination of the same UUID as the model asset ID and the unique sub ID that is now hashed from the material name provided by the DCC tool.
If we map material assignments using the entire asset ID that was generated in the model builder then the mapping will only work with that specific model.
This change updates the material assignment ID equality operators and hash function to only use the sub ID portion of the asset ID.
As long as the sub IDs are generated consistently the material assignment mappings will be portable to models with the same material names.

Also moved material assignment structures to atom common features static library so this was to be moved to cpp files
5 years ago
alexpete 1044dc3da1 Integrating github/staging through commit ab87ed9 5 years ago
alexpete a10351f38d Initial commit 5 years ago