Commit Graph

74 Commits (d9cbc97ec07909e6ddb6687e0c22da07cc6bbdb6)

Author SHA1 Message Date
Chris Galvan d590a91fe7 Implemented helper method of QFileDialog::getSaveFileName to prevent user from saving files with invalid names.
Signed-off-by: Chris Galvan <chgalvan@amazon.com>
4 years ago
Esteban Papp 9c7b55a31d Merge branch 'development' into cmake/linux_fix_warn_unused
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>

# Conflicts:
#	Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/Bits.h
#	Gems/Atom/RHI/Code/Include/Atom/RHI/IndexBufferView.h
#	Gems/Atom/Tools/MaterialEditor/Code/Source/Window/MaterialEditorWindow.cpp
#	Gems/Atom/Tools/ShaderManagementConsole/Code/Source/Window/ShaderManagementConsoleWindow.cpp
4 years ago
santorac 60d137c5b6
Merge pull request #2746 from aws-lumberyard-dev/Atom/santorac/OptionalSceneApiMaterialConversion3
Made Model Material Conversion Optional

Added a new registry setting that disables automatic conversion of materials from model files like FBX.

By default, processing of model files (like FBX) automatically convert the included materials to Atom materials, using StandardPBR. This adds a job dependency on StandardPBR.materialtype, which propagates to any related azsl files as well. Thus any change to azsl code will cause all model files in the project to rebuild.

Some game teams have no interest in using the auto-converted materials; they always use a Material Component to apply material overrides for every mesh. This new setting allows teams to disable material auto-conversion for the entire project, thus removing the job dependency on StandardPBR.materialtype. Instead, every mesh will be assigned the same default material. Any change to azsl code will cause that one default material to rebuild, but this will not trigger any models to rebuild.

Details:
- Added /O3DE/SceneAPI/MaterialConverter registry settings for configuring the scene material converter. It includes an enable flag, and a default material to use when conversion is disabled.
- Added SceneBuilderDependencyRequests::AddFingerprintInfo which allows SceneAPI components to modify the scene builder analysis fingerprint. We use this to reprocess scene files when the material converter settings change.
- Updated SceneAPI's material asset builder to skip the StandardPBR dependency when material conversion is disabled.
- Added some code to MaterialComponentController to handle an edge case that may when disabling material conversion on an existing project, and assigned materials disappear.

Testing:
- Changing the registry setting does trigger a rebuild of the fbx files.
- When material conversion is disabled, changing an azsl file does not cause fbx files to rebuild, but the shader still reloads as expected.
- Made a test level using multiple models with multiple meshes, made various adjustments to the material slots for each mesh, and tried switching the material conversion registry setting from true to false. (Details below)
- Merged this change to a customer's fork and tested on their existing content.

Details about my test level:
- Made a new test level AtomTest project
- Added two entities, both using multi-mat_mesh-groups_1m_cubes.fbx
- Added a material component to both entities
  - Entity 1 material assignments
    - Blue_Zaxis: left as-is
    - Green_Yaxis: exported the material
    - Red_Xaxis: exported the material, and changed the material instance color to pink
    - StingrayPBS1: exported the material, scaled the UVs in the exported material source, and changed the material instance color to green.
    - With_Texture: selected an existing brick material, changed the material instance color to red.
  - Entity 2 material assignments
    - Default Material: set to an existing brick material
    - Blue_Zaxis: manually assigned built-in material that was converted from fbx
    - Green_Yaxis: manually assigned built-in material that was converted from fbx, and changed the material instance color to orange
4 years ago
santorac b6dfb86007 Removed unnecessary #include
Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
santorac de932c62b3 Reverted changes in MaterialComponentController for an obsucre edge case. We'll handle the case of missing material assets more generally as a separate task.
Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
Esteban Papp c19c4af1e1 Gems/Atom
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
4 years ago
Guthrie Adams aa642bd566
Merge pull request #3156 from aws-lumberyard-dev/Atom/guthadam/material_component_api_script_canvas_support
AtomTools: better script canvas support for material component
4 years ago
pappeste d5ed0cc385 AtomLyIntegration
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
4 years ago
Guthrie Adams c67a9f3d12 Updated material component request bus to better support script canvas
Change all name parameters to use standard string so that they could be headed in in script canvas nodes and RPE

