void OnGUI_SequenceContent() { GUILayout.Space(10); var seq = mAnimation._Sequences[mCurrentSequenceIndex]; var changed = GUI.changed; GUI.backgroundColor = Color.blue; GUILayout.BeginVertical(EditorStyles.textArea); GUI.backgroundColor = Color.white; var boxArea = new GUIStyle("Box"); boxArea.overflow = new RectOffset(4, 4, 0, 0); GUILayout.BeginHorizontal(boxArea); GUILayout.Toggle(true, "Sequence:", EditorStyles.foldout, GUITools.DontExpandWidth); seq._Name = EditorGUILayout.TextField(seq._Name, GUILayout.ExpandWidth(true)); if (GUILayout.Button("X", EditorStyles.miniButton, GUITools.DontExpandWidth)) { mCurrentSequenceIndex = -1; } GUILayout.EndHorizontal(); GUILayout.Space(-4); GUI.backgroundColor = GUITools.DarkGray; GUILayout.BeginVertical(GUILayout.Height(1)); GUI.backgroundColor = Color.white; GUI.changed = changed; // ignore changed in the header GUITools.BeginContents(); if (mCurrentSequenceIndex >= 0) { OnGUI_Sequence(); } GUITools.EndContents(true); GUILayout.EndVertical(); }
public void OnGUI_AnimationSlot() { var prop_Slot = mSerialized_AnimationSlots.GetArrayElementAtIndex(mAnimationsReorderableList.index); var prop_SlotPreset = prop_Slot.FindPropertyRelative("_Preset"); var prop_SlotLocalData = prop_Slot.FindPropertyRelative("_LocalSerializedData"); if (mEditor_SelectedAnim == null || iCurrentAnimationSlot != mAnimationsReorderableList.index) { iCurrentAnimationSlot = mAnimationsReorderableList.index; if (prop_SlotPreset.objectReferenceValue != null) { mSerializedObject_SelectedAnim = new SerializedObject(prop_SlotPreset.objectReferenceValue); } else { mSerializedObject_SelectedAnim = null; } DestroyAnimationInspector(); mEditor_SelectedAnim = new SE_Animation_Inspector(mTarget._AnimationSlots[iCurrentAnimationSlot]._Animation /*CreateAnimation()*/, mTarget); } if (prop_SlotPreset.objectReferenceValue != null && mSerializedObject_SelectedAnim != null) { #if UNITY_5_6_OR_NEWER mSerializedObject_SelectedAnim.UpdateIfRequiredOrScript(); #else mSerializedObject_SelectedAnim.UpdateIfDirtyOrScript(); #endif } GUILayout.Space(10); //GUITools.DrawHeader("Animation", true); var boxArea = new GUIStyle("Box"); boxArea.overflow = new RectOffset(2, 2, 0, 0); bool deselectAnimation = false; GUILayout.BeginHorizontal(boxArea); GUILayout.Toggle(true, "Animation", EditorStyles.foldout); GUILayout.FlexibleSpace(); deselectAnimation = GUILayout.Button("X", EditorStyles.miniButton); GUILayout.EndHorizontal(); GUILayout.Space(-4); GUI.backgroundColor = GUITools.DarkGray; GUILayout.BeginVertical(/*EditorStyles.textArea, */ GUILayout.Height(1)); GUI.backgroundColor = Color.white; EditorGUI.BeginChangeCheck(); mEditor_SelectedAnim.OnGUI_Animation(); if (EditorGUI.EndChangeCheck() || SE_AnimationPreset_Inspector.mDirty) { SE_AnimationPreset_Inspector.mDirty = false; var data = SE_Animation.SaveSerializedData(mEditor_SelectedAnim.mAnimation); if (prop_SlotLocalData.stringValue != data) { prop_SlotLocalData.stringValue = data; //Debug.Log(data); } if (prop_SlotPreset.objectReferenceValue != null) { var prop_PresetData = mSerializedObject_SelectedAnim.FindProperty("mSerializedData"); if (prop_PresetData.stringValue != data) { prop_PresetData.stringValue = data; mSerializedObject_SelectedAnim.ApplyModifiedProperties(); //mTarget._AnimationSlots[iCurrentAnimationSlot].CreateAnimation(); } } } if (mEditor_SelectedAnim.mAnimation.IsPlaying) { mMakeMaterialDirty = mMakeVerticesDirty = true; } GUITools.CloseHeader(); if (deselectAnimation) { DeselectAnimation(); } }