public static void OnAddButton(State state) { var tweenMenu = new GenericMenu(); foreach (var editor in Editors) { if (!editor.IsMultiple && state.Items.Any(t => t.GetType() == editor.Type)) { tweenMenu.AddDisabledItem(new GUIContent(editor.Name)); continue; } tweenMenu.AddItem(new GUIContent(editor.Name), false, () => EditorActions.Add(() => { editor.AddAction(state); //TODO move it to EditorState class EditorState.Get(state).OnTweenAdded(state.Last); }, InspectorStates.States, "Add tween")); } tweenMenu.ShowAsContext(); }
public static void OnRemoveButton(State state, int index) { EditorActions.Add(() => { //TODO move it to EditorState class EditorState.Get(state).OnTweenRemoving(state[index]); state.RemoveTween(state[index]); }, InspectorStates.States, "Remove tween"); }
private static void OnAddStateButton(Group group) { EditorActions.Add(() => { var state = group.CreateState(); EditorState.Reorder(group); EditorState.Get(state).Open(); }, InspectorStates.States, "Add State"); }
public static void Enable(Group group) { _statesList = new ReorderableList(group.Items as IList, typeof(UnityEditor.Animations.AnimatorState)) { displayAdd = false, displayRemove = false, draggable = true, headerHeight = 0, footerHeight = 0, showDefaultBackground = false, drawElementBackgroundCallback = EditorState.DrawBackground, elementHeightCallback = index => EditorState.GetHeight(EditorState.Get(group[index])), drawElementCallback = (rect, index, isActive, isFocused) => EditorState.Draw(rect, group[index]), onReorderCallback = list => EditorState.Reorder(group) }; }