Initialize prefab interface pointers only when prefabs are enabled

Signed-off-by: srikappa-amzn <srikappa@amazon.com>
This commit is contained in:
srikappa-amzn
2021-09-08 23:19:05 -07:00
parent b87b807de9
commit 5dcfb8e654
+13 -8
View File
@@ -132,14 +132,19 @@ CCryEditDoc::CCryEditDoc()
RegisterConsoleVariables();
MainWindow::instance()->GetActionManager()->RegisterActionHandler(ID_FILE_SAVE_AS, this, &CCryEditDoc::OnFileSaveAs);
m_prefabSystemComponentInterface = AZ::Interface<AzToolsFramework::Prefab::PrefabSystemComponentInterface>::Get();
AZ_Assert(m_prefabSystemComponentInterface, "PrefabSystemComponentInterface is not found.");
m_prefabEditorEntityOwnershipInterface = AZ::Interface<AzToolsFramework::PrefabEditorEntityOwnershipInterface>::Get();
AZ_Assert(m_prefabEditorEntityOwnershipInterface, "PrefabEditorEntityOwnershipInterface is not found.");
m_prefabLoaderInterface = AZ::Interface<AzToolsFramework::Prefab::PrefabLoaderInterface>::Get();
AZ_Assert(m_prefabLoaderInterface, "PrefabLoaderInterface is not found.");
m_prefabIntegrationInterface = AZ::Interface<AzToolsFramework::Prefab::PrefabIntegrationInterface>::Get();
AZ_Assert(m_prefabIntegrationInterface, "PrefabIntegrationInterface is not found.");
bool isPrefabSystemEnabled = false;
AzFramework::ApplicationRequests::Bus::BroadcastResult(isPrefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
if (isPrefabSystemEnabled)
{
m_prefabSystemComponentInterface = AZ::Interface<AzToolsFramework::Prefab::PrefabSystemComponentInterface>::Get();
AZ_Assert(m_prefabSystemComponentInterface, "PrefabSystemComponentInterface is not found.");
m_prefabEditorEntityOwnershipInterface = AZ::Interface<AzToolsFramework::PrefabEditorEntityOwnershipInterface>::Get();
AZ_Assert(m_prefabEditorEntityOwnershipInterface, "PrefabEditorEntityOwnershipInterface is not found.");
m_prefabLoaderInterface = AZ::Interface<AzToolsFramework::Prefab::PrefabLoaderInterface>::Get();
AZ_Assert(m_prefabLoaderInterface, "PrefabLoaderInterface is not found.");
m_prefabIntegrationInterface = AZ::Interface<AzToolsFramework::Prefab::PrefabIntegrationInterface>::Get();
AZ_Assert(m_prefabIntegrationInterface, "PrefabIntegrationInterface is not found.");
}
}
CCryEditDoc::~CCryEditDoc()