using System; using System.IO; using System.Linq; using JetBrains.Annotations; using UnityEditor; using UnityEditor.Animations; using UnityEditor.UIElements; using UnityEngine; using UnityEngine.UIElements; using Object = UnityEngine.Object; namespace AibisDream.SystemEditor { public class AnimatorClipLink : EditorWindow { [SerializeField] private VisualTreeAsset visualTreeAsset; private ObjectField _animatorField; private Label _animatorMessage; private ListView _stateInfoView; private TextField _clipsPathField; private Label _clipsMessage; private ListView _clipsNameList; private HelpBox _matchMessageBox; #region 部分缓存 private static AnimatorController _animatorCache; private static string _clipsPathCache; private ChildAnimatorState[] _statesCache; private string[] _clipsCache; private bool _isChecked; private bool _allMatched; private bool _isAllLoad; #endregion [MenuItem("Tools/AnimatorClipLink")] public static void ShowExample() { AnimatorClipLink wnd = GetWindow(); wnd.titleContent = new GUIContent("AnimatorClipLink"); } public void CreateGUI() { // Each editor window contains a root VisualElement object VisualElement root = rootVisualElement; // Instantiate UXML root.Add(visualTreeAsset.Instantiate()); // 注册一些事件 _animatorField = root.Q("animator-field"); _animatorField.RegisterValueChangedCallback(OnAnimatorChanged); _animatorMessage = root.Q