Added explicitly type functions for getting and saving property overrides

Signed-off-by: Guthrie Adams <guthadam@amazon.com>
4 years ago
Chris Santora 36abde95a9 Added a new registry setting that disables automatic conversion of materials from model files like FBX.
By default, processing of model files (like FBX) automatically convert the included materials to Atom materials, using StandardPBR. This adds a job dependency on StandardPBR.materialtype, which propagates to any related azsl files as well. Thus any change to azsl code will cause all model files in the project to rebuild.

Some game teams have no interest in using the auto-converted materials; they always use a Material Component to apply material overrides for every mesh. This new setting allows teams to disable material auto-conversion for the entire project, thus removing the job dependency on StandardPBR.materialtype. Instead, every mesh will be assigned the same default material. Any change to azsl code will cause that one default material to rebuild, but this will not trigger any models to rebuild.

Details:
- Added /O3DE/SceneAPI/MaterialConverter registry settings for configuring the scene material converter. It includes an enable flag, and a default material to use when conversion is disabled.
- Added SceneBuilderDependencyRequests::AddFingerprintInfo which allows ScenePI components to modify the scene builder analysis fingerprint. We use this to reprocess scene files when the material converter settings change.
- Updated SceneAPI's material asset builder to skip the StandardPBR dependency when material conversion is disabled.
- Added some code to MaterialComponentController to handle an edge case that may when disabling material conversion on an existing project, and assigned materials disappear.

Testing:
- Changing the registery setting does trigger a rebuild of the fbx files.
- When material conversion is disabled, changing an azsl file does not cause fbx files to rebuild, but the shader still reloads as expected.
- Made a test level using multiple models with multiple meshes, made various adjustments to the material slots for each mesh, and tried switcihng the material conversion registry setting from true to false. (Details below)
- TODO: Will merge this change to a customer's fork and test on their existing content.

