Properly handled reinitializing the cubemap asset when it is changed between Baked and Authored
Signed-off-by: dmcdiar <dmcdiar@amazon.com>
This commit is contained in:
+16
-2
@@ -214,11 +214,25 @@ namespace AZ
|
||||
|
||||
void ReflectionProbeComponentController::UpdateCubeMap()
|
||||
{
|
||||
// disconnect the asset bus since we might reconnect with a different asset
|
||||
Data::AssetBus::MultiHandler::BusDisconnect();
|
||||
|
||||
Data::Asset<RPI::StreamingImageAsset>& cubeMapAsset =
|
||||
m_configuration.m_useBakedCubemap ? m_configuration.m_bakedCubeMapAsset : m_configuration.m_authoredCubeMapAsset;
|
||||
|
||||
// this will invoke OnAssetReady()
|
||||
Data::AssetBus::MultiHandler::BusConnect(cubeMapAsset.GetId());
|
||||
if (cubeMapAsset.GetId().IsValid())
|
||||
{
|
||||
cubeMapAsset.QueueLoad();
|
||||
|
||||
// this will invoke OnAssetReady()
|
||||
Data::AssetBus::MultiHandler::BusConnect(cubeMapAsset.GetId());
|
||||
}
|
||||
else
|
||||
{
|
||||
// clear the current cubemap
|
||||
Data::Instance<RPI::Image> image = nullptr;
|
||||
m_featureProcessor->SetProbeCubeMap(m_handle, image, {});
|
||||
}
|
||||
}
|
||||
|
||||
void ReflectionProbeComponentController::OnTransformChanged([[maybe_unused]] const AZ::Transform& local, const AZ::Transform& world)
|
||||
|
||||
Reference in New Issue
Block a user