public static GetClipName ( |
||
clip | ||
리턴 | string |
public void OnGUI() { if (this.state.selection.canChangeAnimationClip) { string[] clipMenuContent = this.GetClipMenuContent(); EditorGUI.BeginChangeCheck(); this.selectedIndex = EditorGUILayout.Popup(this.ClipToIndex(this.state.activeAnimationClip), clipMenuContent, EditorStyles.toolbarPopup, new GUILayoutOption[0]); if (EditorGUI.EndChangeCheck()) { if (clipMenuContent[this.selectedIndex] == AnimationWindowStyles.createNewClip.text) { AnimationClip animationClip = AnimationWindowUtility.CreateNewClip(this.state.selection.rootGameObject.name); if (animationClip) { AnimationWindowUtility.AddClipToAnimationPlayerComponent(this.state.activeAnimationPlayer, animationClip); this.state.activeAnimationClip = animationClip; } GUIUtility.ExitGUI(); } else { this.state.activeAnimationClip = this.IndexToClip(this.selectedIndex); } } } else if (this.state.activeAnimationClip != null) { Rect controlRect = EditorGUILayout.GetControlRect(false, EditorGUIUtility.singleLineHeight, AnimationWindowStyles.toolbarLabel, new GUILayoutOption[0]); EditorGUI.LabelField(controlRect, CurveUtility.GetClipName(this.state.activeAnimationClip), AnimationWindowStyles.toolbarLabel); } }
public void OnGUI() { if (state.selection.canChangeAnimationClip) { string[] menuContent = GetClipMenuContent(); EditorGUI.BeginChangeCheck(); // TODO: Make this more robust selectedIndex = EditorGUILayout.Popup(ClipToIndex(state.activeAnimationClip), menuContent, EditorStyles.toolbarPopup); if (EditorGUI.EndChangeCheck()) { if (menuContent[selectedIndex] == AnimationWindowStyles.createNewClip.text) { AnimationClip newClip = AnimationWindowUtility.CreateNewClip(state.selection.rootGameObject.name); if (newClip) { AnimationWindowUtility.AddClipToAnimationPlayerComponent(state.activeAnimationPlayer, newClip); state.activeAnimationClip = newClip; } // Layout has changed, bail out now. EditorGUIUtility.ExitGUI(); } else { state.activeAnimationClip = IndexToClip(selectedIndex); } } } else if (state.activeAnimationClip != null) { Rect r = EditorGUILayout.GetControlRect(false, EditorGUIUtility.singleLineHeight, AnimationWindowStyles.toolbarLabel); EditorGUI.LabelField(r, CurveUtility.GetClipName(state.activeAnimationClip), AnimationWindowStyles.toolbarLabel); } }
private string[] GetClipNames() { AnimationClip[] orderedClipList = this.GetOrderedClipList(); string[] array = new string[orderedClipList.Length]; for (int i = 0; i < orderedClipList.Length; i++) { array[i] = CurveUtility.GetClipName(orderedClipList[i]); } return(array); }
private AnimationClip[] GetOrderedClipList() { AnimationClip[] clips = new AnimationClip[0]; if (state.activeRootGameObject != null) { clips = AnimationUtility.GetAnimationClips(state.activeRootGameObject); } Array.Sort(clips, (AnimationClip clip1, AnimationClip clip2) => CurveUtility.GetClipName(clip1).CompareTo(CurveUtility.GetClipName(clip2))); return(clips); }
private string[] GetClipNames() { AnimationClip[] clips = GetOrderedClipList(); string[] clipNames = new string[clips.Length]; for (int i = 0; i < clips.Length; i++) { clipNames[i] = CurveUtility.GetClipName(clips[i]); } return(clipNames); }
private string[] GetClipNames() { AnimationClip[] array = new AnimationClip[0]; if (this.state.activeRootGameObject != null && this.state.activeAnimationClip != null) { array = AnimationUtility.GetAnimationClips(this.state.activeRootGameObject); } string[] array2 = new string[array.Length]; for (int i = 0; i < array.Length; i++) { array2[i] = CurveUtility.GetClipName(array[i]); } return(array2); }
private string[] GetClipNames() { AnimationClip[] animationClips = new AnimationClip[0]; if ((this.state.activeRootGameObject != null) && (this.state.activeAnimationClip != null)) { animationClips = AnimationUtility.GetAnimationClips(this.state.activeRootGameObject); } string[] strArray = new string[animationClips.Length]; for (int i = 0; i < animationClips.Length; i++) { strArray[i] = CurveUtility.GetClipName(animationClips[i]); } return(strArray); }
// (case 1029160) Modified version of EditorGUI.DoPopup to fit large data list query. private AnimationClip DoClipPopup(AnimationClip clip, GUIStyle style) { Rect position = EditorGUILayout.GetControlRect(false, EditorGUI.kSingleLineHeight, style); int controlID = GUIUtility.GetControlID(s_ClipPopupHash, FocusType.Keyboard, position); clip = ClipPopupCallbackInfo.GetSelectedClipForControl(controlID, clip); Event evt = Event.current; switch (evt.type) { case EventType.Repaint: Font originalFont = style.font; if (originalFont && EditorGUIUtility.GetBoldDefaultFont() && originalFont == EditorStyles.miniFont) { style.font = EditorStyles.miniBoldFont; } GUIContent buttonContent = EditorGUIUtility.TempContent(CurveUtility.GetClipName(clip)); buttonContent.tooltip = AssetDatabase.GetAssetPath(clip); style.Draw(position, buttonContent, controlID, false); style.font = originalFont; break; case EventType.MouseDown: if (evt.button == 0 && position.Contains(evt.mousePosition)) { DisplayClipMenu(position, controlID, clip); GUIUtility.keyboardControl = controlID; evt.Use(); } break; case EventType.KeyDown: if (evt.MainActionKeyForControl(controlID)) { DisplayClipMenu(position, controlID, clip); evt.Use(); } break; } return(clip); }
public string[] GetClipNames() { string[] array; if (this.hasAnimationComponent) { AnimationClip[] animationClips = AnimationUtility.GetAnimationClips(this.animatedObject); array = new string[animationClips.Length]; for (int i = 0; i < animationClips.Length; i++) { array[i] = CurveUtility.GetClipName(animationClips[i]); } } else { array = new string[0]; } return(array); }
public void OnGUI() { if (state.selection.canChangeAnimationClip) { EditorGUI.BeginChangeCheck(); var newClip = DoClipPopup(state.activeAnimationClip, AnimationWindowStyles.animClipToolbarPopup); if (EditorGUI.EndChangeCheck()) { state.activeAnimationClip = newClip; // Layout has changed, bail out now. EditorGUIUtility.ExitGUI(); } } else if (state.activeAnimationClip != null) { Rect r = EditorGUILayout.GetControlRect(false, EditorGUIUtility.singleLineHeight, AnimationWindowStyles.toolbarLabel); EditorGUI.LabelField(r, CurveUtility.GetClipName(state.activeAnimationClip), AnimationWindowStyles.toolbarLabel); } }
private string[] GetClipNames() { AnimationClip[] animationClipArray = new AnimationClip[0]; if (this.state.clipOnlyMode) { animationClipArray = new AnimationClip[1] { this.state.activeAnimationClip } } ; else if ((UnityEngine.Object) this.state.activeRootGameObject != (UnityEngine.Object)null) { animationClipArray = AnimationUtility.GetAnimationClips(this.state.activeRootGameObject); } string[] strArray = new string[animationClipArray.Length]; for (int index = 0; index < animationClipArray.Length; ++index) { strArray[index] = CurveUtility.GetClipName(animationClipArray[index]); } return(strArray); }
private GUIContent[] GetClipMenuContent(AnimationClip[] clips) { int size = clips.Length; if (state.selection.canCreateClips) { size += 2; } GUIContent[] content = new GUIContent[size]; for (int i = 0; i < clips.Length; i++) { content[i] = new GUIContent(CurveUtility.GetClipName(clips[i])); } if (state.selection.canCreateClips) { content[content.Length - 2] = GUIContent.none; content[content.Length - 1] = AnimationWindowStyles.createNewClip; } return(content); }
private AnimationClip[] GetOrderedClipList() { AnimationClip[] array = new AnimationClip[0]; if (this.state.activeRootGameObject != null) { array = AnimationUtility.GetAnimationClips(this.state.activeRootGameObject); } Array.Sort <AnimationClip>(array, (AnimationClip clip1, AnimationClip clip2) => CurveUtility.GetClipName(clip1).CompareTo(CurveUtility.GetClipName(clip2))); return(array); }