BXLYT : Fix updating layout instance on new panes (fixes pane name list in bxlan editor)

This commit is contained in:
KillzXGaming 2020-09-18 18:13:31 -04:00
parent 91f4909b1f
commit 4f28c0747f

View file

@ -62,10 +62,14 @@ namespace LayoutBXLYT
//Adjust necessary parameters if the user changes the name //Adjust necessary parameters if the user changes the name
if (name != null && LayoutFile != null) if (name != null && LayoutFile != null)
{ {
Console.WriteLine($"LayoutFile {name} {LayoutFile.PaneLookup.ContainsKey(name)}");
//Adjust name table entry //Adjust name table entry
if (LayoutFile != null && LayoutFile.PaneLookup.ContainsKey(name)) if (LayoutFile.PaneLookup.ContainsKey(name))
LayoutFile.PaneLookup.Remove(name); LayoutFile.PaneLookup.Remove(name);
Console.WriteLine($"LayoutFileR {name} {LayoutFile.PaneLookup.ContainsKey(name)}");
//Adjust material reference //Adjust material reference
if (this is IPicturePane) if (this is IPicturePane)
((IPicturePane)this).Material.SetName(name, value); ((IPicturePane)this).Material.SetName(name, value);
@ -91,6 +95,11 @@ namespace LayoutBXLYT
if (LayoutFile != null && !LayoutFile.PaneLookup.ContainsKey(name)) if (LayoutFile != null && !LayoutFile.PaneLookup.ContainsKey(name))
LayoutFile.PaneLookup.Add(name, this); LayoutFile.PaneLookup.Add(name, this);
Console.WriteLine($"test {name}");
if (LayoutFile != null)
Console.WriteLine($"LayoutFileN {name} {LayoutFile.PaneLookup.ContainsKey(name)}");
} }
} }
@ -2326,6 +2335,7 @@ namespace LayoutBXLYT
if (!PaneLookup.ContainsKey(pane.Name)) if (!PaneLookup.ContainsKey(pane.Name))
PaneLookup.Add(pane.Name, pane); PaneLookup.Add(pane.Name, pane);
pane.LayoutFile = this;
pane.Parent = parent; pane.Parent = parent;
parent.Childern.Add(pane); parent.Childern.Add(pane);
parent.NodeWrapper.Nodes.Add(pane.NodeWrapper); parent.NodeWrapper.Nodes.Add(pane.NodeWrapper);