实现bake的自动化,但是autoorient的重建还是需要一些优化

Signed-off-by: TRAfoer <lhf190@outlook.com>
This commit is contained in:
2026-01-24 20:56:43 +08:00
parent de4e399d78
commit 77726bcb6c
29 changed files with 728515 additions and 10750 deletions

View File

@@ -304,13 +304,16 @@ namespace Dreamteck.Splines
protected MeshRenderer meshRenderer;
protected MeshCollider meshCollider;
#if UNITY_EDITOR
public void Bake(bool makeStatic, bool lightmapUV)
{
if (_mesh == null) return;
gameObject.isStatic = false;
#if UNITY_EDITOR
UnityEditor.MeshUtility.Optimize(_mesh);
#endif
if (spline != null)
{
spline.Unsubscribe(this);
@@ -320,10 +323,14 @@ namespace Dreamteck.Splines
filter.hideFlags = meshRenderer.hideFlags = HideFlags.None;
_bakedMesh = Instantiate(_mesh);
_bakedMesh.name = meshName + " - Baked";
#if UNITY_EDITOR
if (lightmapUV)
{
Unwrapping.GenerateSecondaryUVSet(_bakedMesh);
}
#endif
filter.sharedMesh = _bakedMesh;
_mesh = null;
gameObject.isStatic = makeStatic;
@@ -341,6 +348,7 @@ namespace Dreamteck.Splines
Rebuild();
}
#if UNITY_EDITOR
public override void EditorAwake()
{
GetComponents();