Details about my test level:
- Made a new test level AtomTest project
- Added two entities, both using multi-mat_mesh-groups_1m_cubes.fbx
- Added a material component to both entities
  - Entity 1 material assignments
    - Blue_Zaxis: left as-is
    - Green_Yaxis: exported the material
    - Red_Xaxis: exported the material, and changed the material instance color to pink
    - StingrayPBS1: exported the material, scaled the UVs in the exported material source, and changed the material instance color to green.
    - With_Texture: selected an existing brick material, changed the material instance color to red.
  - Entity 2 material assignments
    - Default Material: set to an existing brick material
    - Blue_Zaxis: manually assigned built-in material that was converted from fbx
    - Green_Yaxis: manually assigned built-in material that was converted from fbx, and changed the material instance color to orange

Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
santorac b407e501e3 Merge branch 'development' into Atom/santorac/OptionalSceneApiMaterialConversion 4 years ago
Chris Santora 13679a7cc3 Reverted partial support for property overrides on default material assignments. This needs more UI design discussion first.
Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
Chris Santora 1a478608a7 Restored the previous behavior of preventing material property overrides when there is no explicit material override assignment.
Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
Chris Santora b19a895889 Reverted accidentally commented out code.
Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
Chris Santora 6fa891848d Factored out redundant call to GetMaterialSlots().
Removed code that was intended to handle duplicate default material assignments, but duplicacate default material assignments aren't possible yet.

Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
Chris Santora 21d5baa184 Fixed an issue where I had changed prior functionality by mistake, preventing exported materials from replacing material assignments.
Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
Chris Santora abec7a4f5b Fixed an issue where a default material should show up as a filled-in value in the UI even though it should appear as empty, indicating the default is being used.
Also, I'm going back on what I said in my last commit, and removing the converter for version 3 in EditorMaterialComponent::ConvertVersion. The code that I had put in before wouldn't work because it was relying on the new m_defaultMaterialAsset which will be empty for old data. The only way we could support version conversion is if we preserve legacy versions of multiple types like EditorMaterialComponentSlot and MaterialAssignmentId. Since this serialization version is old and pre-dates the public release of O3DE, it's unlikely that we need to continue supporting this version so isn't worth maintaining.

Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
Chris Santora 75b4d62dcb Restored the version converter EditorMaterialComponent::ConvertVersion for version 3, which wasn't possible with an earlier version of my changes.
Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
Chris Santora 28671c8546 Addressed suggestions from gadams3 to make EditorMaterialComponent get the default material assets from its own data rather than fetching them from the asset. Presumably this should give more reliable behavior.
Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
Chris Santora e145ce1d01 Updated EditorMaterialComponentSlot to support editing property overrides and UV overrides for the material, regardless of whether there is a material override or not.
Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
Chris Santora 670dd6c5bc Removed the GetLabelByAssetId function since now we can use the display name that comes with the ModelMaterialSlot.
Updated OpenMaterialExporter() to account for the fact that multiple material slots can have the same default material asset.
Updated the material inspector to sort material slots by name to match the order in the Material Component.
Updated ExportItem to protect its data members, which makes it more clear that assetId and materialSlotName are readonly inputs.

Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
Chris Santora e3ceaa477e Added a version converter for MaterialAssignmentId. This allowed me to successfully load the Sponza level in AtomTest.
Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
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
sphrose 9639003a7d
LYN-4774 Fix missing box icons inside the main Viewport (#2297)
* LYN-4774 Fix missing box icons inside the main Viewport

Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>

* V2 icons

Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>

* Bug fixes

Signed-off-by: sphrose <82213493+sphrose@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
Twolewis b9964bbb5a
Fixed Material Editor not launching (#1920)
* Fixed Material Editor not launching

Explicitly providing project-path as part of launch parameters.

Signed-off-by: Lloyd Tullues <lloyd@carbonated.com>

* Update Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/EditorMaterialSystemComponent.cpp

Co-authored-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
Signed-off-by: Lloyd Tullues <lloyd@carbonated.com>

* Minor - adding whitespace for consistency

Signed-off-by: Lloyd Tullues <lloyd@carbonated.com>

Co-authored-by: Lloyd Tullues <lloyd@carbonated.com>
Co-authored-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
5 years ago
AMZN-stankowi 4c4be73bd5
First pass FBX -> Scene File conversion. (#1699)
This is the simple pass, minimizing code changes and focused on comments.

Signed-off-by: stankowi <4838196+AMZN-stankowi@users.noreply.github.com>
5 years ago
Guthrie Adams ff9d52d38e
Merge pull request #1705 from aws-lumberyard-dev/Atom/guthadam/ATOM-15908
ATOM-15908 Fixed material component exporter to use correct relative paths
5 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
guthadam 4c28c9d894 ATOM-15908 Fixed material component exporter to use correct relative paths
Signed-off-by: guthadam <guthadam@amazon.com>
5 years ago
guthadam 64186b4ec6 ATOM-15892 fixing material component clear overrides button
The clear material override properties button was not sending the notification to update the entity or undo state.

Signed-off-by: guthadam <guthadam@amazon.com>
5 years ago
Terry Michaels 21ebff5709
Updated help search and all docs.o3de.org links to o3de.org (#1594) 5 years ago
Terry Michaels 1e457928f5
Update help URLs and remove unneeded links (#1520) 5 years ago
Steve Pham 70042fcdcd
O3DE Copyright Updates for Linux Foundation (#1504) 5 years ago
guthadam 58d516688f LYN-4251 fix confusing material component menu options 5 years ago
Terry Michaels 91fb8be535
Added toolbar icons, updated viewport header UX (#1240) 5 years ago
guthadam b10ed227c0 Added version handling for removed fields 5 years ago
guthadam d115eae84a LYN-3871/3872 Added JSON serializer for MaterialAssignment property overrides 5 years ago
Chris Santora de4e6957e8 Made a bunch of display name and description updates to core material types.
- Renamed "Details" group to "Overview".
- Renamed "UV Names" group to "UV Sets".
- Renamed "General" group to "General Settings".
- Renamed "Parallax" group to "Displacement".
- Renamed "Texture Map" properties to just "Texture". In cases where a specific type of texture is mentioned like "roughness texture map" I called this "roughness map" (which is more common according to google).
- Renamed "Heightmap" to "Height map" (which is more common according to google).

ATOM-14002 [Material Editor] Revisit user facing organization and layout of material types
5 years ago
Chris Santora bffc72794b ATOM-15597 Accessing Material Instance Panel Crashes Editor
There were two issues fixed here. First, I broke the material inspector with my changes at 53188a12da which added support for hiding entire property groups. I'm not sure how this happened because I definitely tested the MaterialComponent's material inspector. Perhaps there was a bad merge or something otherwise got clobbered after testing and before committing. Anyway, this issue was I accidentally delete the code that prepared the list of material properties for functor processing.

The second issue was the MaterialFunctor class needs to return null when metadata can't be found; it was proceeding to dereference an end iterator.

Testing:
Successfully opened the material inspector through the MaterialComponent. Was able to change property flags in the inspector and see other properties change visibility as expected.
5 years ago
Chris Santora f3099aa7d5 Merge remote-tracking branch 'origin/main' into Atom/santorac/NewLayeringWorkflow 5 years ago
Chris Santora e429c8e06a Fixed issues after merging latest main, as well as some edge cases I didn't notice before.
The structure of InspectorWidget::m_groups changed, so I had to update my new code accordingly.
Updated the InspectorWidget::m_groups code a bit to be more readable.
Discovered the initial property group visiblity state wasn't being set correctly when a material was first opened, so groups weren't initially hidden when they should have been. This had to be fixed in different ways for MaterialEditor's inspector and MaterialComponent's inspector.

ATOM-14688 Disable Individual Layers
5 years ago
Chris Santora 37a1b77d50 Merge branch 'main' into Atom/santorac/NewLayeringWorkflow 5 years ago
Chris Santora 53188a12da Made StandardMultilayerPBR hide a layer's property groups when that layer is disabled.
ATOM-14688 Disable Individual Layers

- Added new SetMaterialPropertyGroupVisibility functions to the material functors.
- Updated the MaterialFunctor::EditorContext to include parameters for handling material property group metadata.
- Updated the material inspector(s) to apply the property group visiblity changes from the material functor, to hide or show the property groups.
- Moved some code from MaterialPropertyDescriptor.h/cpp to a new MaterialDynamicMetadata.h/cpp, since these aren't really related to the MaterialPropertyDescriptor code. It's more for material functors to use.
- Also fixed the casing for the "GetMaterialPropertyValue_Image" lua function, since I was already in this code (ATOM-14793 "Fix Inconsistent Casing For LuaMaterialFunctorRuntimeContext")

Tested in MaterialEditor and in in the main Editor's MaterialComponent property override inspector.
5 years ago
mnaumov 7342e62680 Hiding "Open Material" when material asset is assigned 5 years ago
guthadam 1dda6dabe4 Added support for expanding/collapsing material inspector groups by name
Saving/restoring material inspector group expansion state
5 years ago
guthadam e9165ed911 Added save state keys to most of the RPEs in the material editor and component to save expand/collapse state
Saving main window fancy docking state so all of the dock widgets save/restore visibly and positioning

Added window decoration wrapper inside material editor main window for saving/restoring window position, size, state

Added object names to several QT widgets so that their state could be captured and restored
5 years ago
guthadam 6b1f0c53a5 Injecting --activateWindow every time new process sends command line
Updated comments
5 years ago
guthadam 80f692118b ATOM-15451 always bring material editor and foreground when launching
Bus, command line option, and handler to activate material editor window
Made sure that material editor action in Ly tools menu is not checked/checkable
Ly editor pushes command line option to use the same RHI

https://jira.agscollab.com/browse/LYN-2610
https://jira.agscollab.com/browse/ATOM-15451
https://jira.agscollab.com/browse/ATOM-13742
5 years ago