YNV/XML conversion

This commit is contained in:
dexy
2021-04-17 06:33:23 +10:00
Unverified
parent 6268298207
commit 4751818703
7 changed files with 768 additions and 276 deletions
+16 -1
View File
@@ -274,7 +274,7 @@ namespace CodeWalker
InitFileType(".pso", "Metadata (PSO)", 6, FileTypeAction.ViewJPso, true);
InitFileType(".gfx", "Scaleform Flash", 7);
InitFileType(".ynd", "Path Nodes", 8, FileTypeAction.ViewYnd, true);
InitFileType(".ynv", "Nav Mesh", 9, FileTypeAction.ViewModel);
InitFileType(".ynv", "Nav Mesh", 9, FileTypeAction.ViewModel, true);
InitFileType(".yvr", "Vehicle Record", 9, FileTypeAction.ViewYvr);
InitFileType(".ywr", "Waypoint Record", 9, FileTypeAction.ViewYwr);
InitFileType(".fxc", "Compiled Shaders", 9, FileTypeAction.ViewFxc);
@@ -2603,6 +2603,10 @@ namespace CodeWalker
{
mformat = MetaFormat.Ynd;
}
if (fnamel.EndsWith(".ynv.xml"))
{
mformat = MetaFormat.Ynv;
}
if (fnamel.EndsWith(".ycd.xml"))
{
mformat = MetaFormat.Ycd;
@@ -2711,6 +2715,17 @@ namespace CodeWalker
data = ynd.Save();
break;
}
case MetaFormat.Ynv:
{
var ynv = XmlYnv.GetYnv(doc);
if (ynv.Nav == null)
{
MessageBox.Show(fname + ": Schema not supported.", "Cannot import YNV XML");
continue;
}
data = ynv.Save();
break;
}
case MetaFormat.Ycd:
{
var ycd = XmlYcd.GetYcd(doc);
+12 -12
View File
@@ -47,7 +47,7 @@
this.YnvFlagsUnknownCheckBox = new System.Windows.Forms.CheckBox();
this.YnvFlagsVehicleCheckBox = new System.Windows.Forms.CheckBox();
this.YnvFlagsPortalsCheckBox = new System.Windows.Forms.CheckBox();
this.YnvFlagsVerticesCheckBox = new System.Windows.Forms.CheckBox();
this.YnvFlagsPolygonsCheckBox = new System.Windows.Forms.CheckBox();
this.YnvVersionUnkHashTextBox = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
@@ -200,7 +200,7 @@
this.YnvFlagsGroupBox.Controls.Add(this.YnvFlagsUnknownCheckBox);
this.YnvFlagsGroupBox.Controls.Add(this.YnvFlagsVehicleCheckBox);
this.YnvFlagsGroupBox.Controls.Add(this.YnvFlagsPortalsCheckBox);
this.YnvFlagsGroupBox.Controls.Add(this.YnvFlagsVerticesCheckBox);
this.YnvFlagsGroupBox.Controls.Add(this.YnvFlagsPolygonsCheckBox);
this.YnvFlagsGroupBox.Location = new System.Drawing.Point(247, 48);
this.YnvFlagsGroupBox.Name = "YnvFlagsGroupBox";
this.YnvFlagsGroupBox.Size = new System.Drawing.Size(103, 115);
@@ -241,16 +241,16 @@
this.YnvFlagsPortalsCheckBox.UseVisualStyleBackColor = true;
this.YnvFlagsPortalsCheckBox.CheckedChanged += new System.EventHandler(this.YnvFlagsPortalsCheckBox_CheckedChanged);
//
// YnvFlagsVerticesCheckBox
// YnvFlagsPolygonsCheckBox
//
this.YnvFlagsVerticesCheckBox.AutoSize = true;
this.YnvFlagsVerticesCheckBox.Location = new System.Drawing.Point(12, 19);
this.YnvFlagsVerticesCheckBox.Name = "YnvFlagsVerticesCheckBox";
this.YnvFlagsVerticesCheckBox.Size = new System.Drawing.Size(64, 17);
this.YnvFlagsVerticesCheckBox.TabIndex = 0;
this.YnvFlagsVerticesCheckBox.Text = "Vertices";
this.YnvFlagsVerticesCheckBox.UseVisualStyleBackColor = true;
this.YnvFlagsVerticesCheckBox.CheckedChanged += new System.EventHandler(this.YnvFlagsVerticesCheckBox_CheckedChanged);
this.YnvFlagsPolygonsCheckBox.AutoSize = true;
this.YnvFlagsPolygonsCheckBox.Location = new System.Drawing.Point(12, 19);
this.YnvFlagsPolygonsCheckBox.Name = "YnvFlagsPolygonsCheckBox";
this.YnvFlagsPolygonsCheckBox.Size = new System.Drawing.Size(69, 17);
this.YnvFlagsPolygonsCheckBox.TabIndex = 0;
this.YnvFlagsPolygonsCheckBox.Text = "Polygons";
this.YnvFlagsPolygonsCheckBox.UseVisualStyleBackColor = true;
this.YnvFlagsPolygonsCheckBox.CheckedChanged += new System.EventHandler(this.YnvFlagsVerticesCheckBox_CheckedChanged);
//
// YnvVersionUnkHashTextBox
//
@@ -402,7 +402,7 @@
private System.Windows.Forms.CheckBox YnvFlagsUnknownCheckBox;
private System.Windows.Forms.CheckBox YnvFlagsVehicleCheckBox;
private System.Windows.Forms.CheckBox YnvFlagsPortalsCheckBox;
private System.Windows.Forms.CheckBox YnvFlagsVerticesCheckBox;
private System.Windows.Forms.CheckBox YnvFlagsPolygonsCheckBox;
private System.Windows.Forms.TextBox YnvVersionUnkHashTextBox;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
+3 -3
View File
@@ -87,7 +87,7 @@ namespace CodeWalker.Project.Panels
YnvAreaIDYUpDown.Value = Ynv.CellY;
YnvAreaIDInfoLabel.Text = "ID: " + Ynv.AreaID.ToString();
YnvAABBSizeTextBox.Text = FloatUtil.GetVector3String(nv.AABBSize);
YnvFlagsVerticesCheckBox.Checked = nv.ContentFlags.HasFlag(NavMeshFlags.Vertices);
YnvFlagsPolygonsCheckBox.Checked = nv.ContentFlags.HasFlag(NavMeshFlags.Polygons);
YnvFlagsPortalsCheckBox.Checked = nv.ContentFlags.HasFlag(NavMeshFlags.Portals);
YnvFlagsVehicleCheckBox.Checked = nv.ContentFlags.HasFlag(NavMeshFlags.Vehicle);
YnvFlagsUnknownCheckBox.Checked = nv.ContentFlags.HasFlag(NavMeshFlags.Unknown8);
@@ -97,7 +97,7 @@ namespace CodeWalker.Project.Panels
YnvPortalLinkCountLabel.Text = "Portal link count: " + nv.PortalLinksCount.ToString();
YnvPointCountLabel.Text = "Point count: " + nv.PointsCount.ToString();
YnvByteCountLabel.Text = "Byte count: " + nv.TotalBytes.ToString();
YnvVersionUnkHashTextBox.Text = nv.VersionUnk2.ToString();
YnvVersionUnkHashTextBox.Text = nv.VersionUnk2.Hash.ToString();
YnvAdjAreaIDsTextBox.Text = GetAdjAreaIDsString(nv.AdjAreaIDs.Values);
populatingui = false;
}
@@ -154,7 +154,7 @@ namespace CodeWalker.Project.Panels
{
if (populatingui) return;
if (Ynv?.Nav == null) return;
var verts = YnvFlagsVerticesCheckBox.Checked ? NavMeshFlags.Vertices : NavMeshFlags.None;
var verts = YnvFlagsPolygonsCheckBox.Checked ? NavMeshFlags.Polygons : NavMeshFlags.None;
var ports = YnvFlagsPortalsCheckBox.Checked ? NavMeshFlags.Portals : NavMeshFlags.None;
var vehcs = YnvFlagsVehicleCheckBox.Checked ? NavMeshFlags.Vehicle : NavMeshFlags.None;
var unk8s = YnvFlagsUnknownCheckBox.Checked ? NavMeshFlags.Unknown8 : NavMeshFlags.None;