Commit Graph

29 Commits (a3d018f30f46d1fdafae73b4aa02b1d0d8b60d45)

Author SHA1 Message Date
Guthrie Adams 799290aefc Created custom JSON serializer for editor material component
The editor component contains an editor specific, dynamically generated version of the material slots to display all the possible options, organize properties for the user interface, and add custom actions.
The critical data is already stored inside of the component controller configuration, which only stores a map of modified or overridden values.
This change disables serialization of the redundant data for prefabs.

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
Guthrie Adams e8142fa403 Updated editor material component slots to support dynamic previews rendered with property overrides applied
Fixed scaling issues with labels used for images
Reduced updating previews and material component inspector to only apply after a value is committed
Storing cache of previously rendered material previews

Signed-off-by: Guthrie Adams <guthadam@amazon.com>
4 years ago
Pinfel bf58638505
Merge remote-tracking branch 'origin/development' into component-doc-links 4 years ago
Guthrie Adams 376a6040d8 Addressing PR feedback
Signed-off-by: Guthrie Adams <guthadam@amazon.com>
4 years ago
Guthrie Adams 0c9dbb8658 Adding new commands to the material component for managing, removing, repairing material slots
• Adding commands to material component to clear or repair material slots
• Moved all clear and repair functions from the editor component to the material component controller, bound to its buses so they can be accessed from script
• Added new functions to clear model and LOD material groups
• Added function to remove material assignments with bad asset references
• Added function to reassign materials with bad asset references to the default asset
• Added function to remove material assignments that don’t match slots available on the active model. This case arises when switching between different models, changing the materials on a given model, or copying and pasting the material component to a different entity with a different model. The user might end up with hidden material slots that load assets but have no effect.
• Converted remaining code that iterated over editor material slots to instead use the material component request bus
• Removed functions from the editor material component that enumerated editor material slots

Signed-off-by: Guthrie Adams <guthadam@amazon.com>
4 years ago
Pinfel 00b5b7ba2d
Fixed in-editor "Atom" category components reference links to o3de.org docs
Signed-off-by: Pinfel <ppinfel@gmail.com>
4 years ago
Guthrie Adams 825e523483 Merge branch 'development' into Atom/guthadam/multiple_dockable_pinned_material_component_property_editor
Signed-off-by: Guthrie Adams <guthadam@amazon.com>
4 years ago
Guthrie Adams f7d4b8e70f Changing material component property inspector to dockable view pane
• Inspector is locked to a specific entity and material assignment ID
• All modifications are made via the material component request bus
• Removed complicated configuration management in editor material component
• Multiple material property inspectors can be opened
• Multiple materials across different entities can be edited simultaneously
• No longer blocks the viewport or other interactions
• Added functions to material component request bus for retrieving material slot labels, default materials, getting and setting property and UV overrides
• Added more asset related types to material property value conversion from any
• Added support for static heading widget on top of atom tools inspector, currently used for menus and messages

