mirror of
				https://github.com/maxartz15/VertexAnimation.git
				synced 2025-11-04 02:15:59 +01:00 
			
		
		
		
	GenerateTexture2DArray in ModelBaker
This commit is contained in:
		@@ -4,7 +4,7 @@ using UnityEditor;
 | 
			
		||||
 | 
			
		||||
namespace TAO.VertexAnimation.Editor
 | 
			
		||||
{
 | 
			
		||||
	[CreateAssetMenu(fileName = "new ModelBaker", menuName = "VA_ModelBaker/ModelBaker", order = 400)]
 | 
			
		||||
	[CreateAssetMenu(fileName = "new ModelBaker", menuName = "TAO/VertexAnimation/ModelBaker", order = 400)]
 | 
			
		||||
	public class VA_ModelBaker : ScriptableObject
 | 
			
		||||
	{
 | 
			
		||||
#if UNITY_EDITOR
 | 
			
		||||
@@ -23,6 +23,7 @@ namespace TAO.VertexAnimation.Editor
 | 
			
		||||
 | 
			
		||||
		// Output.
 | 
			
		||||
		public GameObject prefab = null;
 | 
			
		||||
		public Texture2DArray positionMap = null;
 | 
			
		||||
		public Material material = null;
 | 
			
		||||
		public Mesh[] meshes = null;
 | 
			
		||||
		public VA_AnimationBook book = null;
 | 
			
		||||
@@ -89,6 +90,8 @@ namespace TAO.VertexAnimation.Editor
 | 
			
		||||
			target.ConbineAndConvertGameObject();
 | 
			
		||||
			bakedData = target.Bake(animationClips, fps, textureWidth);
 | 
			
		||||
 | 
			
		||||
			positionMap = VA_Texture2DArrayUtils.CreateTextureArray(bakedData.positionMaps.ToArray(), false, true, TextureWrapMode.Repeat, FilterMode.Point, 1, string.Format("{0}-PositionMap", name), true);
 | 
			
		||||
 | 
			
		||||
			if (lodSettings.generate)
 | 
			
		||||
			{
 | 
			
		||||
				meshes = bakedData.mesh.GenerateLOD(lodSettings.LODCount(), lodSettings.GetQualitySettings());
 | 
			
		||||
@@ -105,16 +108,16 @@ namespace TAO.VertexAnimation.Editor
 | 
			
		||||
		{
 | 
			
		||||
			AssetDatabaseUtils.RemoveChildAssets(this, new Object[2] { book, material });
 | 
			
		||||
 | 
			
		||||
			// TODO: LODs
 | 
			
		||||
			foreach (var m in meshes)
 | 
			
		||||
			{
 | 
			
		||||
				AssetDatabase.AddObjectToAsset(m, this);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			foreach (var pm in bakedData.positionMaps)
 | 
			
		||||
			{
 | 
			
		||||
				AssetDatabase.AddObjectToAsset(pm, this);
 | 
			
		||||
			}
 | 
			
		||||
			AssetDatabase.AddObjectToAsset(positionMap, this);
 | 
			
		||||
			//foreach (var pm in bakedData.positionMaps)
 | 
			
		||||
			//{
 | 
			
		||||
			//	AssetDatabase.AddObjectToAsset(pm, this);
 | 
			
		||||
			//}
 | 
			
		||||
 | 
			
		||||
			AssetDatabase.SaveAssets();
 | 
			
		||||
 | 
			
		||||
@@ -176,6 +179,9 @@ namespace TAO.VertexAnimation.Editor
 | 
			
		||||
				material.shader = materialShader;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			material.SetTexture("_PositionMap", positionMap);
 | 
			
		||||
			material.SetInt("_MaxFrames", bakedData.maxFrames);
 | 
			
		||||
 | 
			
		||||
			// Generate Prefab
 | 
			
		||||
			prefab = AnimationPrefab.Create(path, name, meshes, material, lodSettings.GetTransitionSettings());
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,12 +0,0 @@
 | 
			
		||||
using System.Collections;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using UnityEngine;
 | 
			
		||||
 | 
			
		||||
namespace TAO.VertexAnimation.Editor
 | 
			
		||||
{
 | 
			
		||||
    [CreateAssetMenu(fileName = "new AssetConverter", menuName = "VA_Animation/AssetConverter", order = 400)]
 | 
			
		||||
    public class VA_AssetConverter : ScriptableObject
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,11 +0,0 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: 55b196764521c964c84e8f2edd5c8da5
 | 
			
		||||
MonoImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  serializedVersion: 2
 | 
			
		||||
  defaultReferences: []
 | 
			
		||||
  executionOrder: 0
 | 
			
		||||
  icon: {instanceID: 0}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
		Reference in New Issue
	
	Block a user