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

Nonexistent function 'get_playback_time' in base 'AnimationNodeAnimation'. #23629

Closed
nagasawamaki opened this issue Nov 10, 2018 · 11 comments
Closed

Comments

@nagasawamaki
Copy link

Godot version:
3.1 a16d9c6

OS/device including version:
Windows 7

Issue description:
the function get_playback_time nonexist in AnimationNodeAnimation
error message:
Invalid call. Nonexistent function 'get_playback_time' in base 'AnimationNodeAnimation'.

@ghost
Copy link

ghost commented Nov 10, 2018

Removed since 531dc2f. The docs will be synced soon.

@nagasawamaki
Copy link
Author

Removed since 531dc2f. The docs will be synced soon.

Thank you.
Then how to get the playback time now?

@ghost
Copy link

ghost commented Nov 10, 2018

I think it's AnimationNodeAnimation.get_parameter("time"). Not sure though.

@nagasawamaki
Copy link
Author

I think it's AnimationNodeAnimation.get_parameter("time"). Not sure though.

Tested but I got a Nil

@ghost
Copy link

ghost commented Nov 10, 2018

Then it's probably AnimationTreePlayer.animation_node_get_position(nodename)

@nagasawamaki
Copy link
Author

Then it's probably AnimationTreePlayer.animation_node_get_position(nodename)

Thank you but my AnimationNodeAnimation is inside AnimationTree but not AnimationTreePlayer

@ghost
Copy link

ghost commented Nov 10, 2018

Sorry, I confused those two. Actually I don't know how to use the new one.

@nagasawamaki
Copy link
Author

Anyone knows how to get the playback time now?
Thank you!

@KoBeWi
Copy link
Member

KoBeWi commented Nov 24, 2021

Seems like it should be get_parameter("time"), but when I try it I get error !state is true; same thing might've happened to the OP. Not sure what is the correct usage of this node though, maybe I'm doing something wrong. The parameter is supposed to be set only when the animation is being processed.

@TokageItLab
Copy link
Member

TokageItLab commented Dec 25, 2021

I did a little investigation. It is true that get_parameter () is not accessible except when processing the tree nodes. I guess that it is due to the reason why 531dc2f was merged; If multiple scenes rewrite the parameters of a single TreeNode at the same time, the process will be duplicated for as many scenes as there are. This means that processing time multiple times will increase the playback speed.

However, if we implement it in a way that duplicates TreeNode for each scene, the performance may be worse.

set_playback_time() is difficult to reimplement for the above reasons, but get_playback_time() may be possible. However, if it is a simple implementation, it might not be possible to get its value correctly when there are multiple scenes.

For example, let's think we have SceneA and it has AnimTreeA. Also, you have B and C as well. The processing order may be as follows

[AnimTreeA]->[AnimTreeB]->[AnimTreeC]->[SceneA]->[SceneB]->[SceneC]

instead of

[AnimTreeA]->[SceneA]->[AnimTreeB]->[SceneB]->[AnimTreeC]->[SceneC]

Keep in mind that AnimationNodeAnimation is a resource and can be referenced by multiple scenes simultaneously (AnimTreeA, AnimTreeB, and AnimTreeC are all processing the same NodeAnimation). In the first case, we can only get AnimTreeC values, so we need to store time in each scene in some way. But if the behavior is fine that the progress of the AnimationTree in multiple scenes is always equal, then a simple implementation will be fine.

@KoBeWi
Copy link
Member

KoBeWi commented May 15, 2022

Given the above comment, I think it's fine to closes this. Implementing this feature would be complicated and users don't seem to ask about it.

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

4 participants