修复头尾抖,auto orient完全胜利

Signed-off-by: TRAfoer <lhf190@outlook.com>
This commit is contained in:
2025-07-26 19:03:38 +08:00
parent b577cf7f8d
commit 428ca1d738
20 changed files with 120198 additions and 18641 deletions

View File

@@ -41,17 +41,30 @@ namespace Ichni.Editor
}
public static void Lgp(int loop, Vector3 start, Vector3 end)
public static void Lgp(int loop, Vector3 start, Vector3 end, bool Clear = false)
{
if (inspector.connectedGameElement == null || inspector.connectedGameElement.GetType() != typeof(Track))
{
LogWindow.Log("Please select a Track first!");
return;
}
if (loop <= 1)
{
LogWindow.Log("Loop must be greater than 1!");
return;
}
Track track = (Track)inspector.connectedGameElement;
if (Clear)
{
// 清除之前的PathNode
foreach (var node in track.trackPathSubmodule.pathNodeList.ToList())
{
EditorManager.instance.operationManager.CopyPasteDeleteModule.DeleteElement(node);
}
}
for (int i = 0; i < loop; i++)
{
float t = (float)i / loop;
float t = (float)i / (loop - 1); // 修正插值
float x = start.x + (end.x - start.x) * t;
float y = start.y + (end.y - start.y) * t;
float z = start.z + (end.z - start.z) * t;
@@ -270,8 +283,18 @@ namespace Ichni.Editor
{
foreach (var note in noteBases)
{
note.noteVisual.isHighlighted = false;
note.noteVisual.SetHighlight();
if (note.noteVisual != null)
{
note.noteVisual.isHighlighted = false;
try
{
note.noteVisual?.SetHighlight();
}
catch (Exception ex)
{
Debug.LogError($"Error setting highlight for note {note.name}: {ex.Message}");
}
}
}
}
@@ -287,8 +310,18 @@ namespace Ichni.Editor
{
foreach (var note in group)
{
note.noteVisual.isHighlighted = true;
note.noteVisual.SetHighlight();
if (note.noteVisual != null)
{
note.noteVisual.isHighlighted = true;
try
{
note.noteVisual?.SetHighlight();
}
catch (Exception ex)
{
Debug.LogError($"Error setting highlight for note {note.name}: {ex.Message}");
}
}
}
}
}
@@ -303,8 +336,18 @@ namespace Ichni.Editor
{
foreach (var note in noteBases)
{
note.noteVisual.isHighlighted = false;
note.noteVisual.SetHighlight();
if (note.noteVisual != null)
{
note.noteVisual.isHighlighted = false;
try
{
note.noteVisual?.SetHighlight();
}
catch (Exception ex)
{
Debug.LogError($"Error setting highlight for note {note.name}: {ex.Message}");
}
}
}
}
@@ -320,8 +363,19 @@ namespace Ichni.Editor
{
foreach (var note in group)
{
note.noteVisual.isHighlighted = true;
note.noteVisual.SetHighlight();
if (note.noteVisual != null)
{
note.noteVisual.isHighlighted = true;
try
{
note.noteVisual?.SetHighlight();
}
catch (Exception ex)
{
Debug.LogError($"Error setting highlight for note {note.name}: {ex.Message}");
}
}
}
}
}
@@ -501,5 +555,6 @@ namespace Ichni.Editor
LogWindow.Log("Colped Done!", Color.green);
}
}
}