-
-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not process tween if it has already ended #175
Comments
Hi @AlexandreSi, thanks for reporting this and for using Shifty in GDevelop! What you're proposing seems reasonable, but I don't know if such a change would be safe to make. There are two reasons for this:
Regarding point 2, Shifty is generally designed around immediate mode use cases (and therefore happens to work well with retained mode at a minor performance cost). It looks like the suggested change would need to be implemented as opt-in behavior to avoid changing the established behavior of Shifty (which, as far as I know, works well for most users). I can try to implement support for this behavior in the next week or so, but feel free to open a PR if you need it sooner than that. Let me know if this sounds good to you! |
Thanks for your quick answer! |
For sure! For reference, either for myself later or anyone who gets to this before me, here's what I think a solution for this might look like:
/** @private */
this._doRenderAfterStopping = true
/** @private */
this._didFinalRender = false
I think that should at least mostly implement this functionality. We'll need some unit tests for this new behavior as well. |
After spending some time with this, I'm questioning if this is actually an issue within Shifty.
I think this is effectively what is already happening. Here's an overview of the tween "stopping logic":
The end result of all of this is that In any case, I've done some experimental work based off my original plan to change Shifty: https://github.com/jeremyckahn/shifty/compare/feature%2F175__dont-render-after-stop?w=1 @AlexandreSi would you be able to pull down that branch and see if it changes the problematic behavior you're seeing in GDevelop? You'll just need to build the library before importing it into GDevelop to try it out. The built file you'll want to use is |
Thanks for the explanation, I missed that! |
So, here is where I'm at now:
Lines 656 to 683 in ba285da
So when the GDevelop scene is resumed, the shifty scene is resumed and all stopped tweens have their flag |
Thanks for the analysis @AlexandreSi! This is really helpful. I think the issue isn't with I'll explore a solution in a new branch to see if it helps the issue you're seeing in GDevelop. |
I've started a branch with an exploratory fix for this issue: https://github.com/jeremyckahn/shifty/compare/fix%2F175__dont-resume-complete-tweenables-in-scene?w=1 @AlexandreSi would you mind checking out the |
Just tested it out, it works just fine! |
Thank you for checking @AlexandreSi! I'll work to get a release out in the next day or so. |
Thank you for your work and your explanations! Looking forward to release a new version of GDevelop with this fixed! |
The fix for this issue has been released in Thanks again for reporting this @AlexandreSi! |
Hi,
I am working on GDevelop game engine. We use shifty to add tweens in the games made with GDevelop so thanks for your work!
One of our user is having troubles and I ended up digging into your code (See 4ian/GDevelop#5097).
I noticed that you use a flag
_hasEnded
in your instance (thanks @arthuro555 for this!). I figured that it could be logic that when processing tweens, this flag should be checked to know if the render method should be called or not. Something like:What do you think?
The text was updated successfully, but these errors were encountered: