-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
Animations are not resetting properly when played in the editor. #812
Comments
I must admit I did not understand the bug by watching the video... I played a bit with the test scene attached in the second link, and couple finally manage to understand what you mean by
Indeed if you stop the animation e.g. mid-course in the editor, and then run the game, it will not be shown mid-course. On the other hand, if you select the mid-course animation in the editor, and then play the game, it will be shown mid-course. |
After discussing it with @bojidar-bg, it's far from a junior job, as fixing this without a hack likely involves rethinking the way the animation player modifies on the fly the properties of the nodes it acts upon. |
Why not just reset all loaded animation resource positions to 0? Should be simple enough. |
We have a habit of "lets postpone that as this is too complex", that is not really a good habit. |
@slapin Because the 0-frames of different animations might conflict with each other, in which case we get undefined behavior. Don't think we made a quick work of it. We discussed it in depth to the point in which it became obvious that the only "normal" solution would be to rewrite the way animations are played. Not much people know godot code as much as to fix me (I don't either). Also, if we decide on a solution for the conflicting 0-frame thing, I would be happy to implement it, though it would be behind an editor settings flag. |
Could you please elaborate on 0-frames conflict? I don't see a case where that would conflict |
The problem is that you can keyframe properties at position 0 in animations, and the way the AnimationPlayer is built in Godot implies that the state of the animation is directly reflected on the properties of the affected nodes. So imagine that you have a scene with a Sprite with e.g. 10 frames.
Now if all animations are reset to position 0 upon saving, the question of what frame should be displayed in the Sprite is undefined. Obviously one would like to use frame 0 in my example, which would typically be e.g. a character facing the player. But that's not something the engine could decide by itself. What if the "default" frame should be frame 4? Same issue if you have animations starting with a fade in, by resetting to position 0 in this animation you may end up having your Sprite displayed with opacity 0 by default. |
I ask this question again on the proper issues... #8976 Is it possible to rewind each animation before saving (scene) or playing (scene/project)? |
@puppetmaster- Check comments above, slapin specifically asked:
The problem is that you might have conflicts between the first frames of different animations, as I and @akien-mga discussed way back (check the other comments for more info). We can potentially just rewind them in alphabetical order (or some other well-defined order), with the autoplayed animation last, but I'm not completely sold over that idea yet. |
@bojidar-bg Sorry, I have read the comments above but for me reset to position 0 and rewind is not the same. I found out what the problem in my case is. 😃 Created a new issue. #8994 |
First of all thank you for your report and sorry for the delay. We released Godot 3.0 in January 2018 after 18 months of work, fixing many old issues either directly, or by obsoleting/replacing the features they were referring to. We still have hundreds of issues whose relevance/reproducibility needs to be checked against the current stable version, and that's where you can help us. For bug reports, please also make sure that the issue contains detailed steps to reproduce the bug and, if possible, a zipped project that can be used to reproduce it right away. This greatly speeds up debugging and bugfixing tasks for our contributors. Our Bugsquad will review this issue more in-depth in 15 days, and potentially close it if its relevance could not be confirmed. Thanks in advance. Note: This message is being copy-pasted to many "stale" issues (90+ days without activity). It might happen that it is not meaningful for this specific issue or appears oblivious of the issue's context, if so please comment to notify the Bugsquad about it. |
So, I'm making a complex cut-scene that involves multiple animations playing after each other and I find the Animator's behavior to be ULTRA annoying. It's counter-productive needing to rewind your current animation each time you want to see how it looks currently in-game, because otherwise everything dependent is randomly displaced over the scene. The suggestion to reset everything upon saving is unnecessary. I'd be happy with a single button that just resets currently selected animation, basically an instant-rewind, to not waste time carefully moving your timeline back. |
I don't think a proper fix to this exists because the animation system does not really understand initial values. What I propose, is that one could mark an animation as the "default", and Godot may set the state of the animation to whatever is in there before saving. Optionally, we could add a reset button that appears if this animation exists, so you can use it easily from the editor. |
Or maybe when the scene is loaded in the game, the "reset" animation applies its values to everything. |
My problem right now is that whenever I want to play my scene (which is necessary for full test, because I use some stuff outside animator), I have to either rewind the animation by moving timeline manually (absolutely awkward and you need to be careful not to skip some values) or press the rewind button and wait 15 seconds. I need a way to speed-up the process, so a reset button that instantly rewinds the animation and sets all tracks to first value in timeline, would be sufficient. Unless I'm doing something wrong and there's a better way. I'm using a series of single animations for a cutscene and I need to rewind just one of them at a time. |
@KoBeWi, I would appreciate more constructive feedback to what was proposed. |
The "default" animation isn't really needed, but could be there as an option. I'd be for resetting everything in alphabetical order, so you can manipulate animation sorting to resolve conflicts yourself. Setting a "default" animation could override this and just reset all values to this particular animation. As for resetting, a reset button would be obviously useful. Not sure about auto-resetting, unless you'd be able to select when it's happening. Some people might want it when saving and some only when running scene. Also, there could be distinction between "reset all" button, which would have the behavior I described above and "reset current animation" button. btw, you said animation doesn't understand initial values, but they are just values at first key in respective track. EDIT: |
@KoBeWi different animations may have different initial values, so there is not really any information for resetting. This is why I think the only practical way is to defining a special animation with the initial values on load |
That's why I said they should all at once be reset in e.g. (reverse) alphabetical order. This way initial values would be the ones from last animation. But well, if that "special animation" you mention gets special treating (like being played before actual autoplay animation or having a dedicated reset button), it should be fine too. Still better than what we have now. |
I dont think using names to create a precedence order is a good idea. Changing an animation name shouldn't affect state like that. And any sort of ordering seems overly complex / hard to reason about. I like @reduz's "default" approach. Its simpler and more explicit. In my project I frequently use a "default" animation to reset animation state in editor and in code. It would be nice to formalize that. |
Soooo... how about some super-magical UndoRedo action triggered on play and commited on stop that would record all changed properties, so you can easily undo them? |
Any updates? |
The values that we set in the editor can't be used as default values for all the animations? I don't know if I understood the problem clearly, but I have an annoying issue related to this:
Ex.:
I know that I should define the first keyframe with the black colour, but then we go back to the rewind issue problem. And sometimes, you just need to change the background colour to red, regardless of the actual colour in-game.
Sorry for any missconception and let me know if there is any workaround about this. :) |
Just hit this issue myself. I would put this in the same family of confusion as #17903. Values changing in the inspector are confusing. If I change values in script, they don't maintain those changes. But if I change values with the AnimationPlayer, the changes will remain. I am solving this by setting default values in the _ready(). This has two implications from a usability standpoint:
Overall I am loving Godot and I have a workaround so I can move forward. No matter what tool you pick you will hit these sorts of things if you use it long enough and I am very appreciative of the hard work the community has put into this! My suggest would be to consider another button or mode on the Inspector window to specify if you are setting/viewing default or animation values. |
Closing in favor of godotengine/godot-proposals#1597 which would fix this issue. |
https://www.dropbox.com/s/krusjk4lh0655da/812_Demonstrator.webm?dl=0
I've noticed if I wanted the animation to reset properly in the editor, I had to either play it and VERY quickly stop it, play it and then rewind the animation back to the start, then (and this is the buggy bit) if I wanted the animated item to work properly again I had to first select it.
The keyframes are at 0 and 0.5, by the way. https://mediencenter.t-online.de/auth/guest/shareToken/DDE241350EA1C553A3945179DF687D896509C0DF is the example uploaded by Wendigo on http://www.godotengine.org/forum/viewtopic.php?f=11&t=1024
The text was updated successfully, but these errors were encountered: