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>
This commit is contained in:
+4
-3
@@ -140,7 +140,7 @@ namespace AZ
|
||||
|
||||
void EditorMaterialComponentSlot::SetAsset(const Data::AssetId& assetId)
|
||||
{
|
||||
m_materialAsset.Create(assetId);
|
||||
m_materialAsset = AZ::Data::Asset<AZ::RPI::MaterialAsset>(assetId, AZ::AzTypeInfo<AZ::RPI::MaterialAsset>::Uuid());
|
||||
MaterialComponentRequestBus::Event(
|
||||
m_entityId, &MaterialComponentRequestBus::Events::SetMaterialOverride, m_id, m_materialAsset.GetId());
|
||||
OnDataChanged();
|
||||
@@ -164,7 +164,7 @@ namespace AZ
|
||||
|
||||
void EditorMaterialComponentSlot::ClearToDefaultAsset()
|
||||
{
|
||||
m_materialAsset.Create(GetDefaultAssetId());
|
||||
m_materialAsset = AZ::Data::Asset<AZ::RPI::MaterialAsset>(GetDefaultAssetId(), AZ::AzTypeInfo<AZ::RPI::MaterialAsset>::Uuid());
|
||||
MaterialComponentRequestBus::Event(
|
||||
m_entityId, &MaterialComponentRequestBus::Events::SetMaterialOverride, m_id, m_materialAsset.GetId());
|
||||
ClearOverrides();
|
||||
@@ -204,7 +204,8 @@ namespace AZ
|
||||
const auto& assetIdOutcome = AZ::RPI::AssetUtils::MakeAssetId(exportItem.GetExportPath(), 0);
|
||||
if (assetIdOutcome)
|
||||
{
|
||||
m_materialAsset.Create(assetIdOutcome.GetValue());
|
||||
m_materialAsset = AZ::Data::Asset<AZ::RPI::MaterialAsset>(
|
||||
assetIdOutcome.GetValue(), AZ::AzTypeInfo<AZ::RPI::MaterialAsset>::Uuid());
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user