Nav mesh editing improvements

This commit is contained in:
dexyfex 2018-03-11 01:12:08 +11:00
parent 6eb2269597
commit 9e448fdacc
5 changed files with 163 additions and 73 deletions

View File

@ -14,6 +14,7 @@ namespace CodeWalker.GameFiles
public List<Vector3> Vertices { get; set; }
public List<ushort> Indices { get; set; }
public List<NavMeshAdjPoly> AdjPolys { get; set; }
public List<YnvPoly> Polys { get; set; }
@ -97,6 +98,10 @@ namespace CodeWalker.GameFiles
{
Indices = Nav.Indices.GetFullList();
}
if (Nav.AdjPolys != null)
{
AdjPolys = Nav.AdjPolys.GetFullList();
}
if (Nav.Polys != null)
{
var polys = Nav.Polys.GetFullList();
@ -171,24 +176,9 @@ namespace CodeWalker.GameFiles
{
for (int i = 0; i < Vertices.Count; i++)
{
var ov = (Vertices[i] - posoffset) * aabbsizeinv;
vertlist.Add(NavMeshVertex.Create(ov));
vertlist.Add(NavMeshVertex.Create((Vertices[i] - posoffset) * aabbsizeinv));
}
}
if (Nav.Vertices == null)
{
Nav.Vertices = new NavMeshList<NavMeshVertex>();
Nav.Vertices.VFT = 1080158456;
}
Nav.Vertices.RebuildList(vertlist);
if (Nav.Indices == null)
{
Nav.Indices = new NavMeshList<ushort>();
Nav.Indices.VFT = 1080158424;
}
Nav.Indices.RebuildList(Indices);
var polylist = new List<NavMeshPoly>();
if (Polys != null)
{
@ -197,20 +187,51 @@ namespace CodeWalker.GameFiles
polylist.Add(Polys[i].RawData);
}
}
if (Nav.Polys == null)
if (Nav.Vertices == null)
{
Nav.Polys = new NavMeshList<NavMeshPoly>();
Nav.Polys.VFT = 1080158408;
Nav.Vertices = new NavMeshList<NavMeshVertex>();
Nav.Vertices.VFT = 1080158456;
}
if (Nav.Indices == null)
{
Nav.Indices = new NavMeshList<ushort>();
Nav.Indices.VFT = 1080158424;
}
Nav.Polys.RebuildList(polylist);
if (Nav.AdjPolys == null)
{
Nav.AdjPolys = new NavMeshList<NavMeshAdjPoly>();
Nav.AdjPolys.VFT = 1080158440;
}
//Nav.AdjPolys.RebuildList(...)
if (Nav.Polys == null)
{
Nav.Polys = new NavMeshList<NavMeshPoly>();
Nav.Polys.VFT = 1080158408;
}
Nav.Vertices.RebuildList(vertlist);
Nav.Indices.RebuildList(Indices);
Nav.AdjPolys.RebuildList(AdjPolys);
Nav.Polys.RebuildList(polylist);
for (int i = 0; i < Nav.Polys.ListParts.Count; i++) //reassign part id's on all the polys...
{
var listpart = Nav.Polys.ListParts[i];
var partitems = listpart?.Items;
if (partitems == null) continue;
ushort iu = (ushort)i;
for (int j = 0; j < partitems.Length; j++)
{
partitems[j].PartID = iu;
}
}
}
@ -415,6 +436,7 @@ namespace CodeWalker.GameFiles
public ushort AreaID { get { return _RawData.AreaID; } set { _RawData.AreaID = value; } }
public ushort PartID { get { return _RawData.PartID; } set { _RawData.PartID = value; } }
public ushort PortalID { get { return _RawData.PortalID; } set { _RawData.PortalID = value; } }
public byte PortalUnk { get { return _RawData.PortalUnk; } set { _RawData.PortalUnk = value; } }
public byte Flags1 { get { return (byte)(_RawData.Unknown_00h & 0xFF); } set { _RawData.Unknown_00h = (ushort)((_RawData.Unknown_00h & 0xFF00) | (value & 0xFF)); } }
public byte Flags2 { get { return (byte)((_RawData.Unknown_24h.Value >> 0) & 0xFF); } set { _RawData.Unknown_24h = ((_RawData.Unknown_24h.Value & 0xFFFFFF00u) | ((value & 0xFFu) << 0)); } }
public byte Flags3 { get { return (byte)((_RawData.Unknown_24h.Value >> 9) & 0xFF); } set { _RawData.Unknown_24h = ((_RawData.Unknown_24h.Value & 0xFFFE01FFu) | ((value & 0xFFu) << 9)); } }
@ -452,10 +474,10 @@ namespace CodeWalker.GameFiles
public bool B30_SlopeNorthWest { get { return (_RawData.Unknown_28h.Value & 2097152) > 0; } set { _RawData.Unknown_28h = BitUtil.UpdateBit(_RawData.Unknown_28h.Value, 21, value); } }
public bool B31_SlopeWest { get { return (_RawData.Unknown_28h.Value & 4194304) > 0; } set { _RawData.Unknown_28h = BitUtil.UpdateBit(_RawData.Unknown_28h.Value, 22, value); } }
public bool B32_SlopeSouthWest { get { return (_RawData.Unknown_28h.Value & 8388608) > 0; } set { _RawData.Unknown_28h = BitUtil.UpdateBit(_RawData.Unknown_28h.Value, 23, value); } }
//public bool B33_PortalUnk1 { get { return (_RawData.PartUnk2 & 1) > 0; } }
//public bool B34_PortalUnk2 { get { return (_RawData.PartUnk2 & 2) > 0; } }
//public bool B35_PortalUnk3 { get { return (_RawData.PartUnk2 & 4) > 0; } }
//public bool B36_PortalUnk4 { get { return (_RawData.PartUnk2 & 8) > 0; } }
//public bool B33_PortalUnk1 { get { return (_RawData.PortalUnk & 1) > 0; } }
//public bool B34_PortalUnk2 { get { return (_RawData.PortalUnk & 2) > 0; } }
//public bool B35_PortalUnk3 { get { return (_RawData.PortalUnk & 4) > 0; } }
//public bool B36_PortalUnk4 { get { return (_RawData.PortalUnk & 8) > 0; } }
public byte UnkX { get { return _RawData.Unknown_28h_8a; } set { _RawData.Unknown_28h_8a = value; } }
public byte UnkY { get { return _RawData.Unknown_28h_8b; } set { _RawData.Unknown_28h_8b = value; } }
@ -520,7 +542,7 @@ namespace CodeWalker.GameFiles
//if ((u5 & 8388608) > 0) colour.Red += 1.0f; //slope facing -X,-Y (southwest)
//if (u5 >= 16777216) { } //other bits unused
var u1 = _RawData.PartUnk2;
var u1 = _RawData.PortalUnk;
//if ((u1 & 1) > 0) colour.Red += 1.0f; //portal - don't interact?
//if ((u1 & 2) > 0) colour.Green += 1.0f; //portal - ladder/fence interaction?
//if ((u1 & 4) > 0) colour.Blue += 1.0f; //portal - fence interaction / go away from?

