实现bake的自动化,但是autoorient的重建还是需要一些优化
Signed-off-by: TRAfoer <lhf190@outlook.com>
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user