Esempio n. 1
0
                public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
                {
                    ScriptPlayable <SpineAnimatorChannelTrackMixer> playable = TimelineUtils.CreateTrackMixer <SpineAnimatorChannelTrackMixer>(this, graph, go, inputCount);
                    SpineAnimatorTrack parentTrack = this.parent as SpineAnimatorTrack;

                    if (parentTrack != null)
                    {
                        SpineAnimatorTrackMixer parentMixer = TimelineUtils.GetTrackMixer <SpineAnimatorTrackMixer>(graph, parentTrack);

                        if (parentMixer != null)
                        {
                            SpineAnimatorChannelTrackMixer mixer = playable.GetBehaviour();
                            mixer.Init(parentMixer);

                            IEnumerable <TimelineClip> clips = GetClips();

                            foreach (TimelineClip clip in clips)
                            {
                                SpineAnimationClipAsset animationClip = clip.asset as SpineAnimationClipAsset;

                                if (animationClip != null)
                                {
                                    clip.displayName = animationClip._animationId;
                                    animationClip.SetParentTrack(parentTrack);
                                }
                            }
                        }
                    }

                    return(playable);
                }
Esempio n. 2
0
                public void SetTrackAsset(TrackAsset trackAsset, PlayableDirector playableDirector)
                {
                    _trackAsset   = trackAsset as SpineAnimatorTrack;
                    _director     = playableDirector;
                    _trackBinding = _director.GetGenericBinding(GetTrackAsset()) as SkeletonAnimation;

                    if (_trackBinding != null)
                    {
                        _animationState = new AnimationState(_trackBinding.SkeletonDataAsset.GetAnimationStateData());
                    }
                }
Esempio n. 3
0
                protected override void OnCreateClip(TimelineClip clip)
                {
                    SpineAnimatorTrack parentTrack = this.parent as SpineAnimatorTrack;

                    if (parentTrack != null)
                    {
                        SpineAnimationClipAsset animationClip = clip.asset as SpineAnimationClipAsset;

                        if (animationClip != null)
                        {
                            animationClip.SetParentTrack(parentTrack);
                        }
                    }
                }
                    protected override void AddChanelToTrack(SpineAnimatorTrack spineAnimatorTrack)
                    {
                        if (spineAnimatorTrack != null)
                        {
                            //Work out next free channel to add
                            int channel = 0;

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

                            Spine3DAnimatorChannelTrack newTrack = TimelineEditorUtils.CreateChildTrack <Spine3DAnimatorChannelTrack>(spineAnimatorTrack, "Channel " + channel);
                            newTrack._animationChannel = channel;
                        }
                    }
                    public override void OnInspectorGUI()
                    {
                        foreach (Object target in base.targets)
                        {
                            SpineAnimatorTrack track = target as SpineAnimatorTrack;
                            if (track == null)
                            {
                                break;
                            }

                            IEnumerable <TrackAsset> childTracks = track.GetChildTracks();

                            GUILayout.Label(track.name, EditorStyles.boldLabel);
                            track._resetPose = EditorGUILayout.Toggle("Reset Pose", track._resetPose);
                            GUILayout.Space(3f);
                            _channelTracks.list = new List <TrackAsset>(childTracks);
                            _channelTracks.DoLayoutList();
                            _channelTracks.index = -1;

                            track.EnsureMasterClipExists();
                        }
                    }
Esempio n. 6
0
 public void SetParentTrack(SpineAnimatorTrack track)
 {
     _parentAnimatorTrack = track;
 }