View File

@ -356,7 +356,6 @@ namespace CodeWalker.GameFiles
private ResourceSystemStructBlock<uint> ListOffsetsBlock = null;
public int ItemSize { get { return System.Runtime.InteropServices.Marshal.SizeOf<T>(); } }
//public int BytesPerPart { get; private set; }
public override void Read(ResourceDataReader reader, params object[] parameters)
{
@ -374,11 +373,6 @@ namespace CodeWalker.GameFiles
ListParts = reader.ReadBlockAt<ResourceSimpleArray<NavMeshListPart<T>>>(ListPartsPointer, ListPartsCount);
ListOffsets = reader.ReadUintsAt(ListOffsetsPointer, ListPartsCount);
//if (ListParts.Count > 0)
//{
// BytesPerPart = (int)ListParts[0].Count * ItemSize;
//}
}
public override void Write(ResourceDataWriter writer, params object[] parameters)
@ -649,7 +643,7 @@ namespace CodeWalker.GameFiles
//public int PartUnk1 { get { return (PartFlags >> 0) & 0xF; } } //always 0
public ushort PartID { get { return (ushort)((PartFlags >> 4) & 0xFF); } set { PartFlags = (ushort)((PartFlags & 0xF00F) | ((value & 0xFF) << 4)); } }
public byte PartUnk2 { get { return (byte)((PartFlags >> 12) & 0xF); } set { PartFlags = (ushort)((PartFlags & 0x0FFF) | ((value & 0xF) << 12)); } }
public byte PortalUnk { get { return (byte)((PartFlags >> 12) & 0xF); } set { PartFlags = (ushort)((PartFlags & 0x0FFF) | ((value & 0xF) << 12)); } }
public ushort Unknown_28h_16 { get { return (ushort)((Unknown_28h.Value & 0xFFFF)); } set { Unknown_28h = (Unknown_28h.Value & 0xFFFF0000) | (value & 0xFFFFu); } }
@ -670,7 +664,7 @@ namespace CodeWalker.GameFiles
Unknown_28h.Hex + ", " +
//PartFlags.ToString() + ", " + //PartUnk1.ToString() + ", " +
PartID.ToString() + ", " +
PartUnk2.ToString() + ", " +
PortalUnk.ToString() + ", " +
PortalID.ToString();
}
}
@ -857,31 +851,31 @@ namespace CodeWalker.GameFiles
[TypeConverter(typeof(ExpandableObjectConverter))] public struct NavMeshPortal
{
public uint Unknown_00h { get; set; }
public uint TypeFlags { get; set; }
public NavMeshVertex Position1 { get; set; }
public NavMeshVertex Position2 { get; set; }
public ushort Unknown_10h { get; set; }
public ushort Unknown_12h { get; set; }
public ushort Unknown_14h { get; set; }
public ushort Unknown_16h { get; set; }
public ushort Unknown_18h { get; set; }
public ushort Unknown_1Ah { get; set; }
//public NavMeshAABB AABB { get; set; }
public ushort PolyID1a { get; set; }
public ushort PolyID1b { get; set; }
public ushort PolyID2a { get; set; }
public ushort PolyID2b { get; set; }
public uint AreaFlags { get; set; }
public uint Type1 { get { return Unknown_00h & 0xFF; } }
public uint Type2 { get { return (Unknown_00h >> 8) & 0xF; } }
public uint Type3 { get { return (Unknown_00h >> 12) & 0xF; } }
public uint Type4 { get { return (Unknown_00h >> 16) & 0xFFFF; } }
public uint Type1 { get { return TypeFlags & 0xFF; } }
public uint Type2 { get { return (TypeFlags >> 8) & 0xF; } }
public uint Type3 { get { return (TypeFlags >> 12) & 0xF; } }
public uint Type4 { get { return (TypeFlags >> 16) & 0xFFFF; } }
public ushort AreaID1 { get { return (ushort)(AreaFlags & 0x3FFF); } }
public ushort AreaID2 { get { return (ushort)((AreaFlags >> 14) & 0x3FFF); } }
public byte AreaUnk { get { return (byte)((AreaFlags >> 28) & 0xF); } }
public override string ToString()
{
return //Unknown_00h.ToString() + ", " + Unknown_01h.ToString() + ", " + Unknown_02h.ToString() + ", " +
return AreaID1.ToString() + ", " + AreaID2.ToString() + ", " + AreaUnk.ToString() + ", " +
PolyID1a.ToString() + ", " + PolyID1b.ToString() + ", " +
PolyID2a.ToString() + ", " + PolyID2b.ToString() + ", " +
Type1.ToString() + ", " + Type2.ToString() + ", " + Type3.ToString() + ", " + Type4.ToString() + ", " +
Position1.ToString() + ", " + Position2.ToString() + ", " +
Unknown_10h.ToString() + ", " + Unknown_12h.ToString() + ", " +
Unknown_14h.ToString() + ", " + Unknown_16h.ToString() + ", " +
Unknown_18h.ToString() + ", " + Unknown_1Ah.ToString();
//AABB.ToString();
"(" + Position1.ToString() + " | " + Position2.ToString() + ")";
}
}

