Skip to content
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

Issue with Call Method Track added to imported maya animation - Function is never called from animation #49776

Open
punyrobot opened this issue Jun 20, 2021 · 13 comments

Comments

@punyrobot
Copy link

punyrobot commented Jun 20, 2021

Godot version

3.3.stable

System information

Windows 10

Issue description

I imported some animation from a maya generated .DAE file. Adding a CallMethodTrack intending to inform me when animation has completed. Added key and assigned function, but function is never called. This result is the same whether animation is assigned in AnimationPlayer or from an AnimationTree with animation state machine

Addendum: after talking with u/goldotaskquestions on r/godot it seems the issue is down to the scene being imported and not allowing editing of imported animation scenes.

After saving the animation as separate files, adding custom tracks works, and they are saved, but on selecting the animation player there is a warning flag saying:

"This animation belongs to an imported scene, so changes to imported tracks will not be saved.

To enable the ability to add custom tracks, navigate to the scene's import settings and set
"Animation > Storage" to "Files", enable "Animation > Keep Custom Tracks", then re-import.
Alternatively, use an import preset that imports animations to separate files."

even though this has already been done...

seems like the issue is that the warning should show when you attempt to add tracks to an imported animation if you haven't saved the animation as separate files, and then go away if you have

Steps to reproduce

import animation from dae file (with associated clips)
create CallMethodTrack pointing at root node script
add key with function
play animation in game - function will never be called

Minimal reproduction project

CallTrackTest.zip

@golddotasksquestions
Copy link

golddotasksquestions commented Jun 21, 2021

Can confirm. This is really bad as there is no warning or error message whatsoever that the added Method call track won't actually be called.

Imho it should not be possible to add a Call Method track to an inherited AnimationPlayer as long as it does not actually work. At the very least there should be a gigantic warning sign, when the user tries to do this. Otherwise this leads to people wasting a lot of time looking for root cause, especially if they are not that familiar with Godots quirks and features yet.

@Calinou
Copy link
Member

Calinou commented Jun 21, 2021

This is likely not an issue anymore with the new 3D import workflow in 4.0, but I don't know if we'll manage to fix this with the 3.x import workflow.

@golddotasksquestions
Copy link

I've checked the new 3D import PR, but I can't test it as the master instantly crashes for me. Can you confirm methods on added Call Method tracks are actually called in Godot 4 @Calinou ?

@Calinou
Copy link
Member

Calinou commented Jun 21, 2021

Can you confirm methods on added Call Method tracks are actually called in Godot 4 @Calinou ?

I've tried importing the MRP in master but I'm getting "Animation not found: idle/idle2" error messages.

Adding a CallMethodTrack intending to inform me when animation has completed.

Out of curiosity, why not connect the AnimationPlayer's animation_finished signal instead (or even poll for the AnimationPlayer's current state)?

@golddotasksquestions
Copy link

golddotasksquestions commented Jun 21, 2021

Out of curiosity, why not connect the AnimationPlayer's animation_finished signal instead (or even poll for the AnimationPlayer's current state)?

This is certainly a good option if all you want to call a function at the very end of an animation. However if you want to call it anywhere in between, a Call Method track is the best option. The real power and use of the Call Method track is the ability to quickly intuitively and visually align the keys of the Call Method track with specific other keys of the animation.
For example changing ammo value during a longer weapon reload animation, setting keys for animation interrupt and cancel points in fighting games that have combo mechanics, setting triggers for character movement, input windows (QT events) and dialog during cutscene animations ...

@punyrobot
Copy link
Author

in addition, i was using, or hoping to use, call method tracks because i was using an AnimationStateMachine in an animationTree, and signals don't get fired in that scenario - animation_finished never gets fired when using a state machine. which maybe a feature/bug issue in itself.

@golddotasksquestions
Copy link

golddotasksquestions commented Jun 21, 2021

animation_finished never gets fired when using a state machine. which maybe a feature/bug issue in itself.

Yes, also see these:

#34608
#27509

@warriormaster12
Copy link
Contributor

Are there any plans to fix this issue for godot 3.x ? I'm trying to do a call method in the middle of an animation and nothing happens.

@Calinou
Copy link
Member

Calinou commented Jun 20, 2022

Are there any plans to fix this issue for godot 3.x ? I'm trying to do a call method in the middle of an animation and nothing happens.

There are a few possible workarounds, as you can't change the imported 3D scene's contents within the editor (or even what external resources it references):

  • Tell the importer to save separate .animation files if that's possible.
  • Save the animation to a resource file, then modify the AnimationPlayer to load this Animation resource when the project is run.
  • Modify the animation using a script when the project is run.

@Calinou Calinou added this to the 3.x milestone Jun 20, 2022
@warriormaster12
Copy link
Contributor

@Calinou telling importer to save separate .anim files does nothing. I would be okay with using this method if it worked but I still get the error of having an unmodifiable animation. My current workaround is using state machines inside anim tree since you can access animation's current position and length.

@punyrobot
Copy link
Author

saving separately worked for me - i save as .tres files and can add call method tracks in animations... i just get a yellow warning flag telling me i'm editing imported animation.

@warriormaster12
Copy link
Contributor

Just decided to test again and I noticed that I could add key frames to the animations and it would work in animation player (in this case I changed animation's speed). Once however I activated AnimationTree, all of the changes that I made were suddenly erased. Animation's speed was set back to 1 instead of 0.8

@warriormaster12
Copy link
Contributor

warriormaster12 commented Jun 25, 2022

Okay, I found a workaround. I used state machine inside the animation tree and inside the state machine I put my Idle run blend space and a couple of attack animations. I can now use call method with attack animations but I still can't modify animations inside the blend space. Now I can at least work somewhat with the animation tree.👌👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants