Fixed for Entities 1.0

This commit is contained in:
Maximilian Winter
2022-12-04 04:18:35 +01:00
parent 4499f67f31
commit 6fde2095aa
17 changed files with 1059 additions and 331 deletions

View File

@ -14,25 +14,25 @@ namespace TAO.VertexAnimation.Editor
parent = PrefabUtility.LoadPrefabContents(path);
// Check setup.
if (!parent.TryGetComponent(out LODGroup _))
{
parent.AddComponent<LODGroup>();
}
//if (!parent.TryGetComponent(out LODGroup _))
//{
// parent.AddComponent<LODGroup>();
//}
if (!parent.TryGetComponent(out VA_AnimatorComponentAuthoring _))
{
parent.AddComponent<VA_AnimatorComponentAuthoring>();
}
//if (!parent.TryGetComponent(out VA_AnimatorComponentAuthoring _))
//{
// parent.AddComponent<VA_AnimatorComponentAuthoring>();
//}
if (!parent.TryGetComponent(out Unity.Entities.ConvertToEntity _))
{
parent.AddComponent<Unity.Entities.ConvertToEntity>();
}
//if (!parent.TryGetComponent(out Unity.Entities.ConvertToEntity _))
//{
// parent.AddComponent<Unity.Entities.ConvertToEntity>();
//}
}
else
{
// Create parent.
parent = new GameObject(name, typeof(LODGroup), typeof(VA_AnimatorComponentAuthoring), typeof(Unity.Entities.ConvertToEntity));
parent = new GameObject(name);
}
// Create all LODs.
@ -66,16 +66,16 @@ namespace TAO.VertexAnimation.Editor
}
child.transform.SetParent(parent.transform);
lods[i] = new LOD(lodTransitions[i], new Renderer[1] { mr });
//lods[i] = new LOD(lodTransitions[i], new Renderer[1] { mr });
}
var lodGroup = parent.GetComponent<LODGroup>();
lodGroup.SetLODs(lods);
lodGroup.RecalculateBounds();
//var lodGroup = parent.GetComponent<LODGroup>();
//lodGroup.SetLODs(lods);
//lodGroup.RecalculateBounds();
// Create prefab.
GameObject prefab = PrefabUtility.SaveAsPrefabAssetAndConnect(parent, path, InteractionMode.AutomatedAction);
GameObject.DestroyImmediate(parent);
//GameObject.DestroyImmediate(parent);
return prefab;
}

View File

@ -1,6 +1,7 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEngine.Experimental.Rendering;
namespace TAO.VertexAnimation.Editor
{
@ -155,6 +156,9 @@ namespace TAO.VertexAnimation.Editor
// Get info.
NamingConventionUtils.PositionMapInfo info = bakedData.GetPositionMap.name.GetTextureInfo();
bakedData.mesh.SetTriangles( bakedData.mesh.triangles, 0 );
meshes = new[] { bakedData.mesh };
// Generate Material
if (!AssetDatabaseUtils.HasChildAsset(this, material))
{