Added default attribute names for XML vectors reading

This commit is contained in:
dexy
2020-01-22 02:45:27 +11:00
Unverified
parent e44b2ef095
commit 08d60877ee
10 changed files with 118 additions and 118 deletions
@@ -423,14 +423,14 @@ namespace CodeWalker.GameFiles
}
public virtual void ReadXml(XmlNode node)
{
BoxMin = Xml.GetChildVector3Attributes(node, "BoxMin", "x", "y", "z");
BoxMax = Xml.GetChildVector3Attributes(node, "BoxMax", "x", "y", "z");
BoxCenter = Xml.GetChildVector3Attributes(node, "BoxCenter", "x", "y", "z");
SphereCenter = Xml.GetChildVector3Attributes(node, "SphereCenter", "x", "y", "z");
BoxMin = Xml.GetChildVector3Attributes(node, "BoxMin");
BoxMax = Xml.GetChildVector3Attributes(node, "BoxMax");
BoxCenter = Xml.GetChildVector3Attributes(node, "BoxCenter");
SphereCenter = Xml.GetChildVector3Attributes(node, "SphereCenter");
SphereRadius = Xml.GetChildFloatAttribute(node, "SphereRadius", "value");
Margin = Xml.GetChildFloatAttribute(node, "Margin", "value");
Volume = Xml.GetChildFloatAttribute(node, "Volume", "value");
Unknown_60h = Xml.GetChildVector3Attributes(node, "Inertia", "x", "y", "z");
Unknown_60h = Xml.GetChildVector3Attributes(node, "Inertia");
MaterialIndex = (byte)Xml.GetChildUIntAttribute(node, "MaterialIndex", "value");
MaterialColorIndex = (byte)Xml.GetChildUIntAttribute(node, "MaterialColourIndex", "value");
ProceduralId = (byte)Xml.GetChildUIntAttribute(node, "ProceduralID", "value");
@@ -441,9 +441,9 @@ namespace CodeWalker.GameFiles
Unknown_3Ch = (byte)Xml.GetChildUIntAttribute(node, "UnkType", "value");
if (Parent != null)
{
Position = Xml.GetChildVector3Attributes(node, "CompositePosition", "x", "y", "z");
Orientation = Xml.GetChildVector4Attributes(node, "CompositeRotation", "x", "y", "z", "w").ToQuaternion();
Scale = Xml.GetChildVector3Attributes(node, "CompositeScale", "x", "y", "z");
Position = Xml.GetChildVector3Attributes(node, "CompositePosition");
Orientation = Xml.GetChildVector4Attributes(node, "CompositeRotation").ToQuaternion();
Scale = Xml.GetChildVector3Attributes(node, "CompositeScale");
var f = new BoundCompositeChildrenFlags();
f.Flags1 = Xml.GetChildEnumInnerText<EBoundCompositeFlags>(node, "CompositeFlags1");
f.Flags2 = Xml.GetChildEnumInnerText<EBoundCompositeFlags>(node, "CompositeFlags2");
@@ -1163,7 +1163,7 @@ namespace CodeWalker.GameFiles
{
base.ReadXml(node);
CenterGeom = Xml.GetChildVector3Attributes(node, "GeometryCenter", "x", "y", "z");
CenterGeom = Xml.GetChildVector3Attributes(node, "GeometryCenter");
Unknown_9Ch = Xml.GetChildFloatAttribute(node, "UnkFloat1", "value");
Unknown_ACh = Xml.GetChildFloatAttribute(node, "UnkFloat2", "value");
+4 -4
View File
@@ -1119,7 +1119,7 @@ namespace CodeWalker.GameFiles
public override void ReadXml(XmlNode node)
{
base.ReadXml(node);
Value = Xml.GetChildVector3Attributes(node, "Value", "x", "y", "z");
Value = Xml.GetChildVector3Attributes(node, "Value");
}
}
[TypeConverter(typeof(ExpandableObjectConverter))] public class AnimChannelStaticQuaternion : AnimChannel
@@ -1153,7 +1153,7 @@ namespace CodeWalker.GameFiles
public override void ReadXml(XmlNode node)
{
base.ReadXml(node);
Value = new Quaternion(Xml.GetChildVector4Attributes(node, "Value", "x", "y", "z", "w"));
Value = new Quaternion(Xml.GetChildVector4Attributes(node, "Value"));
}
}
[TypeConverter(typeof(ExpandableObjectConverter))] public class AnimChannelIndirectQuantizeFloat : AnimChannel
@@ -4165,7 +4165,7 @@ namespace CodeWalker.GameFiles
public override void ReadXml(XmlNode node)
{
base.ReadXml(node);
Value = Xml.GetChildVector3Attributes(node, "Value", "x", "y", "z");
Value = Xml.GetChildVector3Attributes(node, "Value");
Unknown_02Ch = Xml.GetChildFloatAttribute(node, "Unknown2C", "value");
}
}
@@ -4208,7 +4208,7 @@ namespace CodeWalker.GameFiles
public override void ReadXml(XmlNode node)
{
base.ReadXml(node);
Value = Xml.GetChildVector4Attributes(node, "Value", "x", "y", "z", "w");
Value = Xml.GetChildVector4Attributes(node, "Value");
}
}
[TypeConverter(typeof(ExpandableObjectConverter))] public class ClipPropertyAttributeHashString : ClipPropertyAttribute
+18 -18
View File
@@ -1653,10 +1653,10 @@ namespace CodeWalker.GameFiles
ParentIndex = (short)Xml.GetChildIntAttribute(node, "ParentIndex", "value");
NextSiblingIndex = (short)Xml.GetChildIntAttribute(node, "SiblingIndex", "value");
Flags = Xml.GetChildEnumInnerText<EBoneFlags>(node, "Flags");
Translation = Xml.GetChildVector3Attributes(node, "Translation", "x", "y", "z");
Rotation = Xml.GetChildVector4Attributes(node, "Rotation", "x", "y", "z", "w").ToQuaternion();
Scale = Xml.GetChildVector3Attributes(node, "Scale", "x", "y", "z");
TransformUnk = Xml.GetChildVector4Attributes(node, "TransformUnk", "x", "y", "z", "w");
Translation = Xml.GetChildVector3Attributes(node, "Translation");
Rotation = Xml.GetChildVector4Attributes(node, "Rotation").ToQuaternion();
Scale = Xml.GetChildVector3Attributes(node, "Scale");
TransformUnk = Xml.GetChildVector4Attributes(node, "TransformUnk");
}
public override IResourceBlock[] GetReferences()
@@ -1972,8 +1972,8 @@ namespace CodeWalker.GameFiles
Init();
BoneId = (ushort)Xml.GetChildUIntAttribute(node, "BoneId", "value");
Unknown_Ah = (ushort)Xml.GetChildUIntAttribute(node, "UnknownA", "value");
Min = Xml.GetChildVector3Attributes(node, "Min", "x", "y", "z");
Max = Xml.GetChildVector3Attributes(node, "Max", "x", "y", "z");
Min = Xml.GetChildVector3Attributes(node, "Min");
Max = Xml.GetChildVector3Attributes(node, "Max");
}
}
@@ -2001,8 +2001,8 @@ namespace CodeWalker.GameFiles
public void ReadXml(XmlNode node)
{
BoneId = (ushort)Xml.GetChildUIntAttribute(node, "BoneId", "value");
Min = Xml.GetChildVector3Attributes(node, "Min", "x", "y", "z");
Max = Xml.GetChildVector3Attributes(node, "Max", "x", "y", "z");
Min = Xml.GetChildVector3Attributes(node, "Min");
Max = Xml.GetChildVector3Attributes(node, "Max");
}
}
@@ -2502,8 +2502,8 @@ namespace CodeWalker.GameFiles
{
ShaderID = (ushort)Xml.GetChildUIntAttribute(node, "ShaderIndex", "value");
var aabb = new AABB_s();
aabb.Min = Xml.GetChildVector4Attributes(node, "BoundingBoxMin", "x", "y", "z", "w");
aabb.Max = Xml.GetChildVector4Attributes(node, "BoundingBoxMax", "x", "y", "z", "w");
aabb.Min = Xml.GetChildVector4Attributes(node, "BoundingBoxMin");
aabb.Max = Xml.GetChildVector4Attributes(node, "BoundingBoxMax");
AABB = aabb;
var bnode = node.SelectSingleNode("BoneIDs");
if (bnode != null)
@@ -3666,7 +3666,7 @@ namespace CodeWalker.GameFiles
}
public void ReadXml(XmlNode node)
{
Position = Xml.GetChildVector3Attributes(node, "Position", "x", "y", "z");
Position = Xml.GetChildVector3Attributes(node, "Position");
ColorR = (byte)Xml.GetChildUIntAttribute(node, "Colour", "r");
ColorG = (byte)Xml.GetChildUIntAttribute(node, "Colour", "g");
ColorB = (byte)Xml.GetChildUIntAttribute(node, "Colour", "b");
@@ -3679,7 +3679,7 @@ namespace CodeWalker.GameFiles
TimeFlags = Xml.GetChildUIntAttribute(node, "TimeFlags", "value");
Falloff = Xml.GetChildFloatAttribute(node, "Falloff", "value");
FalloffExponent = Xml.GetChildFloatAttribute(node, "FalloffExponent", "value");
CullingPlaneNormal = Xml.GetChildVector3Attributes(node, "CullingPlaneNormal", "x", "y", "z");
CullingPlaneNormal = Xml.GetChildVector3Attributes(node, "CullingPlaneNormal");
CullingPlaneOffset = Xml.GetChildFloatAttribute(node, "CullingPlaneOffset", "value");
Unknown_45h = (byte)Xml.GetChildUIntAttribute(node, "Unknown45", "value");
Unknown_46h = (ushort)Xml.GetChildUIntAttribute(node, "Unknown46", "value");
@@ -3699,11 +3699,11 @@ namespace CodeWalker.GameFiles
ShadowNearClip = Xml.GetChildFloatAttribute(node, "ShadowNearClip", "value");
CoronaIntensity = Xml.GetChildFloatAttribute(node, "CoronaIntensity", "value");
CoronaZBias = Xml.GetChildFloatAttribute(node, "CoronaZBias", "value");
Direction = Xml.GetChildVector3Attributes(node, "Direction", "x", "y", "z");
Tangent = Xml.GetChildVector3Attributes(node, "Tangent", "x", "y", "z");
Direction = Xml.GetChildVector3Attributes(node, "Direction");
Tangent = Xml.GetChildVector3Attributes(node, "Tangent");
ConeInnerAngle = Xml.GetChildFloatAttribute(node, "ConeInnerAngle", "value");
ConeOuterAngle = Xml.GetChildFloatAttribute(node, "ConeOuterAngle", "value");
Extent = Xml.GetChildVector3Attributes(node, "Extent", "x", "y", "z");
Extent = Xml.GetChildVector3Attributes(node, "Extent");
ProjectedTextureHash = XmlMeta.GetHash(Xml.GetChildInnerText(node, "ProjectedTextureHash"));
}
}
@@ -4181,10 +4181,10 @@ namespace CodeWalker.GameFiles
}
public virtual void ReadXml(XmlNode node, string ddsfolder)
{
BoundingCenter = Xml.GetChildVector3Attributes(node, "BoundingSphereCenter", "x", "y", "z");
BoundingCenter = Xml.GetChildVector3Attributes(node, "BoundingSphereCenter");
BoundingSphereRadius = Xml.GetChildFloatAttribute(node, "BoundingSphereRadius", "value");
BoundingBoxMin = Xml.GetChildVector4Attributes(node, "BoundingBoxMin", "x", "y", "z", "w");
BoundingBoxMax = Xml.GetChildVector4Attributes(node, "BoundingBoxMax", "x", "y", "z", "w");
BoundingBoxMin = Xml.GetChildVector4Attributes(node, "BoundingBoxMin");
BoundingBoxMax = Xml.GetChildVector4Attributes(node, "BoundingBoxMax");
LodDistHigh = Xml.GetChildFloatAttribute(node, "LodDistHigh", "value");
LodDistMed = Xml.GetChildFloatAttribute(node, "LodDistMed", "value");
LodDistLow = Xml.GetChildFloatAttribute(node, "LodDistLow", "value");
+2 -2
View File
@@ -411,7 +411,7 @@ namespace CodeWalker.GameFiles
AreaID = (ushort)Xml.GetChildUIntAttribute(node, "AreaID", "value");
NodeID = (ushort)Xml.GetChildUIntAttribute(node, "NodeID", "value");
StreetName = XmlYnd.GetTextHash(Xml.GetChildInnerText(node, "StreetName"));
Vector3 p = Xml.GetChildVector3Attributes(node, "Position", "x", "y", "z");
Vector3 p = Xml.GetChildVector3Attributes(node, "Position");
PositionX = (short)(p.X * 4.0f);
PositionY = (short)(p.Y * 4.0f);
PositionZ = (short)(p.Z * 32.0f);
@@ -515,7 +515,7 @@ namespace CodeWalker.GameFiles
}
public void ReadXml(XmlNode node, List<byte> allHeightmapDataList)
{
Vector2 p = Xml.GetChildVector2Attributes(node, "Position", "x", "y");
Vector2 p = Xml.GetChildVector2Attributes(node, "Position");
float minz = Xml.GetChildFloatAttribute(node, "MinZ", "value");
float maxz = Xml.GetChildFloatAttribute(node, "MaxZ", "value");
HeightmapDimX = (byte)Xml.GetChildUIntAttribute(node, "SizeX", "value");