void EdApp::SavePersistentData() { // Save layout { QFile file(ED_PATH_TO_APP_LAYOUT); file.open(QIODevice::WriteOnly); if( !file.isOpen() ) { mxWarnf("Failed to save layout to file '%s'.\n",ED_PATH_TO_APP_LAYOUT); return; } QDataStream stream( &file ); this->SerializeWidgetLayout(stream); } // Save current settings { FileWriter file( ED_PATH_TO_APP_SETTINGS ); if( file.IsOpen() ) { TextWriter archive; EdSystem::Get().settings.Serialize( archive ); EdSystem::Get().Event_SerializeAppData( archive ); archive.WriteAllToStream( file ); } } }
//----------------------------------------------------------------------------- bool EdProject::Save() { mxPutf("Saving project '%s'\n",m_name.ToChars()); // serialize engine environment { ANSICHAR levelFilePath[FS_MAX_PATH]; F_Compose_File_Path( m_fullFilePath, PROJ_LEVEL_FILE_EXTENSION, levelFilePath ); FileWriter fileStream( levelFilePath ); if( !fileStream.IsOpen() ) { return false; } TextObjectWriter serializer; SEngineSaveArgs saveArgs; saveArgs.serializer = &serializer; gEngine.SaveState( saveArgs ); // write comment // @todo: project build options, engine version, etc. { const UINT numWorlds = Global_Level_Editor::Get().Num(); String comment; comment.Format("// Level file for \"%s\" (%u world(s))\n//", m_name.ToChars(), numWorlds ); serializer.SetRootComment( comment ); } serializer.WriteAllToStream( fileStream ); } // Serialize project data { FileWriter fileStream( m_fullFilePath ); if( !fileStream.IsOpen() ) { return false; } TextWriter serializer; { { serializer.Serialize_String( "Path_To_Asset_Database", m_assetDbFilePath ); if( !m_assetDbFilePath.IsEmpty() ) { m_assetMgr.SaveToFile( m_assetDbFilePath ); } } EdSystem::Get().Event_SerializeProjectData( serializer ); } serializer.WriteAllToStream( fileStream ); } return true; }