ActivationTrackInspector.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using UnityEngine;
  2. using UnityEngine.Timeline;
  3. namespace UnityEditor.Timeline
  4. {
  5. [CustomEditor(typeof(ActivationTrack))]
  6. class ActivationTrackInspector : TrackAssetInspector
  7. {
  8. static class Styles
  9. {
  10. public static readonly GUIContent PostPlaybackStateText = EditorGUIUtility.TrTextContent("Post-playback state");
  11. }
  12. SerializedProperty m_PostPlaybackProperty;
  13. public override void OnInspectorGUI()
  14. {
  15. using (new EditorGUI.DisabledScope(IsTrackLocked()))
  16. {
  17. serializedObject.Update();
  18. EditorGUI.BeginChangeCheck();
  19. if (m_PostPlaybackProperty != null)
  20. EditorGUILayout.PropertyField(m_PostPlaybackProperty, Styles.PostPlaybackStateText);
  21. if (EditorGUI.EndChangeCheck())
  22. {
  23. serializedObject.ApplyModifiedProperties();
  24. var activationTrack = target as ActivationTrack;
  25. if (activationTrack != null)
  26. activationTrack.UpdateTrackMode();
  27. }
  28. }
  29. }
  30. public override void OnEnable()
  31. {
  32. base.OnEnable();
  33. m_PostPlaybackProperty = serializedObject.FindProperty("m_PostPlaybackState");
  34. }
  35. }
  36. }