View File

@ -46,11 +46,14 @@
this.label4 = new System.Windows.Forms.Label();
this.DeletePolyButton = new System.Windows.Forms.Button();
this.AddToProjectButton = new System.Windows.Forms.Button();
this.PortalUnkUpDown = new System.Windows.Forms.NumericUpDown();
this.label6 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.AreaIDUpDown)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PartIDUpDown)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PortalIDUpDown)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.UnkXUpDown)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.UnkYUpDown)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PortalUnkUpDown)).BeginInit();
this.SuspendLayout();
//
// AreaIDUpDown
@ -63,7 +66,7 @@
0});
this.AreaIDUpDown.Name = "AreaIDUpDown";
this.AreaIDUpDown.Size = new System.Drawing.Size(71, 20);
this.AreaIDUpDown.TabIndex = 35;
this.AreaIDUpDown.TabIndex = 2;
this.AreaIDUpDown.ValueChanged += new System.EventHandler(this.AreaIDUpDown_ValueChanged);
//
// label92
@ -72,7 +75,7 @@
this.label92.Location = new System.Drawing.Point(7, 14);
this.label92.Name = "label92";
this.label92.Size = new System.Drawing.Size(46, 13);
this.label92.TabIndex = 34;
this.label92.TabIndex = 1;
this.label92.Text = "Area ID:";
//
// PartIDUpDown
@ -85,7 +88,7 @@
0});
this.PartIDUpDown.Name = "PartIDUpDown";
this.PartIDUpDown.Size = new System.Drawing.Size(71, 20);
this.PartIDUpDown.TabIndex = 37;
this.PartIDUpDown.TabIndex = 4;
this.PartIDUpDown.ValueChanged += new System.EventHandler(this.PartIDUpDown_ValueChanged);
//
// label1
@ -94,7 +97,7 @@
this.label1.Location = new System.Drawing.Point(144, 14);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(43, 13);
this.label1.TabIndex = 36;
this.label1.TabIndex = 3;
this.label1.Text = "Part ID:";
//
// PortalIDUpDown
@ -107,7 +110,7 @@
0});
this.PortalIDUpDown.Name = "PortalIDUpDown";
this.PortalIDUpDown.Size = new System.Drawing.Size(71, 20);
this.PortalIDUpDown.TabIndex = 39;
this.PortalIDUpDown.TabIndex = 6;
this.PortalIDUpDown.ValueChanged += new System.EventHandler(this.PortalIDUpDown_ValueChanged);
//
// label2
@ -116,7 +119,7 @@
this.label2.Location = new System.Drawing.Point(281, 14);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(51, 13);
this.label2.TabIndex = 38;
this.label2.TabIndex = 5;
this.label2.Text = "Portal ID:";
//
// FlagsCheckedListBox1
@ -135,7 +138,7 @@
this.FlagsCheckedListBox1.Location = new System.Drawing.Point(10, 68);
this.FlagsCheckedListBox1.Name = "FlagsCheckedListBox1";
this.FlagsCheckedListBox1.Size = new System.Drawing.Size(131, 124);
this.FlagsCheckedListBox1.TabIndex = 40;
this.FlagsCheckedListBox1.TabIndex = 10;
this.FlagsCheckedListBox1.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.FlagsCheckedListBox1_ItemCheck);
//
// FlagsCheckedListBox2
@ -154,7 +157,7 @@
this.FlagsCheckedListBox2.Location = new System.Drawing.Point(147, 68);
this.FlagsCheckedListBox2.Name = "FlagsCheckedListBox2";
this.FlagsCheckedListBox2.Size = new System.Drawing.Size(131, 124);
this.FlagsCheckedListBox2.TabIndex = 42;
this.FlagsCheckedListBox2.TabIndex = 11;
this.FlagsCheckedListBox2.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.FlagsCheckedListBox2_ItemCheck);
//
// FlagsCheckedListBox3
@ -173,7 +176,7 @@
this.FlagsCheckedListBox3.Location = new System.Drawing.Point(284, 68);
this.FlagsCheckedListBox3.Name = "FlagsCheckedListBox3";
this.FlagsCheckedListBox3.Size = new System.Drawing.Size(131, 124);
this.FlagsCheckedListBox3.TabIndex = 44;
this.FlagsCheckedListBox3.TabIndex = 12;
this.FlagsCheckedListBox3.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.FlagsCheckedListBox3_ItemCheck);
//
// label5
@ -182,7 +185,7 @@
this.label5.Location = new System.Drawing.Point(7, 52);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(35, 13);
this.label5.TabIndex = 45;
this.label5.TabIndex = 9;
this.label5.Text = "Flags:";
//
// FlagsCheckedListBox4
@ -201,7 +204,7 @@
this.FlagsCheckedListBox4.Location = new System.Drawing.Point(421, 68);
this.FlagsCheckedListBox4.Name = "FlagsCheckedListBox4";
this.FlagsCheckedListBox4.Size = new System.Drawing.Size(131, 124);
this.FlagsCheckedListBox4.TabIndex = 46;
this.FlagsCheckedListBox4.TabIndex = 13;
this.FlagsCheckedListBox4.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.FlagsCheckedListBox4_ItemCheck);
//
// UnkXUpDown
@ -214,7 +217,7 @@
0});
this.UnkXUpDown.Name = "UnkXUpDown";
this.UnkXUpDown.Size = new System.Drawing.Size(59, 20);
this.UnkXUpDown.TabIndex = 48;
this.UnkXUpDown.TabIndex = 15;
this.UnkXUpDown.ValueChanged += new System.EventHandler(this.UnkXUpDown_ValueChanged);
//
// label3
@ -223,7 +226,7 @@
this.label3.Location = new System.Drawing.Point(13, 215);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(63, 13);
this.label3.TabIndex = 47;
this.label3.TabIndex = 14;
this.label3.Text = "UnknownX:";
//
// UnkYUpDown
@ -236,7 +239,7 @@
0});
this.UnkYUpDown.Name = "UnkYUpDown";
this.UnkYUpDown.Size = new System.Drawing.Size(59, 20);
this.UnkYUpDown.TabIndex = 50;
this.UnkYUpDown.TabIndex = 17;
this.UnkYUpDown.ValueChanged += new System.EventHandler(this.UnkYUpDown_ValueChanged);
//
// label4
@ -245,7 +248,7 @@
this.label4.Location = new System.Drawing.Point(150, 215);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(63, 13);
this.label4.TabIndex = 49;
this.label4.TabIndex = 16;
this.label4.Text = "UnknownY:";
//
// DeletePolyButton
@ -254,7 +257,7 @@
this.DeletePolyButton.Location = new System.Drawing.Point(123, 263);
this.DeletePolyButton.Name = "DeletePolyButton";
this.DeletePolyButton.Size = new System.Drawing.Size(90, 23);
this.DeletePolyButton.TabIndex = 52;
this.DeletePolyButton.TabIndex = 19;
this.DeletePolyButton.Text = "Delete Polygon";
this.DeletePolyButton.UseVisualStyleBackColor = true;
this.DeletePolyButton.Click += new System.EventHandler(this.DeletePolyButton_Click);
@ -265,16 +268,40 @@
this.AddToProjectButton.Location = new System.Drawing.Point(27, 263);
this.AddToProjectButton.Name = "AddToProjectButton";
this.AddToProjectButton.Size = new System.Drawing.Size(90, 23);
this.AddToProjectButton.TabIndex = 51;
this.AddToProjectButton.TabIndex = 18;
this.AddToProjectButton.Text = "Add to Project";
this.AddToProjectButton.UseVisualStyleBackColor = true;
this.AddToProjectButton.Click += new System.EventHandler(this.AddToProjectButton_Click);
//
// PortalUnkUpDown
//
this.PortalUnkUpDown.Location = new System.Drawing.Point(495, 12);
this.PortalUnkUpDown.Maximum = new decimal(new int[] {
15,
0,
0,
0});
this.PortalUnkUpDown.Name = "PortalUnkUpDown";
this.PortalUnkUpDown.Size = new System.Drawing.Size(57, 20);
this.PortalUnkUpDown.TabIndex = 8;
this.PortalUnkUpDown.ValueChanged += new System.EventHandler(this.PortalUnkUpDown_ValueChanged);
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(431, 14);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(58, 13);
this.label6.TabIndex = 7;
this.label6.Text = "Portal unk:";
//
// EditYnvPolyPanel
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(562, 404);
this.Controls.Add(this.PortalUnkUpDown);
this.Controls.Add(this.label6);
this.Controls.Add(this.DeletePolyButton);
this.Controls.Add(this.AddToProjectButton);
this.Controls.Add(this.UnkYUpDown);
@ -300,6 +327,7 @@
((System.ComponentModel.ISupportInitialize)(this.PortalIDUpDown)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.UnkXUpDown)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.UnkYUpDown)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PortalUnkUpDown)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@ -324,5 +352,7 @@
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Button DeletePolyButton;
private System.Windows.Forms.Button AddToProjectButton;
private System.Windows.Forms.NumericUpDown PortalUnkUpDown;
private System.Windows.Forms.Label label6;
}
}

