/* Draws the header for each foldout for each AnimObject */ void DrawFoldoutHeader(AnimObject ao, AnimObjectHolder aoh) { EditorGUILayout.BeginHorizontal(); ao.foldout = EditorGUILayout.Foldout(ao.foldout, ao.ToString()); if (GUILayout.Button("UP", GUILayout.Width(50f))) { aoh.MoveAnimObjectUp(ao); } if (GUILayout.Button("DOWN", GUILayout.Width(50f))) { aoh.MoveAnimObjectDown(ao); } GUILayout.Space(10f); if (GUILayout.Button("X", GUILayout.Width(25f))) { aoh.RemoveAnimObject(ao); } GUILayout.Space(60f); EditorGUILayout.EndHorizontal(); }
/* Let user choose an AnimationEnum. If that Enum already exists for the _targetAnimController, * show a message warning the user that this will replace the animation. * * User can then press OK/Cancel */ void OnGUI() { DrawAnimationEnum(); /* If the currently selected _animEnum already exists as an animation for the current object, * show a warning to the user! */ if (_targetAnimController.GetAnimObjectHolders().Count > 0) { if (_targetAnimController.GetAnimObjectHolders().Any(holder => holder.GetAnimationEnum() == _animEnum)) { GUILayout.Space(15f); DrawOverrideWarning(); } } GUILayout.Space(15f); /* OK/Cancel buttons */ GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Add New Animation", GUILayout.MaxWidth(70f))) { AnimObjectHolder newAOH = AnimObjectHolder.CreateNewAnimObjectHolder(); newAOH.SetFields(_animEnum); _targetAnimController.SetAnimObjectHolder(newAOH); this.Close(); } if (GUILayout.Button("Cancel", GUILayout.MaxWidth(50f))) { this.Close(); } }