Skip to content

Commit dbce206

Browse files
committed
Switch to TriInspector
1 parent 893d010 commit dbce206

File tree

5 files changed

+27
-19
lines changed

5 files changed

+27
-19
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Mesh Animation [![Github license](https://img.shields.io/github/license/codewriter-packages/Mesh-Animation.svg)](#)
22
Mesh Animation is lightweight library for rendering hundreds of meshes in one draw call with GPU instancing.
33

4-
NOTE: Library require [Odin Inspector](https://odininspector.com/) for custom editors
4+
#### NOTE: To use MeshAnimation library you need to install [Tri Inspector](https://github.com/codewriter-packages/Tri-Inspector) - Free and open-source library that improves unity inspector.
55

66
## How it works?
77
Mesh Animation bakes vertex positions for each frame of animation to texture. Custom shader then move mesh vertexes to desired positions on GPU. This allows draw the same original mesh multiple times with GPU Instancing. Unique animation parameters are overridden for each instance with Material Property Block.

Runtime/CodeWriter.MeshAnimation.Runtime.asmdef

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
{
22
"name": "CodeWriter.MeshAnimation.Runtime",
3-
"references": [],
3+
"references": [
4+
"TriInspector"
5+
],
46
"includePlatforms": [],
57
"excludePlatforms": [],
68
"allowUnsafeCode": false,
7-
"overrideReferences": false,
9+
"overrideReferences": true,
810
"precompiledReferences": [],
911
"autoReferenced": true,
1012
"defineConstraints": [],

Runtime/Scripts/MeshAnimationAsset.cs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ namespace CodeWriter.MeshAnimation
22
{
33
using System;
44
using System.Collections.Generic;
5-
using Sirenix.OdinInspector;
65
using UnityEngine;
6+
using TriInspector;
77

8+
[DrawWithTriInspector]
89
[CreateAssetMenu(menuName = "Mesh Animation")]
910
public class MeshAnimationAsset : ScriptableObject
1011
{
11-
[InfoBox("@GetValidationMessage()", InfoMessageType.Error, visibleIfMemberName: nameof(IsInvalid))]
12-
[Required]
12+
[InfoBox("$" + nameof(GetValidationMessage), TriMessageType.Error, visibleIf: nameof(IsInvalid))]
1313
[SerializeField]
1414
internal GameObject skin = default;
1515

@@ -23,31 +23,32 @@ public class MeshAnimationAsset : ScriptableObject
2323
[SerializeField]
2424
internal bool npotBakedTexture = false;
2525

26+
[PropertySpace]
2627
[Required]
2728
[SerializeField]
28-
[ListDrawerSettings(Expanded = true, ShowPaging = false, AlwaysAddDefaultValue = true)]
29+
[ListDrawerSettings(AlwaysExpanded = true)]
2930
internal AnimationClip[] animationClips = new AnimationClip[0];
3031

3132
[Required]
3233
[SerializeField]
33-
[TableList(ShowPaging = false)]
34+
[TableList]
3435
internal List<ExtraMaterial> extraMaterials = new List<ExtraMaterial>();
3536

36-
[DisableIf("@true")]
37+
[ReadOnly]
3738
[SerializeField]
3839
internal Texture2D bakedTexture = default;
3940

40-
[DisableIf("@true")]
41+
[ReadOnly]
4142
[SerializeField]
4243
internal Material bakedMaterial = default;
4344

44-
[TableList(ShowPaging = false)]
45-
[DisableIf("@true")]
45+
[TableList(HideAddButton = true, HideRemoveButton = true)]
46+
[ReadOnly]
4647
[SerializeField]
4748
internal List<ExtraMaterialData> extraMaterialData = new List<ExtraMaterialData>();
4849

49-
[TableList(AlwaysExpanded = true, ShowPaging = false)]
50-
[DisableIf("@true")]
50+
[TableList(AlwaysExpanded = true, HideAddButton = true, HideRemoveButton = true)]
51+
[ReadOnly]
5152
[SerializeField]
5253
internal List<AnimationData> animationData = new List<AnimationData>();
5354

@@ -81,6 +82,8 @@ internal class AnimationData
8182

8283
public string GetValidationMessage()
8384
{
85+
if (skin == null) return "Skin is required";
86+
8487
if (animationClips.Length == 0) return "No animation clips";
8588

8689
foreach (var clip in animationClips)

Runtime/Scripts/MeshAnimator.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ namespace CodeWriter.MeshAnimation
22
{
33
using JetBrains.Annotations;
44
using UnityEngine;
5-
using Sirenix.OdinInspector;
5+
using TriInspector;
66

7+
[DrawWithTriInspector]
78
public class MeshAnimator : MonoBehaviour
89
{
910
[Required]
@@ -19,7 +20,7 @@ public class MeshAnimator : MonoBehaviour
1920
private void Awake()
2021
{
2122
_propertyBlock = new MaterialPropertyBlock();
22-
23+
2324
MeshCache.GenerateSecondaryUv(this.meshRenderer.GetComponent<MeshFilter>().sharedMesh);
2425
}
2526

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
"name": "com.codewriter.meshanimation",
33
"displayName": "Mesh Animation",
44
"description": "GPU mesh animation library for Unity",
5-
"version": "1.0.1",
6-
"unity": "2019.3",
5+
"version": "2.0.0",
6+
"unity": "2020.1",
77
"license": "MIT",
88
"author": "Vlad Vanifatov (https://github.com/vanifatovvlad)",
99
"homepage": "https://github.com/codewriter-packages/Mesh-Animation#readme",
10-
"dependencies": {}
10+
"dependencies": {
11+
"com.codewriter.triinspector": "1.4.0"
12+
}
1113
}

0 commit comments

Comments
 (0)