mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2024-10-05 23:47:25 +08:00
Fix for Bounds XML not exporting null composite children
This commit is contained in:
parent
70ebdd8360
commit
a6a2acab75
@ -100,6 +100,7 @@ namespace CodeWalker.GameFiles
|
|||||||
|
|
||||||
public enum BoundsType : byte
|
public enum BoundsType : byte
|
||||||
{
|
{
|
||||||
|
None = 255, //not contained in files, but used as a placeholder in XML conversion
|
||||||
Sphere = 0,
|
Sphere = 0,
|
||||||
Capsule = 1,
|
Capsule = 1,
|
||||||
Box = 3,
|
Box = 3,
|
||||||
@ -466,10 +467,16 @@ namespace CodeWalker.GameFiles
|
|||||||
}
|
}
|
||||||
public static void WriteXmlNode(Bounds b, StringBuilder sb, int indent, string name = "Bounds")
|
public static void WriteXmlNode(Bounds b, StringBuilder sb, int indent, string name = "Bounds")
|
||||||
{
|
{
|
||||||
if (b == null) return;
|
if (b == null)
|
||||||
YbnXml.OpenTag(sb, indent, name + " type=\"" + b.Type.ToString() + "\"");
|
{
|
||||||
b.WriteXml(sb, indent + 1);
|
YbnXml.SelfClosingTag(sb, indent, "Item type=\"" + BoundsType.None.ToString() + "\"");
|
||||||
YbnXml.CloseTag(sb, indent, name);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
YbnXml.OpenTag(sb, indent, name + " type=\"" + b.Type.ToString() + "\"");
|
||||||
|
b.WriteXml(sb, indent + 1);
|
||||||
|
YbnXml.CloseTag(sb, indent, name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public static Bounds ReadXmlNode(XmlNode node, object owner = null, BoundComposite parent = null)
|
public static Bounds ReadXmlNode(XmlNode node, object owner = null, BoundComposite parent = null)
|
||||||
{
|
{
|
||||||
@ -498,6 +505,7 @@ namespace CodeWalker.GameFiles
|
|||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
|
case BoundsType.None: return null;
|
||||||
case BoundsType.Sphere: return new BoundSphere();
|
case BoundsType.Sphere: return new BoundSphere();
|
||||||
case BoundsType.Capsule: return new BoundCapsule();
|
case BoundsType.Capsule: return new BoundCapsule();
|
||||||
case BoundsType.Box: return new BoundBox();
|
case BoundsType.Box: return new BoundBox();
|
||||||
@ -2657,14 +2665,7 @@ namespace CodeWalker.GameFiles
|
|||||||
YbnXml.OpenTag(sb, indent, "Children");
|
YbnXml.OpenTag(sb, indent, "Children");
|
||||||
foreach (var child in c)
|
foreach (var child in c)
|
||||||
{
|
{
|
||||||
if (c == null)
|
Bounds.WriteXmlNode(child, sb, cind, "Item");
|
||||||
{
|
|
||||||
YbnXml.SelfClosingTag(sb, cind, "Item");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Bounds.WriteXmlNode(child, sb, cind, "Item");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
YbnXml.CloseTag(sb, indent, "Children");
|
YbnXml.CloseTag(sb, indent, "Children");
|
||||||
}
|
}
|
||||||
@ -2682,15 +2683,8 @@ namespace CodeWalker.GameFiles
|
|||||||
var blist = new List<Bounds>();
|
var blist = new List<Bounds>();
|
||||||
foreach (XmlNode inode in cnodes)
|
foreach (XmlNode inode in cnodes)
|
||||||
{
|
{
|
||||||
if (inode.HasChildNodes)
|
var b = Bounds.ReadXmlNode(inode, Owner, this);
|
||||||
{
|
blist.Add(b);
|
||||||
var b = Bounds.ReadXmlNode(inode, Owner, this);
|
|
||||||
blist.Add(b);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
blist.Add(null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
var arr = blist.ToArray();
|
var arr = blist.ToArray();
|
||||||
Children = new ResourcePointerArray64<Bounds>();
|
Children = new ResourcePointerArray64<Bounds>();
|
||||||
|
Loading…
Reference in New Issue
Block a user