public override void OnInspectorGUI() { Blendshape _bs = target as Blendshape; base.OnInspectorGUI(); if (GUILayout.Button("Set")) { _bs.GetBlendshape(); } }
public void AutoSetting() { SkinnedMeshRenderer[] smr = GetComponentsInChildren <SkinnedMeshRenderer>(); for (int i = 0; i < smr.Length; i++) { if (smr[i].sharedMesh.blendShapeCount > 0) { if (smr[i].transform.gameObject.GetComponent <Blendshape>() == null) { Blendshape _blendSP = smr[i].transform.gameObject.AddComponent <Blendshape>(); _blendSP.GetBlendshape(); } } } _bs = GetComponentsInChildren <Blendshape> (); if (_bs.Length == 0) { Debug.Log("見つかりませんでした"); } }
public static void ShowWindow() { BakeBlendshapesTool window = EditorWindow.GetWindow <BakeBlendshapesTool>(true); window.titleContent = new GUIContent("Blend Shape Baker"); window.blendshapes = new List <Blendshape>(); window.blendshapeList = new ReorderableList(window.blendshapes, typeof(Blendshape)); window.blendshapeList.drawHeaderCallback = (Rect rect) => { EditorGUI.LabelField(rect, "New Blend Shapes"); }; window.blendshapeList.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) => { Blendshape element = (Blendshape)window.blendshapeList.list[index]; rect.y += 1; rect.height -= 4; EditorGUI.LabelField(new Rect(rect.x, rect.y, rect.width * 0.15f, rect.height), "Name"); element.name = EditorGUI.TextField(new Rect(rect.x + rect.width * 0.15f, rect.y, rect.width * 0.3f, rect.height), element.name); EditorGUI.LabelField(new Rect(rect.x + rect.width * 0.5f, rect.y, rect.width * 0.2f, rect.height), "Mesh"); element.mesh = (Mesh)EditorGUI.ObjectField(new Rect(rect.x + rect.width * 0.7f, rect.y, rect.width * 0.3f, rect.height), element.mesh, typeof(Mesh), false); }; }