mirror of
				https://github.com/maxartz15/VertexAnimation.git
				synced 2025-11-04 10:25:44 +01:00 
			
		
		
		
	Update VA_ModelBaker.cs
Removed LitGUI debug logs. Updated VA_ModelBaker material creation and setting update. Added mesh finalize function to optimize and upload the mesh data.
This commit is contained in:
		@@ -116,12 +116,10 @@ namespace TAO.VertexAnimation.Editor
 | 
			
		||||
 | 
			
		||||
				if (EditorGUI.EndChangeCheck())
 | 
			
		||||
				{
 | 
			
		||||
					Debug.Log(value);
 | 
			
		||||
					SetKeyword("USE_INTERPOLATION_ON", value);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
			{
 | 
			
		||||
				bool value = mat.IsKeywordEnabled("USE_NORMALA_ON");
 | 
			
		||||
				MaterialProperty useNormalA = FindProperty("USE_NORMALA", properties);
 | 
			
		||||
@@ -148,7 +146,6 @@ namespace TAO.VertexAnimation.Editor
 | 
			
		||||
 | 
			
		||||
				if (EditorGUI.EndChangeCheck())
 | 
			
		||||
				{
 | 
			
		||||
					Debug.Log(value);
 | 
			
		||||
					SetKeyword("VA_FLIP_UVS_ON", value);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 
 | 
			
		||||
@@ -113,6 +113,7 @@ namespace TAO.VertexAnimation.Editor
 | 
			
		||||
 | 
			
		||||
			foreach (var m in meshes)
 | 
			
		||||
			{
 | 
			
		||||
				m.Finalize();
 | 
			
		||||
				AssetDatabase.AddObjectToAsset(m, this);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
@@ -141,40 +142,20 @@ namespace TAO.VertexAnimation.Editor
 | 
			
		||||
			path = path.Remove(start, path.Length - start);
 | 
			
		||||
			path += "/" + name + ".prefab";
 | 
			
		||||
 | 
			
		||||
			// Get info.
 | 
			
		||||
			NamingConventionUtils.PositionMapInfo info = bakedData.GetPositionMap.name.GetTextureInfo();
 | 
			
		||||
 | 
			
		||||
			// Generate Material
 | 
			
		||||
			if (!AssetDatabaseUtils.HasChildAsset(this, material))
 | 
			
		||||
			{
 | 
			
		||||
				material = AnimationMaterial.Create(name, materialShader);
 | 
			
		||||
				material = AnimationMaterial.Create(name, materialShader, positionMap, useNormalA, useInterpolation, info.maxFrames);
 | 
			
		||||
				AssetDatabase.AddObjectToAsset(material, this);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				material.shader = materialShader;
 | 
			
		||||
				material.Update(name, materialShader, positionMap, useNormalA, useInterpolation, info.maxFrames);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			material.SetTexture("_PositionMap", positionMap);
 | 
			
		||||
			material.SetInt("_MaxFrames", bakedData.maxFrames);
 | 
			
		||||
 | 
			
		||||
			if (useNormalA)
 | 
			
		||||
			{
 | 
			
		||||
				material.EnableKeyword("USE_NORMALA_ON");
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				material.DisableKeyword("USE_NORMALA_ON");
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			if(useInterpolation)
 | 
			
		||||
			{
 | 
			
		||||
				material.EnableKeyword("USE_INTERPOLATION_ON");
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				material.DisableKeyword("USE_INTERPOLATION_ON");
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			material.enableInstancing = true;
 | 
			
		||||
 | 
			
		||||
			// Generate Prefab
 | 
			
		||||
			prefab = AnimationPrefab.Create(path, name, meshes, material, lodSettings.GetTransitionSettings());
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user