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

Method LoadPanel

Source/Editor/Modules/WindowsModule.cs:439–502  ·  view source on GitHub ↗
(XmlElement node, DockPanel panel)

Source from the content-addressed store, hash-verified

437 }
438
439 private void LoadPanel(XmlElement node, DockPanel panel)
440 {
441 int selectedTab = int.Parse(node.GetAttribute("SelectedTab"), CultureInfo.InvariantCulture);
442
443 // Load docked windows
444 var windows = node.SelectNodes("Window");
445 if (windows != null)
446 {
447 foreach (XmlElement child in windows)
448 {
449 if (child == null)
450 continue;
451
452 var typename = child.GetAttribute("Typename");
453 var window = GetWindow(typename);
454 if (window != null)
455 {
456 if (child.SelectSingleNode("Data") is XmlElement data)
457 {
458 window.OnLayoutDeserialize(data);
459 }
460 else
461 {
462 window.OnLayoutDeserialize();
463 }
464
465 window.Show(DockState.DockFill, panel);
466 }
467 }
468 }
469
470 // Load child panels
471 var panels = node.SelectNodes("Panel");
472 if (panels != null)
473 {
474 foreach (XmlElement child in panels)
475 {
476 if (child == null)
477 continue;
478
479 // Create child panel
480 DockState state = (DockState)int.Parse(child.GetAttribute("DockState"), CultureInfo.InvariantCulture);
481 float splitterValue = float.Parse(child.GetAttribute("SplitterValue"), CultureInfo.InvariantCulture);
482 var p = panel.CreateChildPanel(state, splitterValue);
483
484 LoadPanel(child, p);
485
486 // Check if panel has no docked window (due to loading problems or sth)
487 if (p.TabsCount == 0 && p.ChildPanelsCount == 0)
488 {
489 // Remove empty panel
490 Editor.LogWarning("Empty panel inside layout.");
491 p.RemoveIt();
492 }
493 else
494 {
495 p.CollapseEmptyTabsProxy();
496 }

Callers

nothing calls this directly

Calls 9

CreateChildPanelMethod · 0.80
RemoveItMethod · 0.80
ParseMethod · 0.45
GetAttributeMethod · 0.45
OnLayoutDeserializeMethod · 0.45
ShowMethod · 0.45
LogWarningMethod · 0.45
SelectTabMethod · 0.45

Tested by

no test coverage detected