public override void OnInspectorGUI()
                {
                    foreach (Object target in base.targets)
                    {
                        LegacyAnimatorTrack track = target as LegacyAnimatorTrack;
                        if (track == null)
                        {
                            break;
                        }

                        if (!(track.parent is TimelineAsset))
                        {
                            break;
                        }

                        GUILayout.Label(track.name, EditorStyles.boldLabel);

                        EditorGUILayout.PropertyField(_channelProperty, new GUIContent("Base Animation Channel"));

                        EditorGUILayout.Separator();

                        GUILayout.Label(new GUIContent("Additional Animation Layers"), EditorStyles.boldLabel);

                        IEnumerable <TrackAsset> childTracks = track.GetChildTracks();
                        _channelTracks.list = new List <TrackAsset>(childTracks);
                        _channelTracks.DoLayoutList();
                        _channelTracks.index = -1;
                    }

                    serializedObject.ApplyModifiedProperties();
                }
Example #2
0
            private static void SetClipReferences(LegacyAnimatorTrack asset)
            {
                foreach (TimelineClip clip in asset.GetClips())
                {
                    LegacyAnimationClipAsset animationClipAsset = clip.asset as LegacyAnimationClipAsset;

                    if (animationClipAsset != null)
                    {
                        animationClipAsset.SetClip(clip);
                    }
                }
            }
                protected virtual void OnDrawSubTrack(Rect rect, int index, bool selected, bool focused)
                {
                    float columnWidth         = rect.width / 3f;
                    LegacyAnimatorTrack track = _channelTracks.list[index] as LegacyAnimatorTrack;

                    if (track != null)
                    {
                        rect.width = columnWidth;
                        GUI.Label(rect, track._animationChannel.ToString(), EditorStyles.label);
                        rect.x += columnWidth;
                        GUI.Label(rect, track.duration.ToString(), EditorStyles.label);
                        rect.x += columnWidth;
                        GUI.Label(rect, ArrayUtils.GetCount(track.GetClips()).ToString(), EditorStyles.label);
                    }
                }
                protected virtual void AddChanelToTrack(LegacyAnimatorTrack animatorTrack)
                {
                    if (animatorTrack != null)
                    {
                        //Work out next free channel to add
                        int channel = _channelProperty.intValue + 1;

                        foreach (LegacyAnimatorTrack track in animatorTrack.GetChildTracks())
                        {
                            if (track != null)
                            {
                                channel = Mathf.Max(channel, track._animationChannel + 1);
                            }
                        }

                        LegacyAnimatorTrack newTrack = TimelineEditorUtils.CreateChildTrack <LegacyAnimatorTrack>(animatorTrack, "Channel " + channel);
                        newTrack._animationChannel = channel;
                    }
                }
Example #5
0
 public void SetTrackAsset(TrackAsset trackAsset, PlayableDirector playableDirector)
 {
     _trackAsset   = trackAsset as LegacyAnimatorTrack;
     _director     = playableDirector;
     _trackBinding = _director.GetGenericBinding(GetTrackAsset()) as LegacyAnimator;
 }