WIP: Still investigating intermittent crash because of corrupt asset property
Signed-off-by: Guthrie Adams <guthadam@amazon.com>
4 years ago
santorac 51f101748d These changes make material system report warnings when gameplay scripts attempt to change PSO-impacting material properties at runtime. So far the material system has always allowed any properties to be changed at runtime, including those that affect Pipeline State Objects (PSOs), as this is supported on several platforms. But some platforms require that Pipeline State Objects be pre-compiled and shipped with the game. At some point we will need to add new restrictions that limit what material properties can be changed at runtime. In the meantime, these warnings should alert users to avoid this, as the functionality likely won't be supported in the future.
- Made the Material and LuaMaterialFunctor classes configurable to report errors or warnings when material properties modify Pipeline State Objects. This is controlled by a new "MaterialPropertyPsoHandling" enum.
- Made the EditorMaterialComponent override PSO handling as Enabled, to prevent warnings when the user is editing material instance property overrides. This requried a new MaterialComponentNotificationBus bus message "OnMaterialInstanceCreated".
- Removed unnecessary GetMaterialPropertyDependencies member from material functor context classes, as this is already available as part of the functor itself.
- Made Material::SetPropertyValue return early when the property value hadn't actually changed. Besides being more efficientn, this prevents unnecessary spamming of the new warning.

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 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 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
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
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
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
lumberyard-employee-dm 3dec5d3b71
LYN-2537 engine assets (#254)
* LYN-2537 Moved the Engine and Editor folder to be within the EngineAssets folder

* Fixed Documentation in bootstrap.cfg to correct the path to the user project specific registry file

* Adding a newline to the output of AssetCatalog 'Registering asset..., but type is not set' message

* Updating the AssetProcessorPlatformConfig.setreg Scan Folder to detect
the @ENGINEROOT@/EngineAssets/Engine path for engine runtime assets and
@ENGINEROOT@/EngineAssets/Editor path for engine tool assets

* Updating references to Icons and other assets to account for moving the
Engine and Editor folder under a single EngineAssets folder

* Moving the Engine Settings Registry folder from Engine/Registry -> Registry

* Removed the LY_PROJECT_CMAKE_PATH define as it is not portable to other locations. It is hard coded to the project location that was used for the CMake configuration. Furthermore it paths with backslashes within it are treated as escape characters and not a path separator

* Updated the LyTestTools asset_processor.py script to copy the exclude.filetag from the EngineAssets/Engine directory now

* Fixed Atom Shader Preprocessing when running using an External Project

* Updated the TSGenerateAction.cpp to fix the build error with using a renamed variable

* Updated the Install_Common.cmake ly_setup_others function to install the
EngineAssets directory and the each of the Gem's Assets directory while
maintaining the relative directory structure to the Engine Root
Also updated the install step to install the Registry folder at the
engine root

* Fixed the copying of the Registry folder to be in the install root, instead of under a second 'Registry' folder

* Moving the AssetProcessorPlatformConfig.setreg file over to the Registry folder

* Updated the LyTestTools and C++ code to point that the new location of
the AssetProcessorPlatformConfig.setreg file inside of the Registry
folder

* Renamed Test AssetProcessor*Config.ini files to have the .setreg extension

* Converted the AssetProcessor test setreg files from ini format to json
format using the SerializeContextTools convert-ini command

* Updated the AssetProcessor CMakeLists.txt to copy over the test setreg files to the build folder

* Updated the assetprocessor test file list to point at the renamed AsssetProcessor*Config setreg filenames

* Removed the Output Prefix code from the AssetProcessor. The complexity that it brought to the AP code is not needed, as users can replicate the behavior by just moving there assets underneath a another folder, underneath the scan folder

* Adding back support to read the AssetProcessorPlatformConfig.setreg file from the asset root. This is only needed for C++ UnitTests as they run in an environment where the accessing the Engine Settings Registry is not available

* Updating the Install_common.cmake logic to copy any "Assets" folder to
the install layout.
The Script has also been updated to copy over the "Assets" folder in the
Engine Root to the install layout instead of an "EngineAssets" folder

* Updating References to EngineAssets source asset folder in code to be the Assets source folder

* Moved the Engine Source Asset folder of 'EngineAssets' to a new folder name of 'Assets'. This is inline with the naming scheme we use for Gem asset folders

* Adding the EngineFinder.cmake to the AutomatedTesting project to allow it to work in a project centric manner

* Updating the LyTestTools copy_assets_to_project function to be able to copy assets with folders to the temporary project root
Fixed an issue in LyTestTools where the temporary log directory could have shutil.rmtree being called twice on it leading to an exception which fails an automated test

Updated the asset_procesor_gui_tests_2 AddScanFolder test to not use the
output prefix, but instead place the source asset root into a
subdirectory

* Correct the AssetProcessorPlatformConfig Scan Folders for the EngineAssets directory to point at the Assets directory

* Updated the asset procesor batch dependency test scan folder to point at the 'Assets' folder instead of 'EngineAssets'
5 years ago
alexpete 75dc720198 Integrating latest 47acbe8 5 years ago
alexpete a10351f38d Initial commit 5 years ago