-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathListBlendshapes.cs
More file actions
29 lines (28 loc) · 904 Bytes
/
ListBlendshapes.cs
File metadata and controls
29 lines (28 loc) · 904 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using UnityEngine;
using UnityEditor;
public class ListBlendshapes : MonoBehaviour
{
[MenuItem("Tools/VRM/List Blendshapes of Selected Mesh")]
static void ListBlendshapeNames()
{
var smr = Selection.activeGameObject?.GetComponent<SkinnedMeshRenderer>();
if (smr == null)
{
EditorUtility.DisplayDialog("List Blendshapes", "Select the mesh (SkinnedMeshRenderer) in the Hierarchy.", "OK");
return;
}
Mesh mesh = smr.sharedMesh;
if (mesh == null)
{
Debug.LogError("No mesh found on SkinnedMeshRenderer.");
return;
}
int count = mesh.blendShapeCount;
string names = "";
for (int i = 0; i < count; i++)
{
names += i + ": " + mesh.GetBlendShapeName(i) + "\n";
}
EditorUtility.DisplayDialog("Blendshapes", names, "OK");
}
}