MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / LoadOldProject

Method LoadOldProject

Source/Editor/ProjectInfo.cpp:275–319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

273}
274
275bool ProjectInfo::LoadOldProject(const String& projectPath)
276{
277 // Open Xml file
278 xml_document doc;
279 const xml_parse_result result = doc.load_file((const PUGIXML_CHAR*)*projectPath);
280 if (result.status)
281 {
282 ShowProjectLoadError(TEXT("Xml file parsing error."), projectPath);
283 return true;
284 }
285
286 // Get root node
287 const xml_node root = doc.child(PUGIXML_TEXT("Project"));
288 if (!root)
289 {
290 ShowProjectLoadError(TEXT("Missing Project root node in xml file."), projectPath);
291 return true;
292 }
293
294 // Load data
295 Name = (const Char*)root.child_value(PUGIXML_TEXT("Name"));
296 ProjectPath = projectPath;
297 ProjectFolderPath = StringUtils::GetDirectoryName(projectPath);
298 DefaultScene = Guid::Empty;
299 const auto defaultScene = root.child_value(PUGIXML_TEXT("DefaultSceneId"));
300 if (defaultScene)
301 {
302 Guid::Parse((const Char*)defaultScene, DefaultScene);
303 }
304 DefaultSceneSpawn.Position = GetVector3FromXml(root, PUGIXML_TEXT("DefaultSceneSpawnPos"), Vector3::Zero);
305 DefaultSceneSpawn.Direction = Quaternion::Euler(GetVector3FromXml(root, PUGIXML_TEXT("DefaultSceneSpawnDir"), Vector3::Zero)) * Vector3::Forward;
306 MinEngineVersion = ::Version(0, 0, GetIntFromXml(root, PUGIXML_TEXT("MinVersionSupported"), 0));
307
308 // Always reference engine project
309 auto& flaxReference = References.AddOne();
310 flaxReference.Name = TEXT("$(EnginePath)/Flax.flaxproj");
311 flaxReference.Project = Load(Globals::StartupFolder / TEXT("Flax.flaxproj"));
312 if (!flaxReference.Project)
313 {
314 ShowProjectLoadError(TEXT("Failed to load Flax Engine project."), projectPath);
315 return true;
316 }
317
318 return false;
319}
320
321ProjectInfo* ProjectInfo::Load(const String& path)
322{

Callers 1

LoadProductMethod · 0.80

Calls 10

ShowProjectLoadErrorFunction · 0.85
GetVector3FromXmlFunction · 0.85
GetIntFromXmlFunction · 0.85
load_fileMethod · 0.80
childMethod · 0.80
child_valueMethod · 0.80
AddOneMethod · 0.80
ParseFunction · 0.50
VersionFunction · 0.50
LoadFunction · 0.50

Tested by

no test coverage detected