|
|
|
@@ -57,7 +57,6 @@
|
|
|
|
|
|
|
|
|
|
// LmbrCentral
|
|
|
|
|
#include <LmbrCentral/Audio/AudioSystemComponentBus.h>
|
|
|
|
|
#include <LmbrCentral/Rendering/EditorLightComponentBus.h> // for LmbrCentral::EditorLightComponentRequestBus
|
|
|
|
|
|
|
|
|
|
static const char* kAutoBackupFolder = "_autobackup";
|
|
|
|
|
static const char* kHoldFolder = "$tmp_hold"; // conform to the ignored file types $tmp[0-9]*_ regex
|
|
|
|
@@ -2130,52 +2129,13 @@ void CCryEditDoc::ReleaseXmlArchiveArray(TDocMultiArchive& arrXmlAr)
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// AzToolsFramework::EditorEntityContextNotificationBus interface implementation
|
|
|
|
|
void CCryEditDoc::OnSliceInstantiated(const AZ::Data::AssetId& sliceAssetId, AZ::SliceComponent::SliceInstanceAddress& sliceAddress, const AzFramework::SliceInstantiationTicket& /*ticket*/)
|
|
|
|
|
void CCryEditDoc::OnSliceInstantiated([[maybe_unused]] const AZ::Data::AssetId& sliceAssetId, [[maybe_unused]] AZ::SliceComponent::SliceInstanceAddress& sliceAddress, [[maybe_unused]] const AzFramework::SliceInstantiationTicket& /*ticket*/)
|
|
|
|
|
{
|
|
|
|
|
if (m_envProbeSliceAssetId == sliceAssetId)
|
|
|
|
|
{
|
|
|
|
|
const AZ::SliceComponent::EntityList& entities = sliceAddress.GetInstance()->GetInstantiated()->m_entities;
|
|
|
|
|
const AZ::Uuid editorEnvProbeComponentId("{8DBD6035-583E-409F-AFD9-F36829A0655D}");
|
|
|
|
|
AzToolsFramework::EntityIdList entityIds;
|
|
|
|
|
entityIds.reserve(entities.size());
|
|
|
|
|
for (const AZ::Entity* entity : entities)
|
|
|
|
|
{
|
|
|
|
|
if (entity->FindComponent(editorEnvProbeComponentId))
|
|
|
|
|
{
|
|
|
|
|
// Update Probe Area size to cover the whole terrain
|
|
|
|
|
LmbrCentral::EditorLightComponentRequestBus::Event(entity->GetId(), &LmbrCentral::EditorLightComponentRequests::SetProbeAreaDimensions, AZ::Vector3(m_terrainSize, m_terrainSize, m_envProbeHeight));
|
|
|
|
|
|
|
|
|
|
// Force update the light to apply cubemap
|
|
|
|
|
LmbrCentral::EditorLightComponentRequestBus::Event(entity->GetId(), &LmbrCentral::EditorLightComponentRequests::RefreshLight);
|
|
|
|
|
}
|
|
|
|
|
entityIds.push_back(entity->GetId());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Detach instantiated env probe entities from engine slice
|
|
|
|
|
AzToolsFramework::SliceEditorEntityOwnershipServiceRequestBus::Broadcast(
|
|
|
|
|
&AzToolsFramework::SliceEditorEntityOwnershipServiceRequests::DetachSliceEntities, entityIds);
|
|
|
|
|
|
|
|
|
|
sliceAddress.SetInstance(nullptr);
|
|
|
|
|
sliceAddress.SetReference(nullptr);
|
|
|
|
|
SetModifiedFlag(true);
|
|
|
|
|
SetModifiedModules(eModifiedEntities);
|
|
|
|
|
|
|
|
|
|
AzToolsFramework::SliceEditorEntityOwnershipServiceNotificationBus::Handler::BusDisconnect();
|
|
|
|
|
|
|
|
|
|
//save after level default slice fully instantiated
|
|
|
|
|
Save();
|
|
|
|
|
}
|
|
|
|
|
GetIEditor()->ResumeUndo();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CCryEditDoc::OnSliceInstantiationFailed(const AZ::Data::AssetId& sliceAssetId, const AzFramework::SliceInstantiationTicket& /*ticket*/)
|
|
|
|
|
void CCryEditDoc::OnSliceInstantiationFailed([[maybe_unused]] const AZ::Data::AssetId& sliceAssetId, [[maybe_unused]] const AzFramework::SliceInstantiationTicket& /*ticket*/)
|
|
|
|
|
{
|
|
|
|
|
if (m_envProbeSliceAssetId == sliceAssetId)
|
|
|
|
|
{
|
|
|
|
|
AzToolsFramework::SliceEditorEntityOwnershipServiceNotificationBus::Handler::BusDisconnect();
|
|
|
|
|
AZ_Warning("Editor", false, "Failed to instantiate default environment probe slice.");
|
|
|
|
|
}
|
|
|
|
|
GetIEditor()->ResumeUndo();
|
|
|
|
|
}
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|