mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2026-05-16 12:25:27 +08:00
Editing points and portals in navmesh, improved DX error message
This commit is contained in:
@@ -62,6 +62,7 @@ namespace CodeWalker.Project
|
||||
{
|
||||
|
||||
Dictionary<YndFile, int> pathYnds = new Dictionary<YndFile, int>();
|
||||
Dictionary<YnvFile, int> navYnvs = new Dictionary<YnvFile, int>();
|
||||
Dictionary<TrainTrack, int> trainTracks = new Dictionary<TrainTrack, int>();
|
||||
Dictionary<YmtFile, int> scenarioYmts = new Dictionary<YmtFile, int>();
|
||||
|
||||
@@ -73,6 +74,18 @@ namespace CodeWalker.Project
|
||||
{
|
||||
pathYnds[item.PathNode.Ynd] = 1;
|
||||
}
|
||||
if (item.NavPoly != null)
|
||||
{
|
||||
navYnvs[item.NavPoly.Ynv] = 1;
|
||||
}
|
||||
if (item.NavPoint != null)
|
||||
{
|
||||
navYnvs[item.NavPoint.Ynv] = 1;
|
||||
}
|
||||
if (item.NavPortal != null)
|
||||
{
|
||||
navYnvs[item.NavPortal.Ynv] = 1;
|
||||
}
|
||||
if (item.TrainTrackNode != null)
|
||||
{
|
||||
trainTracks[item.TrainTrackNode.Track] = 1;
|
||||
@@ -88,6 +101,10 @@ namespace CodeWalker.Project
|
||||
{
|
||||
wf.UpdatePathYndGraphics(kvp.Key, true);
|
||||
}
|
||||
foreach (var kvp in navYnvs)
|
||||
{
|
||||
wf.UpdateNavYnvGraphics(kvp.Key, true);
|
||||
}
|
||||
foreach (var kvp in trainTracks)
|
||||
{
|
||||
wf.UpdateTrainTrackGraphics(kvp.Key, false);
|
||||
@@ -491,6 +508,222 @@ namespace CodeWalker.Project
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class NavPointPositionUndoStep : UndoStep
|
||||
{
|
||||
public YnvPoint Point { get; set; }
|
||||
public Vector3 StartPosition { get; set; }
|
||||
public Vector3 EndPosition { get; set; }
|
||||
|
||||
public NavPointPositionUndoStep(YnvPoint point, Vector3 startpos, WorldForm wf)
|
||||
{
|
||||
Point = point;
|
||||
StartPosition = startpos;
|
||||
EndPosition = point?.Position ?? Vector3.Zero;
|
||||
|
||||
UpdateGraphics(wf); //forces the update of the path graphics when it's moved...
|
||||
}
|
||||
|
||||
private void Update(WorldForm wf, ref MapSelection sel, Vector3 p)
|
||||
{
|
||||
Point?.SetPosition(p);
|
||||
|
||||
if (Point != sel.NavPoint)
|
||||
{
|
||||
wf.SelectNavPoint(Point);
|
||||
}
|
||||
wf.SetWidgetPosition(p);
|
||||
|
||||
|
||||
UpdateGraphics(wf);
|
||||
}
|
||||
|
||||
private void UpdateGraphics(WorldForm wf)
|
||||
{
|
||||
if (Point != null)
|
||||
{
|
||||
//Ynv graphics needs to be updated.....
|
||||
wf.UpdateNavYnvGraphics(Point.Ynv, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override void Undo(WorldForm wf, ref MapSelection sel)
|
||||
{
|
||||
Update(wf, ref sel, StartPosition);
|
||||
}
|
||||
|
||||
public override void Redo(WorldForm wf, ref MapSelection sel)
|
||||
{
|
||||
Update(wf, ref sel, EndPosition);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "NavPoint " + (Point?.ToString() ?? "") + ": Position";
|
||||
}
|
||||
}
|
||||
|
||||
public class NavPointRotationUndoStep : UndoStep
|
||||
{
|
||||
public YnvPoint Point { get; set; }
|
||||
public Quaternion StartRotation { get; set; }
|
||||
public Quaternion EndRotation { get; set; }
|
||||
|
||||
public NavPointRotationUndoStep(YnvPoint point, Quaternion startrot, WorldForm wf)
|
||||
{
|
||||
Point = point;
|
||||
StartRotation = startrot;
|
||||
EndRotation = point?.Orientation ?? Quaternion.Identity;
|
||||
|
||||
//UpdateGraphics(wf);
|
||||
}
|
||||
|
||||
|
||||
private void Update(WorldForm wf, ref MapSelection sel, Quaternion q)
|
||||
{
|
||||
Point?.SetOrientation(q);
|
||||
|
||||
if (Point != sel.NavPoint) wf.SelectNavPoint(Point);
|
||||
wf.SetWidgetRotation(q);
|
||||
|
||||
//UpdateGraphics(wf);
|
||||
}
|
||||
|
||||
private void UpdateGraphics(WorldForm wf)
|
||||
{
|
||||
////this function shouldn't actually be needed for rotating...
|
||||
//if (Point != null)
|
||||
//{
|
||||
// //Ynv graphics needs to be updated.....
|
||||
// wf.UpdateNavYnvGraphics(Point.Ynv, false);
|
||||
//}
|
||||
}
|
||||
|
||||
public override void Undo(WorldForm wf, ref MapSelection sel)
|
||||
{
|
||||
Update(wf, ref sel, StartRotation);
|
||||
}
|
||||
|
||||
public override void Redo(WorldForm wf, ref MapSelection sel)
|
||||
{
|
||||
Update(wf, ref sel, EndRotation);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "NavPoint " + (Point?.ToString() ?? "") + ": Rotation";
|
||||
}
|
||||
}
|
||||
|
||||
public class NavPortalPositionUndoStep : UndoStep
|
||||
{
|
||||
public YnvPortal Portal { get; set; }
|
||||
public Vector3 StartPosition { get; set; }
|
||||
public Vector3 EndPosition { get; set; }
|
||||
|
||||
public NavPortalPositionUndoStep(YnvPortal portal, Vector3 startpos, WorldForm wf)
|
||||
{
|
||||
Portal = portal;
|
||||
StartPosition = startpos;
|
||||
EndPosition = portal?.Position ?? Vector3.Zero;
|
||||
|
||||
UpdateGraphics(wf); //forces the update of the path graphics when it's moved...
|
||||
}
|
||||
|
||||
private void Update(WorldForm wf, ref MapSelection sel, Vector3 p)
|
||||
{
|
||||
Portal?.SetPosition(p);
|
||||
|
||||
if (Portal != sel.NavPortal)
|
||||
{
|
||||
wf.SelectNavPortal(Portal);
|
||||
}
|
||||
wf.SetWidgetPosition(p);
|
||||
|
||||
|
||||
UpdateGraphics(wf);
|
||||
}
|
||||
|
||||
private void UpdateGraphics(WorldForm wf)
|
||||
{
|
||||
if (Portal != null)
|
||||
{
|
||||
//Ynv graphics needs to be updated.....
|
||||
wf.UpdateNavYnvGraphics(Portal.Ynv, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override void Undo(WorldForm wf, ref MapSelection sel)
|
||||
{
|
||||
Update(wf, ref sel, StartPosition);
|
||||
}
|
||||
|
||||
public override void Redo(WorldForm wf, ref MapSelection sel)
|
||||
{
|
||||
Update(wf, ref sel, EndPosition);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "NavPortal " + (Portal?.ToString() ?? "") + ": Position";
|
||||
}
|
||||
}
|
||||
public class NavPortalRotationUndoStep : UndoStep
|
||||
{
|
||||
public YnvPortal Portal { get; set; }
|
||||
public Quaternion StartRotation { get; set; }
|
||||
public Quaternion EndRotation { get; set; }
|
||||
|
||||
public NavPortalRotationUndoStep(YnvPortal portal, Quaternion startrot, WorldForm wf)
|
||||
{
|
||||
Portal = portal;
|
||||
StartRotation = startrot;
|
||||
EndRotation = portal?.Orientation ?? Quaternion.Identity;
|
||||
|
||||
//UpdateGraphics(wf);
|
||||
}
|
||||
|
||||
|
||||
private void Update(WorldForm wf, ref MapSelection sel, Quaternion q)
|
||||
{
|
||||
Portal?.SetOrientation(q);
|
||||
|
||||
if (Portal != sel.NavPortal) wf.SelectNavPortal(Portal);
|
||||
wf.SetWidgetRotation(q);
|
||||
|
||||
//UpdateGraphics(wf);
|
||||
}
|
||||
|
||||
private void UpdateGraphics(WorldForm wf)
|
||||
{
|
||||
////this function shouldn't actually be needed for rotating...
|
||||
//if (Point != null)
|
||||
//{
|
||||
// //Ynv graphics needs to be updated.....
|
||||
// wf.UpdateNavYnvGraphics(Point.Ynv, false);
|
||||
//}
|
||||
}
|
||||
|
||||
public override void Undo(WorldForm wf, ref MapSelection sel)
|
||||
{
|
||||
Update(wf, ref sel, StartRotation);
|
||||
}
|
||||
|
||||
public override void Redo(WorldForm wf, ref MapSelection sel)
|
||||
{
|
||||
Update(wf, ref sel, EndRotation);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "NavPortal " + (Portal?.ToString() ?? "") + ": Rotation";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class TrainTrackNodePositionUndoStep : UndoStep
|
||||
{
|
||||
public TrainTrackNode Node { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user