Fix for level export. (#656)

Reproduced the issue where a newly exported level would not display anything when loaded in the editor, verified this change fixes it. Note that this is all related to the legacy level system, not the new prefab level system.
This commit is contained in:
bosnichd
2021-05-10 08:37:59 -06:00
committed by GitHub
parent d03f946609
commit 400fb14e7e
+11
View File
@@ -295,6 +295,17 @@ void CGameExporter::ExportLevelData(const QString& path, bool /*bExportMission*/
CCryMemFile fileAction;
fileAction.Write(xmlDataAction.c_str(), xmlDataAction.length());
m_levelPak.m_pakFile.UpdateFile(levelDataActionFile.toUtf8().data(), fileAction);
AZStd::vector<char> entitySaveBuffer;
AZ::IO::ByteContainerStream<AZStd::vector<char> > entitySaveStream(&entitySaveBuffer);
bool savedEntities = false;
EBUS_EVENT_RESULT(savedEntities, AzToolsFramework::EditorEntityContextRequestBus, SaveToStreamForGame, entitySaveStream, AZ::DataStream::ST_BINARY);
if (savedEntities)
{
QString entitiesFile;
entitiesFile = QStringLiteral("%1%2.entities_xml").arg(path, "Mission0");
m_levelPak.m_pakFile.UpdateFile(entitiesFile.toUtf8().data(), entitySaveBuffer.begin(), entitySaveBuffer.size());
}
}
//////////////////////////////////////////////////////////////////////////