public static void DrawTreesList(DataCreator creator, EditorWindow editor) { GUILayoutElements.DrawHeader("Blend Trees", GUIResources.GetDarkHeaderStyle_MD()); GUILayout.BeginHorizontal(); if (GUILayout.Button("Add")) { creator.blendTrees.Add(new BlendTreeInfo("New info")); } //if (GUILayout.Button("Clear")) //{ // creator.blendTrees.Clear(); //} GUILayout.EndHorizontal(); GUILayout.Space(5); GUILayout.BeginHorizontal(); GUILayout.Label("Find", GUILayout.Width(50)); creator.findingBlendTree = GUILayout.TextField(creator.findingBlendTree); GUILayout.EndHorizontal(); GUILayout.Space(5); for (int i = 0; i < creator.blendTrees.Count; i++) { if (creator.findingBlendTree != "" && !creator.blendTrees[i].name.ToLower().Contains(creator.findingBlendTree.ToLower())) { continue; } GUILayout.BeginHorizontal(); GUILayout.Space(5); GUILayout.Label( creator.blendTrees[i].name, i == creator.selectedBlendTree ? GUIResources.GetDarkHeaderStyle_SM() : GUIResources.GetLightHeaderStyle_SM() ); Event e = Event.current; Rect r = GUILayoutUtility.GetLastRect(); if (r.Contains(e.mousePosition) && e.type == EventType.MouseDown && e.button == 0) { if (creator.selectedBlendTree == i) { creator.selectedBlendTree = -1; } else { creator.selectedBlendTree = i; } e.Use(); editor.Repaint(); } if (GUILayout.Button("Copy", GUILayout.Width(40))) { creator.blendTrees.Add(new BlendTreeInfo(creator.blendTrees[i].name + "_NEW")); for (int j = 0; j < creator.blendTrees[i].clips.Count; j++) { creator.blendTrees[creator.blendTrees.Count - 1].AddClip(creator.blendTrees[i].clips[j]); } } if (GUILayout.Button("X", GUILayout.Width(25))) { creator.blendTrees.RemoveAt(i); i--; } GUILayout.EndHorizontal(); GUILayout.Space(5); } GUILayout.Space(5); }
public static void DrawSequencesList(DataCreator creator, EditorWindow editor) { GUILayoutElements.DrawHeader("Sequences", GUIResources.GetDarkHeaderStyle_MD()); GUILayout.BeginHorizontal(); if (GUILayout.Button("Add")) { creator.sequences.Add(new AnimationsSequence("new Sequence")); } //if (GUILayout.Button("Clear")) //{ // creator.sequences.Clear(); //} GUILayout.EndHorizontal(); GUILayout.Space(5); GUILayout.BeginHorizontal(); GUILayout.Label("Find", GUILayout.Width(50)); creator.findingSequence = EditorGUILayout.TextField(creator.findingSequence); GUILayout.EndHorizontal(); GUILayout.Space(5); for (int i = 0; i < creator.sequences.Count; i++) { if (creator.findingSequence != "" && !creator.sequences[i].name.ToLower().Contains(creator.findingSequence.ToLower())) { continue; } GUILayout.BeginHorizontal(); GUILayout.Space(5); GUILayout.Label( creator.sequences[i].name, i == creator.selectedSequence ? GUIResources.GetDarkHeaderStyle_SM() : GUIResources.GetLightHeaderStyle_SM() ); Event e = Event.current; Rect r = GUILayoutUtility.GetLastRect(); if (r.Contains(e.mousePosition) && e.type == EventType.MouseDown && e.button == 0) { if (creator.selectedSequence == i) { creator.selectedSequence = -1; } else { creator.selectedSequence = i; } e.Use(); editor.Repaint(); } if (GUILayout.Button("Copy", GUILayout.Width(40))) { AnimationsSequence info = new AnimationsSequence(creator.sequences[i].name + "_New"); for (int j = 0; j < creator.sequences[i].clips.Count; j++) { info.clips.Add(creator.sequences[i].clips[j]); info.neededInfo.Add(creator.sequences[i].neededInfo[j]); info.findPoseInClip.Add(creator.sequences[i].findPoseInClip[j]); } creator.sequences.Insert(i + 1, info); } if (GUILayout.Button("X", GUILayout.Width(25))) { creator.sequences.RemoveAt(i); i--; } GUILayout.Space(10); GUILayout.EndHorizontal(); GUILayout.Space(5); } GUILayout.Space(5); }