Guthries excellent recommendation
Signed-off-by: mrieggeramzn <mriegger@amazon.com>
This commit is contained in:
@@ -15,11 +15,6 @@ namespace AZ
|
||||
{
|
||||
namespace Render
|
||||
{
|
||||
static AZ::Data::Asset<AZ::RPI::MaterialAsset> QueueLoad(const AZ::Data::AssetId id)
|
||||
{
|
||||
return AZ::Data::AssetManager::Instance().GetAsset<AZ::RPI::MaterialAsset>(id, AZ::Data::AssetLoadBehavior::QueueLoad);
|
||||
}
|
||||
|
||||
EditorDecalComponent::EditorDecalComponent(const DecalComponentConfig& config)
|
||||
: BaseClass(config)
|
||||
{
|
||||
@@ -92,26 +87,16 @@ namespace AZ
|
||||
AzFramework::EntityDebugDisplayEventBus::Handler::BusConnect(GetEntityId());
|
||||
AzToolsFramework::EditorComponentSelectionRequestsBus::Handler::BusConnect(GetEntityId());
|
||||
AzFramework::BoundsRequestBus::Handler::BusConnect(GetEntityId());
|
||||
CacheMaterial();
|
||||
}
|
||||
|
||||
void EditorDecalComponent::Deactivate()
|
||||
{
|
||||
m_cachedMaterial = {};
|
||||
AzFramework::BoundsRequestBus::Handler::BusDisconnect();
|
||||
AzToolsFramework::EditorComponentSelectionRequestsBus::Handler::BusDisconnect();
|
||||
AzFramework::EntityDebugDisplayEventBus::Handler::BusDisconnect();
|
||||
BaseClass::Deactivate();
|
||||
}
|
||||
|
||||
void EditorDecalComponent::CacheMaterial()
|
||||
{
|
||||
DecalComponentConfig decalComponentConfig;
|
||||
GetConfiguration(decalComponentConfig);
|
||||
const auto& materialAsset = decalComponentConfig.m_materialAsset;
|
||||
m_cachedMaterial = QueueLoad(materialAsset.GetId());
|
||||
}
|
||||
|
||||
AZ::Transform EditorDecalComponent::GetWorldTransform() const
|
||||
{
|
||||
AZ::Transform transform = AZ::Transform::CreateIdentity();
|
||||
@@ -207,8 +192,7 @@ namespace AZ
|
||||
|
||||
u32 EditorDecalComponent::OnConfigurationChanged()
|
||||
{
|
||||
BaseClass::OnConfigurationChanged();
|
||||
CacheMaterial();
|
||||
m_controller.ConfigurationChanged();
|
||||
return Edit::PropertyRefreshLevels::AttributesAndValues;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user