View File

@ -48,6 +48,7 @@ namespace CodeWalker.Project.Panels
AreaIDUpDown.Value = 0;
PartIDUpDown.Value = 0;
PortalIDUpDown.Value = 0;
PortalUnkUpDown.Value = 0;
SetCheckedListBoxValues(FlagsCheckedListBox1, 0);
SetCheckedListBoxValues(FlagsCheckedListBox2, 0);
SetCheckedListBoxValues(FlagsCheckedListBox3, 0);
@ -64,6 +65,7 @@ namespace CodeWalker.Project.Panels
AreaIDUpDown.Value = YnvPoly.AreaID;
PartIDUpDown.Value = YnvPoly.PartID;
PortalIDUpDown.Value = YnvPoly.PortalID;
PortalUnkUpDown.Value = YnvPoly.PortalUnk;
SetCheckedListBoxValues(FlagsCheckedListBox1, YnvPoly.Flags1);
SetCheckedListBoxValues(FlagsCheckedListBox2, YnvPoly.Flags2);
SetCheckedListBoxValues(FlagsCheckedListBox3, YnvPoly.Flags3);
@ -150,6 +152,21 @@ namespace CodeWalker.Project.Panels
}
}
private void PortalUnkUpDown_ValueChanged(object sender, EventArgs e)
{
if (populatingui) return;
if (YnvPoly == null) return;
byte portalunk = (byte)PortalUnkUpDown.Value;
lock (ProjectForm.ProjectSyncRoot)
{
if (YnvPoly.PortalUnk != portalunk)
{
YnvPoly.PortalUnk = portalunk;
ProjectForm.SetYnvHasChanged(true);
}
}
}
private void FlagsCheckedListBox1_ItemCheck(object sender, ItemCheckEventArgs e)
{
if (populatingui) return;
@ -163,6 +180,10 @@ namespace CodeWalker.Project.Panels
ProjectForm.SetYnvHasChanged(true);
}
}
if (ProjectForm.WorldForm != null)
{
ProjectForm.WorldForm.UpdateNavPolyGraphics(YnvPoly, false);
}
}
private void FlagsCheckedListBox2_ItemCheck(object sender, ItemCheckEventArgs e)
@ -178,6 +199,10 @@ namespace CodeWalker.Project.Panels
ProjectForm.SetYnvHasChanged(true);
}
}
if (ProjectForm.WorldForm != null)
{
ProjectForm.WorldForm.UpdateNavPolyGraphics(YnvPoly, false);
}
}
private void FlagsCheckedListBox3_ItemCheck(object sender, ItemCheckEventArgs e)
@ -193,6 +218,10 @@ namespace CodeWalker.Project.Panels
ProjectForm.SetYnvHasChanged(true);
}
}
if (ProjectForm.WorldForm != null)
{
ProjectForm.WorldForm.UpdateNavPolyGraphics(YnvPoly, false);
}
}
private void FlagsCheckedListBox4_ItemCheck(object sender, ItemCheckEventArgs e)
@ -208,6 +237,10 @@ namespace CodeWalker.Project.Panels
ProjectForm.SetYnvHasChanged(true);
}
}
if (ProjectForm.WorldForm != null)
{
ProjectForm.WorldForm.UpdateNavPolyGraphics(YnvPoly, false);
}
}
private void UnkXUpDown_ValueChanged(object sender, EventArgs e)

View File

@ -1720,11 +1720,22 @@ namespace CodeWalker
return space.NodeGrid.GetYndNode(areaid, nodeid);
}
public void UpdateNavYnvGraphics(YnvFile ynv, bool fullupdate)//TODO!
public void UpdateNavYnvGraphics(YnvFile ynv, bool fullupdate)
{
ynv.UpdateTriangleVertices();
//ynv.BuildBVH();//TODO!
lock (Renderer.RenderSyncRoot)
{
Renderer.Invalidate(ynv);
}
}
public void UpdateNavPolyGraphics(YnvPoly poly, bool fullupdate)//TODO!
public void UpdateNavPolyGraphics(YnvPoly poly, bool fullupdate)
{
if (poly == null) return;
//poly.Ynv.UpdateBvhForPoly(poly);//TODO!
UpdateNavYnvGraphics(poly.Ynv, fullupdate);
}
public void UpdateTrainTrackGraphics(TrainTrack tt, bool fullupdate)