void OnGUI() { GUILayout.Label("Animations", EditorStyles.boldLabel); if (CurrentPicture == null) { return; } scrollPos = EditorGUILayout.BeginScrollView(scrollPos); var index = ABAnimationTypeHelper.IndexOfAnimation(CurrentPicture.Animation); var newIndex = EditorGUILayout.Popup(index, ABAnimationTypeHelper.TypeDescriptions()); if (newIndex != index) { var type = (ABAnimationType)newIndex; Debug.Log(newIndex + " is " + ABAnimationTypeHelper.TypeDescription(type)); CurrentPicture.Animation = new ABAnimation(type); } if (CurrentPicture.Animation != null) { foldIndex = 0; EditorGUI.indentLevel = 0; showPreviewAnimationButtonIfExists(CurrentPicture.Animation); showAnimationControls(CurrentPicture.Animation); } EditorGUILayout.EndScrollView(); }
void showChooseAnimationControls(ABAnimation animation) { EditorGUILayout.BeginHorizontal(); var index = ABAnimationTypeHelper.IndexOfAnimation(animation); var newIndex = EditorGUILayout.Popup(index, ABAnimationTypeHelper.TypeDescriptions()); if (newIndex != index) { var type = (ABAnimationType)newIndex; Debug.Log(newIndex + " is " + ABAnimationTypeHelper.TypeDescription(type)); animation.Type = type; } showPreviewAnimationButtonIfExists(animation, "Preview"); EditorGUILayout.EndHorizontal(); }