brunomikoski / Animation-Sequencer

A visual tool that allows you to create animated sequences of tweens and tweak them on editor time.
MIT License
960 stars 116 forks source link

Issue with extending the package #30

Closed kurismakku closed 2 years ago

kurismakku commented 3 years ago

Hi there, I'm trying to add some additional functionalities to the package locally, but because some of the methods are internal, that's not possible.

AnimationSequenceEditorGUIUtility.PauseButtonGUIContent

I also tried another way, by extending the Animation Sequencer Custom Editor, but that class is sealed as well.

brunomikoski commented 3 years ago

I could expose that @kurismakku , I will prepare that for the next release

kurismakku commented 3 years ago

Thanks, @brunomikoski, that's amazing! And this is an amazing idea, kinda a dream come true actually. Also, I was able to receive the update through Unity Package Manager by using an URL to this git.

Here is the code I was trying to add, the idea is that sometimes animations can be called per frame, so this method makes sure that the sequence restarts at a specific time, not too early and not too late.


  public virtual void PlaySequence(float startTime)
        {
            float tweenProgress = 0f;

            if (PlayingSequence != null && PlayingSequence.IsActive())
                tweenProgress = PlayingSequence.ElapsedPercentage();

            if (PlayingSequence == null) Play();
            else
            {
                if (PlayingSequence.IsPlaying())
                {
                    if (tweenProgress > startTime) tweenProgress = startTime;
                    PlayingSequence.Goto(tweenProgress * PlayingSequence.Duration());
                    Play();
                }
                else
                { 
                    Play();
                }
            }

        }
brunomikoski commented 3 years ago

Thanks, @brunomikoski, that's amazing! And this is an amazing idea, kinda a dream come true actually. Also, I was able to receive the update through Unity Package Manager by using an URL to this git.

Here is the code I was trying to add, the idea is that sometimes animations can be called per frame, so this method makes sure that the sequence restarts at a specific time, not too early and not too late.


  public virtual void PlaySequence(float startTime)
        {
            float tweenProgress = 0f;

            if (PlayingSequence != null && PlayingSequence.IsActive())
                tweenProgress = PlayingSequence.ElapsedPercentage();

            if (PlayingSequence == null) Play();
            else
            {
              if (PlayingSequence.IsPlaying())
              {
                    if (tweenProgress > startTime) tweenProgress = startTime;
                    PlayingSequence.Goto(tweenProgress * PlayingSequence.Duration());
                    Play();
                }
              else
              { 
                    Play();
                }
            }

        }

I can definitely add this for the next update, please let me know if you need anything else.

brunomikoski commented 2 years ago

Implemented on the release