TransformTweenTrack.cs 1.0 KB

1234567891011121314151617181920212223242526272829303132
  1. using UnityEngine;
  2. using UnityEngine.Playables;
  3. using UnityEngine.Timeline;
  4. [TrackColor(0.855f,0.8623f,0.870f)]
  5. [TrackClipType(typeof(TransformTweenClip))]
  6. [TrackBindingType(typeof(Transform))]
  7. public class TransformTweenTrack : TrackAsset
  8. {
  9. public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
  10. {
  11. return ScriptPlayable<TransformTweenMixerBehaviour>.Create (graph, inputCount);
  12. }
  13. public override void GatherProperties(PlayableDirector director, IPropertyCollector driver)
  14. {
  15. #if UNITY_EDITOR
  16. var comp = director.GetGenericBinding(this) as Transform;
  17. if (comp == null)
  18. return;
  19. var so = new UnityEditor.SerializedObject(comp);
  20. var iter = so.GetIterator();
  21. while (iter.NextVisible(true))
  22. {
  23. if (iter.hasVisibleChildren)
  24. continue;
  25. driver.AddFromName<Transform>(comp.gameObject, iter.propertyPath);
  26. }
  27. #endif
  28. base.GatherProperties(director, driver);
  29. }
  30. }